diff --git a/app/PaymentDrivers/GoCardless/DirectDebit.php b/app/PaymentDrivers/GoCardless/DirectDebit.php index c115efc3ab..bba0968eca 100644 --- a/app/PaymentDrivers/GoCardless/DirectDebit.php +++ b/app/PaymentDrivers/GoCardless/DirectDebit.php @@ -60,11 +60,13 @@ class DirectDebit implements MethodInterface, LivewireMethodInterface $session_token = \Illuminate\Support\Str::uuid()->toString(); $exit_uri = route('client.payment_methods.index'); + $verify = $this->go_cardless->company_gateway->getConfigField('verifyBankAccount') ? 'recommended' : 'when_available'; + $response = $this->go_cardless->gateway->billingRequests()->create([ "params" => [ "mandate_request" => [ "currency" => auth()->guard('contact')->user()->client->currency()->code, - "verify" => "recommended" //when_available + "verify" => $verify ] ] ]); diff --git a/database/migrations/2025_01_22_013047_2025_01_22_add_verification_setting_to_gocardless.php b/database/migrations/2025_01_22_013047_2025_01_22_add_verification_setting_to_gocardless.php index 8529fe9686..c97d7a484f 100644 --- a/database/migrations/2025_01_22_013047_2025_01_22_add_verification_setting_to_gocardless.php +++ b/database/migrations/2025_01_22_013047_2025_01_22_add_verification_setting_to_gocardless.php @@ -17,11 +17,20 @@ return new class extends Migration \App\Models\CompanyGateway::withTrashed()->where('gateway_key','b9886f9257f0c6ee7c302f1c74475f6c') ->cursor() ->each(function ($cg){ - $cg->setConfigField('verifyBankAccount',false); - $cg->save(); - }); + + $gateway = \App\Models\Gateway::where('key','b9886f9257f0c6ee7c302f1c74475f6c')->first(); + + $fields = json_decode($gateway->fields); + $fields->verifyBankAccount = false; + $gateway->fields = json_encode($fields); + + $gateway->save(); + + \Illuminate\Support\Facades\Cache::forget('gateways'); + + } /**