diff --git a/app/PaymentDrivers/Stripe/ACSS.php b/app/PaymentDrivers/Stripe/ACSS.php index d46817dc5a01..6d5276e7e1fe 100644 --- a/app/PaymentDrivers/Stripe/ACSS.php +++ b/app/PaymentDrivers/Stripe/ACSS.php @@ -22,9 +22,7 @@ use App\Jobs\Util\SystemLogger; use App\Mail\Gateways\ACHVerificationNotification; use App\Models\ClientGatewayToken; use App\Models\GatewayType; -use App\Models\Invoice; use App\Models\Payment; -use App\Models\PaymentHash; use App\Models\PaymentType; use App\Models\SystemLog; use App\PaymentDrivers\StripePaymentDriver; @@ -57,7 +55,6 @@ class ACSS try { $source = Customer::createSource($customer->id, ['source' => $stripe_response->token->id], $this->stripe->stripe_connect_auth); - } catch (InvalidRequestException $e) { throw new PaymentFailed($e->getMessage(), $e->getCode()); } @@ -175,7 +172,6 @@ class ACSS public function paymentResponse(PaymentResponseRequest $request) { - $gateway_response = json_decode($request->gateway_response); $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); @@ -186,7 +182,6 @@ class ACSS return $this->processSuccessfulPayment($gateway_response->id); } return $this->processUnsuccessfulPayment(); - } public function processSuccessfulPayment(string $payment_intent): \Illuminate\Http\RedirectResponse @@ -244,7 +239,6 @@ class ACSS private function storePaymentMethod($intent) { try { - $method = $this->stripe->getStripePaymentMethod($intent->payment_method); $payment_meta = new \stdClass; diff --git a/app/PaymentDrivers/Stripe/BECS.php b/app/PaymentDrivers/Stripe/BECS.php index 21ff8a0058d1..8a9007a0e1c3 100644 --- a/app/PaymentDrivers/Stripe/BECS.php +++ b/app/PaymentDrivers/Stripe/BECS.php @@ -11,15 +11,15 @@ namespace App\PaymentDrivers\Stripe; +use App\Exceptions\PaymentFailed; use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest; -use App\PaymentDrivers\StripePaymentDriver; use App\Jobs\Mail\PaymentFailureMailer; use App\Jobs\Util\SystemLogger; use App\Models\GatewayType; use App\Models\Payment; use App\Models\PaymentType; use App\Models\SystemLog; -use App\Exceptions\PaymentFailed; +use App\PaymentDrivers\StripePaymentDriver; class BECS { @@ -37,7 +37,8 @@ class BECS return render('gateways.stripe.becs.authorize', $data); } - public function paymentView(array $data) { + public function paymentView(array $data) + { $data['gateway'] = $this->stripe; $data['payment_method_id'] = GatewayType::BECS; $data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()); @@ -66,14 +67,12 @@ class BECS public function paymentResponse(PaymentResponseRequest $request) { - $gateway_response = json_decode($request->gateway_response); $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); $this->stripe->payment_hash->save(); if (property_exists($gateway_response, 'status') && $gateway_response->status == 'processing') { - $this->stripe->init(); $this->storePaymentMethod($gateway_response); @@ -81,7 +80,6 @@ class BECS } return $this->processUnsuccessfulPayment(); - } public function processSuccessfulPayment(string $payment_intent): \Illuminate\Http\RedirectResponse @@ -140,7 +138,6 @@ class BECS private function storePaymentMethod($intent) { try { - $method = $this->stripe->getStripePaymentMethod($intent->payment_method); $payment_meta = new \stdClass; diff --git a/app/PaymentDrivers/Stripe/Bancontact.php b/app/PaymentDrivers/Stripe/Bancontact.php index c269b286f7e0..608783de77c6 100644 --- a/app/PaymentDrivers/Stripe/Bancontact.php +++ b/app/PaymentDrivers/Stripe/Bancontact.php @@ -87,8 +87,9 @@ class Bancontact /* @todo: https://github.com/invoiceninja/invoiceninja/pull/3789/files#r436175798 */ //catch duplicate submissions. - if(Payment::where('transaction_reference', $payment_intent)->exists()) + if (Payment::where('transaction_reference', $payment_intent)->exists()) { return redirect()->route('client.payments.index'); + } $this->stripe->init(); diff --git a/app/PaymentDrivers/Stripe/EPS.php b/app/PaymentDrivers/Stripe/EPS.php index 3d8f8323e7d6..5bd92956dca8 100644 --- a/app/PaymentDrivers/Stripe/EPS.php +++ b/app/PaymentDrivers/Stripe/EPS.php @@ -89,8 +89,9 @@ class EPS $this->stripe->init(); //catch duplicate submissions. - if(Payment::where('transaction_reference', $payment_intent)->exists()) + if (Payment::where('transaction_reference', $payment_intent)->exists()) { return redirect()->route('client.payments.index'); + } $data = [ 'payment_method' => $payment_intent, diff --git a/app/PaymentDrivers/Stripe/GIROPAY.php b/app/PaymentDrivers/Stripe/GIROPAY.php index 6894870af0a8..102cf371cfe8 100644 --- a/app/PaymentDrivers/Stripe/GIROPAY.php +++ b/app/PaymentDrivers/Stripe/GIROPAY.php @@ -89,8 +89,9 @@ class GIROPAY $this->stripe->init(); //catch duplicate submissions. - if(Payment::where('transaction_reference', $payment_intent)->exists()) + if (Payment::where('transaction_reference', $payment_intent)->exists()) { return redirect()->route('client.payments.index'); + } $data = [ 'payment_method' => $payment_intent, diff --git a/app/PaymentDrivers/Stripe/PRZELEWY24.php b/app/PaymentDrivers/Stripe/PRZELEWY24.php index 8ed4b76bc3a1..5438649912e1 100644 --- a/app/PaymentDrivers/Stripe/PRZELEWY24.php +++ b/app/PaymentDrivers/Stripe/PRZELEWY24.php @@ -89,8 +89,9 @@ class PRZELEWY24 $this->stripe->init(); //catch duplicate submissions. - if(Payment::where('transaction_reference', $payment_intent)->exists()) + if (Payment::where('transaction_reference', $payment_intent)->exists()) { return redirect()->route('client.payments.index'); + } $data = [ 'payment_method' => $payment_intent, diff --git a/app/PaymentDrivers/Stripe/iDeal.php b/app/PaymentDrivers/Stripe/iDeal.php index 1a26e03c18bd..c9a43a8e1793 100644 --- a/app/PaymentDrivers/Stripe/iDeal.php +++ b/app/PaymentDrivers/Stripe/iDeal.php @@ -89,8 +89,9 @@ class iDeal $this->stripe->init(); //catch duplicate submissions. - if(Payment::where('transaction_reference', $payment_intent)->exists()) + if (Payment::where('transaction_reference', $payment_intent)->exists()) { return redirect()->route('client.payments.index'); + } $data = [ 'payment_method' => $payment_intent,