Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Adyen Magento2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared Libs
Adyen Magento2
Commits
5f1ff32c
Commit
5f1ff32c
authored
Mar 30, 2018
by
Rik ter Beek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If token is deleted, delete this on adyen side as well
parent
f8e1aca4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
0 deletions
+73
-0
Plugin/PaymentVaultDeleteToken.php
Plugin/PaymentVaultDeleteToken.php
+67
-0
etc/di.xml
etc/di.xml
+6
-0
No files found.
Plugin/PaymentVaultDeleteToken.php
0 → 100644
View file @
5f1ff32c
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace
Adyen\Payment\Plugin
;
use
Magento\Vault\Api\Data\PaymentTokenInterface
;
class
PaymentVaultDeleteToken
{
/**
* @var \Adyen\Payment\Model\Api\PaymentRequest
*/
protected
$_paymentRequest
;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected
$_storeManager
;
/**
* PaymentVaultDeleteToken constructor.
* @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest
*/
public
function
__construct
(
\Adyen\Payment\Model\Api\PaymentRequest
$paymentRequest
,
\Magento\Store\Model\StoreManagerInterface
$storeManager
)
{
$this
->
_paymentRequest
=
$paymentRequest
;
$this
->
_storeManager
=
$storeManager
;
}
public
function
beforeDelete
(
\Magento\Vault\Api\PaymentTokenRepositoryInterface
$subject
,
PaymentTokenInterface
$paymentToken
)
{
try
{
$this
->
_paymentRequest
->
disableRecurringContract
(
$paymentToken
->
getGatewayToken
(),
$paymentToken
->
getCustomerId
(),
$this
->
_storeManager
->
getStore
()
->
getStoreId
()
);
}
catch
(
\Exception
$e
)
{
throw
new
\Magento\Framework\Exception\LocalizedException
(
__
(
'Failed to disable this contract'
));
}
}
}
\ No newline at end of file
etc/di.xml
View file @
5f1ff32c
...
@@ -916,4 +916,10 @@
...
@@ -916,4 +916,10 @@
<preference
for=
"Adyen\Payment\Api\GuestAdyenPaymentMethodManagementInterface"
type=
"Adyen\Payment\Model\GuestAdyenPaymentMethodManagement"
/>
<preference
for=
"Adyen\Payment\Api\GuestAdyenPaymentMethodManagementInterface"
type=
"Adyen\Payment\Model\GuestAdyenPaymentMethodManagement"
/>
<preference
for=
"Adyen\Payment\Api\AdyenPaymentMethodManagementInterface"
type=
"Adyen\Payment\Model\AdyenPaymentMethodManagement"
/>
<preference
for=
"Adyen\Payment\Api\AdyenPaymentMethodManagementInterface"
type=
"Adyen\Payment\Model\AdyenPaymentMethodManagement"
/>
<preference
for=
"Adyen\Payment\Api\AdyenRequestMerchantSessionInterface"
type=
"Adyen\Payment\Model\AdyenRequestMerchantSession"
/>
<preference
for=
"Adyen\Payment\Api\AdyenRequestMerchantSessionInterface"
type=
"Adyen\Payment\Model\AdyenRequestMerchantSession"
/>
<type
name=
"Magento\Vault\Api\PaymentTokenRepositoryInterface"
>
<plugin
name=
"AdyenPaymentVaultDeleteToken"
type=
"Adyen\Payment\Plugin\PaymentVaultDeleteToken"
sortOrder=
"10"
/>
</type>
</config>
</config>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment