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 e8002438 authored by Rik ter Beek's avatar Rik ter Beek

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

parent 504033c2
......@@ -33,7 +33,7 @@ class Cctypes extends \Magento\Framework\View\Element\Html\Select
protected $ccTypes = [];
/**
* @var \Magento\Braintree\Model\Source\CcType
* @var \Adyen\Payment\Model\Config\Source\CcType
*/
protected $ccTypeSource;
......
......@@ -31,8 +31,9 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA
*/
protected $_installmentRenderer = null;
/**
* @var \Magento\Braintree\Block\Adminhtml\Form\Field\CcTypes
* @var \Adyen\Payment\Block\Adminhtml\System\Config\Field\Cctypes
*/
protected $_ccTypesRenderer = null;
......@@ -57,7 +58,8 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA
/**
* 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()
{
......@@ -106,7 +108,7 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA
* Prepare existing row data object
*
* @param \Magento\Framework\DataObject $row
* @return void
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function _prepareArrayRow(\Magento\Framework\DataObject $row)
{
......@@ -127,6 +129,5 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA
}
}
$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 @@
*/
namespace Adyen\Payment\Controller\Process;
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
{
......@@ -56,6 +63,19 @@ class Validate3d extends \Magento\Framework\App\Action\Action
*/
protected $_orderRepository;
/**
* @var PaymentTokenFactoryInterface
*/
private $paymentTokenFactory;
/**
* @var OrderPaymentExtensionInterfaceFactory
*/
private $paymentExtensionFactory;
/**
* @var OrderPaymentResource
*/
private $orderPaymentResource;
/**
* Validate3d constructor.
*
......@@ -63,21 +83,31 @@ class Validate3d extends \Magento\Framework\App\Action\Action
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @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(
\Magento\Framework\App\Action\Context $context,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Helper\Data $adyenHelper,
\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);
$this->_adyenLogger = $adyenLogger;
$this->_adyenHelper = $adyenHelper;
$this->_paymentRequest = $paymentRequest;
$this->_orderRepository = $orderRepository;
$this->paymentTokenFactory = $paymentTokenFactory;
$this->paymentExtensionFactory = $paymentExtensionFactory;
$this->orderPaymentResource = $orderPaymentResource;
// 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();
if ($request instanceof HttpRequest && $request->isPost()) {
$request->setParam('isAjax', true);
......@@ -115,15 +145,6 @@ class Validate3d extends \Magento\Framework\App\Action\Action
$order->getPayment()->setAdditionalInformation('paResponse', $requestPaRes);
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());
} catch (\Exception $e) {
$this->_adyenLogger->addAdyenResult("Process 3D secure payment was refused");
......@@ -135,11 +156,52 @@ class Validate3d extends \Magento\Framework\App\Action\Action
// check if authorise3d was successful
if ($result == 'Authorised') {
$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('3dSuccess', true);
$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']]);
} else {
$order->addStatusHistoryComment(__('3D-secure validation was unsuccessful.'))->save();
......@@ -215,4 +277,43 @@ class Validate3d extends \Magento\Framework\App\Action\Action
{
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,6 +61,8 @@ class RecurringDataBuilder implements BuilderInterface
{
$result = [];
// If the vault feature is on this logic is handled in the VaultDataBuilder
if (!$this->adyenHelper->isCreditCardVaultEnabled()) {
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
......@@ -88,6 +90,7 @@ class RecurringDataBuilder implements BuilderInterface
if ($payment->getAdditionalInformation('store_cc') === '1') {
$result['paymentMethod']['storeDetails'] = true;
}
}
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
$payment->setTransactionId($response['pspReference']);
}
if (!empty($response['additionalData']['recurring.recurringDetailReference'])
if (!empty($response['additionalData']['recurring.recurringDetailReference']) &&
!$this->adyenHelper->isCreditCardVaultEnabled()
) {
$order = $payment->getOrder();
......
......@@ -105,8 +105,12 @@ class PaymentPosCloudHandler implements HandlerInterface
$additionalData['paymentMethod'] = $brand;
$additionalData['recurring.recurringDetailReference'] = $recurringDetailReference;
$additionalData['pos_payment'] = true;
if (!$this->adyenHelper->isCreditCardVaultEnabled()) {
$this->adyenHelper->createAdyenBillingAgreement($payment->getOrder(), $additionalData);
}
// TODO: add to vault if recurring!!
}
}
// set transaction(status)
......
<?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
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
* @param $field
......@@ -943,7 +954,8 @@ class Data extends AbstractHelper
return $billingAgreements;
}
public function isPerStoreBillingAgreement($storeId) {
public function isPerStoreBillingAgreement($storeId)
{
return !$this->getAdyenOneclickConfigDataFlag('share_billing_agreement', $storeId);
}
......@@ -1397,8 +1409,7 @@ class Data extends AbstractHelper
try {
$service = $this->createAdyenCheckoutUtilityService($client);
$response = $service->originKeys($params);
}
catch(\Exception $e){
} catch (\Exception $e) {
$this->adyenLogger->error($e->getMessage());
}
......@@ -1494,7 +1505,8 @@ class Data extends AbstractHelper
// add to order to save agreement
$order->addRelatedObject($billingAgreement);
} 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);
}
......@@ -1514,7 +1526,8 @@ class Data extends AbstractHelper
* @param \Magento\Sales\Model\Order $order
* @return int|null
*/
public function getCustomerId(\Magento\Sales\Model\Order $order) {
public function getCustomerId(\Magento\Sales\Model\Order $order)
{
return $order->getCustomerId();
}
......@@ -1539,4 +1552,34 @@ class Data extends AbstractHelper
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);
}
}
......@@ -115,12 +115,10 @@ class PaymentRequest extends DataObject
$client = $this->_adyenHelper->initializeAdyenClient($storeId);
$service = new \Adyen\Service\Checkout($client);
$result = $service->paymentsDetails($request);
} catch(\Adyen\AdyenException $e) {
} catch (\Adyen\AdyenException $e) {
throw new \Magento\Framework\Exception\LocalizedException(__('3D secure failed'));
}
$this->_adyenHelper->createAdyenBillingAgreement($order, $result['additionalData']);
return $result;
}
......
......@@ -941,6 +941,10 @@ class Cron
break;
case Notification::RECURRING_CONTRACT:
// only store billing agreements if Vault is disabled
if (!$this->_adyenHelper->isCreditCardVaultEnabled()) {
// storedReferenceCode
$recurringDetailReference = $this->_pspReference;
......@@ -1052,6 +1056,9 @@ class Cron
$this->_adyenLogger->addAdyenNotificationCronjob($message);
$comment = $this->_order->addStatusHistoryComment($message);
$this->_order->addRelatedObject($comment);
} else {
$this->_adyenLogger->addAdyenNotificationCronjob('Ignore recurring_contract notification because Vault feature is enabled');
}
break;
default:
$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
const CODE = 'adyen_cc';
const CC_VAULT_CODE = 'adyen_cc_vault';
/**
* @var PaymentHelper
*/
......@@ -106,6 +108,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$config = [
'payment' => [
self::CODE => [
'vaultCode' => self::CC_VAULT_CODE,
'isActive' => true,
'redirectUrl' => $this->_urlBuilder->getUrl(
'adyen/process/validate3d/',
......@@ -120,8 +123,8 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$config = array_merge_recursive($config, [
'payment' => [
'ccform' => [
'availableTypes' => [$methodCode => $this->getCcAvailableTypes($methodCode)],
'availableTypesByAlt' => [$methodCode => $this->getCcAvailableTypesByAlt($methodCode)],
'availableTypes' => [$methodCode => $this->getCcAvailableTypes()],
'availableTypesByAlt' => [$methodCode => $this->getCcAvailableTypesByAlt()],
'months' => [$methodCode => $this->getCcMonths()],
'years' => [$methodCode => $this->getCcYears()],
'hasVerification' => [$methodCode => $this->hasVerification($methodCode)],
......@@ -167,10 +170,9 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
/**
* Retrieve availables credit card types
*
* @param string $methodCode
* @return array
*/
protected function getCcAvailableTypes($methodCode)
protected function getCcAvailableTypes()
{
$types = [];
$ccTypes = $this->_adyenHelper->getAdyenCcTypes();
......@@ -193,7 +195,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
* @param string $methodCode
* @return array
*/
protected function getCcAvailableTypesByAlt($methodCode)
protected function getCcAvailableTypesByAlt()
{
$types = [];
$ccTypes = $this->_adyenHelper->getAdyenCcTypes();
......
......@@ -103,6 +103,8 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
/**
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getConfig()
{
......@@ -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;
$config = array_merge_recursive($config, [
'payment' => [
'ccform' => [
'availableTypes' => [$methodCode => $this->getCcAvailableTypes($methodCode)],
'availableTypes' => [$methodCode => $this->getCcAvailableTypes()],
'months' => [$methodCode => $this->getCcMonths()],
'years' => [$methodCode => $this->getCcYears()],
'hasVerification' => [$methodCode => $this->hasVerification($methodCode)],
......@@ -150,9 +160,9 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
$config['payment'] ['adyenOneclick']['billingAgreements'] = $this->getAdyenOneclickPaymentMethods();
if ($recurringContractType == \Adyen\Payment\Model\RecurringType::ONECLICK) {
$config['payment'] ['adyenOneclick']['hasCustomerInteraction'] = true;
$config['payment']['adyenOneclick']['hasCustomerInteraction'] = true;
} else {
$config['payment'] ['adyenOneclick']['hasCustomerInteraction'] = false;
$config['payment']['adyenOneclick']['hasCustomerInteraction'] = false;
}
return $config;
......@@ -201,10 +211,9 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
/**
* Retrieve availables credit card types
*
* @param string $methodCode
* @return array
*/
protected function getCcAvailableTypes($methodCode)
protected function getCcAvailableTypes()
{
$types = [];
$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
......@@ -72,10 +72,12 @@ class AdyenCcDataAssignObserver extends AbstractDataAssignObserver
$paymentInfo = $this->readPaymentModelArgument($observer);
// set ccType
if (!empty($additionalData['cc_type'])) {
$paymentInfo->setCcType($additionalData['cc_type']);
}
foreach ($this->additionalInformationList as $additionalInformationKey) {
if (isset($additionalData[$additionalInformationKey])) {
if (!empty($additionalData[$additionalInformationKey])) {
$paymentInfo->setAdditionalInformation(
$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:
</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
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 @@
],
"require": {
"adyen/php-api-library": ">=1.5.3",
"magento/framework": ">=100.1.0"
"magento/framework": ">=101.0.*",
"magento/module-vault": "101.0.*"
},
"autoload": {
"files": [
......
......@@ -9,4 +9,11 @@
</argument>
</arguments>
</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>
......@@ -22,52 +22,74 @@
* 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">
<group id="adyen_cc" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment</frontend_model>
<fieldset_css>adyen-method-adyen-cc</fieldset_css>
<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>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_cc/active</config_path>
</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>
<config_path>payment/adyen_cc/title</config_path>
</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>
<frontend_class>validate-number</frontend_class>
<config_path>payment/adyen_cc/sort_order</config_path>
</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>
<source_model>Adyen\Payment\Model\Config\Source\CcType</source_model>
<config_path>payment/adyen_cc/cctypes</config_path>
</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>
<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>
<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>
<config_path>payment/adyen_cc/enable_moto</config_path>
</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>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<tooltip>Enable installments for each credit card type.</tooltip>
<config_path>payment/adyen_cc/enable_installments</config_path>
</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>
<depends><field id="enable_installments">1</field></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>
<depends>
<field id="enable_installments">1</field>
</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>
<backend_model>Adyen\Payment\Model\Config\Backend\Installments</backend_model>
<config_path>payment/adyen_cc/installments</config_path>
......@@ -77,12 +99,14 @@
<group id="adyen_cc_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="200">
<label>Country Specific Settings</label>
<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>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
<config_path>payment/adyen_cc/allowspecific</config_path>
</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>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
......
......@@ -60,8 +60,18 @@
<can_refund>1</can_refund>
<can_void>1</can_void>
<can_cancel>1</can_cancel>
<can_authorize_vault>1</can_authorize_vault>
<can_capture_vault>1</can_capture_vault>
<group>adyen</group>
</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>
<active>1</active>
<model>AdyenPaymentOneclickFacade</model>
......
......@@ -44,6 +44,15 @@
<argument name="commandPool" xsi:type="object">AdyenPaymentCcCommandPool</argument>
</arguments>
</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">
<arguments>
<argument name="code" xsi:type="const">Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE</argument>
......@@ -116,6 +125,18 @@
</virtualType>
<!-- 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">
<arguments>
<argument name="handlers" xsi:type="array">
......@@ -215,7 +236,8 @@
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPayByMailConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler">
<virtualType name="AdyenPaymentPayByMailConfigValueHandler"
type="Magento\Payment\Gateway\Config\ConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">AdyenPaymentPayByMailConfig</argument>
</arguments>
......@@ -237,7 +259,8 @@
<!-- Configuration reader -->
<virtualType name="AdyenPaymentGenericConfig" type="Magento\Payment\Gateway\Config\Config">
<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>
</virtualType>
......@@ -246,9 +269,16 @@
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenCcConfigProvider::CODE</argument>
</arguments>
</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">
<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>
</virtualType>
<virtualType name="AdyenPaymentHppConfig" type="Magento\Payment\Gateway\Config\Config">
......@@ -263,22 +293,26 @@
</virtualType>
<virtualType name="AdyenPaymentBoletoConfig" type="Magento\Payment\Gateway\Config\Config">
<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>
</virtualType>
<virtualType name="AdyenPaymentPosCloudConfig" type="Magento\Payment\Gateway\Config\Config">
<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>
</virtualType>
<virtualType name="AdyenPaymentPayByMailConfig" type="Magento\Payment\Gateway\Config\Config">
<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>
</virtualType>
<virtualType name="AdyenPaymentApplePayConfig" type="Magento\Payment\Gateway\Config\Config">
<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>
</virtualType>
......@@ -292,10 +326,25 @@
<item name="void" xsi:type="string">AdyenPaymentCancelCommand</item>
<item name="refund" xsi:type="string">AdyenPaymentRefundCommand</item>
<item name="cancel" xsi:type="string">AdyenPaymentCancelCommand</item>
<item name="vault_authorize" xsi:type="string">AdyenPaymentCcVaultAuthorizeCommand</item>
</argument>
</arguments>
</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">
<arguments>
<argument name="commands" xsi:type="array">
......@@ -308,6 +357,17 @@
</arguments>
</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">
<arguments>
<argument name="commands" xsi:type="array">
......@@ -415,7 +475,8 @@
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentBoletoAuthorizeRequest</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="handler" xsi:type="object">AdyenPaymentBoletoResponseHandlerComposite</argument>
</arguments>
......@@ -425,7 +486,8 @@
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentPosCloudAuthorizeRequest</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="handler" xsi:type="object">AdyenPaymentPosCloudResponseHandlerComposite</argument>
</arguments>
......@@ -435,7 +497,8 @@
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentApplePayAuthorizeRequest</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="handler" xsi:type="object">AdyenPaymentResponseHandlerComposite</argument>
</arguments>
......@@ -447,7 +510,8 @@
<argument name="requestBuilder" xsi:type="object">AdyenPaymentCaptureRequest</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="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>
</arguments>
</virtualType>
......@@ -457,7 +521,8 @@
<argument name="requestBuilder" xsi:type="object">AdyenPaymentRefundRequest</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="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>
</arguments>
</virtualType>
......@@ -466,7 +531,8 @@
<argument name="requestBuilder" xsi:type="object">AdyenPaymentCancelRequest</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="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>
</arguments>
</virtualType>
......@@ -476,14 +542,48 @@
<virtualType name="AdyenPaymentCcAuthorizeRequest" 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="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\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>
</arguments>
</virtualType>
......@@ -491,15 +591,19 @@
<virtualType name="AdyenPaymentOneclickAuthorizeRequest" 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="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\RecurringDataBuilder</item>
<item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\CcAuthorizationDataBuilder</item>
<item name="oneclick" xsi:type="string">Adyen\Payment\Gateway\Request\OneclickAuthorizationDataBuilder</item>
<item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\CcAuthorizationDataBuilder
</item>
<item name="oneclick" xsi:type="string">Adyen\Payment\Gateway\Request\OneclickAuthorizationDataBuilder
</item>
</argument>
</arguments>
</virtualType>
......@@ -507,14 +611,17 @@
<virtualType name="AdyenPaymentSepaAuthorizeRequest" 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="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\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>
</arguments>
</virtualType>
......@@ -522,14 +629,18 @@
<virtualType name="AdyenPaymentBoletoAuthorizeRequest" 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="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\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>
</arguments>
</virtualType>
......@@ -545,13 +656,17 @@
<virtualType name="AdyenPaymentApplePayAuthorizeRequest" 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="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="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\ApplePayAuthorizationDataBuilder</item>
<item name="transaction" xsi:type="string">
Adyen\Payment\Gateway\Request\ApplePayAuthorizationDataBuilder
</item>
</argument>
</arguments>
</virtualType>
......@@ -560,7 +675,9 @@
<virtualType name="AdyenPaymentCaptureRequest" 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="merchantaccount" xsi:type="string">
Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder
</item>
<item name="capture" xsi:type="string">Adyen\Payment\Gateway\Request\CaptureDataBuilder</item>
</argument>
</arguments>
......@@ -578,7 +695,9 @@
<virtualType name="AdyenPaymentCancelRequest" 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="merchantaccount" xsi:type="string">
Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder
</item>
<item name="cancel" xsi:type="string">Adyen\Payment\Gateway\Request\CancelDataBuilder</item>
</argument>
</arguments>
......@@ -588,49 +707,72 @@
<virtualType name="AdyenPaymentCcResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="payment_details" xsi:type="string">Adyen\Payment\Gateway\Response\CheckoutPaymentsDetailsHandler</item>
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\CheckoutPaymentCommentHistoryHandler</item>
<item name="payment_details" xsi:type="string">
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>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentSepaResponseHandlerComposite" 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>
<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>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentBoletoResponseHandlerComposite" 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>
<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>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentPosCloudResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain">
<virtualType name="AdyenPaymentPosCloudResponseHandlerComposite"
type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments>
<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>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentResponseHandlerComposite" 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>
<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>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentCaptureResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain">
<virtualType name="AdyenPaymentCaptureResponseHandlerComposite"
type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="capture" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCaptureDetailsHandler</item>
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler</item>
<item name="capture" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCaptureDetailsHandler
</item>
<item name="payment_comments" xsi:type="string">
Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler
</item>
</argument>
</arguments>
</virtualType>
......@@ -638,7 +780,9 @@
<arguments>
<argument name="handlers" xsi:type="array">
<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>
</arguments>
</virtualType>
......@@ -646,7 +790,9 @@
<arguments>
<argument name="handlers" xsi:type="array">
<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>
</arguments>
</virtualType>
......@@ -787,7 +933,7 @@
</arguments>
</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">
<arguments>
<argument name="filesystem" xsi:type="object">Magento\Framework\Filesystem\Driver\File</argument>
......@@ -852,9 +998,17 @@
<argument name="dataStorage" xsi:type="object">adyenPaymentConfigDataStorage</argument>
</arguments>
</type>
<preference for="Adyen\Payment\Api\GuestAdyenPaymentMethodManagementInterface" type="Adyen\Payment\Model\GuestAdyenPaymentMethodManagement" />
<preference for="Adyen\Payment\Api\AdyenPaymentMethodManagementInterface" type="Adyen\Payment\Model\AdyenPaymentMethodManagement" />
<preference for="Adyen\Payment\Api\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" />
<preference for="Adyen\Payment\Api\GuestAdyenPaymentMethodManagementInterface"
type="Adyen\Payment\Model\GuestAdyenPaymentMethodManagement"/>
<preference for="Adyen\Payment\Api\AdyenPaymentMethodManagementInterface"
type="Adyen\Payment\Model\AdyenPaymentMethodManagement"/>
<preference for="Adyen\Payment\Api\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>
\ No newline at end of file
......@@ -27,14 +27,35 @@
<type name="Magento\Checkout\Model\CompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="adyen_generic_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenGenericConfigProvider</item>
<item name="adyen_cc_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenCcConfigProvider</item>
<item name="adyen_oneclick_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider</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>
<item name="adyen_generic_config_provider" xsi:type="object">
Adyen\Payment\Model\Ui\AdyenGenericConfigProvider
</item>
<item name="adyen_cc_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenCcConfigProvider
</item>
<item name="adyen_oneclick_config_provider" xsi:type="object">
Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider
</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>
</arguments>
</type>
......
......@@ -31,6 +31,7 @@
<module name="Magento_Checkout"/>
<module name="Magento_Paypal"/>
<module name="Magento_AdminNotification"/>
<module name="Magento_Vault"/>
</sequence>
</module>
</config>
......@@ -22,8 +22,17 @@
* 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>
<css src="Adyen_Payment::css/order_create_styles.css"/>
</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>
<?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(
'Magento_Checkout/js/model/payment/additional-validators',
'Magento_Checkout/js/model/quote',
'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';
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: {
template: 'Adyen_Payment/payment/cc-form',
creditCardOwner: '',
......@@ -43,6 +47,17 @@ define(
installment: '',
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 () {
this._super()
.observe([
......@@ -70,7 +85,6 @@ define(
*/
renderSecureFields: function () {
var self = this;
self.placeOrderAllowed(false);
if (!self.getOriginKey()) {
return;
}
......@@ -162,7 +176,7 @@ define(
self.creditCardDetailsValid(true);
self.placeOrderAllowed(true);
},
onError: function (state) {
onError: function () {
self.creditCardDetailsValid(false);
self.placeOrderAllowed(false);
}
......@@ -176,7 +190,7 @@ define(
* @returns {{method: *, additional_data: {cc_type: *, number: *, cvc, expiryMonth: *, expiryYear: *, holderName: *, store_cc: *, number_of_installments: *}}}
*/
getData: function () {
return {
var data = {
'method': this.item.method,
additional_data: {
'card_brand': this.variant(),
......@@ -190,6 +204,8 @@ define(
'number_of_installments': this.installment()
}
};
this.vaultEnabler.visitAdditionalData(data);
return data;
},
/**
* Returns state of place order button
......@@ -360,6 +376,18 @@ define(
},
context: function () {
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(
'dfValue'
]);
return this;
},
initialize: function () {
},initialize: function () {
var self = this;
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 @@
<div class="payment-method-content">
<!-- 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-->
<div class="payment-method-billing-address">
......@@ -104,8 +105,20 @@
<!-- /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">
<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