From 941a797374064436020ae31b96ab625841156d5f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 11 Mar 2022 12:01:59 +1100 Subject: [PATCH] Fixes for onboarding migratino --- app/PaymentDrivers/Stripe/UpdatePaymentMethods.php | 7 ++++++- database/migrations/2021_11_08_131308_onboarding.php | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/PaymentDrivers/Stripe/UpdatePaymentMethods.php b/app/PaymentDrivers/Stripe/UpdatePaymentMethods.php index b89a9bc1a750..d3b9e974e221 100644 --- a/app/PaymentDrivers/Stripe/UpdatePaymentMethods.php +++ b/app/PaymentDrivers/Stripe/UpdatePaymentMethods.php @@ -104,7 +104,12 @@ class UpdatePaymentMethods 'payment_method_id' => GatewayType::BANK_TRANSFER, ]; - $this->stripe->storeGatewayToken($data, ['gateway_customer_reference' => $customer->id]); + $additional_data = ['gateway_customer_reference' => $customer->id]; + + if($customer->default_source === $method->id) + $additional_data = ['gateway_customer_reference' => $customer->id, 'is_default', 1]; + + $this->stripe->storeGatewayToken($data, $additional_data); } diff --git a/database/migrations/2021_11_08_131308_onboarding.php b/database/migrations/2021_11_08_131308_onboarding.php index be9795cc3fd2..21bafd04a090 100644 --- a/database/migrations/2021_11_08_131308_onboarding.php +++ b/database/migrations/2021_11_08_131308_onboarding.php @@ -4,7 +4,8 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class Onboarding extends Migration +//class Onboarding extends Migration +return new class extends Migration { /** * Run the migrations. @@ -34,4 +35,4 @@ class Onboarding extends Migration } } -} +};