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

Ability to detach payment method

This commit is contained in:
Benjamin Beganović 2021-09-30 14:55:46 +02:00
parent f848fd83a8
commit 42991e1813

View File

@ -188,4 +188,27 @@ class GoCardlessPaymentDriver extends BaseDriver
{
return \round(($amount * pow(10, $precision)), 0);
}
public function detach(ClientGatewayToken $token)
{
$this->init();
try {
$this->gateway->mandates()->cancel($token->token);
} catch (\Exception $e) {
nlog($e->getMessage());
SystemLogger::dispatch(
[
'server_response' => $e->getMessage(),
'data' => request()->all(),
],
SystemLog::CATEGORY_GATEWAY_RESPONSE,
SystemLog::EVENT_GATEWAY_FAILURE,
SystemLog::TYPE_GOCARDLESS,
$this->client,
$this->client->company
);
}
}
}