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 0e3c72ec authored by basm's avatar basm

PW-304 Inserted Personal number for Nordic countries

parent 74a0b291
...@@ -274,8 +274,6 @@ class Redirect extends \Magento\Payment\Block\Form ...@@ -274,8 +274,6 @@ class Redirect extends \Magento\Payment\Block\Form
$formFields = $this->setOpenInvoiceData($formFields); $formFields = $this->setOpenInvoiceData($formFields);
$formFields['shopper.gender'] = $this->getGenderText($this->_order->getCustomerGender()); $formFields['shopper.gender'] = $this->getGenderText($this->_order->getCustomerGender());
$dob = $this->_order->getCustomerDob(); $dob = $this->_order->getCustomerDob();
if ($dob) { if ($dob) {
$formFields['shopper.dateOfBirthDayOfMonth'] = trim($this->_getDate($dob, 'd')); $formFields['shopper.dateOfBirthDayOfMonth'] = trim($this->_getDate($dob, 'd'));
...@@ -285,6 +283,10 @@ class Redirect extends \Magento\Payment\Block\Form ...@@ -285,6 +283,10 @@ class Redirect extends \Magento\Payment\Block\Form
// For klarna acceptPrivacyPolicy to skip HPP page // For klarna acceptPrivacyPolicy to skip HPP page
if ($brandCode == "klarna") { if ($brandCode == "klarna") {
$ssn = $this->_order->getPayment()->getAdditionalInformation('ssn');
if (!empty($ssn)) {
$formFields['shopper.socialSecurityNumber'] = $this->_order->getPayment()->getAdditionalInformation('ssn');
}
// // needed for DE and AT // // needed for DE and AT
$formFields['klarna.acceptPrivacyPolicy'] = 'true'; $formFields['klarna.acceptPrivacyPolicy'] = 'true';
} }
...@@ -324,7 +326,7 @@ class Redirect extends \Magento\Payment\Block\Form ...@@ -324,7 +326,7 @@ class Redirect extends \Magento\Payment\Block\Form
// echo "GENDER" . $this->_order->getCustomerGender(); // echo "GENDER" . $this->_order->getCustomerGender();
// //
// print_r($formFields);die(); //print_r($formFields);die();
return $formFields; return $formFields;
} }
...@@ -336,9 +338,7 @@ class Redirect extends \Magento\Payment\Block\Form ...@@ -336,9 +338,7 @@ class Redirect extends \Magento\Payment\Block\Form
protected function setBillingAddressData($formFields) protected function setBillingAddressData($formFields)
{ {
$billingAddress = $this->_order->getBillingAddress(); $billingAddress = $this->_order->getBillingAddress();
if ($billingAddress) { if ($billingAddress) {
$formFields['shopper.firstName'] = trim($billingAddress->getFirstname()); $formFields['shopper.firstName'] = trim($billingAddress->getFirstname());
$middleName = trim($billingAddress->getMiddlename()); $middleName = trim($billingAddress->getMiddlename());
if ($middleName != "") { if ($middleName != "") {
...@@ -347,7 +347,6 @@ class Redirect extends \Magento\Payment\Block\Form ...@@ -347,7 +347,6 @@ class Redirect extends \Magento\Payment\Block\Form
$formFields['shopper.lastName'] = trim($billingAddress->getLastname()); $formFields['shopper.lastName'] = trim($billingAddress->getLastname());
$formFields['shopper.telephoneNumber'] = trim($billingAddress->getTelephone()); $formFields['shopper.telephoneNumber'] = trim($billingAddress->getTelephone());
$street = $this->_adyenHelper->getStreet($billingAddress); $street = $this->_adyenHelper->getStreet($billingAddress);
if (isset($street['name']) && $street['name'] != "") { if (isset($street['name']) && $street['name'] != "") {
......
...@@ -142,7 +142,7 @@ class AdyenHppConfigProvider implements ConfigProviderInterface ...@@ -142,7 +142,7 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
); );
$config['payment'] ['adyenHpp']['ratePayId'] = $this->_adyenHelper->getRatePayId(); $config['payment'] ['adyenHpp']['ratePayId'] = $this->_adyenHelper->getRatePayId();
$config['payment'] ['adyenHpp']['deviceIdentToken'] = md5($this->_session->getQuoteId().date('c')); $config['payment'] ['adyenHpp']['deviceIdentToken'] = md5($this->_session->getQuoteId().date('c'));
$config['payment'] ['adyenHpp']['nordicCountries'] = ['SE','NO','DK', 'FI'];
return $config; return $config;
} }
......
...@@ -37,6 +37,7 @@ class AdyenHppDataAssignObserver extends AbstractDataAssignObserver ...@@ -37,6 +37,7 @@ class AdyenHppDataAssignObserver extends AbstractDataAssignObserver
const DOB = 'dob'; const DOB = 'dob';
const TELEPHONE = 'telephone'; const TELEPHONE = 'telephone';
const DF_VALUE = 'df_value'; const DF_VALUE = 'df_value';
const SSN = 'ssn';
/** /**
...@@ -48,7 +49,8 @@ class AdyenHppDataAssignObserver extends AbstractDataAssignObserver ...@@ -48,7 +49,8 @@ class AdyenHppDataAssignObserver extends AbstractDataAssignObserver
self::GENDER, self::GENDER,
self::DOB, self::DOB,
self::TELEPHONE, self::TELEPHONE,
self::DF_VALUE self::DF_VALUE,
self::SSN
]; ];
/** /**
......
...@@ -137,7 +137,17 @@ define( ...@@ -137,7 +137,17 @@ define(
result.validate = function () { result.validate = function () {
return self.validate(); return self.validate();
} }
result.isPaymentMethodOpenInvoiceMethod = function () {
return value.isPaymentMethodOpenInvoiceMethod;
}
result.getSsnFormat = function(){
if (quote.billingAddress().countryId == "NO") {
return 5;
}
else {
return 4;
}
}
if(value.brandCode == "ideal") { if(value.brandCode == "ideal") {
result.issuerIds = value.issuers; result.issuerIds = value.issuers;
result.issuerId = ko.observable(null); result.issuerId = ko.observable(null);
...@@ -146,12 +156,32 @@ define( ...@@ -146,12 +156,32 @@ define(
result.gender = ko.observable(window.checkoutConfig.payment.adyenHpp.gender); result.gender = ko.observable(window.checkoutConfig.payment.adyenHpp.gender);
result.dob = ko.observable(window.checkoutConfig.payment.adyenHpp.dob); result.dob = ko.observable(window.checkoutConfig.payment.adyenHpp.dob);
result.datepickerValue = ko.observable(); // needed ?? result.datepickerValue = ko.observable(); // needed ??
result.ssn = ko.observable();
result.getRatePayDeviceIdentToken = function () {
return window.checkoutConfig.payment.adyenHpp.deviceIdentToken;
} }
result.isPaymentMethodOpenInvoiceMethod = function() { result.showGender = function () {
return value.isPaymentMethodOpenInvoiceMethod; return window.checkoutConfig.payment.adyenHpp.showGender;
}
result.showDob = function () {
return window.checkoutConfig.payment.adyenHpp.showDob;
}
result.showTelephone = function () {
return window.checkoutConfig.payment.adyenHpp.showTelephone;
}
result.showSsn = function () {
if (value.brandCode.indexOf("klarna") >= 0) {
var ba = quote.billingAddress();
if (ba != null) {
var nordicCountriesList = window.checkoutConfig.payment.adyenHpp.nordicCountries;
if (nordicCountriesList.indexOf(ba.countryId) >= 0) {
return true;
}
}
}
return false;
} }
result.getRatePayDeviceIdentToken = function() {
return window.checkoutConfig.payment.adyenHpp.deviceIdentToken;
} }
return result; return result;
}); });
...@@ -194,6 +224,7 @@ define( ...@@ -194,6 +224,7 @@ define(
additionalData.gender = this.gender(); additionalData.gender = this.gender();
additionalData.dob = this.dob(); additionalData.dob = this.dob();
additionalData.telephone = this.telephone(); additionalData.telephone = this.telephone();
additionalData.ssn = this.ssn();
if(brandCode() == "ratepay"){ if(brandCode() == "ratepay"){
additionalData.df_value = this.getRatePayDeviceIdentToken(); additionalData.df_value = this.getRatePayDeviceIdentToken();
} }
...@@ -247,15 +278,6 @@ define( ...@@ -247,15 +278,6 @@ define(
isIconEnabled: function() { isIconEnabled: function() {
return window.checkoutConfig.payment.adyen.showLogo; return window.checkoutConfig.payment.adyen.showLogo;
}, },
showGender: function() {
return window.checkoutConfig.payment.adyenHpp.showGender;
},
showDob: function() {
return window.checkoutConfig.payment.adyenHpp.showDob;
},
showTelephone: function() {
return window.checkoutConfig.payment.adyenHpp.showTelephone;
},
validate: function () { validate: function () {
return true; return true;
}, },
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
<!-- ko if: isPaymentMethodOpenInvoiceMethod() --> <!-- ko if: isPaymentMethodOpenInvoiceMethod() -->
<!-- ko if: $parent.showGender() --> <!-- ko if: showGender() -->
<div class="field gender_type type required"> <div class="field gender_type type required">
<label data-bind="attr: {for: getCode() + '_gender_type'}" class="label"> <label data-bind="attr: {for: getCode() + '_gender_type'}" class="label">
<span><!-- ko text: $t('Gender')--><!-- /ko --></span> <span><!-- ko text: $t('Gender')--><!-- /ko --></span>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</div> </div>
<!--/ko--> <!--/ko-->
<!-- ko if: $parent.showDob() --> <!-- ko if: showDob() -->
<div class="field required"> <div class="field required">
<label data-bind="attr: {for: getCode() + '_dob'}" class="label"> <label data-bind="attr: {for: getCode() + '_dob'}" class="label">
<span><!-- ko text: $t('Date of Birth')--><!-- /ko --></span> <span><!-- ko text: $t('Date of Birth')--><!-- /ko --></span>
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
</div> </div>
<!--/ko--> <!--/ko-->
<!-- ko if: $parent.showTelephone() --> <!-- ko if: showTelephone() -->
<div class="field required"> <div class="field required">
<label data-bind="attr: {for: getCode() + '_telephone'}" class="label"> <label data-bind="attr: {for: getCode() + '_telephone'}" class="label">
<span><!-- ko text: $t('Telephone')--><!-- /ko --></span> <span><!-- ko text: $t('Telephone')--><!-- /ko --></span>
...@@ -131,6 +131,29 @@ ...@@ -131,6 +131,29 @@
</div> </div>
</div> </div>
<!--/ko--> <!--/ko-->
<!-- ko if: showSsn() -->
<div class="field required">
<label data-bind="attr: {for: getCode() + '_ssn'}" class="label">
<span><!-- ko text: $t('Personal number (last digits)')--><!-- /ko --></span>
</label>
<div class="control">
<input type="text" class="input-text"
name="payment[ssn]"
data-bind="
attr: {
id: getCode() + '_ssn',
title: $t('Social Security Number'),
'data-container': getCode() + '-ssn',
'data-validate': JSON.stringify({'required-number':true }),
maxlength : getSsnFormat()
},
value: ssn"
/>
</div>
</div>
<!--/ko-->
<!--/ko--> <!--/ko-->
</fieldset> </fieldset>
<div class="checkout-agreements-block"> <div class="checkout-agreements-block">
......
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