Fixes for gocardless events

This commit is contained in:
David Bomba 2022-11-16 22:52:26 +11:00
parent fbaa27f673
commit f0e51e5a67
2 changed files with 11 additions and 12 deletions

View File

@ -26,15 +26,14 @@ All Pro and Enterprise features from the hosted app are included in the open-cod
* [Support Forum](https://forum.invoiceninja.com) * [Support Forum](https://forum.invoiceninja.com)
* [StackOverflow](https://stackoverflow.com/tags/invoice-ninja/) * [StackOverflow](https://stackoverflow.com/tags/invoice-ninja/)
## Mobile App ## Mobile Apps
* [iPhone](https://apps.apple.com/us/app/invoice-ninja-v5/id1503970375#?platform=iphone) * [iPhone](https://apps.apple.com/app/id1503970375?platform=iphone)
* [Android](https://play.google.com/store/apps/details?id=com.invoiceninja.app) * [Android](https://play.google.com/store/apps/details?id=com.invoiceninja.app)
* [Linux](https://github.com/invoiceninja/flutter-mobile)
## Desktop App ## Desktop Apps
* [MacOS](https://apps.apple.com/app/id1503970375) * [macOS](https://apps.apple.com/app/id1503970375?platform=mac)
* [Windows](https://microsoft.com/en-us/p/invoice-ninja/9n3f2bbcfdr6) * [Windows](https://microsoft.com/en-us/p/invoice-ninja/9n3f2bbcfdr6)
* [MacOS Desktop](https://snapcraft.io/invoiceninja) * [Linux](https://snapcraft.io/invoiceninja)
## Installation Options ## Installation Options

View File

@ -291,13 +291,13 @@ class GoCardlessPaymentDriver extends BaseDriver
return response()->json([], 200); return response()->json([], 200);
} }
$this->go_cardless->setPaymentHash($hash); $this->setPaymentHash($hash);
$billing_request = $this->go_cardless->gateway->billingRequests()->get( $billing_request = $this->gateway->billingRequests()->get(
$event['links']['billing_request'] $event['links']['billing_request']
); );
$payment = $this->go_cardless->gateway->payments()->get( $payment = $this->gateway->payments()->get(
$billing_request->payment_request->links->payment $billing_request->payment_request->links->payment
); );
@ -305,7 +305,7 @@ class GoCardlessPaymentDriver extends BaseDriver
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($hash->invoices(), 'invoice_id')))->withTrashed()->get(); $invoices = Invoice::whereIn('id', $this->transformKeys(array_column($hash->invoices(), 'invoice_id')))->withTrashed()->get();
$this->go_cardless->client = $invoices->first()->client; $this->client = $invoices->first()->client;
$invoices->each(function ($invoice){ $invoices->each(function ($invoice){
@ -347,12 +347,12 @@ class GoCardlessPaymentDriver extends BaseDriver
$data = [ $data = [
'payment_method' => $payment->links->mandate, 'payment_method' => $payment->links->mandate,
'payment_type' => PaymentType::INSTANT_BANK_PAY, 'payment_type' => PaymentType::INSTANT_BANK_PAY,
'amount' => $this->go_cardless->payment_hash->data->amount_with_fee, 'amount' => $this->payment_hash->data->amount_with_fee,
'transaction_reference' => $payment->id, 'transaction_reference' => $payment->id,
'gateway_type_id' => GatewayType::INSTANT_BANK_PAY, 'gateway_type_id' => GatewayType::INSTANT_BANK_PAY,
]; ];
$payment = $this->go_cardless->createPayment($data, Payment::STATUS_COMPLETED); $payment = $this->createPayment($data, Payment::STATUS_COMPLETED);
$payment->status_id = Payment::STATUS_COMPLETED; $payment->status_id = Payment::STATUS_COMPLETED;
$payment->save(); $payment->save();