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 43fb5b0c authored by attilak's avatar attilak

Merge branch 'develop' into 7.0.0-rc.1

parents c74eff91 f575b550
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2020 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 RedirectDataBuilder implements BuilderInterface
{
/**
* @var \Magento\Framework\App\State
*/
private $appState;
/**
* @var \Adyen\Payment\Helper\Requests
*/
private $adyenRequestsHelper;
/**
* RedirectDataBuilder constructor.
*
* @param \Magento\Framework\Model\Context $context
* @param \Adyen\Payment\Helper\Requests $adyenRequestsHelper
*/
public function __construct(
\Magento\Framework\Model\Context $context,
\Adyen\Payment\Helper\Requests $adyenRequestsHelper
) {
$this->appState = $context->getAppState();
$this->adyenRequestsHelper = $adyenRequestsHelper;
}
/**
* @param array $buildSubject
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function build(array $buildSubject)
{
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
$storeId = $payment->getOrder()->getStoreId();
$request['body'] = $this->adyenRequestsHelper->buildRedirectData($storeId, []);
return $request;
}
}
...@@ -103,7 +103,7 @@ class Requests extends AbstractHelper ...@@ -103,7 +103,7 @@ class Requests extends AbstractHelper
if ($customerId > 0) { if ($customerId > 0) {
$request['shopperReference'] = $customerId; $request['shopperReference'] = $customerId;
} }
elseif ($this->adyenHelper->isGuestTokenizationEnabled($storeId)){ else {
$uuid = Uuid::generateV4(); $uuid = Uuid::generateV4();
$guestCustomerId = $payment->getOrder()->getIncrementId() . $uuid; $guestCustomerId = $payment->getOrder()->getIncrementId() . $uuid;
$request['shopperReference'] = $guestCustomerId; $request['shopperReference'] = $guestCustomerId;
...@@ -357,19 +357,6 @@ class Requests extends AbstractHelper ...@@ -357,19 +357,6 @@ class Requests extends AbstractHelper
return $request; return $request;
} }
/**
* @param array $request
* @return array
* @deprecated
*/
public function buildRedirectData($storeId, $request = [])
{
$request['redirectFromIssuerMethod'] = 'GET';
$request['redirectToIssuerMethod'] = 'POST';
$request['returnUrl'] = $this->urlBuilder->getUrl('adyen/process/redirect');
return $request;
}
/** /**
* @param $request * @param $request
* @param $areaCode * @param $areaCode
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
namespace Adyen\Payment\Model; namespace Adyen\Payment\Model;
use Adyen\Payment\Model\Ui\AdyenCcConfigProvider; use Adyen\Payment\Model\Ui\AdyenCcConfigProvider;
use Adyen\Payment\Model\Ui\AdyenGooglePayConfigProvider;
use Adyen\Payment\Model\Ui\AdyenHppConfigProvider; use Adyen\Payment\Model\Ui\AdyenHppConfigProvider;
use Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider; use Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider;
...@@ -102,6 +103,15 @@ class AdyenOrderPaymentStatus implements \Adyen\Payment\Api\AdyenOrderPaymentSta ...@@ -102,6 +103,15 @@ class AdyenOrderPaymentStatus implements \Adyen\Payment\Api\AdyenOrderPaymentSta
return json_encode(['action' => $additionalInformation['action']]); return json_encode(['action' => $additionalInformation['action']]);
} }
} }
/**
* If payment method is google pay
*/
if ($payment->getMethod() === AdyenGooglePayConfigProvider::CODE) {
$additionalInformation = $payment->getAdditionalInformation();
if (!empty($additionalInformation['threeDSType'])) {
return json_encode(['type' => $additionalInformation['threeDSType']]);
}
}
return true; return true;
} }
......
...@@ -43,7 +43,7 @@ class Notification extends \Magento\Framework\Model\AbstractModel implements Not ...@@ -43,7 +43,7 @@ class Notification extends \Magento\Framework\Model\AbstractModel implements Not
const POSAPPROVED = 'POS_APPROVED'; const POSAPPROVED = 'POS_APPROVED';
const HANDLED_EXTERNALLY = 'HANDLED_EXTERNALLY'; const HANDLED_EXTERNALLY = 'HANDLED_EXTERNALLY';
const MANUAL_REVIEW_ACCEPT = 'MANUAL_REVIEW_ACCEPT'; const MANUAL_REVIEW_ACCEPT = 'MANUAL_REVIEW_ACCEPT';
const MANUAL_REVIEW_REJECT = 'MANUAL_REVIEW_REJECT '; const MANUAL_REVIEW_REJECT = 'MANUAL_REVIEW_REJECT';
const RECURRING_CONTRACT = "RECURRING_CONTRACT"; const RECURRING_CONTRACT = "RECURRING_CONTRACT";
const REPORT_AVAILABLE = "REPORT_AVAILABLE"; const REPORT_AVAILABLE = "REPORT_AVAILABLE";
const ORDER_CLOSED = "ORDER_CLOSED"; const ORDER_CLOSED = "ORDER_CLOSED";
......
...@@ -106,6 +106,10 @@ class AdyenGooglePayConfigProvider implements ConfigProviderInterface ...@@ -106,6 +106,10 @@ class AdyenGooglePayConfigProvider implements ConfigProviderInterface
self::CODE => [ self::CODE => [
'isActive' => true, 'isActive' => true,
'redirectUrl' => $this->urlBuilder->getUrl( 'redirectUrl' => $this->urlBuilder->getUrl(
'adyen/process/redirect/',
['_secure' => $this->_getRequest()->isSecure()]
),
'successUrl' => $this->urlBuilder->getUrl(
'checkout/onepage/success/', 'checkout/onepage/success/',
['_secure' => $this->_getRequest()->isSecure()] ['_secure' => $this->_getRequest()->isSecure()]
) )
......
...@@ -12,7 +12,9 @@ Inside Adyen toggle the following settings on inside the API and Responses secti ...@@ -12,7 +12,9 @@ Inside Adyen toggle the following settings on inside the API and Responses secti
* Variant * Variant
## Requirements ## Requirements
This plugin supports Magento2 version 2.2.8 and higher. This plugin supports Magento2 version
* 2.2.9 and higher
* 2.3.1 and higher
## Contributing ## Contributing
We strongly encourage you to join us in contributing to this repository so everyone can benefit from: We strongly encourage you to join us in contributing to this repository so everyone can benefit from:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "adyen/module-payment", "name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.", "description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module", "type": "magento2-module",
"version": "6.6.4", "version": "6.6.5",
"license": [ "license": [
"OSL-3.0", "OSL-3.0",
"AFL-3.0" "AFL-3.0"
......
...@@ -607,7 +607,6 @@ ...@@ -607,7 +607,6 @@
<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="oneclick" xsi:type="string">Adyen\Payment\Gateway\Request\OneclickAuthorizationDataBuilder</item> <item name="oneclick" xsi:type="string">Adyen\Payment\Gateway\Request\OneclickAuthorizationDataBuilder</item>
<item name="threeds2" xsi:type="string">Adyen\Payment\Gateway\Request\ThreeDS2DataBuilder</item> <item name="threeds2" xsi:type="string">Adyen\Payment\Gateway\Request\ThreeDS2DataBuilder</item>
<item name="redirect" xsi:type="string">Adyen\Payment\Gateway\Request\RedirectDataBuilder</item>
</argument> </argument>
</arguments> </arguments>
</virtualType> </virtualType>
......
...@@ -34,9 +34,10 @@ define( ...@@ -34,9 +34,10 @@ define(
'Magento_Checkout/js/model/full-screen-loader', 'Magento_Checkout/js/model/full-screen-loader',
'mage/url', 'mage/url',
'Magento_Vault/js/view/payment/vault-enabler', 'Magento_Vault/js/view/payment/vault-enabler',
'Adyen_Payment/js/model/adyen-payment-service',
'adyenCheckout' 'adyenCheckout'
], ],
function (ko, $, Component, placeOrderAction, additionalValidators, quote, urlBuilder, fullScreenLoader, url, VaultEnabler, AdyenCheckout) { function (ko, $, Component, placeOrderAction, additionalValidators, quote, urlBuilder, fullScreenLoader, url, VaultEnabler, adyenPaymentService,AdyenCheckout) {
'use strict'; 'use strict';
/** /**
...@@ -128,13 +129,16 @@ define( ...@@ -128,13 +129,16 @@ define(
self.isPlaceOrderActionAllowed(true); self.isPlaceOrderActionAllowed(true);
} }
).done( ).done(
function () { function (orderId) {
self.afterPlaceOrder(); self.afterPlaceOrder();
window.location.replace(url.build(window.checkoutConfig.payment[quote.paymentMethod().method].redirectUrl)); adyenPaymentService.getOrderPaymentStatus(orderId)
.done(function (responseJSON) {
self.validateThreeDSOrPlaceOrder(responseJSON)
});
} }
); );
} }
}, },
buttonColor: 'black', // default/black/white buttonColor: 'black', // default/black/white
buttonType: 'long', // long/short buttonType: 'long', // long/short
...@@ -150,6 +154,22 @@ define( ...@@ -150,6 +154,22 @@ define(
self.googlePayAllowed(false); self.googlePayAllowed(false);
}); });
}, },
/**
* Based on the response we can start a 3DS2 validation or place the order
* @param responseJSON
*/
validateThreeDSOrPlaceOrder: function (responseJSON) {
var response = JSON.parse(responseJSON);
if (response && response.type === 'RedirectShopper') {
window.location.replace(url.build(
window.checkoutConfig.payment[quote.paymentMethod().method].redirectUrl
));
} else {
window.location.replace(url.build(
window.checkoutConfig.payment[quote.paymentMethod().method].successUrl
));
}
},
isGooglePayAllowed: function () { isGooglePayAllowed: function () {
if (this.googlePayAllowed()) { if (this.googlePayAllowed()) {
return true; return true;
......
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