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

#67 Adyen CC and Adyen Oneclick are now using the Facade implementation

parent 482fd41f
...@@ -45,21 +45,29 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -45,21 +45,29 @@ class Validate3d extends \Magento\Framework\App\Action\Action
*/ */
protected $_adyenHelper; protected $_adyenHelper;
/**
* @var \Adyen\Payment\Model\Api\PaymentRequest
*/
protected $_paymentRequest;
/** /**
* Validate3d constructor. * Validate3d constructor.
* *
* @param \Magento\Framework\App\Action\Context $context * @param \Magento\Framework\App\Action\Context $context
* @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
*/ */
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
) { ) {
parent::__construct($context); parent::__construct($context);
$this->_adyenLogger = $adyenLogger; $this->_adyenLogger = $adyenLogger;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_paymentRequest = $paymentRequest;
} }
/** /**
...@@ -93,7 +101,17 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -93,7 +101,17 @@ class Validate3d extends \Magento\Framework\App\Action\Action
$order->getPayment()->setAdditionalInformation('paResponse', $requestPaRes); $order->getPayment()->setAdditionalInformation('paResponse', $requestPaRes);
try { try {
$result = $order->getPayment()->getMethodInstance()->authorise3d($order->getPayment());
/**
* 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) { } catch (\Exception $e) {
$this->_adyenLogger->addAdyenResult("Process 3D secure payment was refused"); $this->_adyenLogger->addAdyenResult("Process 3D secure payment was refused");
$result = 'Refused'; $result = 'Refused';
...@@ -134,6 +152,24 @@ class Validate3d extends \Magento\Framework\App\Action\Action ...@@ -134,6 +152,24 @@ class Validate3d extends \Magento\Framework\App\Action\Action
} }
} }
/**
* Called by validate3d controller when cc payment has 3D secure
*
* @param $payment
* @return mixed
* @throws \Exception
*/
protected function _authorise3d($payment)
{
try {
$response = $this->_paymentRequest->authorise3d($payment);
} catch(\Exception $e) {
throw $e;
}
$responseCode = $response['resultCode'];
return $responseCode;
}
/** /**
* Get order object * Get order object
* *
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
/**
* Payment Data Builder
*/
class Authorize3DSecureDataBuilder implements BuilderInterface
{
/**
* @var \Adyen\Payment\Helper\Data
*/
private $adyenHelper;
/**
* PaymentDataBuilder constructor.
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(\Adyen\Payment\Helper\Data $adyenHelper)
{
$this->adyenHelper = $adyenHelper;
}
/**
* @param array $buildSubject
* @return array
*/
public function build(array $buildSubject)
{
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
$md = $payment->getAdditionalInformation('md');
$paResponse = $payment->getAdditionalInformation('paResponse');
return [
"md" => $md,
"paResponse" => $paResponse,
];
}
}
\ No newline at end of file
...@@ -20,22 +20,27 @@ ...@@ -20,22 +20,27 @@
* *
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
namespace Adyen\Payment\Gateway\Request;
namespace Adyen\Payment\Gateway\Config; use Magento\Payment\Gateway\Request\BuilderInterface;
/** /**
* Class Config * Payment Data Builder
*/ */
class SepaConfig extends \Magento\Payment\Gateway\Config\Config class BrowserInfoDataBuilder implements BuilderInterface
{ {
const KEY_ACTIVE = 'active';
/** /**
* Get Payment configuration status * @param array $buildSubject
* @return bool * @return array
*/ */
public function isActive() public function build(array $buildSubject)
{ {
return (bool) $this->getValue(self::KEY_ACTIVE); return [
'browserInfo' =>
[
'userAgent' => $_SERVER['HTTP_USER_AGENT'],
'acceptHeader' => $_SERVER['HTTP_ACCEPT']
]
];
} }
} }
\ 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>
*/
namespace Adyen\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
class CcAuthorizationDataBuilder implements BuilderInterface
{
/**
* @var \Adyen\Payment\Helper\Data
*/
private $adyenHelper;
/**
* @var \Magento\Framework\App\State
*/
private $appState;
/**
* CcAuthorizationDataBuilder constructor.
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\Model\Context $context
*/
public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\Model\Context $context
) {
$this->adyenHelper = $adyenHelper;
$this->appState = $context->getAppState();
}
/**
* @param array $buildSubject
* @return mixed
*/
public function build(array $buildSubject)
{
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
$order = $paymentDataObject->getOrder();
$storeId = $order->getStoreId();
$request = [];
if ($this->adyenHelper->getAdyenCcConfigDataFlag('cse_enabled', $storeId)) {
$request['additionalData']['card.encrypted.json'] =
$payment->getAdditionalInformation("encrypted_data");
} else {
$requestCreditCardDetails = [
"expiryMonth" => $payment->getCcExpMonth(),
"expiryYear" => $payment->getCcExpYear(),
"holderName" => $payment->getCcOwner(),
"number" => $payment->getCcNumber(),
"cvc" => $payment->getCcCid(),
];
$cardDetails['card'] = $requestCreditCardDetails;
$request = array_merge($request, $cardDetails);
}
/**
* if MOTO for backend is enabled use MOTO as shopper interaction type
*/
$enableMoto = $this->adyenHelper->getAdyenCcConfigDataFlag('enable_moto', $storeId);
if ($this->appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE &&
$enableMoto) {
$request['shopperInteraction'] = "Moto";
}
// if installments is set add it into the request
if ($payment->getAdditionalInformation('number_of_installments') &&
$payment->getAdditionalInformation('number_of_installments') > 0) {
$request['installments']['value'] = $payment->getAdditionalInformation('number_of_installments');
}
return $request;
}
}
\ No newline at end of file
...@@ -48,13 +48,11 @@ class CustomerDataBuilder implements BuilderInterface ...@@ -48,13 +48,11 @@ class CustomerDataBuilder implements BuilderInterface
$order = $paymentDataObject->getOrder(); $order = $paymentDataObject->getOrder();
$billingAddress = $order->getBillingAddress(); $billingAddress = $order->getBillingAddress();
$customerEmail = $billingAddress->getEmail(); $customerEmail = $billingAddress->getEmail();
$shopperIp = $order->getRemoteIp();
$realOrderId = $order->getOrderIncrementId(); $realOrderId = $order->getOrderIncrementId();
$customerId = $order->getCustomerId(); $customerId = $order->getCustomerId();
$shopperReference = (!empty($customerId)) ? $customerId : self::GUEST_ID . $realOrderId; $shopperReference = (!empty($customerId)) ? $customerId : self::GUEST_ID . $realOrderId;
return [ return [
"shopperIP" => $shopperIp,
"shopperEmail" => $customerEmail, "shopperEmail" => $customerEmail,
"shopperReference" => $shopperReference "shopperReference" => $shopperReference
]; ];
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
/**
* Class CustomerDataBuilder
*/
class CustomerIpDataBuilder implements BuilderInterface
{
/**
* @param array $buildSubject
* @return array
*/
public function build(array $buildSubject)
{
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$order = $paymentDataObject->getOrder();
return ['shopperIP' => $order->getRemoteIp()];
}
}
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
class OneclickAuthorizationBuilder implements BuilderInterface
{
/**
* @var \Adyen\Payment\Helper\Data
*/
private $adyenHelper;
/**
* CaptureDataBuilder constructor.
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public function __construct(\Adyen\Payment\Helper\Data $adyenHelper)
{
$this->adyenHelper = $adyenHelper;
}
/**
* @param array $buildSubject
* @return mixed
*/
public function build(array $buildSubject)
{
$request = [];
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
$recurringDetailReference = $payment->getAdditionalInformation("recurring_detail_reference");
if ($payment->getAdditionalInformation('customer_interaction')) {
$shopperInteraction = "Ecommerce";
} else {
$shopperInteraction = "ContAuth";
}
$request['selectedRecurringDetailReference'] = $recurringDetailReference;
$request['shopperInteraction'] = $shopperInteraction;
/*
* For recurring Ideal and Sofort needs to be converted to SEPA
* for this it is mandatory to set selectBrand to sepadirectdebit
*/
if (!$payment->getAdditionalInformation('customer_interaction')) {
if ($payment->getCcType() == "directEbanking" || $payment->getCcType() == "ideal") {
$request['selectedBrand'] = "sepadirectdebit";
}
}
return $request;
}
}
\ No newline at end of file
...@@ -56,17 +56,14 @@ class PaymentDataBuilder implements BuilderInterface ...@@ -56,17 +56,14 @@ class PaymentDataBuilder implements BuilderInterface
$order = $paymentDataObject->getOrder(); $order = $paymentDataObject->getOrder();
$orderCurrencyCode = $order->getCurrencyCode(); $orderCurrencyCode = $order->getCurrencyCode();
$amount = $order->getGrandTotalAmount(); $amount = $order->getGrandTotalAmount();
$browserInfo = ['userAgent' => $_SERVER['HTTP_USER_AGENT'], 'acceptHeader' => $_SERVER['HTTP_ACCEPT']];
$amount = ['currency' => $orderCurrencyCode, $amount = ['currency' => $orderCurrencyCode,
'value' => $this->adyenHelper->formatAmount($amount, $orderCurrencyCode)]; 'value' => $this->adyenHelper->formatAmount($amount, $orderCurrencyCode)];
return [ return [
"amount" => $amount, "amount" => $amount,
"reference" => $order->getOrderIncrementId(), "reference" => $order->getOrderIncrementId(),
"fraudOffset" => "0", "fraudOffset" => "0"
"browserInfo" => $browserInfo
]; ];
} }
} }
\ No newline at end of file
...@@ -73,7 +73,7 @@ class RecurringDataBuilder implements BuilderInterface ...@@ -73,7 +73,7 @@ class RecurringDataBuilder implements BuilderInterface
// set the recurring type // set the recurring type
$recurringContractType = null; $recurringContractType = null;
if ($recurringType) { if ($recurringType) {
if ($paymentMethodCode == \Adyen\Payment\Model\Method\Oneclick::METHOD_CODE) { if ($paymentMethodCode == \Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE) {
/* /*
* For ONECLICK look at the recurringPaymentType that the merchant * For ONECLICK look at the recurringPaymentType that the merchant
* has selected in Adyen ONECLICK settings * has selected in Adyen ONECLICK settings
...@@ -83,7 +83,7 @@ class RecurringDataBuilder implements BuilderInterface ...@@ -83,7 +83,7 @@ class RecurringDataBuilder implements BuilderInterface
} else { } else {
$recurringContractType = \Adyen\Payment\Model\RecurringType::RECURRING; $recurringContractType = \Adyen\Payment\Model\RecurringType::RECURRING;
} }
} else if ($paymentMethodCode == \Adyen\Payment\Model\Method\Cc::METHOD_CODE) { } else if ($paymentMethodCode == \Adyen\Payment\Model\Ui\AdyenCcConfigProvider::CODE) {
if ($payment->getAdditionalInformation("store_cc") == "" && if ($payment->getAdditionalInformation("store_cc") == "" &&
($recurringType == "ONECLICK,RECURRING" || $recurringType == "RECURRING")) { ($recurringType == "ONECLICK,RECURRING" || $recurringType == "RECURRING")) {
$recurringContractType = \Adyen\Payment\Model\RecurringType::RECURRING; $recurringContractType = \Adyen\Payment\Model\RecurringType::RECURRING;
......
...@@ -36,6 +36,7 @@ class SepaAuthorizationBuilder implements BuilderInterface ...@@ -36,6 +36,7 @@ class SepaAuthorizationBuilder implements BuilderInterface
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */ /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject); $paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment(); $payment = $paymentDataObject->getPayment();
$request = [];
// set brand to sepa // set brand to sepa
$request['selectedBrand'] = "sepadirectdebit"; $request['selectedBrand'] = "sepadirectdebit";
......
...@@ -43,7 +43,13 @@ class PaymentCommentHistoryHandler implements HandlerInterface ...@@ -43,7 +43,13 @@ class PaymentCommentHistoryHandler implements HandlerInterface
if (isset($response['resultCode'])) { if (isset($response['resultCode'])) {
$responseCode = $response['resultCode']; $responseCode = $response['resultCode'];
} else { } else {
$responseCode = "";
// try to get response from response key (used for modifications
if (isset($response['response'])) {
$responseCode = $response['response'];
} else {
$responseCode = "";
}
} }
if (isset($response['pspReference'])) { if (isset($response['pspReference'])) {
......
...@@ -27,6 +27,24 @@ use Magento\Payment\Gateway\Validator\AbstractValidator; ...@@ -27,6 +27,24 @@ use Magento\Payment\Gateway\Validator\AbstractValidator;
class GeneralResponseValidator extends AbstractValidator class GeneralResponseValidator extends AbstractValidator
{ {
/**
* @var Psr\Log\LoggerInterface
*/
private $logger;
/**
* GeneralResponseValidator constructor.
* @param ResultInterfaceFactory $resultFactory
* @param \Psr\Log\LoggerInterface $loggerInterface
*/
public function __construct(
\Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory,
\Psr\Log\LoggerInterface $loggerInterface
) {
$this->logger = $loggerInterface;
parent::__construct($resultFactory);
}
/** /**
* @param array $validationSubject * @param array $validationSubject
* @return \Magento\Payment\Gateway\Validator\ResultInterface * @return \Magento\Payment\Gateway\Validator\ResultInterface
...@@ -37,6 +55,7 @@ class GeneralResponseValidator extends AbstractValidator ...@@ -37,6 +55,7 @@ class GeneralResponseValidator extends AbstractValidator
$paymentDataObjectInterface = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($validationSubject); $paymentDataObjectInterface = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($validationSubject);
$payment = $paymentDataObjectInterface->getPayment(); $payment = $paymentDataObjectInterface->getPayment();
$payment->setAdditionalInformation('3dActive', false);
$isValid = true; $isValid = true;
$errorMessages = []; $errorMessages = [];
...@@ -46,20 +65,73 @@ class GeneralResponseValidator extends AbstractValidator ...@@ -46,20 +65,73 @@ class GeneralResponseValidator extends AbstractValidator
case "Authorised": case "Authorised":
$payment->setAdditionalInformation('pspReference', $response['pspReference']); $payment->setAdditionalInformation('pspReference', $response['pspReference']);
break; break;
case "RedirectShopper":
$payment->setAdditionalInformation('3dActive', true);
$payment->setAdditionalInformation('pspReference', $response['pspReference']);
$issuerUrl = $response['issuerUrl'];
$paReq = $response['paRequest'];
$md = $response['md'];
if (!empty($paReq) && !empty($md) && !empty($issuerUrl)) {
$payment->setAdditionalInformation('issuerUrl', $response['issuerUrl']);
$payment->setAdditionalInformation('paRequest', $response['paRequest']);
$payment->setAdditionalInformation('md', $response['md']);
} else {
$isValid = false;
$errorMsg = __('3D secure is not valid.');
$this->logger->error($errorMsg);;
$errorMessages[] = $errorMsg;
}
break;
case "Refused": case "Refused":
$errorMsg = __('The payment is REFUSED.'); $isValid = false;
$this->_logger->critical($errorMsg);
$errorMessages[] = $errorMsg; if ($response['refusalReason']) {
$refusalReason = $response['refusalReason'];
switch($refusalReason) {
case "Transaction Not Permitted":
$errorMsg = __('The transaction is not permitted.');
break;
case "CVC Declined":
$errorMsg = __('Declined due to the Card Security Code(CVC) being incorrect. Please check your CVC code!');
break;
case "Restricted Card":
$errorMsg = __('The card is restricted.');
break;
case "803 PaymentDetail not found":
$errorMsg = __('The payment is REFUSED because the saved card is removed. Please try an other payment method.');
break;
case "Expiry month not set":
$errorMsg = __('The expiry month is not set. Please check your expiry month!');
break;
default:
$errorMsg = __('The payment is REFUSED.');
break;
}
} else {
$errorMsg = __('The payment is REFUSED.');
}
// exeption is to general
// $this->logger->critical($errorMsg);
// $errorMessages[] = $errorMsg;
// this will result the specific error
throw new \Magento\Framework\Exception\LocalizedException(__($errorMsg));
break; break;
default: default:
$isValid = false;
$errorMsg = __('Error with payment method please select different payment method.'); $errorMsg = __('Error with payment method please select different payment method.');
$this->_logger->critical($errorMsg); $this->logger->critical($errorMsg);
$errorMessages[] = $errorMsg; $errorMessages[] = $errorMsg;
break; break;
} }
} else { } else {
$errorMsg = __('Error with payment method please select different payment method.'); $errorMsg = __('Error with payment method please select different payment method.');
$this->_logger->critical($errorMsg); $this->logger->critical($errorMsg);
$errorMessages[] = $errorMsg; $errorMessages[] = $errorMsg;
} }
......
...@@ -139,9 +139,11 @@ class PaymentMethods extends AbstractHelper ...@@ -139,9 +139,11 @@ class PaymentMethods extends AbstractHelper
{ {
$paymentMethods = []; $paymentMethods = [];
$ccEnabled = $this->_config->getValue('payment/'.\Adyen\Payment\Model\Method\Cc::METHOD_CODE.'/active'); $ccEnabled = $this->_config->getValue('payment/'.\Adyen\Payment\Model\Ui\AdyenCcConfigProvider::CODE.'/active');
$ccTypes = array_keys($this->_adyenHelper->getCcTypesAltData()); $ccTypes = array_keys($this->_adyenHelper->getCcTypesAltData());
$sepaEnabled = $this->_config->getValue('payment/'.\Adyen\Payment\Model\Method\Sepa::METHOD_CODE.'/active'); $sepaEnabled = $this->_config->getValue(
'payment/'.\Adyen\Payment\Model\Ui\AdyenSepaConfigProvider::CODE.'/active'
);
foreach ($this->_fetchHppMethods($store, $country) as $methodCode => $methodData) { foreach ($this->_fetchHppMethods($store, $country) as $methodCode => $methodData) {
/* /*
...@@ -162,6 +164,7 @@ class PaymentMethods extends AbstractHelper ...@@ -162,6 +164,7 @@ class PaymentMethods extends AbstractHelper
/** /**
* @param $store * @param $store
* @param $country
* @return array * @return array
*/ */
protected function _fetchHppMethods($store, $country) protected function _fetchHppMethods($store, $country)
...@@ -240,6 +243,7 @@ class PaymentMethods extends AbstractHelper ...@@ -240,6 +243,7 @@ class PaymentMethods extends AbstractHelper
return 10; return 10;
} }
/** /**
* @param $store * @param $store
* @return mixed * @return mixed
......
...@@ -47,11 +47,8 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface ...@@ -47,11 +47,8 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
* @var string[] * @var string[]
*/ */
protected $_methodCodes = [ protected $_methodCodes = [
\Adyen\Payment\Model\Method\Cc::METHOD_CODE,
\Adyen\Payment\Model\Method\Hpp::METHOD_CODE, \Adyen\Payment\Model\Method\Hpp::METHOD_CODE,
\Adyen\Payment\Model\Method\Oneclick::METHOD_CODE,
\Adyen\Payment\Model\Method\Pos::METHOD_CODE, \Adyen\Payment\Model\Method\Pos::METHOD_CODE,
// \Adyen\Payment\Model\Method\Sepa::METHOD_CODE,
\Adyen\Payment\Model\Method\Boleto::METHOD_CODE \Adyen\Payment\Model\Method\Boleto::METHOD_CODE
]; ];
......
...@@ -151,26 +151,7 @@ class PaymentRequest extends DataObject ...@@ -151,26 +151,7 @@ class PaymentRequest extends DataObject
// set the recurring type // set the recurring type
$recurringContractType = null; $recurringContractType = null;
if ($recurringType) { if ($recurringType) {
if ($paymentMethodCode == \Adyen\Payment\Model\Method\Oneclick::METHOD_CODE) { $recurringContractType = $recurringType;
/*
* For ONECLICK look at the recurringPaymentType that the merchant
* has selected in Adyen ONECLICK settings
*/
if ($payment->getAdditionalInformation('customer_interaction')) {
$recurringContractType = \Adyen\Payment\Model\RecurringType::ONECLICK;
} else {
$recurringContractType = \Adyen\Payment\Model\RecurringType::RECURRING;
}
} else if ($paymentMethodCode == \Adyen\Payment\Model\Method\Cc::METHOD_CODE) {
if ($payment->getAdditionalInformation("store_cc") == "" &&
($recurringType == "ONECLICK,RECURRING" || $recurringType == "RECURRING")) {
$recurringContractType = \Adyen\Payment\Model\RecurringType::RECURRING;
} elseif ($payment->getAdditionalInformation("store_cc") == "1") {
$recurringContractType = $recurringType;
}
} else {
$recurringContractType = $recurringType;
}
} }
if ($recurringContractType) { if ($recurringContractType) {
...@@ -225,31 +206,8 @@ class PaymentRequest extends DataObject ...@@ -225,31 +206,8 @@ class PaymentRequest extends DataObject
$recurringDetailReference = null; $recurringDetailReference = null;
// define the shopper interaction // define the shopper interaction
if ($this->_appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE && $shopperInteraction = "Ecommerce";
$paymentMethodCode == \Adyen\Payment\Model\Method\Cc::METHOD_CODE &&
$enableMoto) {
// if MOTO for backend is enabled use MOTO as shopper interaction type
$shopperInteraction = "Moto";
} else if ($paymentMethodCode == \Adyen\Payment\Model\Method\Oneclick::METHOD_CODE) {
$recurringDetailReference = $payment->getAdditionalInformation("recurring_detail_reference");
if ($payment->getAdditionalInformation('customer_interaction')) {
$shopperInteraction = "Ecommerce";
} else {
$shopperInteraction = "ContAuth";
}
/*
* For recurring Ideal and Sofort needs to be converted to SEPA
* for this it is mandatory to set selectBrand to sepadirectdebit
*/
if (!$payment->getAdditionalInformation('customer_interaction')) {
if ($payment->getCcType() == "directEbanking" || $payment->getCcType() == "ideal") {
$request['selectedBrand'] = "sepadirectdebit";
}
}
} else {
$shopperInteraction = "Ecommerce";
}
if ($shopperInteraction) { if ($shopperInteraction) {
$request['shopperInteraction'] = $shopperInteraction; $request['shopperInteraction'] = $shopperInteraction;
...@@ -264,43 +222,7 @@ class PaymentRequest extends DataObject ...@@ -264,43 +222,7 @@ class PaymentRequest extends DataObject
$request['selectedBrand'] = "sepadirectdebit"; $request['selectedBrand'] = "sepadirectdebit";
} }
if ($paymentMethodCode == \Adyen\Payment\Model\Method\Cc::METHOD_CODE || if ($paymentMethodCode == \Adyen\Payment\Model\Method\Boleto::METHOD_CODE) {
$paymentMethodCode == \Adyen\Payment\Model\Method\Oneclick::METHOD_CODE) {
// If cse is enabled add encrypted card date into request
if ($this->_adyenHelper->getAdyenCcConfigDataFlag('cse_enabled', $storeId)) {
$request['additionalData']['card.encrypted.json'] =
$payment->getAdditionalInformation("encrypted_data");
} else {
$requestCreditCardDetails = [
"expiryMonth" => $payment->getCcExpMonth(),
"expiryYear" => $payment->getCcExpYear(),
"holderName" => $payment->getCcOwner(),
"number" => $payment->getCcNumber(),
"cvc" => $payment->getCcCid(),
];
$cardDetails['card'] = $requestCreditCardDetails;
$request = array_merge($request, $cardDetails);
}
// if installments is set add it into the request
if ($payment->getAdditionalInformation('number_of_installments') &&
$payment->getAdditionalInformation('number_of_installments') > 0) {
$request['installments']['value'] = $payment->getAdditionalInformation('number_of_installments');
}
} elseif ($paymentMethodCode == \Adyen\Payment\Model\Method\Sepa::METHOD_CODE) {
// set brand to sepa
$request['selectedBrand'] = "sepadirectdebit";
// add bankDetails into request
$bankAccount = [
'iban' => $payment->getAdditionalInformation("iban"),
'ownerName' => $payment->getAdditionalInformation("account_name"),
'countryCode' => $payment->getAdditionalInformation("country")
];
$request['bankAccount'] = $bankAccount;
} elseif ($paymentMethodCode == \Adyen\Payment\Model\Method\Boleto::METHOD_CODE) {
$request['socialSecurityNumber'] = $payment->getAdditionalInformation("social_security_number"); $request['socialSecurityNumber'] = $payment->getAdditionalInformation("social_security_number");
......
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Model\Method;
/**
* Adyen CreditCard payment method
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
* @SuppressWarnings(PHPMD.TooManyFields)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Cc extends \Magento\Payment\Model\Method\Cc
{
const METHOD_CODE = 'adyen_cc';
/**
* Payment Method feature
*
* @var bool
*/
protected $_canAuthorize = true;
/**
* @var bool
*/
protected $_canCapture = true;
/**
* @var bool
*/
protected $_canCapturePartial = true;
/**
* @var bool
*/
protected $_canCaptureOnce = true;
/**
* @var bool
*/
protected $_canRefund = true;
/**
* @var bool
*/
protected $_canRefundInvoicePartial = true;
/**
* @var bool
*/
protected $_isGateway = true;
/**
* @var string
*/
protected $_code = self::METHOD_CODE;
/**
* @var string
*/
protected $_formBlockType = 'Adyen\Payment\Block\Form\Cc';
/**
* @var string
*/
protected $_infoBlockType = 'Adyen\Payment\Block\Info\Cc';
/**
* @var \Adyen\Payment\Model\Api\PaymentRequest
*/
protected $_paymentRequest;
/**
* @var \Magento\Framework\UrlInterface
*/
protected $_urlBuilder;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected $_adyenHelper;
/**
* Request object
*
* @var \Magento\Framework\App\RequestInterface
*/
protected $_request;
/**
* Cc constructor.
*
* @param \Magento\Framework\App\RequestInterface $request
* @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest
* @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
* @param \Magento\Payment\Helper\Data $paymentData
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Payment\Model\Method\Logger $logger
* @param \Magento\Framework\Module\ModuleListInterface $moduleList
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
* @param array $data
*/
public function __construct(
\Magento\Framework\App\RequestInterface $request,
\Adyen\Payment\Model\Api\PaymentRequest $paymentRequest,
\Magento\Framework\UrlInterface $urlBuilder,
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
\Magento\Framework\Api\AttributeValueFactory $customAttributeFactory,
\Magento\Payment\Helper\Data $paymentData,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Payment\Model\Method\Logger $logger,
\Magento\Framework\Module\ModuleListInterface $moduleList,
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
parent::__construct(
$context,
$registry,
$extensionFactory,
$customAttributeFactory,
$paymentData,
$scopeConfig,
$logger,
$moduleList,
$localeDate,
$resource,
$resourceCollection,
$data
);
$this->_paymentRequest = $paymentRequest;
$this->_urlBuilder = $urlBuilder;
$this->_adyenHelper = $adyenHelper;
$this->_request = $request;
}
/**
* @var string
*/
protected $_paymentMethodType = 'api';
/**
* @return string
*/
public function getPaymentMethodType()
{
return $this->_paymentMethodType;
}
/**
* Assign data to info model instance
*
* @param \Magento\Framework\DataObject|mixed $data
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function assignData(\Magento\Framework\DataObject $data)
{
parent::assignData($data);
if (!$data instanceof \Magento\Framework\DataObject) {
$data = new \Magento\Framework\DataObject($data);
}
$additionalData = $data->getAdditionalData();
$infoInstance = $this->getInfoInstance();
if (isset($additionalData['cc_type'])) {
$infoInstance->setCcType($additionalData['cc_type']);
}
if ($this->_adyenHelper->getAdyenCcConfigDataFlag('cse_enabled')) {
if (isset($additionalData['encrypted_data'])) {
$infoInstance->setAdditionalInformation('encrypted_data', $additionalData['encrypted_data']);
} else {
throw new \Magento\Framework\Exception\LocalizedException(__('Card encryption failed'));
}
}
// set number of installements
if (isset($additionalData['number_of_installments'])) {
$infoInstance->setAdditionalInformation('number_of_installments', $additionalData['number_of_installments']);
}
// save value remember details checkbox
if (isset($additionalData['store_cc'])) {
$infoInstance->setAdditionalInformation('store_cc', $additionalData['store_cc']);
}
return $this;
}
/**
* Validate payment method information object
*
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)authorize
*/
public function validate()
{
// validation only possible on front-end for CSE script
return $this;
}
/**
* @param \Magento\Payment\Model\InfoInterface $payment
* @param float $amount
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function authorize(\Magento\Payment\Model\InfoInterface $payment, $amount)
{
if (!$this->canAuthorize()) {
throw new \Magento\Framework\Exception\LocalizedException(__('The authorize action is not available.'));
}
/*
* do not send order confirmation mail after order creation wait for
* Adyen AUTHORIISATION notification
*/
$order = $payment->getOrder();
$order->setCanSendNewEmailFlag(false);
// do not let magento set status to processing
$payment->setLastTransId($this->getTransactionId())->setIsTransactionPending(true);
// DO authorisation
$this->_processRequest($payment, $amount, "authorise");
return $this;
}
/**
* @param \Magento\Sales\Model\Order\Payment $payment
* @param $amount
* @param $request
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function _processRequest(\Magento\Sales\Model\Order\Payment $payment, $amount, $request)
{
switch ($request) {
case "authorise":
try {
$response = $this->_paymentRequest->fullApiRequest($payment, $this->_code);
} catch (\Adyen\AdyenException $e) {
$errorMsg = __('Error with payment method please select different payment method.');
$this->_logger->critical($e->getMessage());
throw new \Magento\Framework\Exception\LocalizedException(__($errorMsg));
}
break;
}
if (!empty($response)) {
$this->_processResponse($payment, $response);
} else {
throw new \Magento\Framework\Exception\LocalizedException(__('Empty result.'));
}
}
/**
* @param \Magento\Payment\Model\InfoInterface $payment
* @param $response
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function _processResponse(\Magento\Payment\Model\InfoInterface $payment, $response)
{
$payment->setAdditionalInformation('3dActive', false);
switch ($response['resultCode']) {
case "Authorised":
$this->_addStatusHistory($payment, $response['resultCode'], $response['pspReference']);
$payment->setAdditionalInformation('pspReference', $response['pspReference']);
break;
case "RedirectShopper":
// 3d is active so set the param to true checked in Controller/Validate3d
$payment->setAdditionalInformation('3dActive', true);
$issuerUrl = $response['issuerUrl'];
$paReq = $response['paRequest'];
$md = $response['md'];
if (!empty($paReq) && !empty($md) && !empty($issuerUrl)) {
$payment->setAdditionalInformation('issuerUrl', $response['issuerUrl']);
$payment->setAdditionalInformation('paRequest', $response['paRequest']);
$payment->setAdditionalInformation('md', $response['md']);
} else {
throw new \Magento\Framework\Exception\LocalizedException(__('3D secure is not valid'));
}
break;
case "Refused":
// refusalReason
if ($response['refusalReason']) {
$refusalReason = $response['refusalReason'];
switch($refusalReason) {
case "Transaction Not Permitted":
$errorMsg = __('The transaction is not permitted.');
break;
case "CVC Declined":
$errorMsg = __('Declined due to the Card Security Code(CVC) being incorrect. Please check your CVC code!');
break;
case "Restricted Card":
$errorMsg = __('The card is restricted.');
break;
case "803 PaymentDetail not found":
$errorMsg = __('The payment is REFUSED because the saved card is removed. Please try an other payment method.');
break;
case "Expiry month not set":
$errorMsg = __('The expiry month is not set. Please check your expiry month!');
break;
default:
$errorMsg = __('The payment is REFUSED.');
break;
}
} else {
$errorMsg = __('The payment is REFUSED.');
}
if ($errorMsg) {
$this->_logger->critical($errorMsg);
throw new \Magento\Framework\Exception\LocalizedException(__($errorMsg));
}
break;
default:
$errorMsg = __('Error with payment method please select different payment method.');
$this->_logger->critical($errorMsg);
throw new \Magento\Framework\Exception\LocalizedException(__($errorMsg));
break;
}
}
/**
* @param $payment
* @param $responseCode
* @param $pspReference
* @return $this
*/
protected function _addStatusHistory($payment, $responseCode, $pspReference)
{
$type = 'Adyen Result URL response:';
$comment = __('%1 <br /> authResult: %2 <br /> pspReference: %3 <br /> paymentMethod: %4',
$type, $responseCode, $pspReference, "");
$payment->getOrder()->setAdyenResulturlEventCode($responseCode);
$payment->getOrder()->addStatusHistoryComment($comment);
return $this;
}
/**
* Called by validate3d controller when cc payment has 3D secure
*
* @param $payment
* @return mixed
* @throws \Exception
*/
public function authorise3d($payment)
{
try {
$response = $this->_paymentRequest->authorise3d($payment);
} catch(\Exception $e) {
throw $e;
}
$responseCode = $response['resultCode'];
return $responseCode;
}
/**
* Checkout redirect URL getter for onepage checkout (hardcode)
*
* @see \Magento\Checkout\Controller\Onepage::savePaymentAction()
* @see \Magento\Quote\Model\Quote\Payment::getCheckoutRedirectUrl()
* @return string
*/
public function getCheckoutRedirectUrl()
{
return $this->_urlBuilder->getUrl('adyen/process/validate3d/', ['_secure' => $this->_getRequest()->isSecure()]);
}
/**
* Capture on Adyen
*
* @param \Magento\Payment\Model\InfoInterface $payment
* @param float $amount
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount)
{
parent::capture($payment, $amount);
$this->_paymentRequest->capture($payment, $amount);
return $this;
}
/**
* Refund specified amount for payment
*
* @param \Magento\Payment\Model\InfoInterface $payment
* @param float $amount
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function refund(\Magento\Payment\Model\InfoInterface $payment, $amount)
{
parent::refund($payment, $amount);
$order = $payment->getOrder();
/*
* if amount is a full refund send a refund/cancelled request so
* if it is not captured yet it will cancel the order
*/
$grandTotal = $order->getGrandTotal();
if ($grandTotal == $amount) {
$this->_paymentRequest->cancelOrRefund($payment);
} else {
$this->_paymentRequest->refund($payment, $amount);
}
return $this;
}
/**
* Retrieve request object
*
* @return \Magento\Framework\App\RequestInterface
*/
protected function _getRequest()
{
return $this->_request;
}
}
\ No newline at end of file
...@@ -301,7 +301,7 @@ class Pos extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa ...@@ -301,7 +301,7 @@ class Pos extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
$shopperEmail = $order->getCustomerEmail(); $shopperEmail = $order->getCustomerEmail();
$customerId = $order->getCustomerId(); $customerId = $order->getCustomerId();
$callbackUrl = $this->_urlBuilder->getUrl('adyen/process/resultpos', $callbackUrl = $this->_urlBuilder->getUrl('adyen/process/resultpos',
['_secure' => $this->_getRequest()->isSecure()]); ['_secure' => $this->_getRequest()->isSecure()]);
$addReceiptOrderLines = $this->_adyenHelper->getAdyenPosConfigData("add_receipt_order_lines"); $addReceiptOrderLines = $this->_adyenHelper->getAdyenPosConfigData("add_receipt_order_lines");
$recurringContract = $this->_adyenHelper->getAdyenPosConfigData('recurring_type'); $recurringContract = $this->_adyenHelper->getAdyenPosConfigData('recurring_type');
$currencyCode = $orderCurrencyCode; $currencyCode = $orderCurrencyCode;
...@@ -313,7 +313,7 @@ class Pos extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa ...@@ -313,7 +313,7 @@ class Pos extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
$recurringParams = ""; $recurringParams = "";
if ($order->getPayment()->getAdditionalInformation("store_cc") != "") { if ($order->getPayment()->getAdditionalInformation("store_cc") != "") {
$recurringParams = "&recurringContract=" . urlencode($recurringContract) . "&shopperReference=" . $recurringParams = "&recurringContract=" . urlencode($recurringContract) . "&shopperReference=" .
urlencode($shopperReference) . "&shopperEmail=" . urlencode($shopperEmail); urlencode($shopperReference) . "&shopperEmail=" . urlencode($shopperEmail);
} }
$receiptOrderLines = ""; $receiptOrderLines = "";
...@@ -331,7 +331,11 @@ class Pos extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa ...@@ -331,7 +331,11 @@ class Pos extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
"&currency=".$currencyCode."&merchantReference=".$merchantReference. $recurringParams . "&currency=".$currencyCode."&merchantReference=".$merchantReference. $recurringParams .
$receiptOrderLines . "&callback=".$callbackUrl . $extraParamaters; $receiptOrderLines . "&callback=".$callbackUrl . $extraParamaters;
$this->_adyenLogger->debug(print_r($launchlink, true)); // cash not working see ticket
// https://youtrack.is.adyen.com/issue/IOS-130#comment=102-20285
// . "&transactionType=CASH";
$this->_adyenLogger->addAdyenDebug(print_r($launchlink, true));
return $launchlink; return $launchlink;
} }
......
...@@ -21,21 +21,17 @@ ...@@ -21,21 +21,17 @@
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
namespace Adyen\Payment\Model; namespace Adyen\Payment\Model\Ui;
use Magento\Payment\Model\CcGenericConfigProvider; use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Payment\Helper\Data as PaymentHelper; use Magento\Payment\Helper\Data as PaymentHelper;
use Magento\Framework\View\Asset\Source as Source; use Magento\Framework\View\Asset\Source as Source;
use \Magento\Payment\Gateway\Config\Config as Config;
class AdyenCcConfigProvider extends CcGenericConfigProvider class AdyenCcConfigProvider implements ConfigProviderInterface
{ {
/** const CODE = 'adyen_cc';
* @var string[]
*/
protected $_methodCodes = [
\Adyen\Payment\Model\Method\Cc::METHOD_CODE
];
/** /**
* @var PaymentHelper * @var PaymentHelper
...@@ -52,24 +48,49 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider ...@@ -52,24 +48,49 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider
*/ */
protected $_assetSource; protected $_assetSource;
/**
* Request object
*
* @var \Magento\Framework\App\RequestInterface
*/
protected $_request;
/**
* @var \Magento\Framework\UrlInterface
*/
protected $_urlBuilder;
/**
* @var \Magento\Payment\Model\CcConfig
*/
private $ccConfig;
/** /**
* AdyenCcConfigProvider constructor. * AdyenCcConfigProvider constructor.
* *
* @param \Magento\Payment\Model\CcConfig $ccConfig
* @param PaymentHelper $paymentHelper * @param PaymentHelper $paymentHelper
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\App\RequestInterface $request
* @param \Magento\Framework\UrlInterface $urlBuilder
* @param Source $assetSource * @param Source $assetSource
* @param \Magento\Payment\Model\CcConfig $ccConfig
* @param Config $config
*/ */
public function __construct( public function __construct(
\Magento\Payment\Model\CcConfig $ccConfig,
PaymentHelper $paymentHelper, PaymentHelper $paymentHelper,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
Source $assetSource \Magento\Framework\App\RequestInterface $request,
\Magento\Framework\UrlInterface $urlBuilder,
Source $assetSource,
\Magento\Payment\Model\CcConfig $ccConfig
) { ) {
parent::__construct($ccConfig, $paymentHelper, $this->_methodCodes);
$this->_paymentHelper = $paymentHelper; $this->_paymentHelper = $paymentHelper;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_request = $request;
$this->_urlBuilder = $urlBuilder;
$this->_assetSource = $assetSource; $this->_assetSource = $assetSource;
$this->ccConfig = $ccConfig;
} }
/** /**
...@@ -77,47 +98,65 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider ...@@ -77,47 +98,65 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider
*/ */
public function getConfig() public function getConfig()
{ {
$config = parent::getConfig(); // set to active
$config = [
'payment' => [
self::CODE => [
'isActive' => true,
'redirectUrl' => $this->_urlBuilder->getUrl(
'adyen/process/validate3d/', ['_secure' => $this->_getRequest()->isSecure()])
]
]
];
foreach ($this->_methodCodes as $code) { $methodCode = self::CODE;
if ($this->methods[$code]->isAvailable()) {
$demoMode = $this->_adyenHelper->getAdyenAbstractConfigDataFlag('demo_mode'); $config = array_merge_recursive($config, [
'payment' => [
'ccform' => [
'availableTypes' => [$methodCode => $this->getCcAvailableTypes($methodCode)],
'months' => [$methodCode => $this->getCcMonths()],
'years' => [$methodCode => $this->getCcYears()],
'hasVerification' => [$methodCode => $this->hasVerification($methodCode)],
'cvvImageUrl' => [$methodCode => $this->getCvvImageUrl()]
]
]
]);
if ($demoMode) { $demoMode = $this->_adyenHelper->getAdyenAbstractConfigDataFlag('demo_mode');
$cseKey = $this->_adyenHelper->getAdyenCcConfigData('cse_publickey_test');
} else {
$cseKey = $this->_adyenHelper->getAdyenCcConfigData('cse_publickey_live');
}
$cseEnabled = $this->_adyenHelper->getAdyenCcConfigDataFlag('cse_enabled'); if ($demoMode) {
$cseKey = $this->_adyenHelper->getAdyenCcConfigData('cse_publickey_test');
} else {
$cseKey = $this->_adyenHelper->getAdyenCcConfigData('cse_publickey_live');
}
$recurringType = $this->_adyenHelper->getAdyenAbstractConfigData('recurring_type'); $cseEnabled = $this->_adyenHelper->getAdyenCcConfigDataFlag('cse_enabled');
$canCreateBillingAgreement = false;
if ($recurringType == "ONECLICK" || $recurringType == "ONECLICK,RECURRING") {
$canCreateBillingAgreement = true;
}
$config['payment'] ['adyenCc']['cseKey'] = $cseKey; $recurringType = $this->_adyenHelper->getAdyenAbstractConfigData('recurring_type');
$config['payment'] ['adyenCc']['cseEnabled'] = $cseEnabled; $canCreateBillingAgreement = false;
$config['payment'] ['adyenCc']['cseEnabled'] = $cseEnabled; if ($recurringType == "ONECLICK" || $recurringType == "ONECLICK,RECURRING") {
$config['payment']['adyenCc']['generationTime'] = date("c"); $canCreateBillingAgreement = true;
$config['payment']['adyenCc']['canCreateBillingAgreement'] = $canCreateBillingAgreement; }
$config['payment']['adyenCc']['icons'] = $this->getIcons();
$config['payment'] ['adyenCc']['cseKey'] = $cseKey;
// has installments by default false $config['payment'] ['adyenCc']['cseEnabled'] = $cseEnabled;
$config['payment']['adyenCc']['hasInstallments'] = false; $config['payment'] ['adyenCc']['cseEnabled'] = $cseEnabled;
$config['payment']['adyenCc']['generationTime'] = date("c");
// get Installments $config['payment']['adyenCc']['canCreateBillingAgreement'] = $canCreateBillingAgreement;
$installments = $this->_adyenHelper->getAdyenCcConfigData('installments'); $config['payment']['adyenCc']['icons'] = $this->getIcons();
if ($installments) { // has installments by default false
$config['payment']['adyenCc']['installments'] = unserialize($installments); $config['payment']['adyenCc']['hasInstallments'] = false;
$config['payment']['adyenCc']['hasInstallments'] = true;
} else { // get Installments
$config['payment']['adyenCc']['installments'] = []; $installments = $this->_adyenHelper->getAdyenCcConfigData('installments');
}
} if ($installments) {
$config['payment']['adyenCc']['installments'] = unserialize($installments);
$config['payment']['adyenCc']['hasInstallments'] = true;
} else {
$config['payment']['adyenCc']['installments'] = [];
} }
return $config; return $config;
...@@ -133,7 +172,7 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider ...@@ -133,7 +172,7 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider
{ {
$types = []; $types = [];
$ccTypes = $this->_adyenHelper->getAdyenCcTypes(); $ccTypes = $this->_adyenHelper->getAdyenCcTypes();
$availableTypes = $this->methods[$methodCode]->getConfigData('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) {
...@@ -171,4 +210,55 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider ...@@ -171,4 +210,55 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider
} }
return $icons; return $icons;
} }
/**
* Retrieve credit card expire months
*
* @return array
*/
protected function getCcMonths()
{
return $this->ccConfig->getCcMonths();
}
/**
* Retrieve credit card expire years
*
* @return array
*/
protected function getCcYears()
{
return $this->ccConfig->getCcYears();
}
/**
* Has verification is always true
*
* @return bool
*/
protected function hasVerification()
{
return $this->_adyenHelper->getAdyenCcConfigData('useccv');
}
/**
* Retrieve CVV tooltip image url
*
* @return string
*/
protected function getCvvImageUrl()
{
return $this->ccConfig->getCvvImageUrl();
}
/**
* Retrieve request object
*
* @return \Magento\Framework\App\RequestInterface
*/
protected function _getRequest()
{
return $this->_request;
}
} }
\ No newline at end of file
...@@ -21,40 +21,31 @@ ...@@ -21,40 +21,31 @@
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
namespace Adyen\Payment\Model; namespace Adyen\Payment\Model\Ui;
use Magento\Payment\Model\CcGenericConfigProvider; use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Payment\Helper\Data as PaymentHelper; use Magento\Payment\Helper\Data as PaymentHelper;
class AdyenOneclickConfigProvider extends CcGenericConfigProvider class AdyenOneclickConfigProvider implements ConfigProviderInterface
{ {
const CODE = 'adyen_oneclick';
/** /**
* @var Config * @var Config
*/ */
protected $config; protected $config;
/**
* @var string[]
*/
protected $_methodCodes = [
\Adyen\Payment\Model\Method\Oneclick::METHOD_CODE
];
/** /**
* @var \Magento\Payment\Model\Method\AbstractMethod[] * @var \Adyen\Payment\Helper\Data
*/
protected $methods = [];
/**
* @var PaymentHelper
*/ */
protected $_paymentHelper; protected $_adyenHelper;
/** /**
* @var \Adyen\Payment\Helper\Data * @var \Magento\Framework\App\RequestInterface
*/ */
protected $_adyenHelper; protected $_request;
/** /**
* @var \Magento\Customer\Model\Session * @var \Magento\Customer\Model\Session
...@@ -67,42 +58,46 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider ...@@ -67,42 +58,46 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
protected $_session; protected $_session;
/** /**
* @var \Magento\Framework\App\State * @var \Magento\Store\Model\StoreManagerInterface
*/ */
protected $_appState; protected $_storeManager;
/** /**
* @var \Magento\Store\Model\StoreManagerInterface * @var \Magento\Framework\UrlInterface
*/ */
protected $_storeManager; protected $_urlBuilder;
/**
* @var \Magento\Payment\Model\CcConfig
*/
private $ccConfig;
/** /**
* AdyenOneclickConfigProvider constructor. * AdyenOneclickConfigProvider constructor.
* *
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Payment\Model\CcConfig $ccConfig
* @param PaymentHelper $paymentHelper
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @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
*/ */
public function __construct( public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Payment\Model\CcConfig $ccConfig,
PaymentHelper $paymentHelper,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\App\RequestInterface $request,
\Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\Session $customerSession,
\Magento\Checkout\Model\Session $session, \Magento\Checkout\Model\Session $session,
\Magento\Store\Model\StoreManagerInterface $storeManager \Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\UrlInterface $urlBuilder,
\Magento\Payment\Model\CcConfig $ccConfig
) { ) {
parent::__construct($ccConfig, $paymentHelper, $this->_methodCodes);
$this->_paymentHelper = $paymentHelper;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_request = $request;
$this->_customerSession = $customerSession; $this->_customerSession = $customerSession;
$this->_session = $session; $this->_session = $session;
$this->_appState = $context->getAppState();
$this->_storeManager = $storeManager; $this->_storeManager = $storeManager;
$this->_urlBuilder = $urlBuilder;
$this->ccConfig = $ccConfig;
} }
/** /**
...@@ -110,7 +105,30 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider ...@@ -110,7 +105,30 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
*/ */
public function getConfig() public function getConfig()
{ {
$config = parent::getConfig(); // set to active
$config = [
'payment' => [
self::CODE => [
'isActive' => true,
'redirectUrl' => $this->_urlBuilder->getUrl(
'adyen/process/validate3d/', ['_secure' => $this->_getRequest()->isSecure()])
]
]
];
$methodCode = self::CODE;
$config = array_merge_recursive($config, [
'payment' => [
'ccform' => [
'availableTypes' => [$methodCode => $this->getCcAvailableTypes($methodCode)],
'months' => [$methodCode => $this->getCcMonths()],
'years' => [$methodCode => $this->getCcYears()],
'hasVerification' => [$methodCode => $this->hasVerification($methodCode)],
'cvvImageUrl' => [$methodCode => $this->getCvvImageUrl()]
]
]
]);
$demoMode = $this->_adyenHelper->getAdyenAbstractConfigDataFlag('demo_mode'); $demoMode = $this->_adyenHelper->getAdyenAbstractConfigDataFlag('demo_mode');
...@@ -134,19 +152,15 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider ...@@ -134,19 +152,15 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
$config['payment']['adyenOneclick']['generationTime'] = date("c"); $config['payment']['adyenOneclick']['generationTime'] = date("c");
$config['payment']['adyenOneclick']['canCreateBillingAgreement'] = $canCreateBillingAgreement; $config['payment']['adyenOneclick']['canCreateBillingAgreement'] = $canCreateBillingAgreement;
foreach ($this->_methodCodes as $code) { $recurringContractType = $this->_getRecurringContractType();
if ($this->methods[$code]->isAvailable()) {
$recurringContractType = $this->_getRecurringContractType();
$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;
} }
...@@ -163,7 +177,12 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider ...@@ -163,7 +177,12 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
$grandTotal = $this->_getQuote()->getGrandTotal(); $grandTotal = $this->_getQuote()->getGrandTotal();
$recurringType = $this->_getRecurringContractType(); $recurringType = $this->_getRecurringContractType();
$billingAgreements = $this->_adyenHelper->getOneClickPaymentMethods($customerId, $storeId, $grandTotal, $recurringType); $billingAgreements = $this->_adyenHelper->getOneClickPaymentMethods(
$customerId,
$storeId,
$grandTotal,
$recurringType
);
} }
return $billingAgreements; return $billingAgreements;
} }
...@@ -183,4 +202,80 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider ...@@ -183,4 +202,80 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
{ {
return $this->_session->getQuote(); return $this->_session->getQuote();
} }
/**
* Retrieve availables credit card types
*
* @param string $methodCode
* @return array
*/
protected function getCcAvailableTypes($methodCode)
{
$types = [];
$ccTypes = $this->_adyenHelper->getAdyenCcTypes();
$availableTypes = $this->_adyenHelper->getAdyenCcConfigData('cctypes');
if ($availableTypes) {
$availableTypes = explode(',', $availableTypes);
foreach (array_keys($ccTypes) as $code) {
if (in_array($code, $availableTypes)) {
$types[$code] = $ccTypes[$code]['name'];
}
}
}
return $types;
}
/**
* Retrieve credit card expire months
*
* @return array
*/
protected function getCcMonths()
{
return $this->ccConfig->getCcMonths();
}
/**
* Retrieve credit card expire years
*
* @return array
*/
protected function getCcYears()
{
return $this->ccConfig->getCcYears();
}
/**
* Has verification is always true
*
* @return bool
*/
protected function hasVerification()
{
return $this->_adyenHelper->getAdyenCcConfigData('useccv');
}
/**
* Retrieve CVV tooltip image url
*
* @return string
*/
protected function getCvvImageUrl()
{
return $this->ccConfig->getCvvImageUrl();
}
/**
* Retrieve request object
*
* @return \Magento\Framework\App\RequestInterface
*/
protected function _getRequest()
{
return $this->_request;
}
} }
\ 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>
*/
namespace Adyen\Payment\Observer;
use Magento\Framework\Event\Observer;
use Magento\Payment\Observer\AbstractDataAssignObserver;
use Magento\Quote\Api\Data\PaymentInterface;
/**
* Class DataAssignObserver
*/
class AdyenCcDataAssignObserver extends AbstractDataAssignObserver
{
const CC_TYPE = 'cc_type';
const ENCRYPTED_DATA = 'encrypted_data';
const NUMBER_OF_INSTALLMENTS = 'number_of_installments';
const STORE_CC = 'store_cc';
/**
* @var array
*/
protected $additionalInformationList = [
self::CC_TYPE,
self::ENCRYPTED_DATA,
self::NUMBER_OF_INSTALLMENTS,
self::STORE_CC
];
/**
* @param Observer $observer
* @return void
*/
public function execute(Observer $observer)
{
$data = $this->readDataArgument($observer);
$additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA);
if (!is_array($additionalData)) {
return;
}
$paymentInfo = $this->readPaymentModelArgument($observer);
// set ccType
$paymentInfo->setCcType($additionalData['cc_type']);
foreach ($this->additionalInformationList as $additionalInformationKey) {
if (isset($additionalData[$additionalInformationKey])) {
$paymentInfo->setAdditionalInformation(
$additionalInformationKey,
$additionalData[$additionalInformationKey]
);
}
}
}
}
...@@ -20,87 +20,95 @@ ...@@ -20,87 +20,95 @@
* *
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
namespace Adyen\Payment\Observer;
namespace Adyen\Payment\Model\Method; use Magento\Framework\Event\Observer;
use Magento\Framework\Webapi\Exception; use Magento\Payment\Observer\AbstractDataAssignObserver;
use Magento\Quote\Api\Data\PaymentInterface;
/** /**
* Adyen CreditCard payment method * Class DataAssignObserver
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
* @SuppressWarnings(PHPMD.TooManyFields)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/ */
class Oneclick extends \Adyen\Payment\Model\Method\Cc class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver
{ {
const METHOD_CODE = 'adyen_oneclick'; const RECURRING_DETAIL_REFERENCE = 'recurring_detail_reference';
const ENCRYPTED_DATA = 'encrypted_data';
const NUMBER_OF_INSTALLMENTS = 'number_of_installments';
/** /**
* @var string * @var array
*/ */
protected $_code = self::METHOD_CODE; protected $additionalInformationList = [
self::RECURRING_DETAIL_REFERENCE,
self::ENCRYPTED_DATA,
self::NUMBER_OF_INSTALLMENTS
];
/** /**
* @var string * @var \Adyen\Payment\Helper\Data
*/ */
protected $_formBlockType = 'Adyen\Payment\Block\Form\Oneclick'; private $adyenHelper;
/** /**
* @var string * @var \Magento\Framework\App\State
*/ */
protected $_infoBlockType = 'Adyen\Payment\Block\Info\Oneclick'; private $appState;
/** /**
* Assign data to info model instance * AdyenCcDataAssignObserver constructor.
* * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\DataObject|mixed $data */
* @return $this public function __construct(
* @throws \Magento\Framework\Exception\LocalizedException \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\Model\Context $context
) {
$this->adyenHelper = $adyenHelper;
$this->appState = $context->getAppState();
}
/**
* @param Observer $observer
* @return void
*/ */
public function assignData(\Magento\Framework\DataObject $data) public function execute(Observer $observer)
{ {
$data = $this->readDataArgument($observer);
if (!$data instanceof \Magento\Framework\DataObject) { $additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA);
$data = new \Magento\Framework\DataObject($data); if (!is_array($additionalData)) {
return;
} }
$additionalData = $data->getAdditionalData(); $paymentInfo = $this->readPaymentModelArgument($observer);
$infoInstance = $this->getInfoInstance();
// get from variant magento code for creditcard type and set this in ccType // set ccType
$variant = $additionalData['variant']; $variant = $additionalData['variant'];
$ccType = $this->_adyenHelper->getMagentoCreditCartType($variant); $ccType = $this->adyenHelper->getMagentoCreditCartType($variant);
$infoInstance->setCcType($ccType); $paymentInfo->setCcType($ccType);
// save value remember details checkbox foreach ($this->additionalInformationList as $additionalInformationKey) {
$infoInstance->setAdditionalInformation('recurring_detail_reference', if (isset($additionalData[$additionalInformationKey])) {
$additionalData['recurring_detail_reference']); $paymentInfo->setAdditionalInformation(
$additionalInformationKey,
$recurringPaymentType = $this->getRecurringPaymentType(); $additionalData[$additionalInformationKey]
if ($recurringPaymentType == \Adyen\Payment\Model\RecurringType::ONECLICK) { );
$customerInteraction = true;
// retrieve cse key
if ($this->_adyenHelper->getAdyenCcConfigDataFlag('cse_enabled')) {
if (isset($additionalData['encrypted_data'])) {
$infoInstance->setAdditionalInformation('encrypted_data', $additionalData['encrypted_data']);
} else {
throw new \Magento\Framework\Exception\LocalizedException(__('Card encryption failed'));
}
} }
} else {
$customerInteraction = false;
} }
$infoInstance->setAdditionalInformation('customer_interaction', $customerInteraction); // set customerInteraction
$recurringContractType = $this->getRecurringPaymentType();
// set number of installements if ($recurringContractType == \Adyen\Payment\Model\RecurringType::ONECLICK) {
if (isset($additionalData['number_of_installments'])) { $paymentInfo->setAdditionalInformation('customer_interaction', true);
$infoInstance->setAdditionalInformation('number_of_installments', } else {
$additionalData['number_of_installments']); $paymentInfo->setAdditionalInformation('customer_interaction', false);
} }
return $this; // set ccType
$variant = $additionalData['variant'];
$ccType = $this->adyenHelper->getMagentoCreditCartType($variant);
$paymentInfo->setAdditionalInformation('cc_type', $ccType);
} }
/** /**
...@@ -112,33 +120,10 @@ class Oneclick extends \Adyen\Payment\Model\Method\Cc ...@@ -112,33 +120,10 @@ class Oneclick extends \Adyen\Payment\Model\Method\Cc
public function getRecurringPaymentType() public function getRecurringPaymentType()
{ {
// For admin always use Recurring // For admin always use Recurring
if ($this->_appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { if ($this->appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) {
return \Adyen\Payment\Model\RecurringType::RECURRING; return \Adyen\Payment\Model\RecurringType::RECURRING;
} else { } else {
return $this->_adyenHelper->getAdyenOneclickConfigData('recurring_payment_type'); return $this->adyenHelper->getAdyenOneclickConfigData('recurring_payment_type');
}
}
/**
* @param \Adyen\Payment\Model\Billing\Agreement $agreement
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function updateBillingAgreementStatus(\Adyen\Payment\Model\Billing\Agreement $agreement)
{
$targetStatus = $agreement->getStatus();
if ($targetStatus == \Magento\Paypal\Model\Billing\Agreement::STATUS_CANCELED) {
try {
$this->_paymentRequest->disableRecurringContract(
$agreement->getReferenceId(),
$agreement->getCustomerReference(),
$agreement->getStoreId()
);
} catch(Exception $e) {
throw new \Magento\Framework\Exception\LocalizedException(__('Failed to disable this contract'));
}
} }
return $this;
} }
} }
\ No newline at end of file
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</adyen_abstract> </adyen_abstract>
<adyen_cc> <adyen_cc>
<active>1</active> <active>1</active>
<model>Adyen\Payment\Model\Method\Cc</model> <model>AdyenPaymentCcFacade</model>
<title>Adyen CreditCard</title> <title>Adyen CreditCard</title>
<allowspecific>0</allowspecific> <allowspecific>0</allowspecific>
<sort_order>2</sort_order> <sort_order>2</sort_order>
...@@ -47,17 +47,43 @@ ...@@ -47,17 +47,43 @@
<cse_enabled>1</cse_enabled> <cse_enabled>1</cse_enabled>
<enable_moto>0</enable_moto> <enable_moto>0</enable_moto>
<payment_action>authorize</payment_action> <payment_action>authorize</payment_action>
<is_gateway>1</is_gateway>
<can_use_checkout>1</can_use_checkout>
<can_authorize>1</can_authorize>
<can_authorize_3d>1</can_authorize_3d>
<can_capture>1</can_capture>
<can_capture_partial>1</can_capture_partial>
<can_use_internal>1</can_use_internal>
<can_refund_partial_per_invoice>1</can_refund_partial_per_invoice>
<can_refund>1</can_refund>
<can_void>1</can_void>
<can_cancel>1</can_cancel>
<group>adyen</group> <group>adyen</group>
</adyen_cc> </adyen_cc>
<adyen_oneclick> <adyen_oneclick>
<active>1</active> <active>1</active>
<model>Adyen\Payment\Model\Method\Oneclick</model> <model>AdyenPaymentOneclickFacade</model>
<title>Adyen OneClick</title> <title>Adyen OneClick</title>
<allowspecific>0</allowspecific> <allowspecific>0</allowspecific>
<sort_order>1</sort_order> <sort_order>1</sort_order>
<cctypes>AE,VI,MC,DI</cctypes> <!-- important to show the payment method isAvailabe()--> <cctypes>AE,VI,MC,DI</cctypes> <!-- important to show the payment method isAvailabe()-->
<recurring_payment_type>ONECLICK</recurring_payment_type> <recurring_payment_type>ONECLICK</recurring_payment_type>
<payment_action>authorize</payment_action> <payment_action>authorize</payment_action>
<useccv>1</useccv>
<cse_enabled>1</cse_enabled>
<enable_moto>0</enable_moto>
<payment_action>authorize</payment_action>
<is_gateway>1</is_gateway>
<can_use_checkout>1</can_use_checkout>
<can_authorize>1</can_authorize>
<can_authorize_3d>1</can_authorize_3d>
<can_capture>1</can_capture>
<can_capture_partial>1</can_capture_partial>
<can_use_internal>1</can_use_internal>
<can_refund_partial_per_invoice>1</can_refund_partial_per_invoice>
<can_refund>1</can_refund>
<can_void>1</can_void>
<can_cancel>1</can_cancel>
<group>adyen</group> <group>adyen</group>
</adyen_oneclick> </adyen_oneclick>
<adyen_hpp> <adyen_hpp>
...@@ -77,7 +103,7 @@ ...@@ -77,7 +103,7 @@
</adyen_hpp> </adyen_hpp>
<adyen_sepa> <adyen_sepa>
<active>0</active> <active>0</active>
<model>AdyenSepaFacade</model> <model>AdyenPaymentSepaFacade</model>
<title>Sepa Direct Debit</title> <title>Sepa Direct Debit</title>
<allowspecific>0</allowspecific> <allowspecific>0</allowspecific>
<sort_order>4</sort_order> <sort_order>4</sort_order>
......
...@@ -26,7 +26,27 @@ ...@@ -26,7 +26,27 @@
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<!-- Payment Method Facade configuration --> <!-- Payment Method Facade configuration -->
<virtualType name="AdyenSepaFacade" type="Magento\Payment\Model\Method\Adapter"> <virtualType name="AdyenPaymentCcFacade" type="Magento\Payment\Model\Method\Adapter">
<arguments>
<argument name="code" xsi:type="const">Adyen\Payment\Model\Ui\AdyenCcConfigProvider::CODE</argument>
<argument name="formBlockType" xsi:type="string">Adyen\Payment\Block\Form\Cc</argument>
<argument name="infoBlockType" xsi:type="string">Adyen\Payment\Block\Info\Cc</argument>
<argument name="valueHandlerPool" xsi:type="object">AdyenPaymentCcValueHandlerPool</argument>
<argument name="validatorPool" xsi:type="object">AdyenPaymentCcValidatorPool</argument>
<argument name="commandPool" xsi:type="object">AdyenPaymentCcCommandPool</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentOneclickFacade" type="Magento\Payment\Model\Method\Adapter">
<arguments>
<argument name="code" xsi:type="const">Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE</argument>
<argument name="formBlockType" xsi:type="string">Adyen\Payment\Block\Form\Oneclick</argument>
<argument name="infoBlockType" xsi:type="string">Adyen\Payment\Block\Info\Oneclick</argument>
<argument name="valueHandlerPool" xsi:type="object">AdyenPaymentOneclickValueHandlerPool</argument>
<argument name="validatorPool" xsi:type="object">AdyenPaymentOneclickValidatorPool</argument>
<argument name="commandPool" xsi:type="object">AdyenPaymentOneclickCommandPool</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentSepaFacade" type="Magento\Payment\Model\Method\Adapter">
<arguments> <arguments>
<argument name="code" xsi:type="const">Adyen\Payment\Model\Ui\AdyenSepaConfigProvider::CODE</argument> <argument name="code" xsi:type="const">Adyen\Payment\Model\Ui\AdyenSepaConfigProvider::CODE</argument>
<argument name="formBlockType" xsi:type="string">Adyen\Payment\Block\Form\Sepa</argument> <argument name="formBlockType" xsi:type="string">Adyen\Payment\Block\Form\Sepa</argument>
...@@ -38,6 +58,32 @@ ...@@ -38,6 +58,32 @@
</virtualType> </virtualType>
<!-- Value handlers infrastructure --> <!-- Value handlers infrastructure -->
<virtualType name="AdyenPaymentCcValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">AdyenPaymentCcConfigValueHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentCcConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">AdyenPaymentCcConfig</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentOneclickValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">AdyenPaymentOneclickConfigValueHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentOneclickConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">AdyenPaymentOneclickConfig</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentSepaValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool"> <virtualType name="AdyenPaymentSepaValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
<arguments> <arguments>
<argument name="handlers" xsi:type="array"> <argument name="handlers" xsi:type="array">
...@@ -47,19 +93,58 @@ ...@@ -47,19 +93,58 @@
</virtualType> </virtualType>
<virtualType name="AdyenPaymentSepaConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler"> <virtualType name="AdyenPaymentSepaConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler">
<arguments> <arguments>
<argument name="configInterface" xsi:type="object">Adyen\Payment\Gateway\Config\SepaConfig</argument> <argument name="configInterface" xsi:type="object">AdyenPaymentSepaConfig</argument>
</arguments> </arguments>
</virtualType> </virtualType>
<!-- Configuration reader --> <!-- Configuration reader -->
<type name="Adyen\Payment\Gateway\Config\SepaConfig"> <virtualType name="AdyenPaymentCcConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments>
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenCcConfigProvider::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>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentSepaConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments> <arguments>
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenSepaConfigProvider::CODE</argument> <argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenSepaConfigProvider::CODE</argument>
</arguments> </arguments>
</type> </virtualType>
<!-- Commands infrastructure --> <!-- Commands infrastructure -->
<virtualType name="AdyenPaymentCcCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
<arguments>
<argument name="commands" xsi:type="array">
<item name="authorize" xsi:type="string">AdyenPaymentCcAuthorizeCommand</item>
<item name="authorize_3d" xsi:type="string">AdyenPaymentAuthorize3DCommand</item>
<item name="capture" xsi:type="string">AdyenPaymentCaptureCommand</item>
<item name="void" xsi:type="string">AdyenPaymentCancelCommand</item>
<item name="refund" xsi:type="string">AdyenPaymentRefundCommand</item>
<item name="cancel" xsi:type="string">AdyenPaymentCancelCommand</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentOneclickCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
<arguments>
<argument name="commands" xsi:type="array">
<item name="authorize" xsi:type="string">AdyenPaymentOneclickAuthorizeCommand</item>
<item name="authorize_3d" xsi:type="string">AdyenPaymentAuthorize3DCommand</item>
<item name="capture" xsi:type="string">AdyenPaymentCaptureCommand</item>
<item name="void" xsi:type="string">AdyenPaymentCancelCommand</item>
<item name="refund" xsi:type="string">AdyenPaymentRefundCommand</item>
<item name="cancel" xsi:type="string">AdyenPaymentCancelCommand</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentSepaCommandPool" type="Magento\Payment\Gateway\Command\CommandPool"> <virtualType name="AdyenPaymentSepaCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
<arguments> <arguments>
<argument name="commands" xsi:type="array"> <argument name="commands" xsi:type="array">
...@@ -73,12 +158,44 @@ ...@@ -73,12 +158,44 @@
</virtualType> </virtualType>
<!-- Authorization command --> <!-- Authorization command -->
<virtualType name="AdyenPaymentCcAuthorizeCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentCcAuthorizeRequest</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">AdyenPaymentCcResponseHandlerComposite</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentAuthorize3DCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentAuthorize3DRequest</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">AdyenPaymentCcResponseHandlerComposite</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentOneclickAuthorizeCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentOneclickAuthorizeRequest</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">AdyenPaymentCcResponseHandlerComposite</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentSepaAuthorizeCommand" type="Magento\Payment\Gateway\Command\GatewayCommand"> <virtualType name="AdyenPaymentSepaAuthorizeCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments> <arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentSepaAuthorizeRequest</argument> <argument name="requestBuilder" xsi:type="object">AdyenPaymentSepaAuthorizeRequest</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">Adyen\Payment\Gateway\Validator\GeneralResponseValidator</argument> <argument name="validator" xsi:type="object">GeneralResponseValidator</argument>
<argument name="handler" xsi:type="object">AdyenPaymentSepaResponseHandlerComposite</argument> <argument name="handler" xsi:type="object">AdyenPaymentSepaResponseHandlerComposite</argument>
</arguments> </arguments>
</virtualType> </virtualType>
...@@ -114,24 +231,69 @@ ...@@ -114,24 +231,69 @@
<!-- Authorization Request --> <!-- Authorization Request -->
<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="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>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentAuthorize3DRequest" 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="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item>
<item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item>
<item name="3dsecure" xsi:type="string">Adyen\Payment\Gateway\Request\Authorize3DSecureDataBuilder</item>
</argument>
</arguments>
</virtualType>
<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="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\OneclickAuthorizationBuilder</item>
</argument>
</arguments>
</virtualType>
<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="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="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\SepaAuthorizationBuilder</item> <item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\SepaAuthorizationBuilder</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
<!--not used right this one below never loaded in looks like--> <!--not used right this one below never loaded in looks like-->
<type name="Adyen\Payment\Gateway\Request\SepaAuthorizationBuilder"> <!--<type name="Adyen\Payment\Gateway\Request\SepaAuthorizationBuilder">-->
<arguments> <!--<arguments>-->
<argument name="config" xsi:type="object">Adyen\Payment\Gateway\Config\SepaConfig</argument> <!--<argument name="config" xsi:type="object">Adyen\Payment\Gateway\Config\SepaConfig</argument>-->
</arguments> <!--</arguments>-->
</type> <!--</type>-->
<!-- Capture Request --> <!-- Capture Request -->
<virtualType name="AdyenPaymentCaptureRequest" type="Magento\Payment\Gateway\Request\BuilderComposite"> <virtualType name="AdyenPaymentCaptureRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments> <arguments>
...@@ -160,9 +322,15 @@ ...@@ -160,9 +322,15 @@
</arguments> </arguments>
</virtualType> </virtualType>
<!-- Response handlers --> <!-- Response handlers -->
<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\PaymentAuthorisationDetailsHandler</item>
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler</item>
</argument>
</arguments>
</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">
...@@ -197,6 +365,33 @@ ...@@ -197,6 +365,33 @@
</virtualType> </virtualType>
<!-- Value validators infrastructure --> <!-- Value validators infrastructure -->
<!--TODO: country validators not working because config model does not exists-->
<virtualType name="AdyenPaymentCcValidatorPool" type="Magento\Payment\Gateway\Validator\ValidatorPool">
<arguments>
<argument name="validators" xsi:type="array">
<item name="country" xsi:type="string">AdyenCcCountryValidator</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenCcCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
<arguments>
<argument name="config" xsi:type="object">Adyen\Payment\Gateway\Config\CcConfig</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentOneclickValidatorPool" type="Magento\Payment\Gateway\Validator\ValidatorPool">
<arguments>
<argument name="validators" xsi:type="array">
<item name="country" xsi:type="string">AdyenOneclickCountryValidator</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenOneclickCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
<arguments>
<argument name="config" xsi:type="object">Adyen\Payment\Gateway\Config\OneclickConfig</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentSepaValidatorPool" type="Magento\Payment\Gateway\Validator\ValidatorPool"> <virtualType name="AdyenPaymentSepaValidatorPool" type="Magento\Payment\Gateway\Validator\ValidatorPool">
<arguments> <arguments>
<argument name="validators" xsi:type="array"> <argument name="validators" xsi:type="array">
...@@ -217,6 +412,13 @@ ...@@ -217,6 +412,13 @@
</virtualType> </virtualType>
<virtualType name="GeneralResponseValidator" type="Adyen\Payment\Gateway\Validator\GeneralResponseValidator">
<arguments>
<argument name="loggerInterface" xsi:type="object">Adyen\Payment\Logger\AdyenLogger</argument>
</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"> <type name="Adyen\Payment\Logger\Handler\AdyenDebug">
<arguments> <arguments>
......
...@@ -23,6 +23,12 @@ ...@@ -23,6 +23,12 @@
*/ */
--> -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="payment_method_assign_data_adyen_cc">
<observer name="adyen_cc_gateway_data_assign" instance="Adyen\Payment\Observer\AdyenCcDataAssignObserver" />
</event>
<event name="payment_method_assign_data_adyen_oneclick">
<observer name="adyen_cc_gateway_data_assign" instance="Adyen\Payment\Observer\AdyenOneclickDataAssignObserver" />
</event>
<event name="payment_method_assign_data_adyen_sepa"> <event name="payment_method_assign_data_adyen_sepa">
<observer name="adyen_sepa_gateway_data_assign" instance="Adyen\Payment\Observer\AdyenSepaDataAssignObserver" /> <observer name="adyen_sepa_gateway_data_assign" instance="Adyen\Payment\Observer\AdyenSepaDataAssignObserver" />
</event> </event>
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
<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\AdyenGenericConfigProvider</item> <item name="adyen_generic_config_provider" xsi:type="object">Adyen\Payment\Model\AdyenGenericConfigProvider</item>
<item name="adyen_cc_config_provider" xsi:type="object">Adyen\Payment\Model\AdyenCcConfigProvider</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\AdyenOneclickConfigProvider</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\AdyenHppConfigProvider</item> <item name="adyen_hpp_config_provider" xsi:type="object">Adyen\Payment\Model\AdyenHppConfigProvider</item>
<item name="adyen_sepa_config_provider" xsi:type="object">Adyen\Payment\Model\Ui\AdyenSepaConfigProvider</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\AdyenBoletoConfigProvider</item> <item name="adyen_boleto_config_provider" xsi:type="object">Adyen\Payment\Model\AdyenBoletoConfigProvider</item>
......
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