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 776b54d4 authored by attilak's avatar attilak Committed by Rik ter Beek

PW-634 backend

- request builders mod to the checkout structure
parent 5bc78129
...@@ -38,11 +38,6 @@ class CcAuthorizationDataBuilder implements BuilderInterface ...@@ -38,11 +38,6 @@ class CcAuthorizationDataBuilder implements BuilderInterface
*/ */
private $appState; private $appState;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
protected $_adyenLogger;
/** /**
* CcAuthorizationDataBuilder constructor. * CcAuthorizationDataBuilder constructor.
* *
...@@ -51,13 +46,11 @@ class CcAuthorizationDataBuilder implements BuilderInterface ...@@ -51,13 +46,11 @@ class CcAuthorizationDataBuilder implements BuilderInterface
*/ */
public function __construct( public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\Model\Context $context, \Magento\Framework\Model\Context $context
\Adyen\Payment\Logger\AdyenLogger $adyenLogger
) )
{ {
$this->adyenHelper = $adyenHelper; $this->adyenHelper = $adyenHelper;
$this->appState = $context->getAppState(); $this->appState = $context->getAppState();
$this->_adyenLogger = $adyenLogger;
} }
/** /**
...@@ -74,11 +67,25 @@ class CcAuthorizationDataBuilder implements BuilderInterface ...@@ -74,11 +67,25 @@ class CcAuthorizationDataBuilder implements BuilderInterface
$request = []; $request = [];
$request['paymentMethod']['type'] = "scheme"; $request['paymentMethod']['type'] = "scheme";
$request['paymentMethod']['encryptedCardNumber'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::CREDIT_CARD_NUMBER);
$request['paymentMethod']['encryptedExpiryMonth'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::EXPIRY_MONTH); if ($cardNumber = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::CREDIT_CARD_NUMBER)) {
$request['paymentMethod']['encryptedExpiryYear'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::EXPIRY_YEAR); $request['paymentMethod']['encryptedCardNumber'] = $cardNumber;
}
if ($expiryMonth = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::EXPIRY_MONTH)) {
$request['paymentMethod']['encryptedExpiryMonth'] = $expiryMonth;
}
if ($expiryYear = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::EXPIRY_YEAR)) {
$request['paymentMethod']['encryptedExpiryYear'] = $expiryYear;
}
if ($holderName = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::HOLDER_NAME)) {
$request['paymentMethod']['holderName'] = $holderName;
}
// The encrypted security code is required in both cc and oneclick
$request['paymentMethod']['encryptedSecurityCode'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::SECURITY_CODE); $request['paymentMethod']['encryptedSecurityCode'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::SECURITY_CODE);
$request['paymentMethod']['holderName'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::HOLDER_NAME);
// Remove from additional data // Remove from additional data
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::CREDIT_CARD_NUMBER); $payment->unsAdditionalInformation(AdyenCcDataAssignObserver::CREDIT_CARD_NUMBER);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
namespace Adyen\Payment\Gateway\Request; namespace Adyen\Payment\Gateway\Request;
use Adyen\Payment\Observer\AdyenOneclickDataAssignObserver;
use Magento\Payment\Gateway\Request\BuilderInterface; use Magento\Payment\Gateway\Request\BuilderInterface;
class OneclickAuthorizationDataBuilder implements BuilderInterface class OneclickAuthorizationDataBuilder implements BuilderInterface
...@@ -53,7 +54,6 @@ class OneclickAuthorizationDataBuilder implements BuilderInterface ...@@ -53,7 +54,6 @@ class OneclickAuthorizationDataBuilder 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();
$recurringDetailReference = $payment->getAdditionalInformation("recurring_detail_reference");
if ($payment->getAdditionalInformation('customer_interaction')) { if ($payment->getAdditionalInformation('customer_interaction')) {
$shopperInteraction = "Ecommerce"; $shopperInteraction = "Ecommerce";
...@@ -61,8 +61,8 @@ class OneclickAuthorizationDataBuilder implements BuilderInterface ...@@ -61,8 +61,8 @@ class OneclickAuthorizationDataBuilder implements BuilderInterface
$shopperInteraction = "ContAuth"; $shopperInteraction = "ContAuth";
} }
$request['selectedRecurringDetailReference'] = $recurringDetailReference;
$request['shopperInteraction'] = $shopperInteraction; $request['shopperInteraction'] = $shopperInteraction;
$request['paymentMethod']['recurringDetailReference'] = $payment->getAdditionalInformation(AdyenOneclickDataAssignObserver::RECURRING_DETAIL_REFERENCE);
// if it is a sepadirectdebit set selectedBrand to sepadirectdebit in the case of oneclick // if it is a sepadirectdebit set selectedBrand to sepadirectdebit in the case of oneclick
if ($payment->getCcType() == "sepadirectdebit") { if ($payment->getCcType() == "sepadirectdebit") {
......
...@@ -32,7 +32,7 @@ use Magento\Quote\Api\Data\PaymentInterface; ...@@ -32,7 +32,7 @@ use Magento\Quote\Api\Data\PaymentInterface;
class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver
{ {
const RECURRING_DETAIL_REFERENCE = 'recurring_detail_reference'; const RECURRING_DETAIL_REFERENCE = 'recurring_detail_reference';
const ENCRYPTED_DATA = 'encrypted_data'; const SECURITY_CODE = 'cvc';
const NUMBER_OF_INSTALLMENTS = 'number_of_installments'; const NUMBER_OF_INSTALLMENTS = 'number_of_installments';
/** /**
...@@ -40,7 +40,7 @@ class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver ...@@ -40,7 +40,7 @@ class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver
*/ */
protected $additionalInformationList = [ protected $additionalInformationList = [
self::RECURRING_DETAIL_REFERENCE, self::RECURRING_DETAIL_REFERENCE,
self::ENCRYPTED_DATA, self::SECURITY_CODE,
self::NUMBER_OF_INSTALLMENTS self::NUMBER_OF_INSTALLMENTS
]; ];
......
...@@ -446,7 +446,7 @@ ...@@ -446,7 +446,7 @@
<argument name="requestBuilder" xsi:type="object">AdyenPaymentOneclickAuthorizeRequest</argument> <argument name="requestBuilder" xsi:type="object">AdyenPaymentOneclickAuthorizeRequest</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\TransactionPayment</argument> <argument name="client" xsi:type="object">Adyen\Payment\Gateway\Http\Client\TransactionPayment</argument>
<argument name="validator" xsi:type="object">GeneralResponseValidator</argument> <argument name="validator" xsi:type="object">CheckoutResponseValidator</argument>
<argument name="handler" xsi:type="object">AdyenPaymentCcResponseHandlerComposite</argument> <argument name="handler" xsi:type="object">AdyenPaymentCcResponseHandlerComposite</argument>
</arguments> </arguments>
</virtualType> </virtualType>
......
...@@ -153,14 +153,6 @@ define( ...@@ -153,14 +153,6 @@ define(
event.preventDefault(); event.preventDefault();
} }
var data = {
"method": self.method,
"additional_data": {
variant: self.agreement_data.variant,
recurring_detail_reference: self.value
}
}
// only use installments for cards // only use installments for cards
if (self.agreement_data.card) { if (self.agreement_data.card) {
if (self.hasVerification()) { if (self.hasVerification()) {
...@@ -249,7 +241,7 @@ define( ...@@ -249,7 +241,7 @@ define(
return { return {
"method": self.method, "method": self.method,
"additional_data": { additional_data: {
variant: variant(), variant: variant(),
recurring_detail_reference: recurringDetailReference(), recurring_detail_reference: recurringDetailReference(),
number_of_installments: numberOfInstallments(), number_of_installments: numberOfInstallments(),
......
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