This commit is contained in:
Lars Kusch 2021-10-20 16:56:30 +02:00
parent 8f700463c4
commit 16be5c96a4
7 changed files with 14 additions and 18 deletions

View File

@ -22,9 +22,7 @@ use App\Jobs\Util\SystemLogger;
use App\Mail\Gateways\ACHVerificationNotification; use App\Mail\Gateways\ACHVerificationNotification;
use App\Models\ClientGatewayToken; use App\Models\ClientGatewayToken;
use App\Models\GatewayType; use App\Models\GatewayType;
use App\Models\Invoice;
use App\Models\Payment; use App\Models\Payment;
use App\Models\PaymentHash;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\PaymentDrivers\StripePaymentDriver; use App\PaymentDrivers\StripePaymentDriver;
@ -57,7 +55,6 @@ class ACSS
try { try {
$source = Customer::createSource($customer->id, ['source' => $stripe_response->token->id], $this->stripe->stripe_connect_auth); $source = Customer::createSource($customer->id, ['source' => $stripe_response->token->id], $this->stripe->stripe_connect_auth);
} catch (InvalidRequestException $e) { } catch (InvalidRequestException $e) {
throw new PaymentFailed($e->getMessage(), $e->getCode()); throw new PaymentFailed($e->getMessage(), $e->getCode());
} }
@ -175,7 +172,6 @@ class ACSS
public function paymentResponse(PaymentResponseRequest $request) public function paymentResponse(PaymentResponseRequest $request)
{ {
$gateway_response = json_decode($request->gateway_response); $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->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->processSuccessfulPayment($gateway_response->id);
} }
return $this->processUnsuccessfulPayment(); return $this->processUnsuccessfulPayment();
} }
public function processSuccessfulPayment(string $payment_intent): \Illuminate\Http\RedirectResponse public function processSuccessfulPayment(string $payment_intent): \Illuminate\Http\RedirectResponse
@ -244,7 +239,6 @@ class ACSS
private function storePaymentMethod($intent) private function storePaymentMethod($intent)
{ {
try { try {
$method = $this->stripe->getStripePaymentMethod($intent->payment_method); $method = $this->stripe->getStripePaymentMethod($intent->payment_method);
$payment_meta = new \stdClass; $payment_meta = new \stdClass;

View File

@ -11,15 +11,15 @@
namespace App\PaymentDrivers\Stripe; namespace App\PaymentDrivers\Stripe;
use App\Exceptions\PaymentFailed;
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest; use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
use App\PaymentDrivers\StripePaymentDriver;
use App\Jobs\Mail\PaymentFailureMailer; use App\Jobs\Mail\PaymentFailureMailer;
use App\Jobs\Util\SystemLogger; use App\Jobs\Util\SystemLogger;
use App\Models\GatewayType; use App\Models\GatewayType;
use App\Models\Payment; use App\Models\Payment;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\Exceptions\PaymentFailed; use App\PaymentDrivers\StripePaymentDriver;
class BECS class BECS
{ {
@ -37,7 +37,8 @@ class BECS
return render('gateways.stripe.becs.authorize', $data); return render('gateways.stripe.becs.authorize', $data);
} }
public function paymentView(array $data) { public function paymentView(array $data)
{
$data['gateway'] = $this->stripe; $data['gateway'] = $this->stripe;
$data['payment_method_id'] = GatewayType::BECS; $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()); $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) public function paymentResponse(PaymentResponseRequest $request)
{ {
$gateway_response = json_decode($request->gateway_response); $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->data = array_merge((array) $this->stripe->payment_hash->data, $request->all());
$this->stripe->payment_hash->save(); $this->stripe->payment_hash->save();
if (property_exists($gateway_response, 'status') && $gateway_response->status == 'processing') { if (property_exists($gateway_response, 'status') && $gateway_response->status == 'processing') {
$this->stripe->init(); $this->stripe->init();
$this->storePaymentMethod($gateway_response); $this->storePaymentMethod($gateway_response);
@ -81,7 +80,6 @@ class BECS
} }
return $this->processUnsuccessfulPayment(); return $this->processUnsuccessfulPayment();
} }
public function processSuccessfulPayment(string $payment_intent): \Illuminate\Http\RedirectResponse public function processSuccessfulPayment(string $payment_intent): \Illuminate\Http\RedirectResponse
@ -140,7 +138,6 @@ class BECS
private function storePaymentMethod($intent) private function storePaymentMethod($intent)
{ {
try { try {
$method = $this->stripe->getStripePaymentMethod($intent->payment_method); $method = $this->stripe->getStripePaymentMethod($intent->payment_method);
$payment_meta = new \stdClass; $payment_meta = new \stdClass;

View File

@ -87,8 +87,9 @@ class Bancontact
/* @todo: https://github.com/invoiceninja/invoiceninja/pull/3789/files#r436175798 */ /* @todo: https://github.com/invoiceninja/invoiceninja/pull/3789/files#r436175798 */
//catch duplicate submissions. //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'); return redirect()->route('client.payments.index');
}
$this->stripe->init(); $this->stripe->init();

View File

@ -89,8 +89,9 @@ class EPS
$this->stripe->init(); $this->stripe->init();
//catch duplicate submissions. //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'); return redirect()->route('client.payments.index');
}
$data = [ $data = [
'payment_method' => $payment_intent, 'payment_method' => $payment_intent,

View File

@ -89,8 +89,9 @@ class GIROPAY
$this->stripe->init(); $this->stripe->init();
//catch duplicate submissions. //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'); return redirect()->route('client.payments.index');
}
$data = [ $data = [
'payment_method' => $payment_intent, 'payment_method' => $payment_intent,

View File

@ -89,8 +89,9 @@ class PRZELEWY24
$this->stripe->init(); $this->stripe->init();
//catch duplicate submissions. //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'); return redirect()->route('client.payments.index');
}
$data = [ $data = [
'payment_method' => $payment_intent, 'payment_method' => $payment_intent,

View File

@ -89,8 +89,9 @@ class iDeal
$this->stripe->init(); $this->stripe->init();
//catch duplicate submissions. //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'); return redirect()->route('client.payments.index');
}
$data = [ $data = [
'payment_method' => $payment_intent, 'payment_method' => $payment_intent,