Commit 46bc4c90 authored by Rik ter Beek's avatar Rik ter Beek Committed by GitHub

Merge pull request #298 from ho-nl-fork/delete-plugin

B: Only delete Vault token remotely when payment method is Adyen
parents 114a3aca d7b5dd97
......@@ -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'));
}
}
}
\ No newline at end of file
}
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