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 77373c29 authored by cyattilakiss's avatar cyattilakiss Committed by GitHub

Merge pull request #474 from Adyen/PW-1368

PW-1368 Upgrade components version to 3.0.0
parents a2a393c6 57e7dcc3
...@@ -87,9 +87,9 @@ class Cc extends \Magento\Payment\Block\Form\Cc ...@@ -87,9 +87,9 @@ class Cc extends \Magento\Payment\Block\Form\Cc
/** /**
* @return string * @return string
*/ */
public function getCheckoutContextUrl() public function getCheckoutEnvironment()
{ {
return $this->adyenHelper->getCheckoutContextUrl($this->checkoutSession->getQuote()->getStore()->getId()); return $this->adyenHelper->getCheckoutEnvironment($this->checkoutSession->getQuote()->getStore()->getId());
} }
/** /**
......
...@@ -33,10 +33,8 @@ class Data extends AbstractHelper ...@@ -33,10 +33,8 @@ class Data extends AbstractHelper
const MODULE_NAME = 'adyen-magento2'; const MODULE_NAME = 'adyen-magento2';
const TEST = 'test'; const TEST = 'test';
const LIVE = 'live'; const LIVE = 'live';
const CHECKOUT_CONTEXT_URL_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/'; const CHECKOUT_COMPONENT_JS_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.0.0/adyen.js';
const CHECKOUT_CONTEXT_URL_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/'; const CHECKOUT_COMPONENT_JS_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/3.0.0/adyen.js';
const CHECKOUT_COMPONENT_JS_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/2.5.0/adyen.js';
const CHECKOUT_COMPONENT_JS_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/2.5.0/adyen.js';
/** /**
* @var \Magento\Framework\Encryption\EncryptorInterface * @var \Magento\Framework\Encryption\EncryptorInterface
...@@ -1549,13 +1547,13 @@ class Data extends AbstractHelper ...@@ -1549,13 +1547,13 @@ class Data extends AbstractHelper
* @param int|null $storeId * @param int|null $storeId
* @return string * @return string
*/ */
public function getCheckoutContextUrl($storeId = null) public function getCheckoutEnvironment($storeId = null)
{ {
if ($this->isDemoMode($storeId)) { if ($this->isDemoMode($storeId)) {
return self::CHECKOUT_CONTEXT_URL_TEST; return self::TEST;
} }
return self::CHECKOUT_CONTEXT_URL_LIVE; return self::LIVE;
} }
/** /**
......
...@@ -146,7 +146,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface ...@@ -146,7 +146,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$config['payment']['adyenCc']['icons'] = $this->getIcons(); $config['payment']['adyenCc']['icons'] = $this->getIcons();
$config['payment']['adyenCc']['originKey'] = $this->_adyenHelper->getOriginKeyForBaseUrl(); $config['payment']['adyenCc']['originKey'] = $this->_adyenHelper->getOriginKeyForBaseUrl();
$config['payment']['adyenCc']['checkoutUrl'] = $this->_adyenHelper->getCheckoutContextUrl($this->storeManager->getStore()->getId()); $config['payment']['adyenCc']['checkoutEnvironment'] = $this->_adyenHelper->getCheckoutEnvironment($this->storeManager->getStore()->getId());
// has installments by default false // has installments by default false
$config['payment']['adyenCc']['hasInstallments'] = false; $config['payment']['adyenCc']['hasInstallments'] = false;
......
...@@ -143,7 +143,7 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface ...@@ -143,7 +143,7 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
$config['payment']['adyenOneclick']['methodCode'] = self::CODE; $config['payment']['adyenOneclick']['methodCode'] = self::CODE;
$config['payment']['adyenOneclick']['originKey'] = $this->_adyenHelper->getOriginKeyForBaseUrl(); $config['payment']['adyenOneclick']['originKey'] = $this->_adyenHelper->getOriginKeyForBaseUrl();
$config['payment']['adyenOneclick']['checkoutUrl'] = $this->_adyenHelper->getCheckoutContextUrl($this->_storeManager->getStore()->getId()); $config['payment']['adyenOneclick']['checkoutEnvironment'] = $this->_adyenHelper->getCheckoutEnvironment($this->_storeManager->getStore()->getId());
$config['payment']['adyenOneclick']['locale'] = $this->_adyenHelper->getStoreLocale($this->_storeManager->getStore()->getId()); $config['payment']['adyenOneclick']['locale'] = $this->_adyenHelper->getStoreLocale($this->_storeManager->getStore()->getId());
$enableOneclick = $this->_adyenHelper->getAdyenAbstractConfigData('enable_oneclick'); $enableOneclick = $this->_adyenHelper->getAdyenAbstractConfigData('enable_oneclick');
......
...@@ -113,7 +113,7 @@ echo $code; ?>" style="display:none"> ...@@ -113,7 +113,7 @@ echo $code; ?>" style="display:none">
var card = checkout.create('card', { var card = checkout.create('card', {
originKey: "<?php echo $block->getCheckoutOriginKeys(); ?>", originKey: "<?php echo $block->getCheckoutOriginKeys(); ?>",
loadingContext: "<?php echo $block->getCheckoutContextUrl(); ?>", environment: "<?php echo $block->getCheckoutEnvironment(); ?>",
type: 'card', type: 'card',
groupTypes: ccTypes, groupTypes: ccTypes,
hideCVC: hideCVC, hideCVC: hideCVC,
...@@ -122,13 +122,17 @@ echo $code; ?>" style="display:none"> ...@@ -122,13 +122,17 @@ echo $code; ?>" style="display:none">
// When the state is valid update the input fields // When the state is valid update the input fields
if (state.isValid) { if (state.isValid) {
// Here we enable the button if the component is now valid // Here we enable the button if the component is now valid
jQuery("#<?php /* @noEscape */ echo $code; ?>-number").val(state.data.encryptedCardNumber); jQuery("#<?php /* @noEscape */ echo $code; ?>-number").val(state.data.paymentMethod.encryptedCardNumber);
jQuery("#<?php /* @noEscape */ echo $code; ?>-expiryMonth").val(state.data.encryptedExpiryMonth); jQuery("#<?php /* @noEscape */ echo $code; ?>-expiryMonth").val(state.data.paymentMethod.encryptedExpiryMonth);
jQuery("#<?php /* @noEscape */ echo $code; ?>-expiryYear").val(state.data.encryptedExpiryYear); jQuery("#<?php /* @noEscape */ echo $code; ?>-expiryYear").val(state.data.paymentMethod.encryptedExpiryYear);
jQuery("#<?php /* @noEscape */ echo $code; ?>-cvc").val(state.data.encryptedSecurityCode); jQuery("#<?php /* @noEscape */ echo $code; ?>-cvc").val(state.data.paymentMethod.encryptedSecurityCode);
jQuery("#<?php /* @noEscape */ echo $code; ?>-cc_type").val(getCcCodeByAltCode(state.brand));
} }
}, },
onBrand: function (state) {
if (state.isValid) {
jQuery("#<?php /* @noEscape */ echo $code; ?>-cc_type").val(getCcCodeByAltCode(state.brand));
}
}
onError: function () { onError: function () {
} }
}); });
......
This diff is collapsed.
...@@ -84,7 +84,6 @@ define( ...@@ -84,7 +84,6 @@ define(
'expiryYear', 'expiryYear',
'installment', 'installment',
'creditCardDetailsValid', 'creditCardDetailsValid',
'variant',
'placeOrderAllowed' 'placeOrderAllowed'
]); ]);
...@@ -119,7 +118,7 @@ define( ...@@ -119,7 +118,7 @@ define(
self.cardComponent = self.checkout.create('card', { self.cardComponent = self.checkout.create('card', {
originKey: self.getOriginKey(), originKey: self.getOriginKey(),
loadingContext: self.getLoadingContext(), environment: self.getCheckoutEnvironment(),
type: 'card', type: 'card',
hasHolderName: true, hasHolderName: true,
holderNameRequired: true, holderNameRequired: true,
...@@ -128,13 +127,12 @@ define( ...@@ -128,13 +127,12 @@ define(
onChange: function (state, component) { onChange: function (state, component) {
if (!!state.isValid && !component.state.errors.encryptedSecurityCode) { if (!!state.isValid && !component.state.errors.encryptedSecurityCode) {
self.storeCc = !!state.data.storeDetails; self.storeCc = !!state.data.storePaymentMethod;
self.variant(state.brand); self.creditCardNumber(state.data.paymentMethod.encryptedCardNumber);
self.creditCardNumber(state.data.encryptedCardNumber); self.expiryMonth(state.data.paymentMethod.encryptedExpiryMonth);
self.expiryMonth(state.data.encryptedExpiryMonth); self.expiryYear(state.data.paymentMethod.encryptedExpiryYear);
self.expiryYear(state.data.encryptedExpiryYear); self.securityCode(state.data.paymentMethod.encryptedSecurityCode);
self.securityCode(state.data.encryptedSecurityCode); self.creditCardOwner(state.data.paymentMethod.holderName);
self.creditCardOwner(state.data.holderName);
self.creditCardDetailsValid(true); self.creditCardDetailsValid(true);
self.placeOrderAllowed(true); self.placeOrderAllowed(true);
} else { } else {
...@@ -269,7 +267,7 @@ define( ...@@ -269,7 +267,7 @@ define(
/** /**
* Builds the payment details part of the payment information reqeust * Builds the payment details part of the payment information reqeust
* *
* @returns {{method: *, additional_data: {card_brand: *, cc_type: *, number: *, cvc: *, expiryMonth: *, expiryYear: *, holderName: *, store_cc: (boolean|*), number_of_installments: *, java_enabled: boolean, screen_color_depth: number, screen_width, screen_height, timezone_offset: *}}} * @returns {{method: *, additional_data: {cc_type: *, number: *, cvc: *, expiryMonth: *, expiryYear: *, holderName: *, store_cc: (boolean|*), number_of_installments: *, java_enabled: () => boolean, screen_color_depth: number, screen_width, screen_height, timezone_offset: *, language: *}}}
*/ */
getCcData: function () { getCcData: function () {
const browserInfo = threeDS2Utils.getBrowserInfo(); const browserInfo = threeDS2Utils.getBrowserInfo();
...@@ -277,7 +275,6 @@ define( ...@@ -277,7 +275,6 @@ define(
var data = { var data = {
'method': this.item.method, 'method': this.item.method,
additional_data: { additional_data: {
'card_brand': this.variant(),
'cc_type': this.creditCardType(), 'cc_type': this.creditCardType(),
'number': this.creditCardNumber(), 'number': this.creditCardNumber(),
'cvc': this.securityCode(), 'cvc': this.securityCode(),
...@@ -306,7 +303,6 @@ define( ...@@ -306,7 +303,6 @@ define(
return { return {
'method': this.item.method, 'method': this.item.method,
additional_data: { additional_data: {
'card_brand': this.variant(),
'cc_type': this.creditCardType(), 'cc_type': this.creditCardType(),
'store_cc': this.storeCc, 'store_cc': this.storeCc,
'number_of_installments': this.installment() 'number_of_installments': this.installment()
...@@ -454,8 +450,8 @@ define( ...@@ -454,8 +450,8 @@ define(
getOriginKey: function () { getOriginKey: function () {
return window.checkoutConfig.payment.adyenCc.originKey; return window.checkoutConfig.payment.adyenCc.originKey;
}, },
getLoadingContext: function () { getCheckoutEnvironment: function () {
return window.checkoutConfig.payment.adyenCc.checkoutUrl; return window.checkoutConfig.payment.adyenCc.checkoutEnvironment;
}, },
getLocale: function () { getLocale: function () {
return window.checkoutConfig.payment.adyenCc.locale; return window.checkoutConfig.payment.adyenCc.locale;
......
...@@ -373,7 +373,7 @@ define( ...@@ -373,7 +373,7 @@ define(
items: result.getIssuers(), items: result.getIssuers(),
onChange: function (state) { onChange: function (state) {
if (!!state.isValid) { if (!!state.isValid) {
result.issuer(state.data.issuer); result.issuer(state.data.paymentMethod.issuer);
result.isPlaceOrderAllowed(true); result.isPlaceOrderAllowed(true);
} else { } else {
...@@ -398,8 +398,8 @@ define( ...@@ -398,8 +398,8 @@ define(
countryCode: self.getLocale(), countryCode: self.getLocale(),
onChange: function (state) { onChange: function (state) {
if (!!state.isValid) { if (!!state.isValid) {
result.ownerName(state.data["sepa.ownerName"]); result.ownerName(state.data.paymentMethod["sepa.ownerName"]);
result.ibanNumber(state.data["sepa.ibanNumber"]); result.ibanNumber(state.data.paymentMethod["sepa.ibanNumber"]);
result.isPlaceOrderAllowed(true); result.isPlaceOrderAllowed(true);
} else { } else {
result.isPlaceOrderAllowed(false); result.isPlaceOrderAllowed(false);
...@@ -431,9 +431,9 @@ define( ...@@ -431,9 +431,9 @@ define(
}, },
onChange: function (state) { onChange: function (state) {
if (!!state.isValid) { if (!!state.isValid) {
result.dob(state.data.personalDetails.dateOfBirth); result.dob(state.data.paymentMethod.personalDetails.dateOfBirth);
result.telephone(state.data.personalDetails.telephoneNumber); result.telephone(state.data.paymentMethod.personalDetails.telephoneNumber);
result.gender(state.data.personalDetails.gender); result.gender(state.data.paymentMethod.personalDetails.gender);
result.isPlaceOrderAllowed(true); result.isPlaceOrderAllowed(true);
} else { } else {
result.isPlaceOrderAllowed(false); result.isPlaceOrderAllowed(false);
...@@ -456,9 +456,9 @@ define( ...@@ -456,9 +456,9 @@ define(
}, },
onChange: function (state) { onChange: function (state) {
if (!!state.isValid) { if (!!state.isValid) {
result.dob(state.data.personalDetails.dateOfBirth); result.dob(state.data.paymentMethod.personalDetails.dateOfBirth);
result.telephone(state.data.personalDetails.telephoneNumber); result.telephone(state.data.paymentMethod.personalDetails.telephoneNumber);
result.gender(state.data.personalDetails.gender); result.gender(state.data.paymentMethod.personalDetails.gender);
result.isPlaceOrderAllowed(true); result.isPlaceOrderAllowed(true);
} else { } else {
result.isPlaceOrderAllowed(false); result.isPlaceOrderAllowed(false);
......
...@@ -110,7 +110,7 @@ define( ...@@ -110,7 +110,7 @@ define(
var checkout = new AdyenCheckout({ var checkout = new AdyenCheckout({
locale: self.getLocale(), locale: self.getLocale(),
originKey: self.getOriginKey(), originKey: self.getOriginKey(),
loadingContext: self.getLoadingContext(), environment: self.getCheckoutEnvironment(),
risk: { risk: {
enabled: false enabled: false
} }
...@@ -256,9 +256,10 @@ define( ...@@ -256,9 +256,10 @@ define(
isValid(true); isValid(true);
if (typeof state.data !== 'undefined' && if (typeof state.data !== 'undefined' &&
typeof state.data.encryptedSecurityCode !== 'undefined' typeof state.data.paymentMethod !== 'undefined' &&
typeof state.data.paymentMethod.encryptedSecurityCode !== 'undefined'
) { ) {
self.encryptedCreditCardVerificationNumber = state.data.encryptedSecurityCode; self.encryptedCreditCardVerificationNumber = state.data.paymentMethod.encryptedSecurityCode;
} }
} else { } else {
self.encryptedCreditCardVerificationNumber = ''; self.encryptedCreditCardVerificationNumber = '';
...@@ -268,14 +269,6 @@ define( ...@@ -268,14 +269,6 @@ define(
isValid(false); isValid(false);
} }
} }
// When we move to the component v2.2 it should be removed
if (self.agreement_data.variant == "maestro" &&
component.state.errors.encryptedSecurityCode
) {
self.placeOrderAllowed(false);
isValid(false);
}
} }
}) })
.mount(oneClickCardNode); .mount(oneClickCardNode);
...@@ -566,8 +559,8 @@ define( ...@@ -566,8 +559,8 @@ define(
getOriginKey: function () { getOriginKey: function () {
return window.checkoutConfig.payment.adyenOneclick.originKey; return window.checkoutConfig.payment.adyenOneclick.originKey;
}, },
getLoadingContext: function () { getCheckoutEnvironment: function () {
return window.checkoutConfig.payment.adyenOneclick.checkoutUrl; return window.checkoutConfig.payment.adyenOneclick.checkoutEnvironment;
} }
}); });
} }
......
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