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 3c41d3e6 authored by attilak's avatar attilak

Version bump component from 2.5.0 to 3.0.0

Using environment in components instead of loadingContext
Rename functions for getCheckoutContextUrl to getCheckoutEnvironment
Update styling
Follow component response changes - instead of state.data remap values
to state.data.paymentMethod
parent 301965fc
...@@ -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,10 @@ class Data extends AbstractHelper ...@@ -33,10 +33,10 @@ 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_ENVIRONMENT_URL_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';
const CHECKOUT_CONTEXT_URL_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/'; const CHECKOUT_ENVIRONMENT_URL_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/';
const CHECKOUT_COMPONENT_JS_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/2.5.0/adyen.js'; const CHECKOUT_COMPONENT_JS_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/3.0.0/adyen.js';
const CHECKOUT_COMPONENT_JS_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/2.5.0/adyen.js'; const CHECKOUT_COMPONENT_JS_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/3.0.0/adyen.js';
/** /**
* @var \Magento\Framework\Encryption\EncryptorInterface * @var \Magento\Framework\Encryption\EncryptorInterface
...@@ -1549,13 +1549,13 @@ class Data extends AbstractHelper ...@@ -1549,13 +1549,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::CHECKOUT_ENVIRONMENT_URL_TEST;
} }
return self::CHECKOUT_CONTEXT_URL_LIVE; return self::CHECKOUT_ENVIRONMENT_URL_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']['checkoutUrl'] = $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']['checkoutUrl'] = $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,10 +122,10 @@ echo $code; ?>" style="display:none"> ...@@ -122,10 +122,10 @@ 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)); jQuery("#<?php /* @noEscape */ echo $code; ?>-cc_type").val(getCcCodeByAltCode(state.brand));
} }
}, },
......
This diff is collapsed.
...@@ -119,7 +119,7 @@ define( ...@@ -119,7 +119,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 +128,13 @@ define( ...@@ -128,13 +128,13 @@ 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.variant(state.brand);
self.creditCardNumber(state.data.encryptedCardNumber); self.creditCardNumber(state.data.paymentMethod.encryptedCardNumber);
self.expiryMonth(state.data.encryptedExpiryMonth); self.expiryMonth(state.data.paymentMethod.encryptedExpiryMonth);
self.expiryYear(state.data.encryptedExpiryYear); self.expiryYear(state.data.paymentMethod.encryptedExpiryYear);
self.securityCode(state.data.encryptedSecurityCode); self.securityCode(state.data.paymentMethod.encryptedSecurityCode);
self.creditCardOwner(state.data.holderName); self.creditCardOwner(state.data.paymentMethod.holderName);
self.creditCardDetailsValid(true); self.creditCardDetailsValid(true);
self.placeOrderAllowed(true); self.placeOrderAllowed(true);
} else { } else {
...@@ -454,7 +454,7 @@ define( ...@@ -454,7 +454,7 @@ 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.checkoutUrl;
}, },
getLocale: function () { getLocale: function () {
......
...@@ -384,7 +384,7 @@ define( ...@@ -384,7 +384,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 {
...@@ -409,8 +409,8 @@ define( ...@@ -409,8 +409,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);
...@@ -442,9 +442,9 @@ define( ...@@ -442,9 +442,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);
...@@ -467,9 +467,9 @@ define( ...@@ -467,9 +467,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,7 +559,7 @@ define( ...@@ -566,7 +559,7 @@ 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.checkoutUrl;
} }
}); });
......
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