mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Stripe: Support for new webhooks format
This commit is contained in:
parent
6740e348a1
commit
ab890f770e
@ -387,21 +387,23 @@ class StripePaymentDriver extends BaseDriver
|
||||
return $this->payment_method->processVerification($request, $payment_method);
|
||||
}
|
||||
|
||||
public function processWebhookRequest(PaymentWebhookRequest $request, Payment $payment)
|
||||
public function processWebhookRequest(PaymentWebhookRequest $request)
|
||||
{
|
||||
if ($request->type == 'source.chargeable') {
|
||||
$payment->status_id = Payment::STATUS_COMPLETED;
|
||||
$payment->save();
|
||||
if ($request->type === 'charge.succeeded' || $request->type === 'source.chargeable') {
|
||||
foreach ($request->data as $transaction) {
|
||||
$payment = Payment::query()
|
||||
->where('transaction_reference', $transaction['id'])
|
||||
->where('company_id', $request->getCompany()->id)
|
||||
->first();
|
||||
|
||||
if ($payment) {
|
||||
$payment->status_id = Payment::STATUS_COMPLETED;
|
||||
$payment->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($request->type == 'charge.succeeded') {
|
||||
$payment->status_id = Payment::STATUS_COMPLETED;
|
||||
$payment->save();
|
||||
}
|
||||
|
||||
// charge.failed, charge.refunded
|
||||
|
||||
return response([], 200);
|
||||
return response()->json([], 200);
|
||||
}
|
||||
|
||||
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
|
||||
|
Loading…
Reference in New Issue
Block a user