Commit 8d705218 authored by Maikel Koek's avatar Maikel Koek

B: Only delete Vault token remotely when payment method is Adyen

Fixes #297
parent 114a3aca
......@@ -27,7 +27,6 @@ use Magento\Vault\Api\Data\PaymentTokenInterface;
class PaymentVaultDeleteToken
{
/**
* @var \Adyen\Payment\Model\Api\PaymentRequest
*/
......@@ -52,6 +51,10 @@ class PaymentVaultDeleteToken
public function beforeDelete(\Magento\Vault\Api\PaymentTokenRepositoryInterface $subject, PaymentTokenInterface $paymentToken)
{
if (strpos($paymentToken->getPaymentMethodCode(), 'adyen_') !== 0) {
return $paymentToken;
}
try {
$this->_paymentRequest->disableRecurringContract(
$paymentToken->getGatewayToken(),
......@@ -61,7 +64,5 @@ class PaymentVaultDeleteToken
} catch(\Exception $e) {
throw new \Magento\Framework\Exception\LocalizedException(__('Failed to disable this contract'));
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment