We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

Commit 64453dbd authored by cyattilakiss's avatar cyattilakiss Committed by GitHub

Merge pull request #434 from Adyen/PW-1085

PW-1085 House number parsing doesn't always work properly
parents 0dbcbcaf a208542b
......@@ -335,6 +335,8 @@ class Redirect extends \Magento\Payment\Block\Form
$formFields['shopper.lastName'] = trim($billingAddress->getLastname());
$formFields['shopper.telephoneNumber'] = trim($billingAddress->getTelephone());
if ($this->_adyenHelper->isSeparateHouseNumberRequired($billingAddress->getCountryId())) {
$street = $this->_adyenHelper->getStreet($billingAddress);
if (isset($street['name']) && $street['name'] != "") {
......@@ -346,6 +348,9 @@ class Redirect extends \Magento\Payment\Block\Form
} else {
$formFields['billingAddress.houseNumberOrName'] = "NA";
}
} else {
$formFields['billingAddress.street'] = implode(" ", $billingAddress->getStreet());
}
if (trim($billingAddress->getCity()) == "") {
$formFields['billingAddress.city'] = "NA";
......@@ -384,6 +389,7 @@ class Redirect extends \Magento\Payment\Block\Form
$shippingAddress = $this->_order->getShippingAddress();
if ($shippingAddress) {
if ($this->_adyenHelper->isSeparateHouseNumberRequired($shippingAddress->getCountryId())) {
$street = $this->_adyenHelper->getStreet($shippingAddress);
if (isset($street['name']) && $street['name'] != "") {
......@@ -395,6 +401,10 @@ class Redirect extends \Magento\Payment\Block\Form
} else {
$formFields['deliveryAddress.houseNumberOrName'] = "NA";
}
} else {
$formFields['deliveryAddress.street'] = implode(" ", $shippingAddress->getStreet());
}
if (trim($shippingAddress->getCity()) == "") {
$formFields['deliveryAddress.city'] = "NA";
......@@ -420,6 +430,7 @@ class Redirect extends \Magento\Payment\Block\Form
$formFields['deliveryAddress.country'] = trim($shippingAddress->getCountryId());
}
}
return $formFields;
}
......
......@@ -1607,4 +1607,16 @@ class Data extends AbstractHelper
return $this->getAdyenCcVaultConfigDataFlag('active', $storeId);
}
/**
* Checks if the house number needs to be sent to the Adyen API separately or as it is in the street field
*
* @param $country
* @return bool
*/
public function isSeparateHouseNumberRequired($country)
{
$countryList = ["nl", "de", "se", "no", "at", "fi", "dk"];
return in_array(strtolower($country), $countryList);
}
}
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