diff --git a/app/Ninja/PaymentDrivers/GoCardlessV2RedirectPaymentDriver.php b/app/Ninja/PaymentDrivers/GoCardlessV2RedirectPaymentDriver.php index 20cf6a82971b..7d5050e4a1a6 100644 --- a/app/Ninja/PaymentDrivers/GoCardlessV2RedirectPaymentDriver.php +++ b/app/Ninja/PaymentDrivers/GoCardlessV2RedirectPaymentDriver.php @@ -2,6 +2,7 @@ namespace App\Ninja\PaymentDrivers; +use Omnipay; use Session; use App\Models\Payment; @@ -19,6 +20,23 @@ class GoCardlessV2RedirectPaymentDriver extends BasePaymentDriver return $types; } + // Workaround for access_token/accessToken issue + protected function gateway() + { + if ($this->gateway) { + return $this->gateway; + } + + $this->gateway = Omnipay::create($this->accountGateway->gateway->provider); + + $config = (array) $this->accountGateway->getConfig(); + $config['access_token'] = $config['accessToken']; + $config['secret'] = $config['webhookSecret']; + $this->gateway->initialize($config); + + return $this->gateway; + } + protected function paymentDetails($paymentMethod = false) { $data = parent::paymentDetails($paymentMethod);