From 2b18bf2b4b9d7aa47278f633e0e2b64ae3e2d547 Mon Sep 17 00:00:00 2001 From: Lars Kusch Date: Fri, 16 Dec 2022 16:54:07 +0100 Subject: [PATCH] Save BACS --- app/PaymentDrivers/Stripe/BACS.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app/PaymentDrivers/Stripe/BACS.php b/app/PaymentDrivers/Stripe/BACS.php index 9f013b9793d6..dd6ba037518c 100644 --- a/app/PaymentDrivers/Stripe/BACS.php +++ b/app/PaymentDrivers/Stripe/BACS.php @@ -58,14 +58,11 @@ class BACS public function authorizeResponse($request) { $this->stripe->init(); - file_put_contents("/home/blumagin/domains/blumagine.de/invoiceninja/log2.txt", $request); - $this->stripe->setupIntents->retrieve('seti_1EzVO3HssDVaQm2PJjXHmLlM', []); - - $stripe_response = json_decode($request->input('gateway_response')); - - $stripe_method = $this->stripe->getStripePaymentMethod($stripe_response->payment_method); - - $this->storePaymentMethod($stripe_method, $request->payment_method_id, $this->stripe->findOrCreateCustomer()); + if ($request->session_id){ + $session = $this->stripe->stripe->checkout->sessions->retrieve($request->session_id, ['expand' => ['setup_intent']]); + } + file_put_contents("/home/blumagin/domains/blumagine.de/invoiceninja/log2.txt", $session); + $this->storePaymentMethod($session->setup_intent->payment_method, 1, $this->stripe->findOrCreateCustomer()); return redirect()->route('client.payment_methods.index'); } @@ -212,7 +209,7 @@ class BACS $data = [ 'payment_meta' => $payment_meta, - 'token' => $method->id, + 'token' => $method, 'payment_method_id' => $payment_method_id, ];