Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Adyen Magento2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared Libs
Adyen Magento2
Commits
0e3c72ec
Commit
0e3c72ec
authored
Nov 06, 2017
by
basm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PW-304 Inserted Personal number for Nordic countries
parent
74a0b291
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
64 deletions
+110
-64
Block/Redirect/Redirect.php
Block/Redirect/Redirect.php
+42
-43
Model/Ui/AdyenHppConfigProvider.php
Model/Ui/AdyenHppConfigProvider.php
+1
-1
Observer/AdyenHppDataAssignObserver.php
Observer/AdyenHppDataAssignObserver.php
+3
-1
view/frontend/web/js/view/payment/method-renderer/adyen-hpp-method.js
...d/web/js/view/payment/method-renderer/adyen-hpp-method.js
+38
-16
view/frontend/web/template/payment/hpp-form.html
view/frontend/web/template/payment/hpp-form.html
+26
-3
No files found.
Block/Redirect/Redirect.php
View file @
0e3c72ec
...
...
@@ -183,22 +183,22 @@ class Redirect extends \Magento\Payment\Block\Form
try
{
if
(
$this
->
_order
->
getPayment
())
{
$realOrderId
=
$this
->
_order
->
getRealOrderId
();
$realOrderId
=
$this
->
_order
->
getRealOrderId
();
$orderCurrencyCode
=
$this
->
_order
->
getOrderCurrencyCode
();
$skinCode
=
trim
(
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'skin_code'
));
$amount
=
$this
->
_adyenHelper
->
formatAmount
(
$skinCode
=
trim
(
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'skin_code'
));
$amount
=
$this
->
_adyenHelper
->
formatAmount
(
$this
->
_order
->
getGrandTotal
(),
$orderCurrencyCode
);
$merchantAccount
=
trim
(
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'merchant_account'
));
$shopperEmail
=
$this
->
_order
->
getCustomerEmail
();
$customerId
=
$this
->
_order
->
getCustomerId
();
$shopperIP
=
$this
->
_order
->
getRemoteIp
();
$browserInfo
=
$_SERVER
[
'HTTP_USER_AGENT'
];
$deliveryDays
=
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'delivery_days'
);
$shopperLocale
=
trim
(
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'shopper_locale'
));
$shopperLocale
=
(
!
empty
(
$shopperLocale
))
?
$shopperLocale
:
$this
->
_resolver
->
getLocale
();
$countryCode
=
trim
(
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'country_code'
));
$countryCode
=
(
!
empty
(
$countryCode
))
?
$countryCode
:
false
;
$merchantAccount
=
trim
(
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'merchant_account'
));
$shopperEmail
=
$this
->
_order
->
getCustomerEmail
();
$customerId
=
$this
->
_order
->
getCustomerId
();
$shopperIP
=
$this
->
_order
->
getRemoteIp
();
$browserInfo
=
$_SERVER
[
'HTTP_USER_AGENT'
];
$deliveryDays
=
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'delivery_days'
);
$shopperLocale
=
trim
(
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'shopper_locale'
));
$shopperLocale
=
(
!
empty
(
$shopperLocale
))
?
$shopperLocale
:
$this
->
_resolver
->
getLocale
();
$countryCode
=
trim
(
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'country_code'
));
$countryCode
=
(
!
empty
(
$countryCode
))
?
$countryCode
:
false
;
// if directory lookup is enabled use the billingaddress as countrycode
if
(
$countryCode
==
false
)
{
...
...
@@ -210,29 +210,29 @@ class Redirect extends \Magento\Payment\Block\Form
$formFields
=
[];
$formFields
[
'merchantAccount'
]
=
$merchantAccount
;
$formFields
[
'merchantAccount'
]
=
$merchantAccount
;
$formFields
[
'merchantReference'
]
=
$realOrderId
;
$formFields
[
'paymentAmount'
]
=
(
int
)
$amount
;
$formFields
[
'currencyCode'
]
=
$orderCurrencyCode
;
$formFields
[
'shipBeforeDate'
]
=
date
(
$formFields
[
'paymentAmount'
]
=
(
int
)
$amount
;
$formFields
[
'currencyCode'
]
=
$orderCurrencyCode
;
$formFields
[
'shipBeforeDate'
]
=
date
(
"Y-m-d"
,
mktime
(
date
(
"H"
),
date
(
"i"
),
date
(
"s"
),
date
(
"m"
),
date
(
"j"
)
+
$deliveryDays
,
date
(
"Y"
))
);
$formFields
[
'skinCode'
]
=
$skinCode
;
$formFields
[
'shopperLocale'
]
=
$shopperLocale
;
$formFields
[
'countryCode'
]
=
$countryCode
;
$formFields
[
'shopperIP'
]
=
$shopperIP
;
$formFields
[
'browserInfo'
]
=
$browserInfo
;
$formFields
[
'sessionValidity'
]
=
date
(
$formFields
[
'skinCode'
]
=
$skinCode
;
$formFields
[
'shopperLocale'
]
=
$shopperLocale
;
$formFields
[
'countryCode'
]
=
$countryCode
;
$formFields
[
'shopperIP'
]
=
$shopperIP
;
$formFields
[
'browserInfo'
]
=
$browserInfo
;
$formFields
[
'sessionValidity'
]
=
date
(
DATE_ATOM
,
mktime
(
date
(
"H"
)
+
1
,
date
(
"i"
),
date
(
"s"
),
date
(
"m"
),
date
(
"j"
),
date
(
"Y"
))
);
$formFields
[
'shopperEmail'
]
=
$shopperEmail
;
$formFields
[
'shopperEmail'
]
=
$shopperEmail
;
// recurring
$recurringType
=
trim
(
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
$recurringType
=
trim
(
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'recurring_type'
)
);
$brandCode
=
$this
->
_order
->
getPayment
()
->
getAdditionalInformation
(
$brandCode
=
$this
->
_order
->
getPayment
()
->
getAdditionalInformation
(
\Adyen\Payment\Observer\AdyenHppDataAssignObserver
::
BRAND_CODE
);
...
...
@@ -243,30 +243,30 @@ class Redirect extends \Magento\Payment\Block\Form
if
(
$customerId
>
0
)
{
$formFields
[
'recurringContract'
]
=
$recurringType
;
$formFields
[
'shopperReference'
]
=
$customerId
;
$formFields
[
'shopperReference'
]
=
$customerId
;
}
else
{
// required for openinvoice payment methods use unique id
$uniqueReference
=
"guest_"
.
$realOrderId
.
"_"
.
$this
->
_order
->
getStoreId
();
$formFields
[
'shopperReference'
]
=
$uniqueReference
;
$uniqueReference
=
"guest_"
.
$realOrderId
.
"_"
.
$this
->
_order
->
getStoreId
();
$formFields
[
'shopperReference'
]
=
$uniqueReference
;
}
//blocked methods
$formFields
[
'blockedMethods'
]
=
""
;
$formFields
[
'blockedMethods'
]
=
""
;
$baseUrl
=
$this
->
_storeManager
->
getStore
(
$this
->
getStore
())
->
getBaseUrl
(
\Magento\Framework\UrlInterface
::
URL_TYPE_LINK
);
$formFields
[
'resURL'
]
=
$baseUrl
.
'adyen/process/result'
;
$hmacKey
=
$this
->
_adyenHelper
->
getHmac
();
$formFields
[
'resURL'
]
=
$baseUrl
.
'adyen/process/result'
;
$hmacKey
=
$this
->
_adyenHelper
->
getHmac
();
if
(
$brandCode
)
{
$formFields
[
'brandCode'
]
=
$brandCode
;
$formFields
[
'brandCode'
]
=
$brandCode
;
}
$issuerId
=
$this
->
_order
->
getPayment
()
->
getAdditionalInformation
(
"issuer_id"
);
if
(
$issuerId
)
{
$formFields
[
'issuerId'
]
=
$issuerId
;
$formFields
[
'issuerId'
]
=
$issuerId
;
}
$formFields
=
$this
->
setBillingAddressData
(
$formFields
);
...
...
@@ -274,8 +274,6 @@ class Redirect extends \Magento\Payment\Block\Form
$formFields
=
$this
->
setOpenInvoiceData
(
$formFields
);
$formFields
[
'shopper.gender'
]
=
$this
->
getGenderText
(
$this
->
_order
->
getCustomerGender
());
$dob
=
$this
->
_order
->
getCustomerDob
();
if
(
$dob
)
{
$formFields
[
'shopper.dateOfBirthDayOfMonth'
]
=
trim
(
$this
->
_getDate
(
$dob
,
'd'
));
...
...
@@ -285,15 +283,19 @@ class Redirect extends \Magento\Payment\Block\Form
// For klarna acceptPrivacyPolicy to skip HPP page
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
$formFields
[
'klarna.acceptPrivacyPolicy'
]
=
'true'
;
$formFields
[
'klarna.acceptPrivacyPolicy'
]
=
'true'
;
}
// OpenInvoice don't allow to edit billing and delivery items
if
(
$this
->
_adyenHelper
->
isPaymentMethodOpenInvoiceMethod
(
$brandCode
))
{
// don't allow editable shipping/delivery address
$formFields
[
'billingAddressType'
]
=
"1"
;
$formFields
[
'billingAddressType'
]
=
"1"
;
$formFields
[
'deliveryAddressType'
]
=
"1"
;
// make setting to make this optional
...
...
@@ -313,7 +315,7 @@ class Redirect extends \Magento\Payment\Block\Form
$merchantSig
=
base64_encode
(
hash_hmac
(
'sha256'
,
$signData
,
pack
(
"H*"
,
$hmacKey
),
true
));
$formFields
[
'merchantSig'
]
=
$merchantSig
;
$formFields
[
'merchantSig'
]
=
$merchantSig
;
$this
->
_adyenLogger
->
addAdyenDebug
(
print_r
(
$formFields
,
true
));
}
...
...
@@ -324,7 +326,7 @@ class Redirect extends \Magento\Payment\Block\Form
// echo "GENDER" . $this->_order->getCustomerGender();
//
//
print_r($formFields);die();
//
print_r($formFields);die();
return
$formFields
;
}
...
...
@@ -336,9 +338,7 @@ class Redirect extends \Magento\Payment\Block\Form
protected
function
setBillingAddressData
(
$formFields
)
{
$billingAddress
=
$this
->
_order
->
getBillingAddress
();
if
(
$billingAddress
)
{
$formFields
[
'shopper.firstName'
]
=
trim
(
$billingAddress
->
getFirstname
());
$middleName
=
trim
(
$billingAddress
->
getMiddlename
());
if
(
$middleName
!=
""
)
{
...
...
@@ -347,7 +347,6 @@ class Redirect extends \Magento\Payment\Block\Form
$formFields
[
'shopper.lastName'
]
=
trim
(
$billingAddress
->
getLastname
());
$formFields
[
'shopper.telephoneNumber'
]
=
trim
(
$billingAddress
->
getTelephone
());
$street
=
$this
->
_adyenHelper
->
getStreet
(
$billingAddress
);
if
(
isset
(
$street
[
'name'
])
&&
$street
[
'name'
]
!=
""
)
{
...
...
Model/Ui/AdyenHppConfigProvider.php
View file @
0e3c72ec
...
...
@@ -142,7 +142,7 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
);
$config
[
'payment'
]
[
'adyenHpp'
][
'ratePayId'
]
=
$this
->
_adyenHelper
->
getRatePayId
();
$config
[
'payment'
]
[
'adyenHpp'
][
'deviceIdentToken'
]
=
md5
(
$this
->
_session
->
getQuoteId
()
.
date
(
'c'
));
$config
[
'payment'
]
[
'adyenHpp'
][
'nordicCountries'
]
=
[
'SE'
,
'NO'
,
'DK'
,
'FI'
];
return
$config
;
}
...
...
Observer/AdyenHppDataAssignObserver.php
View file @
0e3c72ec
...
...
@@ -37,6 +37,7 @@ class AdyenHppDataAssignObserver extends AbstractDataAssignObserver
const
DOB
=
'dob'
;
const
TELEPHONE
=
'telephone'
;
const
DF_VALUE
=
'df_value'
;
const
SSN
=
'ssn'
;
/**
...
...
@@ -48,7 +49,8 @@ class AdyenHppDataAssignObserver extends AbstractDataAssignObserver
self
::
GENDER
,
self
::
DOB
,
self
::
TELEPHONE
,
self
::
DF_VALUE
self
::
DF_VALUE
,
self
::
SSN
];
/**
...
...
view/frontend/web/js/view/payment/method-renderer/adyen-hpp-method.js
View file @
0e3c72ec
...
...
@@ -137,7 +137,17 @@ define(
result
.
validate
=
function
()
{
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
"
)
{
result
.
issuerIds
=
value
.
issuers
;
result
.
issuerId
=
ko
.
observable
(
null
);
...
...
@@ -146,12 +156,32 @@ define(
result
.
gender
=
ko
.
observable
(
window
.
checkoutConfig
.
payment
.
adyenHpp
.
gender
);
result
.
dob
=
ko
.
observable
(
window
.
checkoutConfig
.
payment
.
adyenHpp
.
dob
);
result
.
datepickerValue
=
ko
.
observable
();
// needed ??
}
result
.
isPaymentMethodOpenInvoiceMethod
=
function
()
{
return
value
.
isPaymentMethodOpenInvoiceMethod
;
}
result
.
getRatePayDeviceIdentToken
=
function
()
{
return
window
.
checkoutConfig
.
payment
.
adyenHpp
.
deviceIdentToken
;
result
.
ssn
=
ko
.
observable
();
result
.
getRatePayDeviceIdentToken
=
function
()
{
return
window
.
checkoutConfig
.
payment
.
adyenHpp
.
deviceIdentToken
;
}
result
.
showGender
=
function
()
{
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
;
}
}
return
result
;
});
...
...
@@ -194,6 +224,7 @@ define(
additionalData
.
gender
=
this
.
gender
();
additionalData
.
dob
=
this
.
dob
();
additionalData
.
telephone
=
this
.
telephone
();
additionalData
.
ssn
=
this
.
ssn
();
if
(
brandCode
()
==
"
ratepay
"
){
additionalData
.
df_value
=
this
.
getRatePayDeviceIdentToken
();
}
...
...
@@ -247,15 +278,6 @@ define(
isIconEnabled
:
function
()
{
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
()
{
return
true
;
},
...
...
view/frontend/web/template/payment/hpp-form.html
View file @
0e3c72ec
...
...
@@ -70,7 +70,7 @@
<!-- ko if: isPaymentMethodOpenInvoiceMethod() -->
<!-- ko if:
$parent.
showGender() -->
<!-- ko if: showGender() -->
<div
class=
"field gender_type type required"
>
<label
data-bind=
"attr: {for: getCode() + '_gender_type'}"
class=
"label"
>
<span>
<!-- ko text: $t('Gender')--><!-- /ko -->
</span>
...
...
@@ -90,7 +90,7 @@
</div>
<!--/ko-->
<!-- ko if:
$parent.
showDob() -->
<!-- ko if: showDob() -->
<div
class=
"field required"
>
<label
data-bind=
"attr: {for: getCode() + '_dob'}"
class=
"label"
>
<span>
<!-- ko text: $t('Date of Birth')--><!-- /ko -->
</span>
...
...
@@ -111,7 +111,7 @@
</div>
<!--/ko-->
<!-- ko if:
$parent.
showTelephone() -->
<!-- ko if: showTelephone() -->
<div
class=
"field required"
>
<label
data-bind=
"attr: {for: getCode() + '_telephone'}"
class=
"label"
>
<span>
<!-- ko text: $t('Telephone')--><!-- /ko -->
</span>
...
...
@@ -131,6 +131,29 @@
</div>
</div>
<!--/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-->
</fieldset>
<div
class=
"checkout-agreements-block"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment