1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 22:22:32 +01:00

Fixes for gocardless invalid credentials

This commit is contained in:
David Bomba 2023-10-03 14:50:47 +11:00
parent f80767bcfc
commit 814ac115e8

View File

@ -98,10 +98,17 @@ class GoCardlessPaymentDriver extends BaseDriver
public function init(): self
{
$this->gateway = new \GoCardlessPro\Client([
'access_token' => $this->company_gateway->getConfigField('accessToken'),
'environment' => $this->company_gateway->getConfigField('testMode') ? \GoCardlessPro\Environment::SANDBOX : \GoCardlessPro\Environment::LIVE,
]);
try {
$this->gateway = new \GoCardlessPro\Client([
'access_token' => $this->company_gateway->getConfigField('accessToken'),
'environment' => $this->company_gateway->getConfigField('testMode') ? \GoCardlessPro\Environment::SANDBOX : \GoCardlessPro\Environment::LIVE,
]);
}
catch(\GoCardlessPro\Core\Exception\AuthenticationException $e){
throw new \Exception('GoCardless: Invalid Access Token', 403);
}
return $this;
}