mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 08:34:39 -04:00
Minor fixes for gocardless
This commit is contained in:
parent
641fd20ef2
commit
0c55a9968d
@ -230,14 +230,11 @@ class GoCardlessPaymentDriver extends BaseDriver
|
||||
public function processWebhookRequest(PaymentWebhookRequest $request)
|
||||
{
|
||||
// Allow app to catch up with webhook request.
|
||||
sleep(2);
|
||||
|
||||
$this->init();
|
||||
|
||||
nlog("GoCardless Event");
|
||||
nlog($request->all());
|
||||
|
||||
|
||||
if(!is_array($request->events) || !is_object($request->events)){
|
||||
|
||||
nlog("No GoCardless events to process in response?");
|
||||
@ -245,19 +242,24 @@ class GoCardlessPaymentDriver extends BaseDriver
|
||||
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
|
||||
foreach ($request->events as $event) {
|
||||
if ($event['action'] === 'confirmed') {
|
||||
|
||||
nlog("Searching for transaction reference");
|
||||
|
||||
$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();
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
nlog("I was unable to find the payment for this reference");
|
||||
//finalize payments on invoices here.
|
||||
|
||||
}
|
||||
@ -266,7 +268,7 @@ 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) {
|
||||
|
@ -226,6 +226,7 @@ class Statement
|
||||
->whereIn('status_id', $this->invoiceStatuses())
|
||||
->whereBetween('date', [Carbon::parse($this->options['start_date']), Carbon::parse($this->options['end_date'])])
|
||||
->orderBy('due_date', 'ASC')
|
||||
->orderBy('date', 'ASC')
|
||||
->cursor();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user