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
3b5965f5
Commit
3b5965f5
authored
Nov 13, 2017
by
Bas Maassen
Committed by
GitHub
Nov 13, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #209 from Adyen/PW-304
PW-304 Inserted Personal number for Nordic countries
parents
98dbe562
59ddfa00
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
158 additions
and
108 deletions
+158
-108
Block/Redirect/Redirect.php
Block/Redirect/Redirect.php
+62
-61
Model/Ui/AdyenHppConfigProvider.php
Model/Ui/AdyenHppConfigProvider.php
+6
-5
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
+61
-38
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 @
3b5965f5
This diff is collapsed.
Click to expand it.
Model/Ui/AdyenHppConfigProvider.php
View file @
3b5965f5
...
...
@@ -81,7 +81,8 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
\Magento\Framework\UrlInterface
$urlBuilder
,
\Magento\Customer\Model\Session
$customerSession
,
\Magento\Checkout\Model\Session
$session
)
{
)
{
$this
->
_paymentHelper
=
$paymentHelper
;
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_request
=
$request
;
...
...
@@ -123,7 +124,7 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
$gender
=
""
;
$dob
=
""
;
}
// add to config
$config
[
'payment'
]
[
'adyenHpp'
][
'gender'
]
=
$gender
;
$config
[
'payment'
]
[
'adyenHpp'
][
'dob'
]
=
$dob
;
...
...
@@ -137,12 +138,12 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
$config
[
'payment'
]
[
'adyenHpp'
][
'isPaymentMethodSelectionOnAdyen'
]
=
$paymentMethodSelectionOnAdyen
;
$config
[
'payment'
]
[
'adyenHpp'
][
'showGender'
]
=
$this
->
_adyenHelper
->
getAdyenHppConfigDataFlag
(
'show_gender'
);
$config
[
'payment'
]
[
'adyenHpp'
][
'showDob'
]
=
$this
->
_adyenHelper
->
getAdyenHppConfigDataFlag
(
'show_dob'
);
$config
[
'payment'
]
[
'adyenHpp'
][
'showTelephone'
]
=
$this
->
_adyenHelper
->
getAdyenHppConfigDataFlag
(
$config
[
'payment'
]
[
'adyenHpp'
][
'showTelephone'
]
=
$this
->
_adyenHelper
->
getAdyenHppConfigDataFlag
(
'show_telephone'
);
$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
;
}
...
...
Observer/AdyenHppDataAssignObserver.php
View file @
3b5965f5
...
...
@@ -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 @
3b5965f5
...
...
@@ -74,7 +74,7 @@ define(
// retrieve payment methods
var
serviceUrl
,
payload
;
if
(
customer
.
isLoggedIn
())
{
if
(
customer
.
isLoggedIn
())
{
serviceUrl
=
urlBuilder
.
createUrl
(
'
/carts/mine/retrieve-adyen-payment-methods
'
,
{});
}
else
{
serviceUrl
=
urlBuilder
.
createUrl
(
'
/guest-carts/:cartId/retrieve-adyen-payment-methods
'
,
{
...
...
@@ -92,7 +92,7 @@ define(
).
done
(
function
(
response
)
{
adyenPaymentService
.
setPaymentMethods
(
response
);
if
(
JSON
.
stringify
(
response
).
indexOf
(
"
ratepay
"
)
>
-
1
)
{
if
(
JSON
.
stringify
(
response
).
indexOf
(
"
ratepay
"
)
>
-
1
)
{
var
ratePayId
=
window
.
checkoutConfig
.
payment
.
adyenHpp
.
ratePayId
;
window
.
di
=
{
t
:
''
,
v
:
ratePayId
,
l
:
'
Checkout
'
};
function
waitForDfValue
()
{
...
...
@@ -116,50 +116,81 @@ define(
fullScreenLoader
.
stopLoader
();
}
).
fail
(
function
(
error
)
{
).
fail
(
function
(
error
)
{
console
.
log
(
JSON
.
stringify
(
error
));
fullScreenLoader
.
stopLoader
();
});
},
getAdyenHppPaymentMethods
:
function
()
{
getAdyenHppPaymentMethods
:
function
()
{
var
self
=
this
;
var
paymentMethods
=
adyenPaymentService
.
getAvailablePaymentMethods
();
var
paymentList
=
_
.
map
(
paymentMethods
,
function
(
value
)
{
var
paymentList
=
_
.
map
(
paymentMethods
,
function
(
value
)
{
var
result
=
{};
result
.
value
=
value
.
brandCode
;
result
.
name
=
value
;
result
.
method
=
self
.
item
.
method
;
result
.
getCode
=
function
()
{
result
.
getCode
=
function
()
{
return
self
.
item
.
method
;
};
result
.
validate
=
function
()
{
return
self
.
validate
();
}
if
(
value
.
brandCode
==
"
ideal
"
)
{
result
.
isPaymentMethodOpenInvoiceMethod
=
function
()
{
return
value
.
isPaymentMethodOpenInvoiceMethod
;
}
result
.
getSsnLength
=
function
()
{
if
(
quote
.
billingAddress
().
countryId
==
"
NO
"
)
{
//5 digits for Norway
return
5
;
}
else
{
//4 digits for other Nordic countries
return
4
;
}
}
if
(
value
.
brandCode
==
"
ideal
"
)
{
result
.
issuerIds
=
value
.
issuers
;
result
.
issuerId
=
ko
.
observable
(
null
);
}
else
if
(
value
.
isPaymentMethodOpenInvoiceMethod
)
{
}
else
if
(
value
.
isPaymentMethodOpenInvoiceMethod
)
{
result
.
telephone
=
ko
.
observable
(
quote
.
shippingAddress
().
telephone
);
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
;
});
return
paymentList
;
},
getGenderTypes
:
function
()
{
// return window.checkoutConfig.payment.adyenHpp.genderTypes;
return
_
.
map
(
window
.
checkoutConfig
.
payment
.
adyenHpp
.
genderTypes
,
function
(
value
,
key
)
{
getGenderTypes
:
function
()
{
return
_
.
map
(
window
.
checkoutConfig
.
payment
.
adyenHpp
.
genderTypes
,
function
(
value
,
key
)
{
return
{
'
key
'
:
key
,
'
value
'
:
value
...
...
@@ -175,7 +206,7 @@ define(
return
false
;
}
},
continueToAdyenBrandCode
:
function
()
{
continueToAdyenBrandCode
:
function
()
{
// set payment method to adyen_hpp
var
self
=
this
;
...
...
@@ -188,13 +219,14 @@ define(
additionalData
.
brand_code
=
self
.
value
;
additionalData
.
df_value
=
dfValue
();
if
(
brandCode
()
==
"
ideal
"
)
{
if
(
brandCode
()
==
"
ideal
"
)
{
additionalData
.
issuer_id
=
this
.
issuerId
();
}
else
if
(
self
.
isPaymentMethodOpenInvoiceMethod
())
{
}
else
if
(
self
.
isPaymentMethodOpenInvoiceMethod
())
{
additionalData
.
gender
=
this
.
gender
();
additionalData
.
dob
=
this
.
dob
();
additionalData
.
telephone
=
this
.
telephone
();
if
(
brandCode
()
==
"
ratepay
"
){
additionalData
.
ssn
=
this
.
ssn
();
if
(
brandCode
()
==
"
ratepay
"
)
{
additionalData
.
df_value
=
this
.
getRatePayDeviceIdentToken
();
}
}
...
...
@@ -207,11 +239,11 @@ define(
return
false
;
},
selectPaymentMethodBrandCode
:
function
()
{
selectPaymentMethodBrandCode
:
function
()
{
var
self
=
this
;
// set payment method to adyen_hpp
var
data
=
{
var
data
=
{
"
method
"
:
self
.
method
,
"
po_number
"
:
null
,
"
additional_data
"
:
{
...
...
@@ -232,34 +264,25 @@ define(
},
isBrandCodeChecked
:
ko
.
computed
(
function
()
{
if
(
!
quote
.
paymentMethod
())
{
if
(
!
quote
.
paymentMethod
())
{
return
null
;
}
if
(
quote
.
paymentMethod
().
method
==
paymentMethod
())
{
if
(
quote
.
paymentMethod
().
method
==
paymentMethod
())
{
return
brandCode
();
}
return
null
;
}),
isPaymentMethodSelectionOnAdyen
:
function
()
{
isPaymentMethodSelectionOnAdyen
:
function
()
{
return
window
.
checkoutConfig
.
payment
.
adyenHpp
.
isPaymentMethodSelectionOnAdyen
;
},
isIconEnabled
:
function
()
{
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
;
},
getRatePayDeviceIdentToken
:
function
()
{
getRatePayDeviceIdentToken
:
function
()
{
return
window
.
checkoutConfig
.
payment
.
adyenHpp
.
deviceIdentToken
;
}
});
...
...
view/frontend/web/template/payment/hpp-form.html
View file @
3b5965f5
...
...
@@ -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 : getSsnLength()
},
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