mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for GoCardless webhooks
This commit is contained in:
parent
6e357d8c7b
commit
54c97a8755
@ -235,7 +235,7 @@ class GoCardlessPaymentDriver extends BaseDriver
|
|||||||
nlog("GoCardless Event");
|
nlog("GoCardless Event");
|
||||||
nlog($request->all());
|
nlog($request->all());
|
||||||
|
|
||||||
if(!is_array($request->events) || !is_object($request->events)){
|
if(!$request->has("events")){
|
||||||
|
|
||||||
nlog("No GoCardless events to process in response?");
|
nlog("No GoCardless events to process in response?");
|
||||||
return response()->json([], 200);
|
return response()->json([], 200);
|
||||||
@ -251,12 +251,13 @@ class GoCardlessPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
$payment = Payment::query()
|
$payment = Payment::query()
|
||||||
->where('transaction_reference', $event['links']['payment'])
|
->where('transaction_reference', $event['links']['payment'])
|
||||||
// ->where('company_id', $request->getCompany()->id)
|
->where('company_id', $request->getCompany()->id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($payment) {
|
if ($payment) {
|
||||||
$payment->status_id = Payment::STATUS_COMPLETED;
|
$payment->status_id = Payment::STATUS_COMPLETED;
|
||||||
$payment->save();
|
$payment->save();
|
||||||
|
nlog("GoCardless completed");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nlog("I was unable to find the payment for this reference");
|
nlog("I was unable to find the payment for this reference");
|
||||||
@ -268,12 +269,13 @@ class GoCardlessPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
$payment = Payment::query()
|
$payment = Payment::query()
|
||||||
->where('transaction_reference', $event['links']['payment'])
|
->where('transaction_reference', $event['links']['payment'])
|
||||||
// ->where('company_id', $request->getCompany()->id)
|
->where('company_id', $request->getCompany()->id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($payment) {
|
if ($payment) {
|
||||||
$payment->status_id = Payment::STATUS_FAILED;
|
$payment->status_id = Payment::STATUS_FAILED;
|
||||||
$payment->save();
|
$payment->save();
|
||||||
|
nlog("GoCardless completed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user