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
a33b585c
Commit
a33b585c
authored
Jun 15, 2017
by
Rik ter Beek
Committed by
GitHub
Jun 15, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #122 from Adyen/develop-rik
#116 Billing Agreement can now be cancelled
parents
e8069fc8
3f20623e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
1 deletion
+107
-1
Model/Method/Adapter.php
Model/Method/Adapter.php
+106
-0
etc/di.xml
etc/di.xml
+1
-1
No files found.
Model/Method/Adapter.php
0 → 100644
View file @
a33b585c
<?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\Model\Method
;
use
Magento\Payment\Model\Method
;
use
Magento\Framework\DataObject
;
use
Magento\Framework\Event\ManagerInterface
;
use
Magento\Payment\Gateway\Command\CommandManagerInterface
;
use
Magento\Payment\Gateway\Command\CommandPoolInterface
;
use
Magento\Payment\Gateway\Data\PaymentDataObjectFactory
;
use
Magento\Payment\Gateway\Config\ValueHandlerPoolInterface
;
use
Magento\Payment\Gateway\Validator\ValidatorPoolInterface
;
class
Adapter
extends
Method\Adapter
{
/**
* @var \Adyen\Payment\Model\Api\PaymentRequest
*/
protected
$_paymentRequest
;
/**
* Adapter constructor.
* @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest
* @param ManagerInterface $eventManager
* @param ValueHandlerPoolInterface $valueHandlerPool
* @param PaymentDataObjectFactory $paymentDataObjectFactory
* @param string $code
* @param string $formBlockType
* @param CommandPoolInterface $infoBlockType
* @param CommandPoolInterface|null $commandPool
* @param ValidatorPoolInterface|null $validatorPool
* @param CommandManagerInterface|null $commandExecutor
*/
public
function
__construct
(
\Adyen\Payment\Model\Api\PaymentRequest
$paymentRequest
,
ManagerInterface
$eventManager
,
ValueHandlerPoolInterface
$valueHandlerPool
,
PaymentDataObjectFactory
$paymentDataObjectFactory
,
$code
,
$formBlockType
,
$infoBlockType
,
CommandPoolInterface
$commandPool
=
null
,
ValidatorPoolInterface
$validatorPool
=
null
,
\Magento\Payment\Gateway\Command\CommandManagerInterface
$commandExecutor
=
null
)
{
parent
::
__construct
(
$eventManager
,
$valueHandlerPool
,
$paymentDataObjectFactory
,
$code
,
$formBlockType
,
$infoBlockType
,
$commandPool
,
$validatorPool
,
$commandExecutor
);
$this
->
_paymentRequest
=
$paymentRequest
;
}
/**
* @param \Adyen\Payment\Model\Billing\Agreement $agreement
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public
function
updateBillingAgreementStatus
(
\Adyen\Payment\Model\Billing\Agreement
$agreement
)
{
$targetStatus
=
$agreement
->
getStatus
();
if
(
$targetStatus
==
\Magento\Paypal\Model\Billing\Agreement
::
STATUS_CANCELED
)
{
try
{
$this
->
_paymentRequest
->
disableRecurringContract
(
$agreement
->
getReferenceId
(),
$agreement
->
getCustomerReference
(),
$agreement
->
getStoreId
()
);
}
catch
(
Exception
$e
)
{
throw
new
\Magento\Framework\Exception\LocalizedException
(
__
(
'Failed to disable this contract'
));
}
}
return
$this
;
}
}
etc/di.xml
View file @
a33b585c
...
...
@@ -44,7 +44,7 @@
<argument
name=
"commandPool"
xsi:type=
"object"
>
AdyenPaymentCcCommandPool
</argument>
</arguments>
</virtualType>
<virtualType
name=
"AdyenPaymentOneclickFacade"
type=
"
Magento
\Payment\Model\Method\Adapter"
>
<virtualType
name=
"AdyenPaymentOneclickFacade"
type=
"
Adyen
\Payment\Model\Method\Adapter"
>
<arguments>
<argument
name=
"code"
xsi:type=
"const"
>
Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE
</argument>
<argument
name=
"formBlockType"
xsi:type=
"string"
>
Adyen\Payment\Block\Form\Oneclick
</argument>
...
...
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