1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00

Ensure we retrieve archived invoices in Stripe payment webhook

This commit is contained in:
David Bomba 2022-12-07 07:43:38 +11:00
parent ce1d115ff4
commit 3a97b39e3b

View File

@ -154,31 +154,6 @@ class PaymentIntentWebhook implements ShouldQueue
'card_details' => isset($charge['payment_method_details']['card']['brand']) ? $charge['payment_method_details']['card']['brand'] : PaymentType::CREDIT_CARD_OTHER
];
if(isset($pi['allowed_source_types']) && in_array('card', $pi['allowed_source_types']))
{
$invoice = Invoice::with('client')->find($payment_hash->fee_invoice_id);
$client = $invoice->client;
$this->updateCreditCardPayment($payment_hash, $client, $meta);
}
elseif(isset($pi['payment_method_types']) && in_array('card', $pi['payment_method_types']))
{
$invoice = Invoice::with('client')->find($payment_hash->fee_invoice_id);
$client = $invoice->client;
$this->updateCreditCardPayment($payment_hash, $client, $meta);
}
elseif(isset($pi['payment_method_types']) && in_array('us_bank_account', $pi['payment_method_types']))
{
$invoice = Invoice::with('client')->find($payment_hash->fee_invoice_id);
$client = $invoice->client;
$this->updateAchPayment($payment_hash, $client, $meta);
}
SystemLogger::dispatch(
['response' => $this->stripe_request, 'data' => []],
SystemLog::CATEGORY_GATEWAY_RESPONSE,
@ -188,6 +163,39 @@ class PaymentIntentWebhook implements ShouldQueue
$company,
);
if(isset($pi['allowed_source_types']) && in_array('card', $pi['allowed_source_types']))
{
$invoice = Invoice::with('client')->withTrashed()->find($payment_hash->fee_invoice_id);
$client = $invoice->client;
if($invoice->is_deleted)
return;
$this->updateCreditCardPayment($payment_hash, $client, $meta);
}
elseif(isset($pi['payment_method_types']) && in_array('card', $pi['payment_method_types']))
{
$invoice = Invoice::with('client')->withTrashed()->find($payment_hash->fee_invoice_id);
$client = $invoice->client;
if($invoice->is_deleted)
return;
$this->updateCreditCardPayment($payment_hash, $client, $meta);
}
elseif(isset($pi['payment_method_types']) && in_array('us_bank_account', $pi['payment_method_types']))
{
$invoice = Invoice::with('client')->withTrashed()->find($payment_hash->fee_invoice_id);
$client = $invoice->client;
if($invoice->is_deleted)
return;
$this->updateAchPayment($payment_hash, $client, $meta);
}
}