mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for Stripe
This commit is contained in:
parent
fa5c787140
commit
597cfc0662
@ -794,9 +794,10 @@ class BasePaymentDriver
|
|||||||
$payment->contact_id = $invitation->contact_id;
|
$payment->contact_id = $invitation->contact_id;
|
||||||
$payment->transaction_reference = $ref;
|
$payment->transaction_reference = $ref;
|
||||||
$payment->payment_date = $account->getDateTime()->format('Y-m-d');
|
$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) {
|
if ($paymentMethod) {
|
||||||
$payment->last4 = $paymentMethod->last4;
|
$payment->last4 = $paymentMethod->last4;
|
||||||
|
@ -228,7 +228,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
if ( ! empty($data['payment_intent'])) {
|
if ( ! empty($data['payment_intent'])) {
|
||||||
// Find the existing payment intent.
|
// Find the existing payment intent.
|
||||||
$intent = PaymentIntent::retrieve($data['payment_intent']);
|
$intent = PaymentIntent::retrieve($data['payment_intent']);
|
||||||
|
|
||||||
if ( ! $intent->amount == $data['amount'] * pow(10, $currency['precision'])) {
|
if ( ! $intent->amount == $data['amount'] * pow(10, $currency['precision'])) {
|
||||||
// Make sure that the provided payment intent matches the invoice amount.
|
// Make sure that the provided payment intent matches the invoice amount.
|
||||||
throw new Exception('Incorrect PaymentIntent amount.');
|
throw new Exception('Incorrect PaymentIntent amount.');
|
||||||
@ -270,8 +269,8 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
return $this->doOmnipayOnsitePurchase($data, $paymentMethod);
|
return $this->doOmnipayOnsitePurchase($data, $paymentMethod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$intent = PaymentIntent::create($params);
|
$intent = PaymentIntent::create($params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($intent)) {
|
if (empty($intent)) {
|
||||||
@ -282,6 +281,7 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
throw new PaymentActionRequiredException(['payment_intent' => $intent]);
|
throw new PaymentActionRequiredException(['payment_intent' => $intent]);
|
||||||
} else if ($intent->status == 'succeeded') {
|
} else if ($intent->status == 'succeeded') {
|
||||||
$ref = ! empty($intent->charges->data) ? $intent->charges->data[0]->id : null;
|
$ref = ! empty($intent->charges->data) ? $intent->charges->data[0]->id : null;
|
||||||
|
|
||||||
$payment = $this->createPayment($ref, $paymentMethod);
|
$payment = $this->createPayment($ref, $paymentMethod);
|
||||||
|
|
||||||
if ($this->invitation->invoice->account->isNinjaAccount()) {
|
if ($this->invitation->invoice->account->isNinjaAccount()) {
|
||||||
@ -296,7 +296,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
$this->tokenResponse = $payment_method;
|
$this->tokenResponse = $payment_method;
|
||||||
parent::createToken();
|
parent::createToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $payment;
|
return $payment;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Invalid PaymentIntent status: ' . $intent->status);
|
throw new Exception('Invalid PaymentIntent status: ' . $intent->status);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user