1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Fixes for Stripe

This commit is contained in:
David Bomba 2021-10-06 12:10:09 +11:00
parent fa5c787140
commit 597cfc0662
2 changed files with 5 additions and 5 deletions

View File

@ -794,9 +794,10 @@ class BasePaymentDriver
$payment->contact_id = $invitation->contact_id;
$payment->transaction_reference = $ref;
$payment->payment_date = $account->getDateTime()->format('Y-m-d');
$payment->ip = Request::ip();
$payment->ip = \Request::ip();
$payment = $this->creatingPayment($payment, $paymentMethod);
//Laravel 6 upgrade - uncommented this line as it was causing a failure
// $payment = $this->creatingPayment($payment, $paymentMethod);
if ($paymentMethod) {
$payment->last4 = $paymentMethod->last4;

View File

@ -228,7 +228,6 @@ class StripePaymentDriver extends BasePaymentDriver
if ( ! empty($data['payment_intent'])) {
// Find the existing payment intent.
$intent = PaymentIntent::retrieve($data['payment_intent']);
if ( ! $intent->amount == $data['amount'] * pow(10, $currency['precision'])) {
// Make sure that the provided payment intent matches the invoice amount.
throw new Exception('Incorrect PaymentIntent amount.');
@ -270,8 +269,8 @@ class StripePaymentDriver extends BasePaymentDriver
return $this->doOmnipayOnsitePurchase($data, $paymentMethod);
}
}
$intent = PaymentIntent::create($params);
}
if (empty($intent)) {
@ -282,6 +281,7 @@ class StripePaymentDriver extends BasePaymentDriver
throw new PaymentActionRequiredException(['payment_intent' => $intent]);
} else if ($intent->status == 'succeeded') {
$ref = ! empty($intent->charges->data) ? $intent->charges->data[0]->id : null;
$payment = $this->createPayment($ref, $paymentMethod);
if ($this->invitation->invoice->account->isNinjaAccount()) {
@ -296,7 +296,6 @@ class StripePaymentDriver extends BasePaymentDriver
$this->tokenResponse = $payment_method;
parent::createToken();
}
return $payment;
} else {
throw new Exception('Invalid PaymentIntent status: ' . $intent->status);