diff --git a/app/Http/Livewire/PaymentMethodsTable.php b/app/Http/Livewire/PaymentMethodsTable.php index b4906176fd05..e5dd04905bcc 100644 --- a/app/Http/Livewire/PaymentMethodsTable.php +++ b/app/Http/Livewire/PaymentMethodsTable.php @@ -36,6 +36,10 @@ class PaymentMethodsTable extends Component ->with('gateway_type') ->where('company_id', $this->company->id) ->where('client_id', $this->client->id) + ->whereHas('gateway', function ($query) { + $query->where('is_deleted',0) + ->where('deleted_at', NULL); + }) ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc') ->paginate($this->per_page); diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index 17a511909161..ec5ddc18fe1a 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -307,8 +307,14 @@ class AutoBillInvoice extends AbstractService { //get all client gateway tokens and set the is_default one to the first record - $gateway_tokens = $this->client->gateway_tokens()->orderBy('is_default', 'DESC')->get(); - // $gateway_tokens = $this->client->gateway_tokens; + $gateway_tokens = $this->client + ->gateway_tokens() + ->whereHas('gateway', function ($query) { + $query->where('is_deleted',0) + ->where('deleted_at', NULL); + })->orderBy('is_default', 'DESC') + ->get(); + $filtered_gateways = $gateway_tokens->filter(function ($gateway_token) use($amount) { diff --git a/resources/views/portal/ninja2020/gateways/includes/save_card.blade.php b/resources/views/portal/ninja2020/gateways/includes/save_card.blade.php index 42e50ca1d576..e319effdcfd4 100644 --- a/resources/views/portal/ninja2020/gateways/includes/save_card.blade.php +++ b/resources/views/portal/ninja2020/gateways/includes/save_card.blade.php @@ -1,7 +1,4 @@ @php - // $token_billing = $gateway instanceof \App\Models\CompanyGateway - // ? $gateway->token_billing !== 'always' - // : $gateway->company_gateway->token_billing !== 'always'; $gateway_instance = $gateway instanceof \App\Models\CompanyGateway ? $gateway : $gateway->company_gateway; $token_billing = true; @@ -9,7 +6,7 @@ $checked_on = ''; $checked_off = 'checked'; - if($gateway_instance->token_billing == 'off' || $gateway_instance->token_billing == 'always'){ + if($gateway_instance->token_billing == 'off'){ $token_billing = false; $token_billing_string = 'false'; } diff --git a/resources/views/portal/ninja2020/gateways/stripe/credit_card/pay.blade.php b/resources/views/portal/ninja2020/gateways/stripe/credit_card/pay.blade.php index 53216f13d348..8a91de072bb8 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/credit_card/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/credit_card/pay.blade.php @@ -1,5 +1,17 @@ @extends('portal.ninja2020.layout.payments', ['gateway_title' => 'Credit card', 'card_title' => 'Credit card']) +@php + $gateway_instance = $gateway instanceof \App\Models\CompanyGateway ? $gateway : $gateway->company_gateway; + $token_billing_string = 'true'; + + if($gateway_instance->token_billing == 'off' || $gateway_instance->token_billing == 'optin'){ + $token_billing_string = 'false'; + } + + +@endphp + + @section('gateway_head') @if($gateway->company_gateway->getConfigField('account_id')) @@ -18,7 +30,7 @@