@php $credit = Auth::user()->credits() ->where('currency_code', $invoice->currency_code) ->where('amount', '>', 0) ->first(); $itemHasCredit = $invoice->items()->where('reference_type', App\Models\Credit::class)->exists(); @endphp @if($credit && !$itemHasCredit)

{{ __('invoices.pay_with_credits') }}

{{ __('invoices.account_credits') }}

{{ __('invoices.available_credits', ['amount' => $credit->formattedAmount]) }}

@if($selectedMethod === 'credit') @endif
@endif @if($this->savedPaymentMethods)

{{ __('account.saved_payment_methods') }}

@foreach($this->savedPaymentMethods as $method)
@switch(strtolower($method->type)) @case('visa') @break @case('mastercard') @break @case('amex') @break @case('american express') @break @case('discover') @break @case('paypal') @break @case('sepa_debit') @break @case('ideal') @break @case('bancontact') @break @case('sofort') @break @case('us_bank_account') @case('bacs_debit') @case('au_becs_debit') @break @default @endswitch
{{ $method->name }}
@if($method->expiry)
{{ __('account.expires', ['date' => \Carbon\Carbon::parse($method->expiry)->format('m/Y')]) }}
@endif
@if($selectedMethod === $method->ulid) @endif
@endforeach {{ __('account.add_payment_method') }}
@endif @if($this->gateways && count($this->gateways) > 0)
@foreach($this->gateways as $method)
@if($method->meta?->icon) {{ $method->name }} Icon @else @endif

{{ $method->name }}

{{ __('invoices.one_time_payment') }}

@if($selectedMethod === 'gateway-' . $method->id) @endif
@endforeach
@endif @if($selectedMethod && $selectedMethod !== 'credit' && !str_starts_with($selectedMethod, 'gateway-') && $this->recurringServices()->exists())
@endif
@if($selectedMethod === 'credit' && $credit && $credit->amount >= $invoice->formattedRemaining->total) {{ __('invoices.apply_credits_and_pay') }} @elseif($selectedMethod === 'credit' && $credit) {{ __('invoices.apply_credit_and_continue', ['amount' => $credit->formattedAmount]) }} @else {{ __('invoices.pay_now', ['amount' => $invoice->formattedRemaining]) }} @endif