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