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

Merge pull request #6907 from LarsK1/v5-develop

Stripe: Webhook fixes
This commit is contained in:
David Bomba 2021-11-08 19:44:02 +11:00 committed by GitHub
commit 735bb7ea3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -525,10 +525,13 @@ class StripePaymentDriver extends BaseDriver
foreach ($request->data as $transaction) {
$payment = Payment::query()
->where('transaction_reference', $transaction['id'])
->where('transaction_reference', $transaction['payment_intent'])
->where('company_id', $request->getCompany()->id)
->where(function ($query) use ($transaction) {
$query->where('transaction_reference', $transaction['payment_intent'])
->orWhere('transaction_reference', $transaction['id']);
})
->first();
if ($payment) {
$payment->status_id = Payment::STATUS_COMPLETED;
$payment->save();
@ -546,10 +549,13 @@ class StripePaymentDriver extends BaseDriver
if ($charge->captured) {
$payment = Payment::query()
->where('transaction_reference', $transaction['id'])
->where('transaction_reference', $transaction['payment_intent'])
->where('company_id', $request->getCompany()->id)
->where(function ($query) use ($transaction) {
$query->where('transaction_reference', $transaction['payment_intent'])
->orWhere('transaction_reference', $transaction['id']);
})
->first();
if ($payment) {
$payment->status_id = Payment::STATUS_COMPLETED;
$payment->save();