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

#67 Adyen Boleto is now using the Facade implementation

parent eff192e4
......@@ -88,7 +88,7 @@ class Success extends \Magento\Framework\View\Element\Template
public function isBoletoPayment()
{
if ($this->getOrder()->getPayment() &&
$this->getOrder()->getPayment()->getMethod() == \Adyen\Payment\Model\Method\Boleto::METHOD_CODE) {
$this->getOrder()->getPayment()->getMethod() == \Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider::CODE) {
return true;
}
return false;
......
......@@ -96,9 +96,8 @@ class TransactionAuthorization implements ClientInterface
try {
$response = $service->authorise($request);
} catch(\Adyen\AdyenException $e) {
$response = null;
$response['error'] = $e->getMessage();
}
return $response;
}
}
<?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 BoletoAuthorizationDataBuilder 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)
{
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
/** @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 = [];
$request['socialSecurityNumber'] = $payment->getAdditionalInformation("social_security_number");
$request['selectedBrand'] = $payment->getAdditionalInformation("boleto_type");
$shopperName = [
'firstName' => $payment->getAdditionalInformation("firstname"),
'lastName' => $payment->getAdditionalInformation("lastname"),
];
$request['shopperName'] = $shopperName;
$deliveryDays = (int) $this->adyenHelper->getAdyenBoletoConfigData("delivery_days", $storeId);
$deliveryDays = (!empty($deliveryDays)) ? $deliveryDays : 5;
$deliveryDate = date(
"Y-m-d\TH:i:s ",
mktime(date("H"),
date("i"),
date("s"),
date("m"),
date("j") + $deliveryDays,
date("Y"))
);
$request['deliveryDate'] = $deliveryDate;
return $request;
}
}
\ No newline at end of file
......@@ -25,7 +25,7 @@ namespace Adyen\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
class OneclickAuthorizationBuilder implements BuilderInterface
class OneclickAuthorizationDataBuilder implements BuilderInterface
{
/**
* @var \Adyen\Payment\Helper\Data
......@@ -64,6 +64,11 @@ class OneclickAuthorizationBuilder implements BuilderInterface
$request['selectedRecurringDetailReference'] = $recurringDetailReference;
$request['shopperInteraction'] = $shopperInteraction;
// if it is a sepadirectdebit set selectedBrand to sepadirectdebit in the case of oneclick
if ($payment->getCcType() == "sepadirectdebit") {
$request['selectedBrand'] = "sepadirectdebit";
}
/*
* For recurring Ideal and Sofort needs to be converted to SEPA
* for this it is mandatory to set selectBrand to sepadirectdebit
......
......@@ -25,7 +25,7 @@ namespace Adyen\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
class SepaAuthorizationBuilder implements BuilderInterface
class SepaAuthorizationDataBuilder implements BuilderInterface
{
/**
* @param array $buildSubject
......
......@@ -54,5 +54,6 @@ class PaymentAuthorisationDetailsHandler implements HandlerInterface
// do not close transaction so you can do a cancel() and void
$payment->setIsTransactionClosed(false);
$payment->setShouldCloseParentTransaction(false);
}
}
\ No newline at end of file
......@@ -60,11 +60,39 @@ class GeneralResponseValidator extends AbstractValidator
$errorMessages = [];
// validate result
if ($response) {
if ($response && isset($response['resultCode'])) {
switch ($response['resultCode']) {
case "Authorised":
$payment->setAdditionalInformation('pspReference', $response['pspReference']);
break;
case "Received":
$payment->setAdditionalInformation('pspReference', $response['pspReference']);
// set additionalData
if (isset($response['additionalData']) && is_array($response['additionalData'])) {
$additionalData = $response['additionalData'];
if (isset($additionalData['boletobancario.dueDate'])) {
$payment->setAdditionalInformation(
'dueDate',
$additionalData['boletobancario.dueDate']
);
}
if (isset($additionalData['boletobancario.expirationDate'])) {
$payment->setAdditionalInformation(
'expirationDate',
$additionalData['boletobancario.expirationDate']
);
}
if (isset($additionalData['boletobancario.url'])) {
$payment->setAdditionalInformation(
'url',
$additionalData['boletobancario.url']
);
}
}
break;
case "RedirectShopper":
$payment->setAdditionalInformation('3dActive', true);
$payment->setAdditionalInformation('pspReference', $response['pspReference']);
......@@ -85,10 +113,7 @@ class GeneralResponseValidator extends AbstractValidator
}
break;
case "Refused":
$isValid = false;
if ($response['refusalReason']) {
$refusalReason = $response['refusalReason'];
switch($refusalReason) {
case "Transaction Not Permitted":
......@@ -113,26 +138,17 @@ class GeneralResponseValidator extends AbstractValidator
} 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;
default:
$isValid = false;
$errorMsg = __('Error with payment method please select different payment method.');
$this->logger->critical($errorMsg);
$errorMessages[] = $errorMsg;
throw new \Magento\Framework\Exception\LocalizedException(__($errorMsg));
break;
}
} else {
$errorMsg = __('Error with payment method please select different payment method.');
$this->logger->critical($errorMsg);
$errorMessages[] = $errorMsg;
throw new \Magento\Framework\Exception\LocalizedException(__($errorMsg));
}
return $this->createResult($isValid, $errorMessages);
......
......@@ -49,7 +49,6 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
protected $_methodCodes = [
\Adyen\Payment\Model\Method\Hpp::METHOD_CODE,
\Adyen\Payment\Model\Method\Pos::METHOD_CODE,
\Adyen\Payment\Model\Method\Boleto::METHOD_CODE
];
/**
......
......@@ -202,7 +202,6 @@ class PaymentRequest extends DataObject
$request = array_merge($request, $requestDelivery);
}
$enableMoto = $this->_adyenHelper->getAdyenCcConfigDataFlag('enable_moto', $storeId);
$recurringDetailReference = null;
// define the shopper interaction
......@@ -222,33 +221,6 @@ class PaymentRequest extends DataObject
$request['selectedBrand'] = "sepadirectdebit";
}
if ($paymentMethodCode == \Adyen\Payment\Model\Method\Boleto::METHOD_CODE) {
$request['socialSecurityNumber'] = $payment->getAdditionalInformation("social_security_number");
$request['selectedBrand'] = $payment->getAdditionalInformation("boleto_type");
$shopperName = [
'firstName' => $payment->getAdditionalInformation("firstname"),
'lastName' => $payment->getAdditionalInformation("lastname"),
];
$request['shopperName'] = $shopperName;
$deliveryDays = (int) $this->_adyenHelper->getAdyenBoletoConfigData("delivery_days", $storeId);
$deliveryDays = (!empty($deliveryDays)) ? $deliveryDays : 5;
$deliveryDate = date(
"Y-m-d\TH:i:s ",
mktime(date("H"),
date("i"),
date("s"),
date("m"),
date("j") + $deliveryDays,
date("Y"))
);
$request['deliveryDate'] = $deliveryDate;
}
$result = $service->authorise($request);
return $result;
......
<?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;
/**
* Class Sepa
* @package Adyen\Payment\Model\Method
*/
class Boleto extends \Magento\Payment\Model\Method\AbstractMethod
{
const METHOD_CODE = 'adyen_boleto';
/**
* @var string
*/
protected $_code = self::METHOD_CODE;
/**
* @var string
*/
protected $_formBlockType = 'Adyen\Payment\Block\Form\Boleto';
/**
* @var string
*/
protected $_infoBlockType = 'Adyen\Payment\Block\Info\Boleto';
/**
* @var \Adyen\Payment\Model\Api\PaymentRequest
*/
protected $_paymentRequest;
/**
* @var \Magento\Framework\UrlInterface
*/
protected $_urlBuilder;
/**
* Request object
*
* @var \Magento\Framework\App\RequestInterface
*/
protected $_request;
/**
* 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 bool
*/
protected $_canUseInternal = true;
/**
* Sepa constructor.
* @param \Magento\Framework\App\RequestInterface $request
* @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest
* @param \Magento\Framework\UrlInterface $urlBuilder
* @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\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,
\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\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
parent::__construct(
$context,
$registry,
$extensionFactory,
$customAttributeFactory,
$paymentData,
$scopeConfig,
$logger,
$resource,
$resourceCollection,
$data
);
$this->_paymentRequest = $paymentRequest;
$this->_urlBuilder = $urlBuilder;
$this->_request = $request;
}
/**
* 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();
$infoInstance->setAdditionalInformation('social_security_number', $additionalData['social_security_number']);
$infoInstance->setAdditionalInformation('boleto_type', $additionalData['boleto_type']);
$infoInstance->setAdditionalInformation('firstname', $additionalData['firstname']);
$infoInstance->setAdditionalInformation('lastname', $additionalData['lastname']);
}
/**
* @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 let magento set status to processing
$payment->setLastTransId($this->getTransactionId())->setIsTransactionPending(true);
// Do authorisation
$this->_processRequest($payment, "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, $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 "Received":
$this->_addStatusHistory($payment, $response['resultCode'], $response['pspReference']);
$payment->setAdditionalInformation('pspReference', $response['pspReference']);
if (isset($response['additionalData']) && is_array($response['additionalData'])) {
$additionalData = $response['additionalData'];
if (isset($additionalData['boletobancario.dueDate'])) {
$payment->setAdditionalInformation(
'dueDate',
$additionalData['boletobancario.dueDate']
);
}
if (isset($additionalData['boletobancario.expirationDate'])) {
$payment->setAdditionalInformation(
'expirationDate',
$additionalData['boletobancario.expirationDate']
);
}
if (isset($additionalData['boletobancario.url'])) {
$payment->setAdditionalInformation(
'url',
$additionalData['boletobancario.url']
);
}
}
break;
case "Refused":
$errorMsg = __('The payment is REFUSED.');
$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;
}
/**
* 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('checkout/onepage/success/',
['_secure' => $this->_getRequest()->isSecure()]);
}
/**
* Retrieve request object
*
* @return \Magento\Framework\App\RequestInterface
*/
protected function _getRequest()
{
return $this->_request;
}
}
\ No newline at end of file
......@@ -21,13 +21,15 @@
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Model;
namespace Adyen\Payment\Model\Ui;
use Magento\Checkout\Model\ConfigProviderInterface;
class AdyenBoletoConfigProvider implements ConfigProviderInterface
{
const CODE = 'adyen_boleto';
/**
* @var PaymentHelper
*/
......@@ -39,34 +41,35 @@ class AdyenBoletoConfigProvider implements ConfigProviderInterface
protected $_adyenHelper;
/**
* @var string[]
* @var \Magento\Framework\UrlInterface
*/
protected $_methodCodes = [
\Adyen\Payment\Model\Method\Boleto::METHOD_CODE
];
protected $_urlBuilder;
/**
* @var \Magento\Payment\Model\Method\AbstractMethod[]
* Request object
*
* @var \Magento\Framework\App\RequestInterface
*/
protected $_methods = [];
protected $_request;
/**
* AdyenBoletoConfigProvider constructor.
*
* @param \Magento\Payment\Helper\Data $paymentHelper
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Magento\Framework\App\RequestInterface $request
*/
public function __construct(
\Magento\Payment\Helper\Data $paymentHelper,
\Adyen\Payment\Helper\Data $adyenHelper
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\UrlInterface $urlBuilder,
\Magento\Framework\App\RequestInterface $request
) {
$this->_paymentHelper = $paymentHelper;
$this->_adyenHelper = $adyenHelper;
foreach ($this->_methodCodes as $code) {
$this->_methods[$code] = $this->_paymentHelper->getMethodInstance($code);
}
$this->_urlBuilder = $urlBuilder;
$this->_request = $request;
}
/**
......@@ -74,20 +77,28 @@ class AdyenBoletoConfigProvider implements ConfigProviderInterface
*/
public function getConfig()
{
$config = [];
foreach ($this->_methodCodes as $code) {
if ($this->_methods[$code]->isAvailable()) {
$config = [
// set to active
return [
'payment' => [
self::CODE => [
'isActive' => true,
'redirectUrl' => $this->_urlBuilder->getUrl(
'checkout/onepage/success/', ['_secure' => $this->_getRequest()->isSecure()])
],
'adyenBoleto' => [
'boletoTypes' => $this->_adyenHelper->getBoletoTypes()
]
]
];
}
}
return $config;
/**
* Retrieve request object
*
* @return \Magento\Framework\App\RequestInterface
*/
protected function _getRequest()
{
return $this->_request;
}
}
\ No newline at end of file
......@@ -251,7 +251,6 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
return $this->ccConfig->getCvvImageUrl();
}
/**
* Retrieve request 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\Observer;
use Magento\Framework\Event\Observer;
use Magento\Payment\Observer\AbstractDataAssignObserver;
use Magento\Quote\Api\Data\PaymentInterface;
/**
* Class DataAssignObserver
*/
class AdyenBoletoDataAssignObserver extends AbstractDataAssignObserver
{
const SOCIAL_SECURITY_NUMBER = 'social_security_number';
const BOLETO_TYPE = 'boleto_type';
const FIRSTNAME = 'firstname';
const LASTNAME = 'lastname';
/**
* @var array
*/
protected $additionalInformationList = [
self::SOCIAL_SECURITY_NUMBER,
self::BOLETO_TYPE,
self::FIRSTNAME,
self::LASTNAME
];
/**
* @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);
foreach ($this->additionalInformationList as $additionalInformationKey) {
if (isset($additionalData[$additionalInformationKey])) {
$paymentInfo->setAdditionalInformation(
$additionalInformationKey,
$additionalData[$additionalInformationKey]
);
}
}
}
}
......@@ -145,12 +145,22 @@
</adyen_pay_by_mail>
<adyen_boleto>
<active>0</active>
<model>Adyen\Payment\Model\Method\Boleto</model>
<model>AdyenPaymentBoletoFacade</model>
<title>Boleto</title>
<allowspecific>0</allowspecific>
<sort_order>7</sort_order>
<payment_action>authorize</payment_action>
<delivery_days>5</delivery_days>
<is_gateway>1</is_gateway>
<can_use_checkout>1</can_use_checkout>
<can_authorize>1</can_authorize>
<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>
</adyen_boleto>
</payment>
......
......@@ -56,6 +56,16 @@
<argument name="commandPool" xsi:type="object">AdyenPaymentSepaCommandPool</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentBoletoFacade" type="Magento\Payment\Model\Method\Adapter">
<arguments>
<argument name="code" xsi:type="const">Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider::CODE</argument>
<argument name="formBlockType" xsi:type="string">Adyen\Payment\Block\Form\Boleto</argument>
<argument name="infoBlockType" xsi:type="string">Adyen\Payment\Block\Info\Boleto</argument>
<argument name="valueHandlerPool" xsi:type="object">AdyenPaymentBoletoValueHandlerPool</argument>
<argument name="validatorPool" xsi:type="object">AdyenPaymentBoletoValidatorPool</argument>
<argument name="commandPool" xsi:type="object">AdyenPaymentBoletoCommandPool</argument>
</arguments>
</virtualType>
<!-- Value handlers infrastructure -->
<virtualType name="AdyenPaymentCcValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
......@@ -97,6 +107,19 @@
</arguments>
</virtualType>
<virtualType name="AdyenPaymentBoletoValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">AdyenPaymentBoletoConfigValueHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentBoletoConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">AdyenPaymentBoletoConfig</argument>
</arguments>
</virtualType>
<!-- Configuration reader -->
<virtualType name="AdyenPaymentCcConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments>
......@@ -113,6 +136,11 @@
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenSepaConfigProvider::CODE</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentBoletoConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments>
<argument name="methodCode" xsi:type="const">Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider::CODE</argument>
</arguments>
</virtualType>
<!-- Commands infrastructure -->
......@@ -142,9 +170,6 @@
</arguments>
</virtualType>
<virtualType name="AdyenPaymentSepaCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
<arguments>
<argument name="commands" xsi:type="array">
......@@ -157,6 +182,18 @@
</arguments>
</virtualType>
<virtualType name="AdyenPaymentBoletoCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
<arguments>
<argument name="commands" xsi:type="array">
<item name="authorize" xsi:type="string">AdyenPaymentBoletoAuthorizeCommand</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>
<!-- Authorization command -->
<virtualType name="AdyenPaymentCcAuthorizeCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments>
......@@ -187,9 +224,6 @@
</arguments>
</virtualType>
<virtualType name="AdyenPaymentSepaAuthorizeCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentSepaAuthorizeRequest</argument>
......@@ -199,6 +233,16 @@
<argument name="handler" xsi:type="object">AdyenPaymentSepaResponseHandlerComposite</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentBoletoAuthorizeCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments>
<argument name="requestBuilder" xsi:type="object">AdyenPaymentBoletoAuthorizeRequest</argument>
<argument name="transferFactory" xsi:type="object">Adyen\Payment\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionAuthorization</argument>
<argument name="validator" xsi:type="object">GeneralResponseValidator</argument>
<argument name="handler" xsi:type="object">AdyenPaymentBoletoResponseHandlerComposite</argument>
</arguments>
</virtualType>
<!-- Capture command -->
<virtualType name="AdyenPaymentCaptureCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments>
......@@ -269,7 +313,7 @@
<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>
<item name="oneclick" xsi:type="string">Adyen\Payment\Gateway\Request\OneclickAuthorizationDataBuilder</item>
</argument>
</arguments>
</virtualType>
......@@ -284,12 +328,29 @@
<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\SepaAuthorizationBuilder</item>
<item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\SepaAuthorizationDataBuilder</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentBoletoAuthorizeRequest" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments>
<argument name="builders" xsi:type="array">
<item name="merchantaccount" xsi:type="string">Adyen\Payment\Gateway\Request\MerchantAccountDataBuilder</item>
<item name="customer" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerDataBuilder</item>
<item name="customerip" xsi:type="string">Adyen\Payment\Gateway\Request\CustomerIpDataBuilder</item>
<item name="address" xsi:type="string">Adyen\Payment\Gateway\Request\AddressDataBuilder</item>
<item name="payment" xsi:type="string">Adyen\Payment\Gateway\Request\PaymentDataBuilder</item>
<item name="browserinfo" xsi:type="string">Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder</item>
<item name="recurring" xsi:type="string">Adyen\Payment\Gateway\Request\RecurringDataBuilder</item>
<item name="transaction" xsi:type="string">Adyen\Payment\Gateway\Request\BoletoAuthorizationDataBuilder</item>
</argument>
</arguments>
</virtualType>
<!--not used right this one below never loaded in looks like-->
<!--<type name="Adyen\Payment\Gateway\Request\SepaAuthorizationBuilder">-->
<!--<type name="Adyen\Payment\Gateway\Request\SepaAuthorizationDataBuilder">-->
<!--<arguments>-->
<!--<argument name="config" xsi:type="object">Adyen\Payment\Gateway\Config\SepaConfig</argument>-->
<!--</arguments>-->
......@@ -339,6 +400,14 @@
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentBoletoResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="payment_details" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentAuthorisationDetailsHandler</item>
<item name="payment_comments" xsi:type="string">Adyen\Payment\Gateway\Response\PaymentCommentHistoryHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentCaptureResponseHandlerComposite" type="Magento\Payment\Gateway\Response\HandlerChain">
<arguments>
<argument name="handlers" xsi:type="array">
......@@ -373,6 +442,7 @@
</argument>
</arguments>
</virtualType>
<!--FIXME: Config does not exists-->
<virtualType name="AdyenCcCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
<arguments>
<argument name="config" xsi:type="object">Adyen\Payment\Gateway\Config\CcConfig</argument>
......@@ -386,6 +456,7 @@
</argument>
</arguments>
</virtualType>
<!--FIXME: Config does not exists-->
<virtualType name="AdyenOneclickCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
<arguments>
<argument name="config" xsi:type="object">Adyen\Payment\Gateway\Config\OneclickConfig</argument>
......@@ -400,18 +471,35 @@
</argument>
</arguments>
</virtualType>
<!--FIXME: Config does not exists-->
<virtualType name="AdyenSepaValidator" type="Adyen\Payment\Gateway\Validator\SepaValidator">
<arguments>
<argument name="config" xsi:type="object">Adyen\Payment\Gateway\Config\SepaConfig</argument>
</arguments>
</virtualType>
<!--FIXME: Config does not exists-->
<virtualType name="AdyenSepaCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
<arguments>
<argument name="config" xsi:type="object">Adyen\Payment\Gateway\Config\SepaConfig</argument>
</arguments>
</virtualType>
<virtualType name="AdyenPaymentBoletoValidatorPool" type="Magento\Payment\Gateway\Validator\ValidatorPool">
<arguments>
<argument name="validators" xsi:type="array">
<item name="country" xsi:type="string">AdyenBoletoCountryValidator</item>
</argument>
</arguments>
</virtualType>
<!--FIXME: Config does not exists-->
<virtualType name="AdyenBoletoCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
<arguments>
<argument name="config" xsi:type="object">Adyen\Payment\Gateway\Config\BoletoConfig</argument>
</arguments>
</virtualType>
<!--General Response validator-->
<virtualType name="GeneralResponseValidator" type="Adyen\Payment\Gateway\Validator\GeneralResponseValidator">
<arguments>
<argument name="loggerInterface" xsi:type="object">Adyen\Payment\Logger\AdyenLogger</argument>
......
......@@ -32,4 +32,7 @@
<event name="payment_method_assign_data_adyen_sepa">
<observer name="adyen_sepa_gateway_data_assign" instance="Adyen\Payment\Observer\AdyenSepaDataAssignObserver" />
</event>
<event name="payment_method_assign_data_adyen_boleto">
<observer name="adyen_sepa_gateway_data_assign" instance="Adyen\Payment\Observer\AdyenBoletoDataAssignObserver" />
</event>
</config>
......@@ -32,7 +32,7 @@
<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_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\Ui\AdyenBoletoConfigProvider</item>
</argument>
</arguments>
</type>
......
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