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