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
5e9598fd
Commit
5e9598fd
authored
Jun 05, 2020
by
attilak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix loggedIn user retrieving payment methods
parent
0cfc5323
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
30 deletions
+41
-30
view/frontend/web/js/view/payment/adyen-methods.js
view/frontend/web/js/view/payment/adyen-methods.js
+41
-30
No files found.
view/frontend/web/js/view/payment/adyen-methods.js
View file @
5e9598fd
...
@@ -27,14 +27,16 @@ define(
...
@@ -27,14 +27,16 @@ define(
'
Magento_Checkout/js/model/payment/renderer-list
'
,
'
Magento_Checkout/js/model/payment/renderer-list
'
,
'
Adyen_Payment/js/model/adyen-payment-service
'
,
'
Adyen_Payment/js/model/adyen-payment-service
'
,
'
Adyen_Payment/js/model/adyen-configuration
'
,
'
Adyen_Payment/js/model/adyen-configuration
'
,
'
Magento_Checkout/js/model/quote
'
'
Magento_Checkout/js/model/quote
'
,
'
Magento_Customer/js/model/customer
'
],
],
function
(
function
(
Component
,
Component
,
rendererList
,
rendererList
,
adyenPaymentService
,
adyenPaymentService
,
adyenConfiguration
,
adyenConfiguration
,
quote
quote
,
customer
)
{
)
{
'
use strict
'
;
'
use strict
'
;
rendererList
.
push
(
rendererList
.
push
(
...
@@ -70,6 +72,8 @@ define(
...
@@ -70,6 +72,8 @@ define(
/** Add view logic here if needed */
/** Add view logic here if needed */
return
Component
.
extend
({
return
Component
.
extend
({
initialize
:
function
()
{
initialize
:
function
()
{
var
self
=
this
;
this
.
_super
();
this
.
_super
();
if
(
this
.
isGooglePayEnabled
())
{
if
(
this
.
isGooglePayEnabled
())
{
...
@@ -79,40 +83,47 @@ define(
...
@@ -79,40 +83,47 @@ define(
document
.
head
.
appendChild
(
googlepayscript
);
document
.
head
.
appendChild
(
googlepayscript
);
}
}
if
(
customer
.
isLoggedIn
())
{
self
.
setAdyenPaymentMethods
();
}
quote
.
shippingAddress
.
subscribe
(
function
()
{
quote
.
shippingAddress
.
subscribe
(
function
()
{
adyenPaymentService
.
retrieveAvailablePaymentMethods
().
done
(
function
(
response
)
{
self
.
setAdyenPaymentMethods
();
var
responseJson
=
JSON
.
parse
(
response
);
})
var
paymentMethodsResponse
=
responseJson
.
paymentMethodsResponse
;
},
setAdyenPaymentMethods
:
function
()
{
adyenPaymentService
.
retrieveAvailablePaymentMethods
().
done
(
function
(
response
)
{
var
responseJson
=
JSON
.
parse
(
response
);
var
paymentMethodsResponse
=
responseJson
.
paymentMethodsResponse
;
// TODO check if this is still required or if can be outsourced for the generic component, or checkout can create a ratepay component
// TODO check if this is still required or if can be outsourced for the generic component, or checkout can create a ratepay component
/*if (!!window.checkoutConfig.payment.adyenHpp) {
/*if (!!window.checkoutConfig.payment.adyenHpp) {
if (JSON.stringify(paymentMethods).indexOf("ratepay") > -1) {
if (JSON.stringify(paymentMethods).indexOf("ratepay") > -1) {
var ratePayId = window.checkoutConfig.payment.adyenHpp.ratePayId;
var ratePayId = window.checkoutConfig.payment.adyenHpp.ratePayId;
var dfValueRatePay = self.getRatePayDeviceIdentToken();
var dfValueRatePay = self.getRatePayDeviceIdentToken();
window.di = {
window.di = {
t: dfValueRatePay.replace(':', ''),
t: dfValueRatePay.replace(':', ''),
v: ratePayId,
v: ratePayId,
l: 'Checkout'
l: 'Checkout'
};
};
// Load Ratepay script
// Load Ratepay script
var ratepayScriptTag = document.createElement('script');
var ratepayScriptTag = document.createElement('script');
ratepayScriptTag.src = "//d.ratepay.com/" + ratePayId + "/di.js";
ratepayScriptTag.src = "//d.ratepay.com/" + ratePayId + "/di.js";
ratepayScriptTag.type = "text/javascript";
ratepayScriptTag.type = "text/javascript";
document.body.appendChild(ratepayScriptTag);
document.body.appendChild(ratepayScriptTag);
}
}
}*/
}*/
// Initialises adyen checkout main component with default configuration
// Initialises adyen checkout main component with default configuration
adyenPaymentService
.
initCheckoutComponent
(
adyenPaymentService
.
initCheckoutComponent
(
paymentMethodsResponse
,
paymentMethodsResponse
,
adyenConfiguration
.
getOriginKey
(),
adyenConfiguration
.
getOriginKey
(),
adyenConfiguration
.
getLocale
(),
adyenConfiguration
.
getLocale
(),
adyenConfiguration
.
getCheckoutEnvironment
()
adyenConfiguration
.
getCheckoutEnvironment
()
);
);
})
})
})
},
},
isGooglePayEnabled
:
function
()
{
isGooglePayEnabled
:
function
()
{
...
...
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