1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Fixes for Session-ID

This commit is contained in:
Lars Kusch 2022-12-16 16:37:02 +01:00
parent c56d41ad2a
commit c323060139

View File

@ -29,7 +29,6 @@ use App\Utils\Number;
class BACS class BACS
{ {
public $stripe; public $stripe;
public $session;
public function __construct(StripePaymentDriver $stripe) public function __construct(StripePaymentDriver $stripe)
{ {
@ -44,17 +43,14 @@ class BACS
'mode' => 'setup', 'mode' => 'setup',
'customer' => $customer->id, 'customer' => $customer->id,
'success_url' => str_replace("%7B", "{", str_replace("%7D", "}", $this->buildReturnUrl())), 'success_url' => str_replace("%7B", "{", str_replace("%7D", "}", $this->buildReturnUrl())),
'cancel_url' => 'https://example.com/cancel', 'cancel_url' => route('client.payment_methods.index'),
]); ]);
$session = $data['session'];
return render('gateways.stripe.bacs.authorize', $data); return render('gateways.stripe.bacs.authorize', $data);
} }
private function buildReturnUrl(): string private function buildReturnUrl(): string
{ {
return route('client.payment_methods.store', [ return route('client.payments.confirm', [
'company_gateway_id' => $this->stripe->company_gateway->id, 'method' => GatewayType::BACS,
'payment_method_id' => GatewayType::BACS,
'session_id' => "{CHECKOUT_SESSION_ID}", 'session_id' => "{CHECKOUT_SESSION_ID}",
]); ]);
} }
@ -62,14 +58,14 @@ class BACS
public function authorizeResponse($request) public function authorizeResponse($request)
{ {
$this->stripe->init(); $this->stripe->init();
file_put_contents("/home/blumagin/domains/blumagine.de/invoiceninja/log2.txt", $request);
$customer = $this->stripe->findOrCreateCustomer(); $this->stripe->setupIntents->retrieve('seti_1EzVO3HssDVaQm2PJjXHmLlM', []);
$stripe_response = json_decode($request->input('gateway_response')); $stripe_response = json_decode($request->input('gateway_response'));
$stripe_method = $this->stripe->getStripePaymentMethod($stripe_response->payment_method); $stripe_method = $this->stripe->getStripePaymentMethod($stripe_response->payment_method);
$this->storePaymentMethod($stripe_method, $request->payment_method_id, $customer); $this->storePaymentMethod($stripe_method, $request->payment_method_id, $this->stripe->findOrCreateCustomer());
return redirect()->route('client.payment_methods.index'); return redirect()->route('client.payment_methods.index');
} }
@ -209,10 +205,9 @@ class BACS
{ {
try { try {
$payment_meta = new \stdClass; $payment_meta = new \stdClass;
$payment_meta->exp_month = (string) $method->card->exp_month; $payment_meta->brand = (string) "";
$payment_meta->exp_year = (string) $method->card->exp_year; $payment_meta->last4 = (string) "";
$payment_meta->brand = (string) $method->card->brand; $payment_meta->state = 'authorized';
$payment_meta->last4 = (string) $method->card->last4;
$payment_meta->type = GatewayType::BACS; $payment_meta->type = GatewayType::BACS;
$data = [ $data = [