We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit b4c83a0c authored by Rik ter Beek's avatar Rik ter Beek

Implement Vault + instant purchase and added fixes to files where needed

parent 5d1d536a
...@@ -33,7 +33,7 @@ class Cctypes extends \Magento\Framework\View\Element\Html\Select ...@@ -33,7 +33,7 @@ class Cctypes extends \Magento\Framework\View\Element\Html\Select
protected $ccTypes = []; protected $ccTypes = [];
/** /**
* @var \Magento\Braintree\Model\Source\CcType * @var \Adyen\Payment\Model\Config\Source\CcType
*/ */
protected $ccTypeSource; protected $ccTypeSource;
......
...@@ -31,8 +31,9 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA ...@@ -31,8 +31,9 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA
*/ */
protected $_installmentRenderer = null; protected $_installmentRenderer = null;
/** /**
* @var \Magento\Braintree\Block\Adminhtml\Form\Field\CcTypes * @var \Adyen\Payment\Block\Adminhtml\System\Config\Field\Cctypes
*/ */
protected $_ccTypesRenderer = null; protected $_ccTypesRenderer = null;
...@@ -57,7 +58,8 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA ...@@ -57,7 +58,8 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA
/** /**
* Returns renderer for country element * Returns renderer for country element
* *
* @return \Magento\Braintree\Block\Adminhtml\Form\Field\Cctypes * @return \Magento\Framework\View\Element\BlockInterface|null
* @throws \Magento\Framework\Exception\LocalizedException
*/ */
protected function getCcTypesRenderer() protected function getCcTypesRenderer()
{ {
...@@ -106,7 +108,7 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA ...@@ -106,7 +108,7 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA
* Prepare existing row data object * Prepare existing row data object
* *
* @param \Magento\Framework\DataObject $row * @param \Magento\Framework\DataObject $row
* @return void * @throws \Magento\Framework\Exception\LocalizedException
*/ */
protected function _prepareArrayRow(\Magento\Framework\DataObject $row) protected function _prepareArrayRow(\Magento\Framework\DataObject $row)
{ {
...@@ -127,6 +129,5 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA ...@@ -127,6 +129,5 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA
} }
} }
$row->setData('option_extra_attrs', $options); $row->setData('option_extra_attrs', $options);
return;
} }
} }
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Block\Customer;
use Adyen\Payment\Model\Ui\AdyenCcConfigProvider;
use Adyen\Payment\Helper\Data;
use Magento\Framework\View\Element\Template;
use Magento\Vault\Api\Data\PaymentTokenInterface;
use Magento\Vault\Block\AbstractCardRenderer;
use Magento\Payment\Model\CcConfigProvider;
class CardRenderer extends AbstractCardRenderer
{
/**
* @var Data
*/
protected $adyenHelper;
public function __construct(
Template\Context $context,
CcConfigProvider $iconsProvider,
array $data,
Data $adyenHelper
) {
parent::__construct($context, $iconsProvider, $data);
$this->adyenHelper = $adyenHelper;
}
/**
* Can render specified token
*
* @param PaymentTokenInterface $token
* @return boolean
*/
public function canRender(PaymentTokenInterface $token)
{
return $token->getPaymentMethodCode() === AdyenCcConfigProvider::CODE;
}
/**
* @return string
*/
public function getNumberLast4Digits()
{
return $this->getTokenDetails()['maskedCC'];
}
/**
* @return string
*/
public function getExpDate()
{
return $this->getTokenDetails()['expirationDate'];
}
/**
* @return string
*/
public function getIconUrl()
{
return $this->adyenHelper->getVariantIcon($this->getTokenDetails()['type'])['url'];
}
/**
* @return int
*/
public function getIconHeight()
{
return $this->adyenHelper->getVariantIcon($this->getTokenDetails()['type'])['height'];
}
/**
* @return int
*/
public function getIconWidth()
{
return $this->adyenHelper->getVariantIcon($this->getTokenDetails()['type'])['width'];
}
}
\ No newline at end of file
...@@ -22,7 +22,14 @@ ...@@ -22,7 +22,14 @@
*/ */
namespace Adyen\Payment\Controller\Process; namespace Adyen\Payment\Controller\Process;
use Magento\Framework\App\Request\Http as HttpRequest; use Magento\Framework\App\Request\Http as HttpRequest;
use Magento\Payment\Model\InfoInterface;
use Magento\Vault\Api\Data\PaymentTokenInterface;
use Magento\Vault\Api\Data\PaymentTokenFactoryInterface;
use Magento\Sales\Api\Data\OrderPaymentExtensionInterface;
use Magento\Sales\Api\Data\OrderPaymentExtensionInterfaceFactory;
use Magento\Sales\Model\ResourceModel\Order\Payment as OrderPaymentResource;
class Validate3d extends \Magento\Framework\App\Action\Action class Validate3d extends \Magento\Framework\App\Action\Action
{ {
...@@ -56,6 +63,19 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -56,6 +63,19 @@ class Validate3d extends \Magento\Framework\App\Action\Action
*/ */
protected $_orderRepository; protected $_orderRepository;
/**
* @var PaymentTokenFactoryInterface
*/
private $paymentTokenFactory;
/**
* @var OrderPaymentExtensionInterfaceFactory
*/
private $paymentExtensionFactory;
/**
* @var OrderPaymentResource
*/
private $orderPaymentResource;
/** /**
* Validate3d constructor. * Validate3d constructor.
* *
...@@ -63,21 +83,31 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -63,21 +83,31 @@ class Validate3d extends \Magento\Framework\App\Action\Action
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest * @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest
* @param \Magento\Sales\Api\OrderRepositoryInterface $orderRepository
* @param PaymentTokenFactoryInterface $paymentTokenFactory
* @param OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory
* @param OrderPaymentResource $orderPaymentResource
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\Action\Context $context, \Magento\Framework\App\Action\Context $context,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger, \Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Model\Api\PaymentRequest $paymentRequest, \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest,
\Magento\Sales\Api\OrderRepositoryInterface $orderRepository \Magento\Sales\Api\OrderRepositoryInterface $orderRepository,
PaymentTokenFactoryInterface $paymentTokenFactory,
OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory,
OrderPaymentResource $orderPaymentResource
) { ) {
parent::__construct($context); parent::__construct($context);
$this->_adyenLogger = $adyenLogger; $this->_adyenLogger = $adyenLogger;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_paymentRequest = $paymentRequest; $this->_paymentRequest = $paymentRequest;
$this->_orderRepository = $orderRepository; $this->_orderRepository = $orderRepository;
$this->paymentTokenFactory = $paymentTokenFactory;
$this->paymentExtensionFactory = $paymentExtensionFactory;
$this->orderPaymentResource = $orderPaymentResource;
// Fix for Magento2.3 adding isAjax to the request params // Fix for Magento2.3 adding isAjax to the request params
if(interface_exists("\Magento\Framework\App\CsrfAwareActionInterface")) { if (interface_exists("\Magento\Framework\App\CsrfAwareActionInterface")) {
$request = $this->getRequest(); $request = $this->getRequest();
if ($request instanceof HttpRequest && $request->isPost()) { if ($request instanceof HttpRequest && $request->isPost()) {
$request->setParam('isAjax', true); $request->setParam('isAjax', true);
...@@ -115,15 +145,6 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -115,15 +145,6 @@ class Validate3d extends \Magento\Framework\App\Action\Action
$order->getPayment()->setAdditionalInformation('paResponse', $requestPaRes); $order->getPayment()->setAdditionalInformation('paResponse', $requestPaRes);
try { try {
/**
* Magento should allow this.
* https://github.com/magento/magento2/issues/5819
*/
// $result = $order->getPayment()->getMethodInstance()->executeCommand(
// 'authorise_3d',
// ['payment' => $order->getPayment(), 'amount' => $order->getGrandTotal()]
// );
// old fashion way:
$result = $this->_authorise3d($order->getPayment()); $result = $this->_authorise3d($order->getPayment());
} catch (\Exception $e) { } catch (\Exception $e) {
$this->_adyenLogger->addAdyenResult("Process 3D secure payment was refused"); $this->_adyenLogger->addAdyenResult("Process 3D secure payment was refused");
...@@ -135,11 +156,52 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -135,11 +156,52 @@ class Validate3d extends \Magento\Framework\App\Action\Action
// check if authorise3d was successful // check if authorise3d was successful
if ($result == 'Authorised') { if ($result == 'Authorised') {
$order->addStatusHistoryComment(__('3D-secure validation was successful'))->save(); $order->addStatusHistoryComment(__('3D-secure validation was successful'))->save();
// set back to false so when pressed back button on the success page it will reactivate 3D secure
/**
* set back to false so when pressed back
* button on the success page it will reactivate 3D secure
*/
$order->getPayment()->setAdditionalInformation('3dActive', ''); $order->getPayment()->setAdditionalInformation('3dActive', '');
$order->getPayment()->setAdditionalInformation('3dSuccess', true); $order->getPayment()->setAdditionalInformation('3dSuccess', true);
$this->_orderRepository->save($order); $this->_orderRepository->save($order);
// TODO: add better checks if variables are available in the result
if (!$this->_adyenHelper->isCreditCardVaultEnabled()) {
$this->_adyenHelper->createAdyenBillingAgreement($order, $result['additionalData']);
} elseif (!empty($result['additionalData']) &&
!empty($additionalData['recurring.recurringDetailReference'])
) {
try {
$additionalData = $result['additionalData'];
$token = $additionalData['recurring.recurringDetailReference'];
$expirationDate = $additionalData['expiryDate'];
$cardType = $additionalData['paymentMethod'];
$cardSummary = $additionalData['cardSummary'];
/** @var PaymentTokenInterface $paymentToken */
$paymentToken = $this->paymentTokenFactory->create(
PaymentTokenFactoryInterface::TOKEN_TYPE_CREDIT_CARD
);
$paymentToken->setGatewayToken($token);
$paymentToken->setExpiresAt($this->getExpirationDate($expirationDate));
$details = [
'type' => $cardType,
'maskedCC' => $cardSummary,
'expirationDate' => $expirationDate
];
$paymentToken->setTokenDetails(json_encode($details));
$extensionAttributes = $this->getExtensionAttributes($order->getPayment());
$extensionAttributes->setVaultPaymentToken($paymentToken);
$orderPayment = $order->getPayment()->setExtensionAttributes($extensionAttributes);
$add = unserialize($orderPayment->getAdditionalData());
$add['force_save'] = true;
$orderPayment->setAdditionalData(serialize($add));
$this->orderPaymentResource->save($orderPayment);
} catch (\Exception $e) {
$this->_adyenLogger->error((string)$e->getMessage());
}
}
$this->_redirect('checkout/onepage/success', ['_query' => ['utm_nooverride' => '1']]); $this->_redirect('checkout/onepage/success', ['_query' => ['utm_nooverride' => '1']]);
} else { } else {
$order->addStatusHistoryComment(__('3D-secure validation was unsuccessful.'))->save(); $order->addStatusHistoryComment(__('3D-secure validation was unsuccessful.'))->save();
...@@ -148,7 +210,7 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -148,7 +210,7 @@ class Validate3d extends \Magento\Framework\App\Action\Action
$order->setState(\Magento\Sales\Model\Order::STATE_NEW); $order->setState(\Magento\Sales\Model\Order::STATE_NEW);
$this->_adyenHelper->cancelOrder($order); $this->_adyenHelper->cancelOrder($order);
$this->messageManager->addErrorMessage("3D-secure validation was unsuccessful"); $this->messageManager->addErrorMessage("3D-secure validation was unsuccessful");
// reactivate the quote // reactivate the quote
$session = $this->_getCheckout(); $session = $this->_getCheckout();
...@@ -215,4 +277,43 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -215,4 +277,43 @@ class Validate3d extends \Magento\Framework\App\Action\Action
{ {
return $this->_objectManager->get('Magento\Checkout\Model\Session'); return $this->_objectManager->get('Magento\Checkout\Model\Session');
} }
/**
* Get payment extension attributes
* @param InfoInterface $payment
* @return OrderPaymentExtensionInterface
*/
private function getExtensionAttributes(InfoInterface $payment)
{
$extensionAttributes = $payment->getExtensionAttributes();
if (null === $extensionAttributes) {
$extensionAttributes = $this->paymentExtensionFactory->create();
$payment->setExtensionAttributes($extensionAttributes);
}
return $extensionAttributes;
}
/**
* @param $expirationDate
* @return string
*/
private function getExpirationDate($expirationDate)
{
$expirationDate = explode('/', $expirationDate);
//add leading zero to month
$month = sprintf("%02d", $expirationDate[0]);
$expDate = new \DateTime(
$expirationDate[1]
. '-'
. $month
. '-'
. '01'
. ' '
. '00:00:00',
new \DateTimeZone('UTC')
);
// add one month
$expDate->add(new \DateInterval('P1M'));
return $expDate->format('Y-m-d 00:00:00');
}
} }
...@@ -61,32 +61,35 @@ class RecurringDataBuilder implements BuilderInterface ...@@ -61,32 +61,35 @@ class RecurringDataBuilder implements BuilderInterface
{ {
$result = []; $result = [];
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */ // If the vault feature is on this logic is handled in the VaultDataBuilder
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject); if (!$this->adyenHelper->isCreditCardVaultEnabled()) {
$payment = $paymentDataObject->getPayment(); /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
$storeId = null; $storeId = null;
if ($this->appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { if ($this->appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) {
$storeId = $payment->getOrder()->getStoreId(); $storeId = $payment->getOrder()->getStoreId();
} }
$enableOneclick = $this->adyenHelper->getAdyenAbstractConfigData('enable_oneclick', $storeId); $enableOneclick = $this->adyenHelper->getAdyenAbstractConfigData('enable_oneclick', $storeId);
$enableRecurring = $this->adyenHelper->getAdyenAbstractConfigData('enable_recurring', $storeId); $enableRecurring = $this->adyenHelper->getAdyenAbstractConfigData('enable_recurring', $storeId);
if ($enableOneclick) { if ($enableOneclick) {
$result['enableOneClick'] = true; $result['enableOneClick'] = true;
} else { } else {
$result['enableOneClick'] = false; $result['enableOneClick'] = false;
} }
if ($enableRecurring) { if ($enableRecurring) {
$result['enableRecurring'] = true; $result['enableRecurring'] = true;
} else { } else {
$result['enableRecurring'] = false; $result['enableRecurring'] = false;
} }
if ($payment->getAdditionalInformation('store_cc') === '1') { if ($payment->getAdditionalInformation('store_cc') === '1') {
$result['paymentMethod']['storeDetails'] = true; $result['paymentMethod']['storeDetails'] = true;
}
} }
return $result; return $result;
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
class RecurringVaultDataBuilder implements BuilderInterface
{
/**
* @param array $buildSubject
* @return array
*/
public function build(array $buildSubject)
{
$result = [];
$recurring = ['contract' => \Adyen\Payment\Model\RecurringType::RECURRING];
$result['recurring'] = $recurring;
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
$extensionAttributes = $payment->getExtensionAttributes();
$paymentToken = $extensionAttributes->getVaultPaymentToken();
$result['selectedRecurringDetailReference'] = $paymentToken->getGatewayToken();
$result['shopperInteraction'] = 'ContAuth';
return $result;
}
}
\ No newline at end of file
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
use Magento\Vault\Model\Ui\VaultConfigProvider;
use \Magento\Payment\Gateway\Helper\SubjectReader;
class VaultDataBuilder implements BuilderInterface
{
/**
* Recurring variable
* @var string
*/
private static $enableRecurring = 'enableRecurring';
/**
* @param array $buildSubject
* @return array
*/
public function build(array $buildSubject)
{
// vault is enabled and shopper provided consent to store card this logic is triggered
$request = [];
$paymentDO = SubjectReader::readPayment($buildSubject);
$payment = $paymentDO->getPayment();
$data = $payment->getAdditionalInformation();
if (!empty($data[VaultConfigProvider::IS_ACTIVE_CODE]) &&
$data[VaultConfigProvider::IS_ACTIVE_CODE] === true
) {
// store it only as oneclick otherwise we store oneclick tokens (maestro+bcmc) that will fail
$request[self::$enableRecurring] = true;
} else {
// explicity turn this off as merchants have recurring on by default
$request[self::$enableRecurring] = false;
}
return $request;
}
}
\ No newline at end of file
...@@ -65,7 +65,8 @@ class CheckoutPaymentsDetailsHandler implements HandlerInterface ...@@ -65,7 +65,8 @@ class CheckoutPaymentsDetailsHandler implements HandlerInterface
$payment->setTransactionId($response['pspReference']); $payment->setTransactionId($response['pspReference']);
} }
if (!empty($response['additionalData']['recurring.recurringDetailReference']) if (!empty($response['additionalData']['recurring.recurringDetailReference']) &&
!$this->adyenHelper->isCreditCardVaultEnabled()
) { ) {
$order = $payment->getOrder(); $order = $payment->getOrder();
......
...@@ -105,7 +105,11 @@ class PaymentPosCloudHandler implements HandlerInterface ...@@ -105,7 +105,11 @@ class PaymentPosCloudHandler implements HandlerInterface
$additionalData['paymentMethod'] = $brand; $additionalData['paymentMethod'] = $brand;
$additionalData['recurring.recurringDetailReference'] = $recurringDetailReference; $additionalData['recurring.recurringDetailReference'] = $recurringDetailReference;
$additionalData['pos_payment'] = true; $additionalData['pos_payment'] = true;
$this->adyenHelper->createAdyenBillingAgreement($payment->getOrder(), $additionalData);
if (!$this->adyenHelper->isCreditCardVaultEnabled()) {
$this->adyenHelper->createAdyenBillingAgreement($payment->getOrder(), $additionalData);
}
// TODO: add to vault if recurring!!
} }
} }
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Gateway\Response;
use Magento\Vault\Api\Data\PaymentTokenFactoryInterface;
use Magento\Payment\Gateway\Response\HandlerInterface;
use Magento\Payment\Model\InfoInterface;
class VaultDetailsHandler implements HandlerInterface
{
/**
* @var PaymentTokenInterfaceFactory
*/
protected $paymentTokenFactory;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
private $_adyenLogger;
/**
* VaultDetailsHandler constructor.
*
* @param PaymentTokenFactoryInterface $paymentTokenFactory
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
*/
public function __construct(
PaymentTokenFactoryInterface $paymentTokenFactory,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger
) {
$this->_adyenLogger = $adyenLogger;
$this->paymentTokenFactory = $paymentTokenFactory;
}
/**
* @inheritdoc
*/
public function handle(array $handlingSubject, array $response)
{
$payment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($handlingSubject);
/** @var OrderPaymentInterface $payment */
$payment = $payment->getPayment();
// add vault payment token entity to extension attributes
$paymentToken = $this->getVaultPaymentToken($response);
if (null !== $paymentToken) {
$extensionAttributes = $this->getExtensionAttributes($payment);
$extensionAttributes->setVaultPaymentToken($paymentToken);
}
}
/**
* Get vault payment token entity
*
* @param array $response
* @return PaymentTokenInterface|null
* @throws \Exception
*/
private function getVaultPaymentToken(array $response)
{
$paymentToken = null;
if (!empty($response['additionalData'])) {
$additionalData = $response['additionalData'];
if (empty($additionalData['recurring.recurringDetailReference'])) {
$this->_adyenLogger->error(
'Missing Token in Result please enable in ' .
'Settings -> API URLs and Response menu in the Adyen Customer Area Recurring details setting'
);
return null;
}
$token = $additionalData['recurring.recurringDetailReference'];
if (empty($additionalData['cardSummary'])) {
$this->_adyenLogger->error(
'Missing cardSummary in Result please login to the adyen portal ' .
'and go to Settings -> API URLs and Response and enable the Card summary property'
);
return null;
}
$cardSummary = $additionalData['cardSummary'];
if (empty($additionalData['expiryDate'])) {
$this->_adyenLogger->error(
'Missing expiryDate in Result please login to the adyen portal and go to ' .
'Settings -> API URLs and Response and enable the Expiry date property'
);
return null;
}
$expirationDate = $additionalData['expiryDate'];
if (empty($additionalData['paymentMethod'])) {
$this->_adyenLogger->error(
'Missing paymentMethod in Result please login to the adyen portal and go to ' .
'Settings -> API URLs and Response and enable the Variant property'
);
return null;
}
$cardType = $additionalData['paymentMethod'];
try {
/** @var PaymentTokenInterface $paymentToken */
$paymentToken = $this->paymentTokenFactory->create(
PaymentTokenFactoryInterface::TOKEN_TYPE_CREDIT_CARD
);
$paymentToken->setGatewayToken($token);
$paymentToken->setExpiresAt($this->getExpirationDate($expirationDate));
$details = [
'type' => $cardType,
'maskedCC' => $cardSummary,
'expirationDate' => $expirationDate
];
$paymentToken->setTokenDetails(json_encode($details));
} catch (Exception $e) {
$this->_adyenLogger->error(print_r($e, true));
}
}
return $paymentToken;
}
/**
* @param $expirationDate
* @return string
* @throws \Exception
*/
private function getExpirationDate($expirationDate)
{
$expirationDate = explode('/', $expirationDate);
//add leading zero to month
$month = sprintf('%02d', $expirationDate[0]);
$expDate = new \DateTime(
$expirationDate[1]
. '-'
. $month
. '-'
. '01'
. ' '
. '00:00:00',
new \DateTimeZone('UTC')
);
// add one month
$expDate->add(new \DateInterval('P1M'));
return $expDate->format('Y-m-d 00:00:00');
}
/**
* Get payment extension attributes
* @param InfoInterface $payment
* @return OrderPaymentExtensionInterface
*/
private function getExtensionAttributes(InfoInterface $payment)
{
$extensionAttributes = $payment->getExtensionAttributes();
if (null === $extensionAttributes) {
$extensionAttributes = $this->paymentExtensionFactory->create();
$payment->setExtensionAttributes($extensionAttributes);
}
return $extensionAttributes;
}
}
\ No newline at end of file
...@@ -416,6 +416,17 @@ class Data extends AbstractHelper ...@@ -416,6 +416,17 @@ class Data extends AbstractHelper
return $this->getConfigData($field, 'adyen_cc', $storeId, true); return $this->getConfigData($field, 'adyen_cc', $storeId, true);
} }
/**
* @desc Gives back adyen_cc configuration values as flag
* @param $field
* @param null $storeId
* @return mixed
*/
public function getAdyenCcVaultConfigDataFlag($field, $storeId = null)
{
return $this->getConfigData($field, 'adyen_cc_vault', $storeId, true);
}
/** /**
* @desc Gives back adyen_hpp configuration values * @desc Gives back adyen_hpp configuration values
* @param $field * @param $field
...@@ -943,7 +954,8 @@ class Data extends AbstractHelper ...@@ -943,7 +954,8 @@ class Data extends AbstractHelper
return $billingAgreements; return $billingAgreements;
} }
public function isPerStoreBillingAgreement($storeId) { public function isPerStoreBillingAgreement($storeId)
{
return !$this->getAdyenOneclickConfigDataFlag('share_billing_agreement', $storeId); return !$this->getAdyenOneclickConfigDataFlag('share_billing_agreement', $storeId);
} }
...@@ -1393,16 +1405,15 @@ class Data extends AbstractHelper ...@@ -1393,16 +1405,15 @@ class Data extends AbstractHelper
); );
$client = $this->initializeAdyenClient($storeId); $client = $this->initializeAdyenClient($storeId);
try { try {
$service = $this->createAdyenCheckoutUtilityService($client); $service = $this->createAdyenCheckoutUtilityService($client);
$response = $service->originKeys($params); $response = $service->originKeys($params);
} } catch (\Exception $e) {
catch(\Exception $e){
$this->adyenLogger->error($e->getMessage()); $this->adyenLogger->error($e->getMessage());
} }
$originKey = ""; $originKey = "";
if (!empty($response['originKeys'][$url])) { if (!empty($response['originKeys'][$url])) {
$originKey = $response['originKeys'][$url]; $originKey = $response['originKeys'][$url];
...@@ -1494,7 +1505,8 @@ class Data extends AbstractHelper ...@@ -1494,7 +1505,8 @@ class Data extends AbstractHelper
// add to order to save agreement // add to order to save agreement
$order->addRelatedObject($billingAgreement); $order->addRelatedObject($billingAgreement);
} else { } else {
$message = __('Failed to create billing agreement for this order. Reason(s): ') . join(', ', $billingAgreement->getErrors()); $message = __('Failed to create billing agreement for this order. Reason(s): ') . join(', ',
$billingAgreement->getErrors());
throw new \Exception($message); throw new \Exception($message);
} }
...@@ -1514,7 +1526,8 @@ class Data extends AbstractHelper ...@@ -1514,7 +1526,8 @@ class Data extends AbstractHelper
* @param \Magento\Sales\Model\Order $order * @param \Magento\Sales\Model\Order $order
* @return int|null * @return int|null
*/ */
public function getCustomerId(\Magento\Sales\Model\Order $order) { public function getCustomerId(\Magento\Sales\Model\Order $order)
{
return $order->getCustomerId(); return $order->getCustomerId();
} }
...@@ -1539,4 +1552,34 @@ class Data extends AbstractHelper ...@@ -1539,4 +1552,34 @@ class Data extends AbstractHelper
return \Adyen\Payment\Model\RecurringType::NONE; return \Adyen\Payment\Model\RecurringType::NONE;
} }
} }
/**
* Get icon from variant
*
* @param $variant
* @return array
*/
public function getVariantIcon($variant)
{
$asset = $this->createAsset(sprintf("Adyen_Payment::images/logos/%s_small.png", $variant));
list($width, $height) = getimagesize($asset->getSourceFile());
$icon = [
'url' => $asset->getUrl(),
'width' => $width,
'height' => $height
];
return $icon;
}
/**
* @desc Check if CreditCard vault is enabled
* @param int|null $storeId
* @return mixed
*/
public function isCreditCardVaultEnabled($storeId = null)
{
return $this->getAdyenCcVaultConfigDataFlag('active', $storeId);
}
} }
...@@ -101,26 +101,24 @@ class PaymentRequest extends DataObject ...@@ -101,26 +101,24 @@ class PaymentRequest extends DataObject
$md = $payment->getAdditionalInformation('md'); $md = $payment->getAdditionalInformation('md');
$paResponse = $payment->getAdditionalInformation('paResponse'); $paResponse = $payment->getAdditionalInformation('paResponse');
$paymentData = $payment->getAdditionalInformation('paymentData'); $paymentData = $payment->getAdditionalInformation('paymentData');
$request = [ $request = [
"paymentData" => $paymentData, "paymentData" => $paymentData,
"details" => [ "details" => [
"MD" => $md, "MD" => $md,
"PaRes" => $paResponse "PaRes" => $paResponse
] ]
]; ];
try { try {
$client = $this->_adyenHelper->initializeAdyenClient($storeId); $client = $this->_adyenHelper->initializeAdyenClient($storeId);
$service = new \Adyen\Service\Checkout($client); $service = new \Adyen\Service\Checkout($client);
$result = $service->paymentsDetails($request); $result = $service->paymentsDetails($request);
} catch(\Adyen\AdyenException $e) { } catch (\Adyen\AdyenException $e) {
throw new \Magento\Framework\Exception\LocalizedException(__('3D secure failed')); throw new \Magento\Framework\Exception\LocalizedException(__('3D secure failed'));
} }
$this->_adyenHelper->createAdyenBillingAgreement($order, $result['additionalData']);
return $result; return $result;
} }
...@@ -183,8 +181,8 @@ class PaymentRequest extends DataObject ...@@ -183,8 +181,8 @@ class PaymentRequest extends DataObject
// rest call to get list of recurring details // rest call to get list of recurring details
$contract = ['contract' => $recurringType]; $contract = ['contract' => $recurringType];
$request = [ $request = [
"merchantAccount" => $this->_adyenHelper->getAdyenAbstractConfigData('merchant_account', $storeId), "merchantAccount" => $this->_adyenHelper->getAdyenAbstractConfigData('merchant_account', $storeId),
"shopperReference" => $shopperReference, "shopperReference" => $shopperReference,
"recurring" => $contract, "recurring" => $contract,
]; ];
......
...@@ -941,117 +941,124 @@ class Cron ...@@ -941,117 +941,124 @@ class Cron
break; break;
case Notification::RECURRING_CONTRACT: case Notification::RECURRING_CONTRACT:
// storedReferenceCode
$recurringDetailReference = $this->_pspReference;
$storeId = $this->_order->getStoreId();
$customerReference = $this->_order->getCustomerId();
$listRecurringContracts = null;
$this->_adyenLogger->addAdyenNotificationCronjob(
__(
'CustomerReference is: %1 and storeId is %2 and RecurringDetailsReference is %3',
$customerReference,
$storeId,
$recurringDetailReference
)
);
try {
$listRecurringContracts = $this->_adyenPaymentRequest->getRecurringContractsForShopper(
$customerReference,
$storeId
);
$contractDetail = null;
// get current Contract details and get list of all current ones
$recurringReferencesList = [];
if (!$listRecurringContracts) { // only store billing agreements if Vault is disabled
throw new \Exception("Empty list recurring contracts"); if (!$this->_adyenHelper->isCreditCardVaultEnabled()) {
} // storedReferenceCode
// Find the reference on the list $recurringDetailReference = $this->_pspReference;
foreach ($listRecurringContracts as $rc) {
$recurringReferencesList[] = $rc['recurringDetailReference'];
if (isset($rc['recurringDetailReference']) &&
$rc['recurringDetailReference'] == $recurringDetailReference
) {
$contractDetail = $rc;
}
}
if ($contractDetail == null) { $storeId = $this->_order->getStoreId();
$this->_adyenLogger->addAdyenNotificationCronjob(print_r($listRecurringContracts, 1)); $customerReference = $this->_order->getCustomerId();
$message = __( $listRecurringContracts = null;
'Failed to create billing agreement for this order ' . $this->_adyenLogger->addAdyenNotificationCronjob(
'(listRecurringCall did not contain contract)' __(
'CustomerReference is: %1 and storeId is %2 and RecurringDetailsReference is %3',
$customerReference,
$storeId,
$recurringDetailReference
)
);
try {
$listRecurringContracts = $this->_adyenPaymentRequest->getRecurringContractsForShopper(
$customerReference,
$storeId
); );
throw new \Exception($message); $contractDetail = null;
} // get current Contract details and get list of all current ones
$recurringReferencesList = [];
$billingAgreements = $this->_billingAgreementCollectionFactory->create(); if (!$listRecurringContracts) {
$billingAgreements->addFieldToFilter('customer_id', $customerReference); throw new \Exception("Empty list recurring contracts");
}
// Get collection and update existing agreements // Find the reference on the list
foreach ($listRecurringContracts as $rc) {
$recurringReferencesList[] = $rc['recurringDetailReference'];
if (isset($rc['recurringDetailReference']) &&
$rc['recurringDetailReference'] == $recurringDetailReference
) {
$contractDetail = $rc;
}
}
foreach ($billingAgreements as $updateBillingAgreement) { if ($contractDetail == null) {
if (!in_array($updateBillingAgreement->getReferenceId(), $recurringReferencesList)) { $this->_adyenLogger->addAdyenNotificationCronjob(print_r($listRecurringContracts, 1));
$updateBillingAgreement->setStatus( $message = __(
\Adyen\Payment\Model\Billing\Agreement::STATUS_CANCELED 'Failed to create billing agreement for this order ' .
); '(listRecurringCall did not contain contract)'
} else {
$updateBillingAgreement->setStatus(
\Adyen\Payment\Model\Billing\Agreement::STATUS_ACTIVE
); );
throw new \Exception($message);
} }
$updateBillingAgreement->save();
}
// Get or create billing agreement $billingAgreements = $this->_billingAgreementCollectionFactory->create();
$billingAgreement = $this->_billingAgreementFactory->create(); $billingAgreements->addFieldToFilter('customer_id', $customerReference);
$billingAgreement->load($recurringDetailReference, 'reference_id');
// check if BA exists // Get collection and update existing agreements
if (!($billingAgreement && $billingAgreement->getAgreementId() > 0 && $billingAgreement->isValid())) {
// create new foreach ($billingAgreements as $updateBillingAgreement) {
$this->_adyenLogger->addAdyenNotificationCronjob("Creating new Billing Agreement"); if (!in_array($updateBillingAgreement->getReferenceId(), $recurringReferencesList)) {
$this->_order->getPayment()->setBillingAgreementData( $updateBillingAgreement->setStatus(
[ \Adyen\Payment\Model\Billing\Agreement::STATUS_CANCELED
'billing_agreement_id' => $recurringDetailReference, );
'method_code' => $this->_order->getPayment()->getMethodCode(), } else {
] $updateBillingAgreement->setStatus(
); \Adyen\Payment\Model\Billing\Agreement::STATUS_ACTIVE
);
}
$updateBillingAgreement->save();
}
// Get or create billing agreement
$billingAgreement = $this->_billingAgreementFactory->create(); $billingAgreement = $this->_billingAgreementFactory->create();
$billingAgreement->setStoreId($this->_order->getStoreId()); $billingAgreement->load($recurringDetailReference, 'reference_id');
$billingAgreement->importOrderPayment($this->_order->getPayment()); // check if BA exists
$message = __('Created billing agreement #%1.', $recurringDetailReference); if (!($billingAgreement && $billingAgreement->getAgreementId() > 0 && $billingAgreement->isValid())) {
} else { // create new
$this->_adyenLogger->addAdyenNotificationCronjob("Using existing Billing Agreement"); $this->_adyenLogger->addAdyenNotificationCronjob("Creating new Billing Agreement");
$billingAgreement->setIsObjectChanged(true); $this->_order->getPayment()->setBillingAgreementData(
$message = __('Updated billing agreement #%1.', $recurringDetailReference); [
} 'billing_agreement_id' => $recurringDetailReference,
'method_code' => $this->_order->getPayment()->getMethodCode(),
]
);
$billingAgreement = $this->_billingAgreementFactory->create();
$billingAgreement->setStoreId($this->_order->getStoreId());
$billingAgreement->importOrderPayment($this->_order->getPayment());
$message = __('Created billing agreement #%1.', $recurringDetailReference);
} else {
$this->_adyenLogger->addAdyenNotificationCronjob("Using existing Billing Agreement");
$billingAgreement->setIsObjectChanged(true);
$message = __('Updated billing agreement #%1.', $recurringDetailReference);
}
// Populate billing agreement data // Populate billing agreement data
$billingAgreement->parseRecurringContractData($contractDetail); $billingAgreement->parseRecurringContractData($contractDetail);
if ($billingAgreement->isValid()) { if ($billingAgreement->isValid()) {
if (!$this->agreementResourceModel->getOrderRelation($billingAgreement->getAgreementId(), if (!$this->agreementResourceModel->getOrderRelation($billingAgreement->getAgreementId(),
$this->_order->getId())) { $this->_order->getId())) {
// save into sales_billing_agreement_order // save into sales_billing_agreement_order
$billingAgreement->addOrderRelation($this->_order); $billingAgreement->addOrderRelation($this->_order);
// add to order to save agreement // add to order to save agreement
$this->_order->addRelatedObject($billingAgreement); $this->_order->addRelatedObject($billingAgreement);
}
} else {
$message = __('Failed to create billing agreement for this order.');
throw new \Exception($message);
} }
} else { } catch (\Exception $exception) {
$message = __('Failed to create billing agreement for this order.'); $message = $exception->getMessage();
throw new \Exception($message);
} }
} catch (\Exception $exception) {
$message = $exception->getMessage();
}
$this->_adyenLogger->addAdyenNotificationCronjob($message); $this->_adyenLogger->addAdyenNotificationCronjob($message);
$comment = $this->_order->addStatusHistoryComment($message); $comment = $this->_order->addStatusHistoryComment($message);
$this->_order->addRelatedObject($comment); $this->_order->addRelatedObject($comment);
} else {
$this->_adyenLogger->addAdyenNotificationCronjob('Ignore recurring_contract notification because Vault feature is enabled');
}
break; break;
default: default:
$this->_adyenLogger->addAdyenNotificationCronjob( $this->_adyenLogger->addAdyenNotificationCronjob(
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment Module
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Model\InstantPurchase\CreditCard;
use Magento\InstantPurchase\PaymentMethodIntegration\AvailabilityCheckerInterface;
/**
* Availability of Adyen vaults for instant purchase.
*/
class AvailabilityChecker implements AvailabilityCheckerInterface
{
/**
* @inheritdoc
*/
public function isAvailable(): bool
{
return true;
}
}
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment Module
*
* Copyright (c) 2019 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Model\InstantPurchase\CreditCard;
use Magento\InstantPurchase\PaymentMethodIntegration\PaymentTokenFormatterInterface;
use Magento\Vault\Api\Data\PaymentTokenInterface;
/**
* Adyen stored credit card formatter.
*/
class TokenFormatter implements PaymentTokenFormatterInterface
{
/**
* Most used credit card types
* @var array
*/
public static $baseCardTypes = [
'AE' => 'American Express',
'VI' => 'Visa',
'MC' => 'MasterCard',
'DI' => 'Discover',
'JBC' => 'JBC',
'CUP' => 'China Union Pay',
'MI' => 'Maestro',
];
/**
* @inheritdoc
*/
public function formatPaymentToken(PaymentTokenInterface $paymentToken): string
{
$details = json_decode($paymentToken->getTokenDetails() ?: '{}', true);
if (!isset($details['type'], $details['maskedCC'], $details['expirationDate'])) {
throw new \InvalidArgumentException('Invalid Adyen credit card token details.');
}
if (isset(self::$baseCardTypes[$details['type']])) {
$ccType = self::$baseCardTypes[$details['type']];
} else {
$ccType = $details['type'];
}
$formatted = sprintf(
'%s: %s, %s: %s (%s: %s)',
__('Credit Card'),
$ccType,
__('ending'),
$details['maskedCC'],
__('expires'),
$details['expirationDate']
);
return $formatted;
}
}
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment Module
*
* Copyright (c) 2017 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Model\Ui\Adminhtml;
use Adyen\Payment\Model\Ui\AdyenCcConfigProvider;
use Adyen\Payment\Helper\Data;
use Magento\Framework\View\Element\Template;
use Magento\Vault\Api\Data\PaymentTokenInterface;
use Magento\Vault\Model\Ui\TokenUiComponentInterfaceFactory;
use Magento\Vault\Model\Ui\TokenUiComponentProviderInterface;
class TokenUiComponentProvider implements TokenUiComponentProviderInterface
{
/**
* @var TokenUiComponentInterfaceFactory
*/
private $componentFactory;
/**
* @var Data
*/
private $adyenHelper;
/**
* TokenUiComponentProvider constructor.
*
* @param TokenUiComponentInterfaceFactory $componentFactory
* @param Data $adyenHelper
*/
public function __construct(
TokenUiComponentInterfaceFactory $componentFactory,
Data $adyenHelper
) {
$this->componentFactory = $componentFactory;
$this->adyenHelper = $adyenHelper;
}
/**
* @inheritdoc
*/
public function getComponentForToken(PaymentTokenInterface $paymentToken)
{
$details = json_decode($paymentToken->getTokenDetails() ?: '{}', true);
$details['icon'] = $this->adyenHelper->getVariantIcon($details['type']);
$component = $this->componentFactory->create(
[
'config' => [
'code' => AdyenCcConfigProvider::CC_VAULT_CODE,
TokenUiComponentProviderInterface::COMPONENT_DETAILS => $details,
TokenUiComponentProviderInterface::COMPONENT_PUBLIC_HASH => $paymentToken->getPublicHash(),
'template' => 'Adyen_Payment::form/vault.phtml'
],
'name' => Template::class
]
);
return $component;
}
}
\ No newline at end of file
...@@ -30,6 +30,8 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -30,6 +30,8 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
const CODE = 'adyen_cc'; const CODE = 'adyen_cc';
const CC_VAULT_CODE = 'adyen_cc_vault';
/** /**
* @var PaymentHelper * @var PaymentHelper
*/ */
...@@ -62,30 +64,30 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -62,30 +64,30 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
*/ */
private $ccConfig; private $ccConfig;
/** /**
* @var \Magento\Store\Model\StoreManagerInterface * @var \Magento\Store\Model\StoreManagerInterface
*/ */
private $storeManager; private $storeManager;
/** /**
* AdyenCcConfigProvider constructor. * AdyenCcConfigProvider constructor.
* *
* @param \Magento\Payment\Helper\Data $paymentHelper * @param \Magento\Payment\Helper\Data $paymentHelper
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\App\RequestInterface $request * @param \Magento\Framework\App\RequestInterface $request
* @param \Magento\Framework\UrlInterface $urlBuilder * @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Magento\Framework\View\Asset\Source $assetSource * @param \Magento\Framework\View\Asset\Source $assetSource
* @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Payment\Model\CcConfig $ccConfig * @param \Magento\Payment\Model\CcConfig $ccConfig
*/ */
public function __construct( public function __construct(
\Magento\Payment\Helper\Data $paymentHelper, \Magento\Payment\Helper\Data $paymentHelper,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\App\RequestInterface $request, \Magento\Framework\App\RequestInterface $request,
\Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\UrlInterface $urlBuilder,
\Magento\Framework\View\Asset\Source $assetSource, \Magento\Framework\View\Asset\Source $assetSource,
\Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Payment\Model\CcConfig $ccConfig \Magento\Payment\Model\CcConfig $ccConfig
) { ) {
$this->_paymentHelper = $paymentHelper; $this->_paymentHelper = $paymentHelper;
...@@ -94,7 +96,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -94,7 +96,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$this->_urlBuilder = $urlBuilder; $this->_urlBuilder = $urlBuilder;
$this->_assetSource = $assetSource; $this->_assetSource = $assetSource;
$this->ccConfig = $ccConfig; $this->ccConfig = $ccConfig;
$this->storeManager = $storeManager; $this->storeManager = $storeManager;
} }
/** /**
...@@ -106,6 +108,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -106,6 +108,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$config = [ $config = [
'payment' => [ 'payment' => [
self::CODE => [ self::CODE => [
'vaultCode' => self::CC_VAULT_CODE,
'isActive' => true, 'isActive' => true,
'redirectUrl' => $this->_urlBuilder->getUrl( 'redirectUrl' => $this->_urlBuilder->getUrl(
'adyen/process/validate3d/', 'adyen/process/validate3d/',
...@@ -120,8 +123,8 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -120,8 +123,8 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$config = array_merge_recursive($config, [ $config = array_merge_recursive($config, [
'payment' => [ 'payment' => [
'ccform' => [ 'ccform' => [
'availableTypes' => [$methodCode => $this->getCcAvailableTypes($methodCode)], 'availableTypes' => [$methodCode => $this->getCcAvailableTypes()],
'availableTypesByAlt' => [$methodCode => $this->getCcAvailableTypesByAlt($methodCode)], 'availableTypesByAlt' => [$methodCode => $this->getCcAvailableTypesByAlt()],
'months' => [$methodCode => $this->getCcMonths()], 'months' => [$methodCode => $this->getCcMonths()],
'years' => [$methodCode => $this->getCcYears()], 'years' => [$methodCode => $this->getCcYears()],
'hasVerification' => [$methodCode => $this->hasVerification($methodCode)], 'hasVerification' => [$methodCode => $this->hasVerification($methodCode)],
...@@ -137,15 +140,15 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -137,15 +140,15 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$canCreateBillingAgreement = true; $canCreateBillingAgreement = true;
} }
$config['payment']['adyenCc']['methodCode'] = self::CODE; $config['payment']['adyenCc']['methodCode'] = self::CODE;
$config['payment']['adyenCc']['locale'] = $this->_adyenHelper->getStoreLocale($this->storeManager->getStore()->getId()); $config['payment']['adyenCc']['locale'] = $this->_adyenHelper->getStoreLocale($this->storeManager->getStore()->getId());
$config['payment']['adyenCc']['canCreateBillingAgreement'] = $canCreateBillingAgreement; $config['payment']['adyenCc']['canCreateBillingAgreement'] = $canCreateBillingAgreement;
$config['payment']['adyenCc']['icons'] = $this->getIcons(); $config['payment']['adyenCc']['icons'] = $this->getIcons();
$config['payment']['adyenCc']['originKey'] = $this->_adyenHelper->getOriginKeyForBaseUrl(); $config['payment']['adyenCc']['originKey'] = $this->_adyenHelper->getOriginKeyForBaseUrl();
$config['payment']['adyenCc']['checkoutUrl'] = $this->_adyenHelper->getCheckoutContextUrl($this->storeManager->getStore()->getId()); $config['payment']['adyenCc']['checkoutUrl'] = $this->_adyenHelper->getCheckoutContextUrl($this->storeManager->getStore()->getId());
// has installments by default false // has installments by default false
$config['payment']['adyenCc']['hasInstallments'] = false; $config['payment']['adyenCc']['hasInstallments'] = false;
...@@ -167,10 +170,9 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -167,10 +170,9 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
/** /**
* Retrieve availables credit card types * Retrieve availables credit card types
* *
* @param string $methodCode
* @return array * @return array
*/ */
protected function getCcAvailableTypes($methodCode) protected function getCcAvailableTypes()
{ {
$types = []; $types = [];
$ccTypes = $this->_adyenHelper->getAdyenCcTypes(); $ccTypes = $this->_adyenHelper->getAdyenCcTypes();
...@@ -187,28 +189,28 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -187,28 +189,28 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
return $types; return $types;
} }
/** /**
* Retrieve availables credit card type codes by alt code * Retrieve availables credit card type codes by alt code
* *
* @param string $methodCode * @param string $methodCode
* @return array * @return array
*/ */
protected function getCcAvailableTypesByAlt($methodCode) protected function getCcAvailableTypesByAlt()
{ {
$types = []; $types = [];
$ccTypes = $this->_adyenHelper->getAdyenCcTypes(); $ccTypes = $this->_adyenHelper->getAdyenCcTypes();
$availableTypes = $this->_adyenHelper->getAdyenCcConfigData('cctypes'); $availableTypes = $this->_adyenHelper->getAdyenCcConfigData('cctypes');
if ($availableTypes) { if ($availableTypes) {
$availableTypes = explode(',', $availableTypes); $availableTypes = explode(',', $availableTypes);
foreach (array_keys($ccTypes) as $code) { foreach (array_keys($ccTypes) as $code) {
if (in_array($code, $availableTypes)) { if (in_array($code, $availableTypes)) {
$types[$ccTypes[$code]['code_alt']] = $code; $types[$ccTypes[$code]['code_alt']] = $code;
} }
} }
} }
return $types; return $types;
} }
/** /**
* Get icons for available payment methods * Get icons for available payment methods
......
...@@ -72,17 +72,17 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface ...@@ -72,17 +72,17 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
*/ */
private $ccConfig; private $ccConfig;
/** /**
* AdyenOneclickConfigProvider constructor. * AdyenOneclickConfigProvider constructor.
* *
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\App\RequestInterface $request * @param \Magento\Framework\App\RequestInterface $request
* @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Model\Session $customerSession
* @param \Magento\Checkout\Model\Session $session * @param \Magento\Checkout\Model\Session $session
* @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\UrlInterface $urlBuilder * @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Magento\Payment\Model\CcConfig $ccConfig * @param \Magento\Payment\Model\CcConfig $ccConfig
*/ */
public function __construct( public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\App\RequestInterface $request, \Magento\Framework\App\RequestInterface $request,
...@@ -103,6 +103,8 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface ...@@ -103,6 +103,8 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
/** /**
* @return array * @return array
* @throws \Magento\Framework\Exception\LocalizedException
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/ */
public function getConfig() public function getConfig()
{ {
...@@ -119,12 +121,20 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface ...@@ -119,12 +121,20 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
] ]
]; ];
// don't show this payment method if vault is enabled
if ($this->_adyenHelper->isCreditCardVaultEnabled()) {
$config['payment']['adyenOneclick']['methodCode'] = self::CODE;
$config['payment'][self::CODE]['isActive'] = false;
return $config;
}
$methodCode = self::CODE; $methodCode = self::CODE;
$config = array_merge_recursive($config, [ $config = array_merge_recursive($config, [
'payment' => [ 'payment' => [
'ccform' => [ 'ccform' => [
'availableTypes' => [$methodCode => $this->getCcAvailableTypes($methodCode)], 'availableTypes' => [$methodCode => $this->getCcAvailableTypes()],
'months' => [$methodCode => $this->getCcMonths()], 'months' => [$methodCode => $this->getCcMonths()],
'years' => [$methodCode => $this->getCcYears()], 'years' => [$methodCode => $this->getCcYears()],
'hasVerification' => [$methodCode => $this->hasVerification($methodCode)], 'hasVerification' => [$methodCode => $this->hasVerification($methodCode)],
...@@ -133,10 +143,10 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface ...@@ -133,10 +143,10 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
] ]
]); ]);
$config['payment']['adyenOneclick']['methodCode'] = self::CODE; $config['payment']['adyenOneclick']['methodCode'] = self::CODE;
$config['payment']['adyenOneclick']['originKey'] = $this->_adyenHelper->getOriginKeyForBaseUrl(); $config['payment']['adyenOneclick']['originKey'] = $this->_adyenHelper->getOriginKeyForBaseUrl();
$config['payment']['adyenOneclick']['checkoutUrl'] = $this->_adyenHelper->getCheckoutContextUrl($this->_storeManager->getStore()->getId()); $config['payment']['adyenOneclick']['checkoutUrl'] = $this->_adyenHelper->getCheckoutContextUrl($this->_storeManager->getStore()->getId());
$config['payment']['adyenOneclick']['locale'] = $this->_adyenHelper->getStoreLocale($this->_storeManager->getStore()->getId()); $config['payment']['adyenOneclick']['locale'] = $this->_adyenHelper->getStoreLocale($this->_storeManager->getStore()->getId());
$enableOneclick = $this->_adyenHelper->getAdyenAbstractConfigData('enable_oneclick'); $enableOneclick = $this->_adyenHelper->getAdyenAbstractConfigData('enable_oneclick');
$canCreateBillingAgreement = false; $canCreateBillingAgreement = false;
...@@ -150,9 +160,9 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface ...@@ -150,9 +160,9 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
$config['payment'] ['adyenOneclick']['billingAgreements'] = $this->getAdyenOneclickPaymentMethods(); $config['payment'] ['adyenOneclick']['billingAgreements'] = $this->getAdyenOneclickPaymentMethods();
if ($recurringContractType == \Adyen\Payment\Model\RecurringType::ONECLICK) { if ($recurringContractType == \Adyen\Payment\Model\RecurringType::ONECLICK) {
$config['payment'] ['adyenOneclick']['hasCustomerInteraction'] = true; $config['payment']['adyenOneclick']['hasCustomerInteraction'] = true;
} else { } else {
$config['payment'] ['adyenOneclick']['hasCustomerInteraction'] = false; $config['payment']['adyenOneclick']['hasCustomerInteraction'] = false;
} }
return $config; return $config;
...@@ -201,10 +211,9 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface ...@@ -201,10 +211,9 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
/** /**
* Retrieve availables credit card types * Retrieve availables credit card types
* *
* @param string $methodCode
* @return array * @return array
*/ */
protected function getCcAvailableTypes($methodCode) protected function getCcAvailableTypes()
{ {
$types = []; $types = [];
$ccTypes = $this->_adyenHelper->getAdyenCcTypes(); $ccTypes = $this->_adyenHelper->getAdyenCcTypes();
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Model\Ui;
use Adyen\Payment\Helper\Data;
use Magento\Vault\Api\Data\PaymentTokenInterface;
use Magento\Vault\Model\Ui\TokenUiComponentInterface;
use Magento\Vault\Model\Ui\TokenUiComponentProviderInterface;
use Magento\Vault\Model\Ui\TokenUiComponentInterfaceFactory;
use Magento\Framework\UrlInterface;
/**
* Class TokenUiComponentProvider
*/
class TokenUiComponentProvider implements TokenUiComponentProviderInterface
{
/**
* @var TokenUiComponentInterfaceFactory
*/
private $componentFactory;
/**
* @var Data
*/
private $adyenHelper;
/**
* @param TokenUiComponentInterfaceFactory $componentFactory
* @param UrlInterface $urlBuilder
*/
public function __construct(
TokenUiComponentInterfaceFactory $componentFactory,
Data $adyenHelper
) {
$this->componentFactory = $componentFactory;
$this->adyenHelper = $adyenHelper;
}
/**
* Get UI component for token
* @param PaymentTokenInterface $paymentToken
* @return TokenUiComponentInterface
*/
public function getComponentForToken(PaymentTokenInterface $paymentToken)
{
$details = json_decode($paymentToken->getTokenDetails() ?: '{}', true);
$details['icon'] = $this->adyenHelper->getVariantIcon($details['type']);
$component = $this->componentFactory->create(
[
'config' => [
'code' => AdyenCcConfigProvider::CC_VAULT_CODE,
TokenUiComponentProviderInterface::COMPONENT_DETAILS => $details,
TokenUiComponentProviderInterface::COMPONENT_PUBLIC_HASH => $paymentToken->getPublicHash()
],
'name' => 'Adyen_Payment/js/view/payment/method-renderer/vault'
]
);
return $component;
}
}
\ No newline at end of file
...@@ -34,11 +34,11 @@ class AdyenCcDataAssignObserver extends AbstractDataAssignObserver ...@@ -34,11 +34,11 @@ class AdyenCcDataAssignObserver extends AbstractDataAssignObserver
const CC_TYPE = 'cc_type'; const CC_TYPE = 'cc_type';
const NUMBER_OF_INSTALLMENTS = 'number_of_installments'; const NUMBER_OF_INSTALLMENTS = 'number_of_installments';
const STORE_CC = 'store_cc'; const STORE_CC = 'store_cc';
const ENCRYPTED_CREDIT_CARD_NUMBER = 'number'; const ENCRYPTED_CREDIT_CARD_NUMBER = 'number';
const ENCRYPTED_SECURITY_CODE = 'cvc'; const ENCRYPTED_SECURITY_CODE = 'cvc';
const ENCRYPTED_EXPIRY_MONTH = 'expiryMonth'; const ENCRYPTED_EXPIRY_MONTH = 'expiryMonth';
const ENCRYPTED_EXPIRY_YEAR = 'expiryYear'; const ENCRYPTED_EXPIRY_YEAR = 'expiryYear';
const HOLDER_NAME = 'holderName'; const HOLDER_NAME = 'holderName';
const VARIANT = 'variant'; const VARIANT = 'variant';
/** /**
...@@ -48,11 +48,11 @@ class AdyenCcDataAssignObserver extends AbstractDataAssignObserver ...@@ -48,11 +48,11 @@ class AdyenCcDataAssignObserver extends AbstractDataAssignObserver
self::CC_TYPE, self::CC_TYPE,
self::NUMBER_OF_INSTALLMENTS, self::NUMBER_OF_INSTALLMENTS,
self::STORE_CC, self::STORE_CC,
self::ENCRYPTED_CREDIT_CARD_NUMBER, self::ENCRYPTED_CREDIT_CARD_NUMBER,
self::ENCRYPTED_SECURITY_CODE, self::ENCRYPTED_SECURITY_CODE,
self::ENCRYPTED_EXPIRY_MONTH, self::ENCRYPTED_EXPIRY_MONTH,
self::ENCRYPTED_EXPIRY_YEAR, self::ENCRYPTED_EXPIRY_YEAR,
self::HOLDER_NAME, self::HOLDER_NAME,
self::VARIANT self::VARIANT
]; ];
...@@ -72,10 +72,12 @@ class AdyenCcDataAssignObserver extends AbstractDataAssignObserver ...@@ -72,10 +72,12 @@ class AdyenCcDataAssignObserver extends AbstractDataAssignObserver
$paymentInfo = $this->readPaymentModelArgument($observer); $paymentInfo = $this->readPaymentModelArgument($observer);
// set ccType // set ccType
$paymentInfo->setCcType($additionalData['cc_type']); if (!empty($additionalData['cc_type'])) {
$paymentInfo->setCcType($additionalData['cc_type']);
}
foreach ($this->additionalInformationList as $additionalInformationKey) { foreach ($this->additionalInformationList as $additionalInformationKey) {
if (isset($additionalData[$additionalInformationKey])) { if (!empty($additionalData[$additionalInformationKey])) {
$paymentInfo->setAdditionalInformation( $paymentInfo->setAdditionalInformation(
$additionalInformationKey, $additionalInformationKey,
$additionalData[$additionalInformationKey] $additionalData[$additionalInformationKey]
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 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
) {
if (strpos($paymentToken->getPaymentMethodCode(), 'adyen_') !== 0) {
return [$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
...@@ -34,6 +34,14 @@ We have defined this: ...@@ -34,6 +34,14 @@ We have defined this:
</group> </group>
``` ```
## Vault ##
For enabling vault you need the following permissions:
rechargeSynchronousStoreDetails ask adyen support to enable this
Toggle one the following API responses. This can be done in the CA of Adyen inside API and Responses (settings -> API and Responses)
* Card summary
* Expiry date
* Variant
## Support ## Support
You can create issues on our Magento Repository. In case of specific problems with your account, please contact <a href="mailto:support@adyen.com">support@adyen.com</a>. You can create issues on our Magento Repository. In case of specific problems with your account, please contact <a href="mailto:support@adyen.com">support@adyen.com</a>.
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
], ],
"require": { "require": {
"adyen/php-api-library": ">=1.5.3", "adyen/php-api-library": ">=1.5.3",
"magento/framework": ">=100.1.0" "magento/framework": ">=101.0.*",
"magento/module-vault": "101.0.*"
}, },
"autoload": { "autoload": {
"files": [ "files": [
......
...@@ -9,4 +9,11 @@ ...@@ -9,4 +9,11 @@
</argument> </argument>
</arguments> </arguments>
</type> </type>
<type name="Magento\Vault\Model\Ui\Adminhtml\TokensConfigProvider">
<arguments>
<argument name="tokenUiComponentProviders" xsi:type="array">
<item name="adyen_cc" xsi:type="object">Adyen\Payment\Model\Ui\Adminhtml\TokenUiComponentProvider</item>
</argument>
</arguments>
</type>
</config> </config>
...@@ -22,52 +22,74 @@ ...@@ -22,52 +22,74 @@
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
--> -->
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd"> <include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<group id="adyen_cc" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1"> xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="adyen_cc" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"
showInStore="1">
<label><![CDATA[CreditCard API integration]]></label> <label><![CDATA[CreditCard API integration]]></label>
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment</frontend_model> <frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment</frontend_model>
<fieldset_css>adyen-method-adyen-cc</fieldset_css> <fieldset_css>adyen-method-adyen-cc</fieldset_css>
<comment>Process creditcard payments inside your checkout.</comment> <comment>Process creditcard payments inside your checkout.</comment>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Enabled</label> <label>Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_cc/active</config_path> <config_path>payment/adyen_cc/active</config_path>
</field> </field>
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Title</label> <label>Title</label>
<config_path>payment/adyen_cc/title</config_path> <config_path>payment/adyen_cc/title</config_path>
</field> </field>
<field id="sort_order" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> <field id="sort_order" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1"
showInStore="0">
<label>Sort Order</label> <label>Sort Order</label>
<frontend_class>validate-number</frontend_class> <frontend_class>validate-number</frontend_class>
<config_path>payment/adyen_cc/sort_order</config_path> <config_path>payment/adyen_cc/sort_order</config_path>
</field> </field>
<field id="cctypes" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0"> <field id="cctypes" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="1"
showInStore="0">
<label>Credit Card Types</label> <label>Credit Card Types</label>
<source_model>Adyen\Payment\Model\Config\Source\CcType</source_model> <source_model>Adyen\Payment\Model\Config\Source\CcType</source_model>
<config_path>payment/adyen_cc/cctypes</config_path> <config_path>payment/adyen_cc/cctypes</config_path>
</field> </field>
<field id="adyen_cc_vault" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1"
showInStore="0">
<label>Vault Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_cc_vault/active</config_path>
</field>
<group id="adyen_cc_advanced_settings" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="150"> <group id="adyen_cc_advanced_settings" translate="label" showInDefault="1" showInWebsite="1" showInStore="1"
sortOrder="150">
<label>Advanced Settings</label> <label>Advanced Settings</label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model> <frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="enable_moto" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="enable_moto" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Enable MOTO</label> <label>Enable MOTO</label>
<tooltip><![CDATA[Important you have to activate MOTO for your account contact magento@adyen.com.]]></tooltip> <tooltip>
<![CDATA[Important you have to activate MOTO for your account contact magento@adyen.com.]]></tooltip>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_cc/enable_moto</config_path> <config_path>payment/adyen_cc/enable_moto</config_path>
</field> </field>
<field id="enable_installments" translate="label" type="select" sortOrder="219" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="enable_installments" translate="label" type="select" sortOrder="219" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Enable Installments</label> <label>Enable Installments</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<tooltip>Enable installments for each credit card type.</tooltip> <tooltip>Enable installments for each credit card type.</tooltip>
<config_path>payment/adyen_cc/enable_installments</config_path> <config_path>payment/adyen_cc/enable_installments</config_path>
</field> </field>
<field id="installments" translate="label" sortOrder="220" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="installments" translate="label" sortOrder="220" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Installments</label> <label>Installments</label>
<depends><field id="enable_installments">1</field></depends> <depends>
<tooltip>Configure your installment for each credit card type: Insert the minimum amount required to make the configured installment available in the amount range column. <field id="enable_installments">1</field>
Example: if the amount range is configured to 100 and the number of installments to 4x, the shopper will see the 4x option only if the payment total is higher or equal than 100.</tooltip> </depends>
<tooltip>Configure your installment for each credit card type: Insert the minimum amount required to
make the configured installment available in the amount range column.
Example: if the amount range is configured to 100 and the number of installments to 4x, the shopper
will see the 4x option only if the payment total is higher or equal than 100.
</tooltip>
<frontend_model>Adyen\Payment\Block\Adminhtml\System\Config\Field\Installments</frontend_model> <frontend_model>Adyen\Payment\Block\Adminhtml\System\Config\Field\Installments</frontend_model>
<backend_model>Adyen\Payment\Model\Config\Backend\Installments</backend_model> <backend_model>Adyen\Payment\Model\Config\Backend\Installments</backend_model>
<config_path>payment/adyen_cc/installments</config_path> <config_path>payment/adyen_cc/installments</config_path>
...@@ -77,12 +99,14 @@ ...@@ -77,12 +99,14 @@
<group id="adyen_cc_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="200"> <group id="adyen_cc_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="200">
<label>Country Specific Settings</label> <label>Country Specific Settings</label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model> <frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> <field id="allowspecific" translate="label" type="allowspecific" sortOrder="100" showInDefault="1"
showInWebsite="1" showInStore="0">
<label>Payment from Applicable Countries</label> <label>Payment from Applicable Countries</label>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
<config_path>payment/adyen_cc/allowspecific</config_path> <config_path>payment/adyen_cc/allowspecific</config_path>
</field> </field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0"> <field id="specificcountry" translate="label" type="multiselect" sortOrder="200" showInDefault="1"
showInWebsite="1" showInStore="0">
<label>Payment from Specific Countries</label> <label>Payment from Specific Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model> <source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty> <can_be_empty>1</can_be_empty>
......
...@@ -60,8 +60,18 @@ ...@@ -60,8 +60,18 @@
<can_refund>1</can_refund> <can_refund>1</can_refund>
<can_void>1</can_void> <can_void>1</can_void>
<can_cancel>1</can_cancel> <can_cancel>1</can_cancel>
<can_authorize_vault>1</can_authorize_vault>
<can_capture_vault>1</can_capture_vault>
<group>adyen</group> <group>adyen</group>
</adyen_cc> </adyen_cc>
<adyen_cc_vault>
<model>AdyenPaymentCcVaultFacade</model>
<title>Stored Cards (Adyen)</title>
<instant_purchase>
<available>Adyen\Payment\Model\InstantPurchase\CreditCard\AvailabilityChecker</available>
<tokenFormat>Adyen\Payment\Model\InstantPurchase\CreditCard\TokenFormatter</tokenFormat>
</instant_purchase>
</adyen_cc_vault>
<adyen_oneclick> <adyen_oneclick>
<active>1</active> <active>1</active>
<model>AdyenPaymentOneclickFacade</model> <model>AdyenPaymentOneclickFacade</model>
......
...@@ -44,6 +44,15 @@ ...@@ -44,6 +44,15 @@
<argument name="commandPool" xsi:type="object">AdyenPaymentCcCommandPool</argument> <argument name="commandPool" xsi:type="object">AdyenPaymentCcCommandPool</argument>
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentCcVaultFacade" type="Magento\Vault\Model\Method\Vault">
<arguments>
<argument name="code" xsi:type="const">Adyen\Payment\Model\Ui\AdyenCcConfigProvider::CC_VAULT_CODE
</argument>
<argument name="config" xsi:type="object">AdyenPaymentCcVaultConfig</argument>
<argument name="valueHandlerPool" xsi:type="object">AdyenPaymentCcVaultPaymentValueHandlerPool</argument>
<argument name="vaultProvider" xsi:type="object">AdyenPaymentCcFacade</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentOneclickFacade" type="Adyen\Payment\Model\Method\Adapter"> <virtualType name="AdyenPaymentOneclickFacade" type="Adyen\Payment\Model\Method\Adapter">
<arguments> <arguments>
<argument name="code" xsi:type="const">Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE</argument> <argument name="code" xsi:type="const">Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE</argument>
...@@ -116,6 +125,18 @@ ...@@ -116,6 +125,18 @@
</virtualType> </virtualType>
<!-- Value handlers infrastructure --> <!-- Value handlers infrastructure -->
<virtualType name="AdyenPaymentCcVaultPaymentValueHandler" type="VaultPaymentDefaultValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">AdyenPaymentCcVaultConfig</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentCcVaultPaymentValueHandlerPool" type="VaultPaymentValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">AdyenPaymentCcVaultPaymentValueHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentGenericValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool"> <virtualType name="AdyenPaymentGenericValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
<arguments> <arguments>
<argument name="handlers" xsi:type="array"> <argument name="handlers" xsi:type="array">
...@@ -215,7 +236,8 @@ ...@@ -215,7 +236,8 @@
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentPayByMailConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler"> <virtualType name="AdyenPaymentPayByMailConfigValueHandler"
type="Magento\Payment\Gateway\Config\ConfigValueHandler">
<arguments> <arguments>
<argument name="configInterface" xsi:type="object">AdyenPaymentPayByMailConfig</argument> <argument name="configInterface" xsi:type="object">AdyenPaymentPayByMailConfig</argument>
</arguments> </arguments>
...@@ -237,7 +259,8 @@ ...@@ -237,7 +259,8 @@
<!-- Configuration reader --> <!-- Configuration reader -->
<virtualType name="AdyenPaymentGenericConfig" type="Magento\Payment\Gateway\Config\Config"> <virtualType name="AdyenPaymentGenericConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments> <arguments>
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenGenericConfigProvider::CODE</argument> <argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenGenericConfigProvider::CODE
</argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -246,9 +269,16 @@ ...@@ -246,9 +269,16 @@
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenCcConfigProvider::CODE</argument> <argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenCcConfigProvider::CODE</argument>
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentCcVaultConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments>
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenCcConfigProvider::CC_VAULT_CODE
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentOneclickConfig" type="Magento\Payment\Gateway\Config\Config"> <virtualType name="AdyenPaymentOneclickConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments> <arguments>
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE</argument> <argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE
</argument>
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentHppConfig" type="Magento\Payment\Gateway\Config\Config"> <virtualType name="AdyenPaymentHppConfig" type="Magento\Payment\Gateway\Config\Config">
...@@ -263,22 +293,26 @@ ...@@ -263,22 +293,26 @@
</virtualType> </virtualType>
<virtualType name="AdyenPaymentBoletoConfig" type="Magento\Payment\Gateway\Config\Config"> <virtualType name="AdyenPaymentBoletoConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments> <arguments>
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider::CODE</argument> <argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider::CODE
</argument>
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentPosCloudConfig" type="Magento\Payment\Gateway\Config\Config"> <virtualType name="AdyenPaymentPosCloudConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments> <arguments>
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider::CODE</argument> <argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider::CODE
</argument>
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentPayByMailConfig" type="Magento\Payment\Gateway\Config\Config"> <virtualType name="AdyenPaymentPayByMailConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments> <arguments>
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenPayByMailConfigProvider::CODE</argument> <argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenPayByMailConfigProvider::CODE
</argument>
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentApplePayConfig" type="Magento\Payment\Gateway\Config\Config"> <virtualType name="AdyenPaymentApplePayConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments> <arguments>
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider::CODE</argument> <argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider::CODE
</argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -292,10 +326,25 @@ ...@@ -292,10 +326,25 @@
<item name="void" xsi:type="string">AdyenPaymentCancelCommand</item> <item name="void" xsi:type="string">AdyenPaymentCancelCommand</item>
<item name="refund" xsi:type="string">AdyenPaymentRefundCommand</item> <item name="refund" xsi:type="string">AdyenPaymentRefundCommand</item>
<item name="cancel" xsi:type="string">AdyenPaymentCancelCommand</item> <item name="cancel" xsi:type="string">AdyenPaymentCancelCommand</item>
<item name="vault_authorize" xsi:type="string">AdyenPaymentCcVaultAuthorizeCommand</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
<!-- Command managers section for Vault -->
<virtualType name="AdyenPaymentCcCommandManager" type="Magento\Payment\Gateway\Command\CommandManager">
<arguments>
<argument name="commandPool" xsi:type="object">AdyenPaymentCcCommandPool</argument>
</arguments>
</virtualType>
<type name="Magento\Payment\Gateway\Command\CommandManagerPool">
<arguments>
<argument name="executors" xsi:type="array">
<item name="adyen_cc" xsi:type="string">AdyenPaymentCcCommandManager</item>
</argument>
</arguments>
</type>
<virtualType name="AdyenPaymentOneclickCommandPool" type="Magento\Payment\Gateway\Command\CommandPool"> <virtualType name="AdyenPaymentOneclickCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
<arguments> <arguments>
<argument name="commands" xsi:type="array"> <argument name="commands" xsi:type="array">
...@@ -308,6 +357,17 @@ ...@@ -308,6 +357,17 @@
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentCcVaultAuthorizeCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentCcVaultAuthorizeRequest</argument>
<argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionAuthorization
</argument>
<argument name="validator" xsi:type="object">GeneralResponseValidator</argument>
<argument name="handler" xsi:type="object">AdyenPaymentCcVaultResponseHandlerComposite</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentHppCommandPool" type="Magento\Payment\Gateway\Command\CommandPool"> <virtualType name="AdyenPaymentHppCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
<arguments> <arguments>
<argument name="commands" xsi:type="array"> <argument name="commands" xsi:type="array">
...@@ -415,7 +475,8 @@ ...@@ -415,7 +475,8 @@
<arguments> <arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentBoletoAuthorizeRequest</argument> <argument name="requestBuilder" xsi:type="object">AdyenPaymentBoletoAuthorizeRequest</argument>
<argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument> <argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionAuthorization</argument> <argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionAuthorization
</argument>
<argument name="validator" xsi:type="object">GeneralResponseValidator</argument> <argument name="validator" xsi:type="object">GeneralResponseValidator</argument>
<argument name="handler" xsi:type="object">AdyenPaymentBoletoResponseHandlerComposite</argument> <argument name="handler" xsi:type="object">AdyenPaymentBoletoResponseHandlerComposite</argument>
</arguments> </arguments>
...@@ -425,7 +486,8 @@ ...@@ -425,7 +486,8 @@
<arguments> <arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentPosCloudAuthorizeRequest</argument> <argument name="requestBuilder" xsi:type="object">AdyenPaymentPosCloudAuthorizeRequest</argument>
<argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument> <argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionPosCloudSync</argument> <argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionPosCloudSync
</argument>
<argument name="validator" xsi:type="object">PosCloudResponseValidator</argument> <argument name="validator" xsi:type="object">PosCloudResponseValidator</argument>
<argument name="handler" xsi:type="object">AdyenPaymentPosCloudResponseHandlerComposite</argument> <argument name="handler" xsi:type="object">AdyenPaymentPosCloudResponseHandlerComposite</argument>
</arguments> </arguments>
...@@ -435,7 +497,8 @@ ...@@ -435,7 +497,8 @@
<arguments> <arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentApplePayAuthorizeRequest</argument> <argument name="requestBuilder" xsi:type="object">AdyenPaymentApplePayAuthorizeRequest</argument>
<argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument> <argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionAuthorization</argument> <argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionAuthorization
</argument>
<argument name="validator" xsi:type="object">GeneralResponseValidator</argument> <argument name="validator" xsi:type="object">GeneralResponseValidator</argument>
<argument name="handler" xsi:type="object">AdyenPaymentResponseHandlerComposite</argument> <argument name="handler" xsi:type="object">AdyenPaymentResponseHandlerComposite</argument>
</arguments> </arguments>
...@@ -447,7 +510,8 @@ ...@@ -447,7 +510,8 @@
<argument name="requestBuilder" xsi:type="object">AdyenPaymentCaptureRequest</argument> <argument name="requestBuilder" xsi:type="object">AdyenPaymentCaptureRequest</argument>
<argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument> <argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionCapture</argument> <argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionCapture</argument>
<argument name="validator" xsi:type="object">Adyen\Payment\Gateway\Validator\CaptureResponseValidator</argument> <argument name="validator" xsi:type="object">Adyen\Payment\Gateway\Validator\CaptureResponseValidator
</argument>
<argument name="handler" xsi:type="object">AdyenPaymentCaptureResponseHandlerComposite</argument> <argument name="handler" xsi:type="object">AdyenPaymentCaptureResponseHandlerComposite</argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -457,7 +521,8 @@ ...@@ -457,7 +521,8 @@
<argument name="requestBuilder" xsi:type="object">AdyenPaymentRefundRequest</argument> <argument name="requestBuilder" xsi:type="object">AdyenPaymentRefundRequest</argument>
<argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument> <argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionRefund</argument> <argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionRefund</argument>
<argument name="validator" xsi:type="object">Adyen\Payment\Gateway\Validator\RefundResponseValidator</argument> <argument name="validator" xsi:type="object">Adyen\Payment\Gateway\Validator\RefundResponseValidator
</argument>
<argument name="handler" xsi:type="object">AdyenPaymentRefundResponseHandlerComposite</argument> <argument name="handler" xsi:type="object">AdyenPaymentRefundResponseHandlerComposite</argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -466,7 +531,8 @@ ...@@ -466,7 +531,8 @@
<argument name="requestBuilder" xsi:type="object">AdyenPaymentCancelRequest</argument> <argument name="requestBuilder" xsi:type="object">AdyenPaymentCancelRequest</argument>
<argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument> <argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionCancel</argument> <argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionCancel</argument>
<argument name="validator" xsi:type="object">Adyen\Payment\Gateway\Validator\CancelResponseValidator</argument> <argument name="validator" xsi:type="object">Adyen\Payment\Gateway\Validator\CancelResponseValidator
</argument>
<argument name="handler" xsi:type="object">AdyenPaymentCancelResponseHandlerComposite</argument> <argument name="handler" xsi:type="object">AdyenPaymentCancelResponseHandlerComposite</argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -476,14 +542,48 @@ ...@@ -476,14 +542,48 @@
<virtualType name="AdyenPaymentCcAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite"> <virtualType name="AdyenPaymentCcAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments> <arguments>
<argument name="builders" xsi:type="array"> <argument name="builders" xsi:type="array">
<item name="merchantaccount" xsi:type="string">Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder</item> <item name="merchantaccount" xsi:type="string">
Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder
</item>
<item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item> <item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item>
<item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item> <item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item>
<item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item> <item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item>
<item name="payment" xsi:type="string">Adyen\Payment\Gateway\Request\PaymentDataBuilder</item> <item name="payment" xsi:type="string">Adyen\Payment\Gateway\Request\PaymentDataBuilder</item>
<item name="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item> <item name="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item>
<item name="recurring" xsi:type="string">Adyen\Payment\Gateway\Request\RecurringDataBuilder</item> <item name="recurring" xsi:type="string">Adyen\Payment\Gateway\Request\RecurringDataBuilder</item>
<item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\CcAuthorizationDataBuilder</item> <item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\CcAuthorizationDataBuilder
</item>
<item name="vault" xsi:type="string">Adyen\Payment\Gateway\Request\VaultDataBuilder</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentCcVaultAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments>
<argument name="builders" xsi:type="array">
<item name="merchantaccount" xsi:type="string">
Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder
</item>
<item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item>
<item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item>
<item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item>
<item name="payment" xsi:type="string">Adyen\Payment\Gateway\Request\PaymentDataBuilder</item>
<item name="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item>
<item name="recurring" xsi:type="string">Adyen\Payment\Gateway\Request\RecurringVaultDataBuilder</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentCcVaultResponseHandlerComposite"
type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="payment_details" xsi:type="string">
Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler
</item>
<item name="payment_comments" xsi:type="string">
Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler
</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -491,7 +591,9 @@ ...@@ -491,7 +591,9 @@
<virtualType name="AdyenPaymentOneclickAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite"> <virtualType name="AdyenPaymentOneclickAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments> <arguments>
<argument name="builders" xsi:type="array"> <argument name="builders" xsi:type="array">
<item name="merchantaccount" xsi:type="string">Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder</item> <item name="merchantaccount" xsi:type="string">
Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder
</item>
<item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item> <item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item>
<item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item> <item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item>
<item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item> <item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item>
...@@ -506,14 +608,17 @@ ...@@ -506,14 +608,17 @@
<virtualType name="AdyenPaymentSepaAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite"> <virtualType name="AdyenPaymentSepaAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments> <arguments>
<argument name="builders" xsi:type="array"> <argument name="builders" xsi:type="array">
<item name="merchantaccount" xsi:type="string">Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder</item> <item name="merchantaccount" xsi:type="string">
Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder
</item>
<item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item> <item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item>
<item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item> <item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item>
<item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item> <item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item>
<item name="payment" xsi:type="string">Adyen\Payment\Gateway\Request\PaymentDataBuilder</item> <item name="payment" xsi:type="string">Adyen\Payment\Gateway\Request\PaymentDataBuilder</item>
<item name="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item> <item name="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item>
<item name="recurring" xsi:type="string">Adyen\Payment\Gateway\Request\RecurringDataBuilder</item> <item name="recurring" xsi:type="string">Adyen\Payment\Gateway\Request\RecurringDataBuilder</item>
<item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\SepaAuthorizationDataBuilder</item> <item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\SepaAuthorizationDataBuilder
</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -521,14 +626,18 @@ ...@@ -521,14 +626,18 @@
<virtualType name="AdyenPaymentBoletoAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite"> <virtualType name="AdyenPaymentBoletoAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments> <arguments>
<argument name="builders" xsi:type="array"> <argument name="builders" xsi:type="array">
<item name="merchantaccount" xsi:type="string">Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder</item> <item name="merchantaccount" xsi:type="string">
Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder
</item>
<item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item> <item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item>
<item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item> <item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item>
<item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item> <item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item>
<item name="payment" xsi:type="string">Adyen\Payment\Gateway\Request\PaymentDataBuilder</item> <item name="payment" xsi:type="string">Adyen\Payment\Gateway\Request\PaymentDataBuilder</item>
<item name="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item> <item name="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item>
<item name="recurring" xsi:type="string">Adyen\Payment\Gateway\Request\RecurringDataBuilder</item> <item name="recurring" xsi:type="string">Adyen\Payment\Gateway\Request\RecurringDataBuilder</item>
<item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\BoletoAuthorizationDataBuilder</item> <item name="transaction" xsi:type="string">
Adyen\Payment\Gateway\Request\BoletoAuthorizationDataBuilder
</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -544,13 +653,17 @@ ...@@ -544,13 +653,17 @@
<virtualType name="AdyenPaymentApplePayAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite"> <virtualType name="AdyenPaymentApplePayAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments> <arguments>
<argument name="builders" xsi:type="array"> <argument name="builders" xsi:type="array">
<item name="merchantaccount" xsi:type="string">Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder</item> <item name="merchantaccount" xsi:type="string">
Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder
</item>
<item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item> <item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item>
<item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item> <item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item>
<item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item> <item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item>
<item name="payment" xsi:type="string">Adyen\Payment\Gateway\Request\PaymentDataBuilder</item> <item name="payment" xsi:type="string">Adyen\Payment\Gateway\Request\PaymentDataBuilder</item>
<item name="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item> <item name="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item>
<item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\ApplePayAuthorizationDataBuilder</item> <item name="transaction" xsi:type="string">
Adyen\Payment\Gateway\Request\ApplePayAuthorizationDataBuilder
</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -559,7 +672,9 @@ ...@@ -559,7 +672,9 @@
<virtualType name="AdyenPaymentCaptureRequest" type="Magento\Payment\Gateway\Request\BuilderComposite"> <virtualType name="AdyenPaymentCaptureRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments> <arguments>
<argument name="builders" xsi:type="array"> <argument name="builders" xsi:type="array">
<item name="merchantaccount" xsi:type="string">Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder</item> <item name="merchantaccount" xsi:type="string">
Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder
</item>
<item name="capture" xsi:type="string">Adyen\Payment\Gateway\Request\CaptureDataBuilder</item> <item name="capture" xsi:type="string">Adyen\Payment\Gateway\Request\CaptureDataBuilder</item>
</argument> </argument>
</arguments> </arguments>
...@@ -577,7 +692,9 @@ ...@@ -577,7 +692,9 @@
<virtualType name="AdyenPaymentCancelRequest" type="Magento\Payment\Gateway\Request\BuilderComposite"> <virtualType name="AdyenPaymentCancelRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments> <arguments>
<argument name="builders" xsi:type="array"> <argument name="builders" xsi:type="array">
<item name="merchantaccount" xsi:type="string">Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder</item> <item name="merchantaccount" xsi:type="string">
Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder
</item>
<item name="cancel" xsi:type="string">Adyen\Payment\Gateway\Request\CancelDataBuilder</item> <item name="cancel" xsi:type="string">Adyen\Payment\Gateway\Request\CancelDataBuilder</item>
</argument> </argument>
</arguments> </arguments>
...@@ -587,49 +704,72 @@ ...@@ -587,49 +704,72 @@
<virtualType name="AdyenPaymentCcResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain"> <virtualType name="AdyenPaymentCcResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments> <arguments>
<argument name="handlers" xsi:type="array"> <argument name="handlers" xsi:type="array">
<item name="payment_details" xsi:type="string">Adyen\Payment\Gateway\Response\CheckoutPaymentsDetailsHandler</item> <item name="payment_details" xsi:type="string">
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\CheckoutPaymentCommentHistoryHandler</item> Adyen\Payment\Gateway\Response\CheckoutPaymentsDetailsHandler
</item>
<item name="vault_details" xsi:type="string">Adyen\Payment\Gateway\Response\VaultDetailsHandler</item>
<item name="payment_comments" xsi:type="string">
Adyen\Payment\Gateway\Response\CheckoutPaymentCommentHistoryHandler
</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentSepaResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain"> <virtualType name="AdyenPaymentSepaResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments> <arguments>
<argument name="handlers" xsi:type="array"> <argument name="handlers" xsi:type="array">
<item name="payment_details" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler</item> <item name="payment_details" xsi:type="string">
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler</item> Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler
</item>
<item name="payment_comments" xsi:type="string">
Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler
</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentBoletoResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain"> <virtualType name="AdyenPaymentBoletoResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments> <arguments>
<argument name="handlers" xsi:type="array"> <argument name="handlers" xsi:type="array">
<item name="payment_details" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler</item> <item name="payment_details" xsi:type="string">
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler</item> Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler
</item>
<item name="payment_comments" xsi:type="string">
Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler
</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentPosCloudResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain"> <virtualType name="AdyenPaymentPosCloudResponseHandlerComposite"
type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments> <arguments>
<argument name="handlers" xsi:type="array"> <argument name="handlers" xsi:type="array">
<item name="payment_details" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentPosCloudHandler</item> <item name="payment_details" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentPosCloudHandler
</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain"> <virtualType name="AdyenPaymentResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments> <arguments>
<argument name="handlers" xsi:type="array"> <argument name="handlers" xsi:type="array">
<item name="payment_details" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler</item> <item name="payment_details" xsi:type="string">
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler</item> Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler
</item>
<item name="payment_comments" xsi:type="string">
Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler
</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
<virtualType name="AdyenPaymentCaptureResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain"> <virtualType name="AdyenPaymentCaptureResponseHandlerComposite"
type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments> <arguments>
<argument name="handlers" xsi:type="array"> <argument name="handlers" xsi:type="array">
<item name="capture" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCaptureDetailsHandler</item> <item name="capture" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCaptureDetailsHandler
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler</item> </item>
<item name="payment_comments" xsi:type="string">
Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler
</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -637,7 +777,9 @@ ...@@ -637,7 +777,9 @@
<arguments> <arguments>
<argument name="handlers" xsi:type="array"> <argument name="handlers" xsi:type="array">
<item name="capture" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentRefundDetailsHandler</item> <item name="capture" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentRefundDetailsHandler</item>
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCommentHistoryRefundHandler</item> <item name="payment_comments" xsi:type="string">
Adyen\Payment\Gateway\Response\PaymentCommentHistoryRefundHandler
</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -645,7 +787,9 @@ ...@@ -645,7 +787,9 @@
<arguments> <arguments>
<argument name="handlers" xsi:type="array"> <argument name="handlers" xsi:type="array">
<item name="cancel" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCancelDetailsHandler</item> <item name="cancel" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCancelDetailsHandler</item>
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler</item> <item name="payment_comments" xsi:type="string">
Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler
</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -786,7 +930,7 @@ ...@@ -786,7 +930,7 @@
</arguments> </arguments>
</virtualType> </virtualType>
<preference for="Magento\Paypal\Model\Billing\Agreement" type="Adyen\Payment\Model\Billing\Agreement" /> <preference for="Magento\Paypal\Model\Billing\Agreement" type="Adyen\Payment\Model\Billing\Agreement"/>
<type name="Adyen\Payment\Logger\Handler\AdyenDebug"> <type name="Adyen\Payment\Logger\Handler\AdyenDebug">
<arguments> <arguments>
<argument name="filesystem" xsi:type="object">Magento\Framework\Filesystem\Driver\File</argument> <argument name="filesystem" xsi:type="object">Magento\Framework\Filesystem\Driver\File</argument>
...@@ -820,7 +964,7 @@ ...@@ -820,7 +964,7 @@
<type name="Adyen\Payment\Logger\AdyenLogger"> <type name="Adyen\Payment\Logger\AdyenLogger">
<arguments> <arguments>
<argument name="name" xsi:type="string">AdyenLoggerTest</argument> <argument name="name" xsi:type="string">AdyenLoggerTest</argument>
<argument name="handlers" xsi:type="array"> <argument name="handlers" xsi:type="array">
<item name="adyenDebug" xsi:type="object">Adyen\Payment\Logger\Handler\AdyenDebug</item> <item name="adyenDebug" xsi:type="object">Adyen\Payment\Logger\Handler\AdyenDebug</item>
<item name="adyenNotification" xsi:type="object">Adyen\Payment\Logger\Handler\AdyenNotification</item> <item name="adyenNotification" xsi:type="object">Adyen\Payment\Logger\Handler\AdyenNotification</item>
<item name="adyenResult" xsi:type="object">Adyen\Payment\Logger\Handler\AdyenResult</item> <item name="adyenResult" xsi:type="object">Adyen\Payment\Logger\Handler\AdyenResult</item>
...@@ -851,9 +995,17 @@ ...@@ -851,9 +995,17 @@
<argument name="dataStorage" xsi:type="object">adyenPaymentConfigDataStorage</argument> <argument name="dataStorage" xsi:type="object">adyenPaymentConfigDataStorage</argument>
</arguments> </arguments>
</type> </type>
<preference for="Adyen\Payment\Api\GuestAdyenPaymentMethodManagementInterface" type="Adyen\Payment\Model\GuestAdyenPaymentMethodManagement" /> <preference for="Adyen\Payment\Api\GuestAdyenPaymentMethodManagementInterface"
<preference for="Adyen\Payment\Api\AdyenPaymentMethodManagementInterface" type="Adyen\Payment\Model\AdyenPaymentMethodManagement" /> type="Adyen\Payment\Model\GuestAdyenPaymentMethodManagement"/>
<preference for="Adyen\Payment\Api\AdyenRequestMerchantSessionInterface" type="Adyen\Payment\Model\AdyenRequestMerchantSession" /> <preference for="Adyen\Payment\Api\AdyenPaymentMethodManagementInterface"
<preference for="Adyen\Payment\Api\AdyenInitiateTerminalApiInterface" type="Adyen\Payment\Model\AdyenInitiateTerminalApi" /> type="Adyen\Payment\Model\AdyenPaymentMethodManagement"/>
<preference for="Magento\Checkout\Api\PaymentInformationManagementInterface" type="Adyen\Payment\Model\AdyenPaymentInformationManagement" /> <preference for="Adyen\Payment\Api\AdyenRequestMerchantSessionInterface"
type="Adyen\Payment\Model\AdyenRequestMerchantSession"/>
<preference for="Adyen\Payment\Api\AdyenInitiateTerminalApiInterface"
type="Adyen\Payment\Model\AdyenInitiateTerminalApi"/>
<preference for="Magento\Checkout\Api\PaymentInformationManagementInterface"
type="Adyen\Payment\Model\AdyenPaymentInformationManagement"/>
<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
...@@ -27,14 +27,35 @@ ...@@ -27,14 +27,35 @@
<type name="Magento\Checkout\Model\CompositeConfigProvider"> <type name="Magento\Checkout\Model\CompositeConfigProvider">
<arguments> <arguments>
<argument name="configProviders" xsi:type="array"> <argument name="configProviders" xsi:type="array">
<item name="adyen_generic_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenGenericConfigProvider</item> <item name="adyen_generic_config_provider" xsi:type="object">
<item name="adyen_cc_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenCcConfigProvider</item> Adyen\Payment\Model\Ui\AdyenGenericConfigProvider
<item name="adyen_oneclick_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider</item> </item>
<item name="adyen_hpp_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenHppConfigProvider</item> <item name="adyen_cc_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenCcConfigProvider
<item name="adyen_sepa_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenSepaConfigProvider</item> </item>
<item name="adyen_boleto_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider</item> <item name="adyen_oneclick_config_provider" xsi:type="object">
<item name="adyen_pos_cloud_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider</item> Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider
<item name="adyen_apple_pay_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider</item> </item>
<item name="adyen_hpp_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenHppConfigProvider
</item>
<item name="adyen_sepa_config_provider" xsi:type="object">
Adyen\Payment\Model\Ui\AdyenSepaConfigProvider
</item>
<item name="adyen_boleto_config_provider" xsi:type="object">
Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider
</item>
<item name="adyen_pos_cloud_config_provider" xsi:type="object">
Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider
</item>
<item name="adyen_apple_pay_config_provider" xsi:type="object">
Adyen\Payment\Model\Ui\AdyenApplePayConfigProvider
</item>
</argument>
</arguments>
</type>
<type name="Magento\Vault\Model\Ui\TokensConfigProvider">
<arguments>
<argument name="tokenUiComponentProviders" xsi:type="array">
<item name="adyen_cc" xsi:type="object">Adyen\Payment\Model\Ui\TokenUiComponentProvider</item>
</argument> </argument>
</arguments> </arguments>
</type> </type>
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<module name="Magento_Checkout"/> <module name="Magento_Checkout"/>
<module name="Magento_Paypal"/> <module name="Magento_Paypal"/>
<module name="Magento_AdminNotification"/> <module name="Magento_AdminNotification"/>
<module name="Magento_Vault"/>
</sequence> </sequence>
</module> </module>
</config> </config>
...@@ -22,8 +22,17 @@ ...@@ -22,8 +22,17 @@
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
--> -->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head> <head>
<css src="Adyen_Payment::css/order_create_styles.css"/> <css src="Adyen_Payment::css/order_create_styles.css"/>
</head> </head>
<body>
<referenceBlock name="order_create_billing_form">
<action method="setMethodFormTemplate">
<argument name="method" xsi:type="string">adyen_cc_vault</argument>
<argument name="template" xsi:type="string">Magento_Vault::form/vault.phtml</argument>
</action>
</referenceBlock>
</body>
</page> </page>
<?xml version="1.0"?>
<!--
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="order.create.billing.method.form">
<action method="setMethodFormTemplate">
<argument name="method" xsi:type="string">adyen_cc_vault</argument>
<argument name="template" xsi:type="string">Magento_Vault::form/vault.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
\ No newline at end of file
<?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>
*/
use Magento\Vault\Model\Ui\TokenUiComponentProviderInterface;
// @codingStandardsIgnoreFile
/** @var \Magento\Framework\View\Element\Template $block */
$details = $block->getData(TokenUiComponentProviderInterface::COMPONENT_DETAILS);
$id = $block->escapeHtml($block->getData('id'));
?>
<div data-mage-init='{
"Adyen_Payment/js/vault": {
"container": "payment_<?= /* @noEscape */
$id ?>",
"publicHash": "<?= $block->escapeHtml($block->getData(TokenUiComponentProviderInterface::COMPONENT_PUBLIC_HASH)) ?>",
"code": "<?= $block->escapeHtml($block->getData('code')) ?>"
}
}' id="payment_<?= /* @noEscape */
$id ?>" class="admin__field">
<div class="admin__field-control control">
<input type="radio" id="token_switcher_<?= /* @noEscape */
$id ?>" name="payment[token_switcher]"/>
<img src="<?= $block->escapeUrl($details['icon']['url']) ?>"
width="<?= $block->escapeHtml($details['icon']['width']) ?>"
height="<?= $block->escapeHtml($details['icon']['height']) ?>"
class="payment-icon">
<span><?= $block->escapeHtml(__('ending')) ?></span>
<span><?= $block->escapeHtml($details['maskedCC']) ?></span>
(<span><?= $block->escapeHtml(__('expires')) ?></span>:
<span><?= $block->escapeHtml($details['expirationDate']) ?></span>)
</div>
</div>
\ No newline at end of file
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
/*browser:true*/
/*global define*/
define([
'jquery',
'uiComponent'
], function ($, Class) {
'use strict';
return Class.extend({
defaults: {
$selector: null,
selector: 'edit_form'
},
initObservable: function () {
var self = this;
self.$selector = $('#' + self.selector);
this._super();
this.initEventHandlers();
return this;
},
getCode: function () {
return this.code;
},
initEventHandlers: function () {
$('#' + this.container).find('[name="payment[token_switcher]"]')
.on('click', this.setPaymentDetails.bind(this));
},
setPaymentDetails: function () {
this.$selector.find('[name="payment[public_hash]"]').val(this.publicHash);
}
});
});
\ No newline at end of file
<?xml version="1.0"?>
<!--
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<referenceBlock name="vault.cards.list">
<block class="Adyen\Payment\Block\Customer\CardRenderer" name="adyen.card.renderer"
template="Magento_Vault::customer_account/credit_card.phtml"/>
</referenceBlock>
</referenceContainer>
</body>
</page>
...@@ -29,13 +29,17 @@ define( ...@@ -29,13 +29,17 @@ define(
'Magento_Checkout/js/model/payment/additional-validators', 'Magento_Checkout/js/model/payment/additional-validators',
'Magento_Checkout/js/model/quote', 'Magento_Checkout/js/model/quote',
'Adyen_Payment/js/model/installments', 'Adyen_Payment/js/model/installments',
'mage/url' 'mage/url',
'Magento_Vault/js/view/payment/vault-enabler'
], ],
function ($, ko, Component, customer, creditCardData, additionalValidators, quote, installments, url) { function ($, ko, Component, customer, creditCardData, additionalValidators, quote, installments, url, VaultEnabler) {
'use strict'; 'use strict';
return Component.extend({ return Component.extend({
// need to duplicate as without the button will never activate on first time page view
isPlaceOrderActionAllowed: ko.observable(quote.billingAddress() != null),
defaults: { defaults: {
template: 'Adyen_Payment/payment/cc-form', template: 'Adyen_Payment/payment/cc-form',
creditCardOwner: '', creditCardOwner: '',
...@@ -43,6 +47,17 @@ define( ...@@ -43,6 +47,17 @@ define(
installment: '', installment: '',
creditCardDetailsValid: false creditCardDetailsValid: false
}, },
/**
* @returns {exports.initialize}
*/
initialize: function () {
this._super();
this.vaultEnabler = new VaultEnabler();
this.vaultEnabler.setPaymentCode(this.getVaultCode());
this.vaultEnabler.isActivePaymentTokenEnabler(false);
return this;
},
initObservable: function () { initObservable: function () {
this._super() this._super()
.observe([ .observe([
...@@ -70,7 +85,6 @@ define( ...@@ -70,7 +85,6 @@ define(
*/ */
renderSecureFields: function () { renderSecureFields: function () {
var self = this; var self = this;
self.placeOrderAllowed(false);
if (!self.getOriginKey()) { if (!self.getOriginKey()) {
return; return;
} }
...@@ -162,7 +176,7 @@ define( ...@@ -162,7 +176,7 @@ define(
self.creditCardDetailsValid(true); self.creditCardDetailsValid(true);
self.placeOrderAllowed(true); self.placeOrderAllowed(true);
}, },
onError: function (state) { onError: function () {
self.creditCardDetailsValid(false); self.creditCardDetailsValid(false);
self.placeOrderAllowed(false); self.placeOrderAllowed(false);
} }
...@@ -176,7 +190,7 @@ define( ...@@ -176,7 +190,7 @@ define(
* @returns {{method: *, additional_data: {cc_type: *, number: *, cvc, expiryMonth: *, expiryYear: *, holderName: *, store_cc: *, number_of_installments: *}}} * @returns {{method: *, additional_data: {cc_type: *, number: *, cvc, expiryMonth: *, expiryYear: *, holderName: *, store_cc: *, number_of_installments: *}}}
*/ */
getData: function () { getData: function () {
return { var data = {
'method': this.item.method, 'method': this.item.method,
additional_data: { additional_data: {
'card_brand': this.variant(), 'card_brand': this.variant(),
...@@ -190,6 +204,8 @@ define( ...@@ -190,6 +204,8 @@ define(
'number_of_installments': this.installment() 'number_of_installments': this.installment()
} }
}; };
this.vaultEnabler.visitAdditionalData(data);
return data;
}, },
/** /**
* Returns state of place order button * Returns state of place order button
...@@ -360,6 +376,18 @@ define( ...@@ -360,6 +376,18 @@ define(
}, },
context: function () { context: function () {
return this; return this;
},
/**
* @returns {Bool}
*/
isVaultEnabled: function () {
return this.vaultEnabler.isVaultEnabled();
},
/**
* @returns {String}
*/
getVaultCode: function () {
return window.checkoutConfig.payment[this.getCode()].vaultCode;
} }
}); });
} }
......
...@@ -60,8 +60,8 @@ define( ...@@ -60,8 +60,8 @@ define(
'dfValue' 'dfValue'
]); ]);
return this; return this;
}, },initialize: function () {
initialize: function () {
var self = this; var self = this;
this._super(); this._super();
......
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
/*browser:true*/
/*global define*/
define([
'jquery',
'Magento_Vault/js/view/payment/method-renderer/vault'
], function ($, VaultComponent) {
'use strict';
return VaultComponent.extend({
defaults: {
template: 'Magento_Vault/payment/form'
},
/**
* Get last 4 digits of card
* @returns {String}
*/
getMaskedCard: function () {
return this.details.maskedCC;
},
/**
* Get expiration date
* @returns {String}
*/
getExpirationDate: function () {
return this.details.expirationDate;
},
/**
* Get card type
* @returns {String}
*/
getCardType: function () {
return this.details.type;
},
/**
* @returns {String}
*/
getToken: function () {
return this.publicHash;
},
/**
* @param {String} type
* @returns {Boolean}
*/
getIcons: function (type) {
return this.details.icon;
}
});
});
\ No newline at end of file
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
<div class="payment-method-content"> <div class="payment-method-content">
<!-- ko ifnot: (getOriginKey()) --> <!-- ko ifnot: (getOriginKey()) -->
<span class="message message-error error"><!-- ko text: $t('Please configure an API Key and a live endpoint prefix(if in Production Mode) in your Adyen Required Settings')--><!-- /ko --></span> <span class="message message-error error"><!-- ko text: $t('Please configure an API Key and a live endpoint prefix(if in Production Mode) in your Adyen Required Settings')-->
<!-- /ko --></span>
<!--/ko--> <!--/ko-->
<div class="payment-method-billing-address"> <div class="payment-method-billing-address">
...@@ -104,8 +105,20 @@ ...@@ -104,8 +105,20 @@
<!-- /ko --> <!-- /ko -->
<!-- ko if: (isVaultEnabled())-->
<div class="field choice">
<input type="checkbox"
name="vault[is_enabled]"
class="checkbox"
data-bind="attr: {'id': getCode() + '_enable_vault'}, checked: vaultEnabler.isActivePaymentTokenEnabler"/>
<label class="label" data-bind="attr: {'for': getCode() + '_enable_vault'}">
<span><!-- ko i18n: 'Save for later use.'--><!-- /ko --></span>
</label>
</div>
<!-- /ko -->
<!-- ko if: (canCreateBillingAgreement())--> <!-- ko if: (canCreateBillingAgreement() && !isVaultEnabled())-->
<div class="field choice"> <div class="field choice">
<input type="checkbox" <input type="checkbox"
......
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