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
039cb194
Commit
039cb194
authored
Nov 16, 2017
by
Giorgos Adam
Committed by
GitHub
Nov 16, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #213 from Adyen/issue-186
Fixes #186 Remove minify_exclude and load df.js on runtime
parents
cbe900b3
16053d91
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
39 deletions
+44
-39
etc/config.xml
etc/config.xml
+0
-7
view/frontend/requirejs-config.js
view/frontend/requirejs-config.js
+1
-2
view/frontend/web/js/view/payment/method-renderer/adyen-hpp-method.js
...d/web/js/view/payment/method-renderer/adyen-hpp-method.js
+43
-30
No files found.
etc/config.xml
View file @
039cb194
...
...
@@ -192,12 +192,5 @@
<group>
adyen
</group>
</adyen_boleto>
</payment>
<dev>
<js>
<minify_exclude>
live.adyen.com/hpp/js/df
</minify_exclude>
</js>
</dev>
</default>
</config>
view/frontend/requirejs-config.js
View file @
039cb194
...
...
@@ -6,8 +6,7 @@
/*global alert*/
var
config
=
{
paths
:
{
'
adyen/encrypt
'
:
'
Adyen_Payment/js/view/payment/adyen.encrypt.min
'
,
'
adyen/df
'
:
'
https://live.adyen.com/hpp/js/df
'
'
adyen/encrypt
'
:
'
Adyen_Payment/js/view/payment/adyen.encrypt.min
'
},
config
:
{
mixins
:
{
...
...
view/frontend/web/js/view/payment/method-renderer/adyen-hpp-method.js
View file @
039cb194
...
...
@@ -35,10 +35,9 @@ define(
'
Magento_Checkout/js/model/url-builder
'
,
'
Adyen_Payment/js/model/adyen-payment-service
'
,
'
Magento_Customer/js/model/customer
'
,
'
Magento_Checkout/js/model/full-screen-loader
'
,
'
adyen/df
'
'
Magento_Checkout/js/model/full-screen-loader
'
],
function
(
ko
,
$
,
Component
,
setPaymentMethodAction
,
selectPaymentMethodAction
,
quote
,
checkoutData
,
additionalValidators
,
storage
,
urlBuilder
,
adyenPaymentService
,
customer
,
fullScreenLoader
,
deviceFingerprint
)
{
function
(
ko
,
$
,
Component
,
setPaymentMethodAction
,
selectPaymentMethodAction
,
quote
,
checkoutData
,
additionalValidators
,
storage
,
urlBuilder
,
adyenPaymentService
,
customer
,
fullScreenLoader
)
{
'
use strict
'
;
var
brandCode
=
ko
.
observable
(
null
);
var
paymentMethod
=
ko
.
observable
(
null
);
...
...
@@ -91,28 +90,43 @@ define(
serviceUrl
,
JSON
.
stringify
(
payload
)
).
done
(
function
(
response
)
{
function
waitForDfSet
()
{
// Wait for dfSet function to be loaded from df.js script
if
(
typeof
dfSet
==
"
undefined
"
)
{
setTimeout
(
waitForDfSet
,
500
);
return
;
}
// set device fingerprint value
dfSet
(
'
dfValue
'
,
0
);
// propagate this manually to knockoutjs otherwise it would not work
dfValue
(
$
(
'
#dfValue
'
).
val
());
}
adyenPaymentService
.
setPaymentMethods
(
response
);
if
(
JSON
.
stringify
(
response
).
indexOf
(
"
ratepay
"
)
>
-
1
)
{
var
ratePayId
=
window
.
checkoutConfig
.
payment
.
adyenHpp
.
ratePayId
;
window
.
di
=
{
t
:
''
,
v
:
ratePayId
,
l
:
'
Checkout
'
};
function
waitForDfValue
()
{
var
dfValueRatePay
=
self
.
getRatePayDeviceIdentToken
();
if
(
dfValueRatePay
)
{
window
.
di
.
t
=
dfValueRatePay
.
replace
(
'
:
'
,
''
);
var
scriptTag
=
document
.
createElement
(
'
script
'
);
scriptTag
.
src
=
"
//d.ratepay.com/
"
+
ratePayId
+
"
/di.js
"
;
scriptTag
.
type
=
"
text/javascript
"
;
document
.
body
.
appendChild
(
scriptTag
);
}
else
{
setTimeout
(
waitForDfValue
,
200
);
}
}
waitForDfValue
();
var
dfValueRatePay
=
self
.
getRatePayDeviceIdentToken
();
window
.
di
=
{
t
:
dfValueRatePay
.
replace
(
'
:
'
,
''
),
v
:
ratePayId
,
l
:
'
Checkout
'
};
// Load Ratepay script
var
ratepayScriptTag
=
document
.
createElement
(
'
script
'
);
ratepayScriptTag
.
src
=
"
//d.ratepay.com/
"
+
ratePayId
+
"
/di.js
"
;
ratepayScriptTag
.
type
=
"
text/javascript
"
;
document
.
body
.
appendChild
(
ratepayScriptTag
);
}
// set device fingerprint value
dfSet
(
'
dfValue
'
,
0
);
// propagate this manually to knockoutjs otherwise it would not work
dfValue
(
$
(
'
#dfValue
'
).
val
());
// Load Adyen df.js script
var
dfScriptTag
=
document
.
createElement
(
'
script
'
);
dfScriptTag
.
src
=
"
//live.adyen.com/hpp/js/df.js?v=20171130
"
;
dfScriptTag
.
type
=
"
text/javascript
"
;
document
.
body
.
appendChild
(
dfScriptTag
);
waitForDfSet
();
fullScreenLoader
.
stopLoader
();
}
...
...
@@ -126,7 +140,6 @@ define(
var
paymentMethods
=
adyenPaymentService
.
getAvailablePaymentMethods
();
var
paymentList
=
_
.
map
(
paymentMethods
,
function
(
value
)
{
var
result
=
{};
result
.
value
=
value
.
brandCode
;
result
.
name
=
value
;
...
...
@@ -136,10 +149,10 @@ define(
};
result
.
validate
=
function
()
{
return
self
.
validate
();
}
}
;
result
.
isPaymentMethodOpenInvoiceMethod
=
function
()
{
return
value
.
isPaymentMethodOpenInvoiceMethod
;
}
}
;
result
.
getSsnLength
=
function
()
{
if
(
quote
.
billingAddress
().
countryId
==
"
NO
"
)
{
//5 digits for Norway
...
...
@@ -149,7 +162,7 @@ define(
//4 digits for other Nordic countries
return
4
;
}
}
}
;
if
(
value
.
brandCode
==
"
ideal
"
)
{
result
.
issuerIds
=
value
.
issuers
;
result
.
issuerId
=
ko
.
observable
(
null
);
...
...
@@ -162,16 +175,16 @@ define(
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
();
...
...
@@ -183,7 +196,7 @@ define(
}
}
return
false
;
}
}
;
}
return
result
;
});
...
...
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