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 9ece2e5f authored by attilak's avatar attilak

[WIP]

Convert Magento locale codes to ISO locale codes
Fix javaEnabled and stateOrProvince
Stop loading if error response returned during 3DS process
parent 6eeed37f
......@@ -1123,12 +1123,12 @@ class Data extends AbstractHelper
{
$localeCode = $this->getAdyenAbstractConfigData('shopper_locale', $store->getId());
if ($localeCode != "") {
return $localeCode;
return $this->formatLocaleCode($localeCode);
}
$locale = $this->localeResolver->getLocale();
if ($locale) {
return $locale;
$localeCode = $this->localeResolver->getLocale();
if ($localeCode) {
return $this->formatLocaleCode($localeCode);
}
// should have the value if not fall back to default
......@@ -1138,7 +1138,16 @@ class Data extends AbstractHelper
$store->getCode()
);
return $localeCode;
return $this->formatLocaleCode($localeCode);
}
/**
* Format Magento locale codes with undersocre to ISO locale codes with dash
* @param $localeCode
*/
public function formatLocaleCode($localeCode)
{
return str_replace("_", "-", $localeCode);
}
public function getApplePayShippingTypes()
......
......@@ -29,7 +29,7 @@ use Magento\Vault\Model\Ui\VaultConfigProvider;
use Adyen\Payment\Observer\AdyenHppDataAssignObserver;
use Adyen\Payment\Observer\AdyenCcDataAssignObserver;
//TODO: enable stateOrProvince field if no issues with empty values
class Requests extends AbstractHelper
{
/**
......@@ -149,7 +149,6 @@ class Requests extends AbstractHelper
"postalCode" => '',
"city" => "N/A",
"houseNumberOrName" => '',
// "stateOrProvince" => '',
"country" => "ZZ"
];
......@@ -174,9 +173,9 @@ class Requests extends AbstractHelper
$requestBilling["city"] = $billingAddress->getCity();
}
// if (!empty($billingAddress->getRegionCode())) {
// $requestBilling["stateOrProvince"] = $billingAddress->getRegionCode();
// }
if (!empty($billingAddress->getRegionCode())) {
$requestBilling["stateOrProvince"] = $billingAddress->getRegionCode();
}
if (!empty($billingAddress->getCountryId())) {
$requestBilling["country"] = $billingAddress->getCountryId();
......@@ -196,7 +195,6 @@ class Requests extends AbstractHelper
"postalCode" => '',
"city" => "N/A",
"houseNumberOrName" => '',
// "stateOrProvince" => '',
"country" => "ZZ"
];
......@@ -222,9 +220,9 @@ class Requests extends AbstractHelper
$requestDelivery["city"] = $shippingAddress->getCity();
}
// if (!empty($shippingAddress->getRegionCode())) {
// $requestDelivery["stateOrProvince"] = $shippingAddress->getRegionCode();
// }
if (!empty($shippingAddress->getRegionCode())) {
$requestDelivery["stateOrProvince"] = $shippingAddress->getRegionCode();
}
if (!empty($shippingAddress->getCountryId())) {
$requestDelivery["country"] = $shippingAddress->getCountryId();
......@@ -289,8 +287,13 @@ class Requests extends AbstractHelper
$request['browserInfo']['screenHeight'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::SCREEN_HEIGHT);
$request['browserInfo']['colorDepth'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::SCREEN_COLOR_DEPTH);
$request['browserInfo']['timeZoneOffset'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::TIMEZONE_OFFSET);
$request['browserInfo']['language'] = "nl-NL";//$this->adyenHelper->getCurrentLocaleCode($store); TODO change format to nl-NL instead of nl_NL
$request['browserInfo']['javaEnabled'] = false; //$payment->getAdditionalInformation(AdyenCcDataAssignObserver::JAVA_ENABLED);TODO make sure it is not passed as null
$request['browserInfo']['language'] = $this->adyenHelper->getCurrentLocaleCode($store);
if ($javaEnabled = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::JAVA_ENABLED)) {
$request['browserInfo']['javaEnabled'] = $javaEnabled;
} else {
$request['browserInfo']['javaEnabled'] = false;
}
// uset browser related data from additional information
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::SCREEN_WIDTH);
......
......@@ -261,6 +261,8 @@ define(
).done(function(responseJSON) {
fullScreenLoader.stopLoader();
self.validateThreeDS2OrPlaceOrder(responseJSON)
}).error(function(responseJSON) {
fullScreenLoader.stopLoader();
});
},
/**
......
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