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 34bbb13c authored by Alexandros Moraitis's avatar Alexandros Moraitis Committed by GitHub

Merge pull request #876 from Adyen/develop

Release 6.6.5
parents 4d50e700 9b5d48cf
<?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;
}
}
......@@ -357,19 +357,6 @@ class Requests extends AbstractHelper
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 $areaCode
......
......@@ -25,6 +25,7 @@
namespace Adyen\Payment\Model;
use Adyen\Payment\Model\Ui\AdyenCcConfigProvider;
use Adyen\Payment\Model\Ui\AdyenGooglePayConfigProvider;
use Adyen\Payment\Model\Ui\AdyenHppConfigProvider;
use Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider;
......@@ -102,6 +103,15 @@ class AdyenOrderPaymentStatus implements \Adyen\Payment\Api\AdyenOrderPaymentSta
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;
}
......
......@@ -97,6 +97,10 @@ class AdyenGooglePayConfigProvider implements ConfigProviderInterface
self::CODE => [
'isActive' => true,
'redirectUrl' => $this->urlBuilder->getUrl(
'adyen/process/redirect/',
['_secure' => $this->_getRequest()->isSecure()]
),
'successUrl' => $this->urlBuilder->getUrl(
'checkout/onepage/success/',
['_secure' => $this->_getRequest()->isSecure()]
)
......
......@@ -12,7 +12,9 @@ Inside Adyen toggle the following settings on inside the API and Responses secti
* Variant
## 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
We strongly encourage you to join us in contributing to this repository so everyone can benefit from:
......
......@@ -2,7 +2,7 @@
"name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module",
"version": "6.6.4",
"version": "6.6.5",
"license": [
"OSL-3.0",
"AFL-3.0"
......
......@@ -607,7 +607,6 @@
<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="threeds2" xsi:type="string">Adyen\Payment\Gateway\Request\ThreeDS2DataBuilder</item>
<item name="redirect" xsi:type="string">Adyen\Payment\Gateway\Request\RedirectDataBuilder</item>
</argument>
</arguments>
</virtualType>
......
......@@ -34,9 +34,10 @@ define(
'Magento_Checkout/js/model/full-screen-loader',
'mage/url',
'Magento_Vault/js/view/payment/vault-enabler',
'Adyen_Payment/js/model/adyen-payment-service',
'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';
/**
......@@ -128,13 +129,16 @@ define(
self.isPlaceOrderActionAllowed(true);
}
).done(
function () {
self.afterPlaceOrder();
window.location.replace(url.build(window.checkoutConfig.payment[quote.paymentMethod().method].redirectUrl));
}
);
function (orderId) {
self.afterPlaceOrder();
adyenPaymentService.getOrderPaymentStatus(orderId)
.done(function (responseJSON) {
self.validateThreeDSOrPlaceOrder(responseJSON)
});
}
);
}
},
buttonColor: 'black', // default/black/white
buttonType: 'long', // long/short
......@@ -150,6 +154,22 @@ define(
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 () {
if (this.googlePayAllowed()) {
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