Fixes for GoCardless webhooks
This commit is contained in:
parent
6e357d8c7b
commit
54c97a8755
1 changed files with 5 additions and 3 deletions
|
|
@ -235,7 +235,7 @@ class GoCardlessPaymentDriver extends BaseDriver
|
|||
nlog("GoCardless Event");
|
||||
nlog($request->all());
|
||||
|
||||
if(!is_array($request->events) || !is_object($request->events)){
|
||||
if(!$request->has("events")){
|
||||
|
||||
nlog("No GoCardless events to process in response?");
|
||||
return response()->json([], 200);
|
||||
|
|
@ -251,12 +251,13 @@ class GoCardlessPaymentDriver extends BaseDriver
|
|||
|
||||
$payment = Payment::query()
|
||||
->where('transaction_reference', $event['links']['payment'])
|
||||
// ->where('company_id', $request->getCompany()->id)
|
||||
->where('company_id', $request->getCompany()->id)
|
||||
->first();
|
||||
|
||||
if ($payment) {
|
||||
$payment->status_id = Payment::STATUS_COMPLETED;
|
||||
$payment->save();
|
||||
nlog("GoCardless completed");
|
||||
}
|
||||
else
|
||||
nlog("I was unable to find the payment for this reference");
|
||||
|
|
@ -268,12 +269,13 @@ class GoCardlessPaymentDriver extends BaseDriver
|
|||
|
||||
$payment = Payment::query()
|
||||
->where('transaction_reference', $event['links']['payment'])
|
||||
// ->where('company_id', $request->getCompany()->id)
|
||||
->where('company_id', $request->getCompany()->id)
|
||||
->first();
|
||||
|
||||
if ($payment) {
|
||||
$payment->status_id = Payment::STATUS_FAILED;
|
||||
$payment->save();
|
||||
nlog("GoCardless completed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue