Fixes for webhook

This commit is contained in:
Lars Kusch 2023-01-16 21:46:23 +01:00
parent 1580a93a6e
commit 133c49595f

View File

@ -737,6 +737,10 @@ class StripePaymentDriver extends BaseDriver
$customer = $this->findOrCreateCustomer();
$this->attach($setup_intent->payment_method, $customer);
$payment_method = $this->getStripePaymentMethod($setup_intent->payment_method);
$clientgateway = ClientGatewayToken::query()
->where('token', $payment_method)
->first();
if (!$clientgateway){
$payment_meta = new \stdClass;
$payment_meta->brand = (string) $payment_method->bacs_debit->sort_code;
$payment_meta->last4 = (string) $payment_method->bacs_debit->last4;
@ -749,6 +753,7 @@ class StripePaymentDriver extends BaseDriver
'payment_method_id' => GatewayType::BACS,
];
$this->storeGatewayToken($data, ['gateway_customer_reference' => $customer->id]);
}
return response()->json([], 200);
} elseif ($request->type === "mandate.updated"){
// Check if payment method BACS is still valid