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
6ed050b3
Commit
6ed050b3
authored
Mar 18, 2019
by
attilak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP]
works with challenge shopper
parent
5727c8d0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
23 deletions
+38
-23
Gateway/Validator/ThreeDS2ResponseValidator.php
Gateway/Validator/ThreeDS2ResponseValidator.php
+0
-1
Helper/Requests.php
Helper/Requests.php
+8
-1
Model/AdyenThreeDS2Process.php
Model/AdyenThreeDS2Process.php
+8
-4
Plugin/PaymentInformationManagement.php
Plugin/PaymentInformationManagement.php
+8
-0
view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js
...nd/web/js/view/payment/method-renderer/adyen-cc-method.js
+14
-15
view/frontend/web/template/payment/cc-form.html
view/frontend/web/template/payment/cc-form.html
+0
-2
No files found.
Gateway/Validator/ThreeDS2ResponseValidator.php
View file @
6ed050b3
...
...
@@ -60,7 +60,6 @@ class ThreeDS2ResponseValidator extends AbstractValidator
throw
new
\Magento\Framework\Exception\LocalizedException
(
__
(
$errorMsg
));
}
$payment
->
setAdditionalInformation
(
'3ds2Active'
,
false
);
$isValid
=
true
;
$errorMessages
=
[];
...
...
Helper/Requests.php
View file @
6ed050b3
...
...
@@ -250,7 +250,7 @@ class Requests extends AbstractHelper
{
$request
[
'amount'
]
=
[
'currency'
=>
$currencyCode
,
'value'
=>
$this
->
adyenHelper
->
formatAmount
(
$amount
,
$currencyCode
)
'value'
=>
$this
->
adyenHelper
->
formatAmount
(
$amount
,
$currencyCode
)
];
...
...
@@ -292,6 +292,13 @@ class Requests extends AbstractHelper
$request
[
'browserInfo'
][
'language'
]
=
$this
->
adyenHelper
->
getCurrentLocaleCode
(
$store
);
$request
[
'browserInfo'
][
'javaEnabled'
]
=
true
;
//$payment->getAdditionalInformation(AdyenCcDataAssignObserver::JAVA_ENABLED);
// uset browser related data from additional information
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
SCREEN_WIDTH
);
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
SCREEN_HEIGHT
);
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
SCREEN_COLOR_DEPTH
);
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
TIMEZONE_OFFSET
);
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
JAVA_ENABLED
);
return
$request
;
}
...
...
Model/AdyenThreeDS2Process.php
View file @
6ed050b3
...
...
@@ -75,10 +75,13 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface
"paymentData"
=>
$payment
->
getAdditionalInformation
(
"threeDS2PaymentData"
)
];
// unset payment data from additional information
$payment
->
unsAdditionalInformation
(
"threeDS2PaymentData"
);
// Depends on the component's response we send a fingerprint or the challenge result
if
(
!
empty
(
$payload
[
'details'
][
'threeds2.fingerprint'
]))
{
$request
[
'details'
][
'threeds2.fingerprint'
]
=
$payload
[
'details'
][
'threeds2.fingerprint'
];
}
elseif
(
!
empty
(
$payload
[
'threeds2.challengeResult'
]))
{
}
elseif
(
!
empty
(
$payload
[
'
details'
][
'
threeds2.challengeResult'
]))
{
$request
[
'details'
][
'threeds2.challengeResult'
]
=
$payload
[
'details'
][
'threeds2.challengeResult'
];
}
...
...
@@ -94,19 +97,20 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface
// Check if result is challenge shopper, if yes return the token
if
(
!
empty
(
$result
[
'resultCode'
])
&&
$result
[
'resultCode'
]
===
'ChallengeShopper'
&&
!
empty
(
result
[
'authentication'
][
'threeds2.fingerprint
Token'
])
!
empty
(
$result
[
'authentication'
][
'threeds2.challenge
Token'
])
)
{
return
json_encode
(
array
(
'threeDS2'
=>
true
,
'type'
=>
'ChallengeShopper'
,
'token'
=>
$result
[
'authentication'
][
'threeds2.challenge
Result
'
]
'type'
=>
$result
[
'resultCode'
]
,
'token'
=>
$result
[
'authentication'
][
'threeds2.challenge
Token
'
]
)
);
}
// Payment can get back to the original flow
$payment
->
setAdditionalInformation
(
"paymentsResponse"
,
$result
);
$payment
->
setAdditionalInformation
(
'3ds2Active'
,
false
);
$quote
->
save
();
// 3DS2 flow is done, original place order flow can continue from frontend
...
...
Plugin/PaymentInformationManagement.php
View file @
6ed050b3
...
...
@@ -72,6 +72,11 @@ class PaymentInformationManagement
$quote
=
$this
->
checkoutSession
->
getQuote
();
$payment
=
$quote
->
getPayment
();
// in case payments response is already there we don't need to perform another payments call
if
(
$payment
->
getAdditionalInformation
(
'paymentsResponse'
))
{
return
true
;
}
// Init request array
$request
=
[];
...
...
@@ -132,6 +137,7 @@ class PaymentInformationManagement
)
{
if
(
$this
->
threeDS2ResponseValidator
->
validate
(
array
(
"response"
=>
$paymentsResponse
,
"payment"
=>
$payment
))
->
isValid
())
{
$payment
->
setAdditionalInformation
(
'3ds2Active'
,
true
);
$quote
->
save
();
return
json_encode
(
array
(
...
...
@@ -140,6 +146,8 @@ class PaymentInformationManagement
"token"
=>
$payment
->
getAdditionalInformation
(
'threeDS2Token'
)
)
);
}
else
{
// TODO Handle error
}
}
else
{
$payment
->
setAdditionalInformation
(
'paymentsResponse'
,
$paymentsResponse
);
...
...
view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js
View file @
6ed050b3
...
...
@@ -61,6 +61,7 @@ define(
this
.
vaultEnabler
.
setPaymentCode
(
this
.
getVaultCode
());
this
.
vaultEnabler
.
isActivePaymentTokenEnabler
(
false
);
// initialize adyen component for general use
this
.
checkout
=
new
AdyenCheckout
({
locale
:
this
.
getLocale
()
});
...
...
@@ -104,7 +105,7 @@ define(
var
allInstallments
=
self
.
getAllInstallments
();
var
cardNode
=
document
.
getElementById
(
'
cardContainer
'
);
var
card
=
self
.
checkout
.
create
(
'
card
'
,
{
self
.
cardComponent
=
self
.
checkout
.
create
(
'
card
'
,
{
originKey
:
self
.
getOriginKey
(),
loadingContext
:
self
.
getLoadingContext
(),
type
:
'
card
'
,
...
...
@@ -178,9 +179,7 @@ define(
installments
.
setInstallments
(
0
);
}
}
});
card
.
mount
(
cardNode
);
}).
mount
(
cardNode
);
},
/**
* Rendering the 3DS2.0 components
...
...
@@ -189,17 +188,12 @@ define(
* @param token
*/
renderThreeDS2Component
:
function
(
type
,
token
)
{
console
.
log
(
"
ati 2
"
);
var
self
=
this
;
// hide card component
var
cardNode
=
document
.
getElementById
(
'
cardContainer
'
);
$
(
cardNode
).
slideUp
();
var
threeDS2Node
=
document
.
getElementById
(
'
threeDS2Container
'
);
if
(
type
==
"
IdentifyShopper
"
)
{
var
threeDS2Component
=
self
.
checkout
self
.
threeDS2Component
=
self
.
checkout
.
create
(
'
threeDS2DeviceFingerprint
'
,
{
fingerprintToken
:
token
,
onComplete
:
function
(
result
)
{
...
...
@@ -211,12 +205,16 @@ define(
}
});
}
else
if
(
type
==
"
ChallengeShopper
"
)
{
var
threeDS2Component
=
self
.
checkout
self
.
cardComponent
.
unmount
(
cardNode
);
if
(
self
.
threeDS2Component
)
{
self
.
threeDS2Component
.
unmount
(
cardNode
);
}
self
.
threeDS2Component
=
self
.
checkout
.
create
(
'
threeDS2Challenge
'
,
{
challengeToken
:
token
,
onComplete
:
function
(
result
)
{
console
.
log
(
result
);
//self.processThreeDS2(result);
self
.
processThreeDS2
(
result
.
data
);
},
onError
:
function
(
result
)
{
// TODO error handling show error message
...
...
@@ -225,7 +223,7 @@ define(
});
}
threeDS2Component
.
mount
(
threeDS2
Node
);
self
.
threeDS2Component
.
mount
(
card
Node
);
},
/**
*
...
...
@@ -267,7 +265,7 @@ define(
'
holderName
'
:
this
.
creditCardOwner
(),
'
store_cc
'
:
this
.
setStoreCc
(),
'
number_of_installments
'
:
this
.
installment
(),
'
java_enabled
'
:
navigator
.
javaEnabled
(),
'
java_enabled
'
:
navigator
.
javaEnabled
()
.
toString
()
,
'
screen_color_depth
'
:
screen
.
colorDepth
,
'
screen_width
'
:
screen
.
width
,
'
screen_height
'
:
screen
.
height
,
...
...
@@ -330,6 +328,7 @@ define(
if
(
!!
response
.
threeDS2
)
{
// render component
self
.
cardComponent
.
unmount
();
self
.
renderThreeDS2Component
(
response
.
type
,
response
.
token
);
}
else
{
self
.
getPlaceOrderDeferredObject
()
...
...
view/frontend/web/template/payment/cc-form.html
View file @
6ed050b3
...
...
@@ -77,8 +77,6 @@
<div
afterRender=
"renderSecureFields()"
data-bind=
"attr: { id: 'cardContainer'}"
></div>
</div>
<div
id=
"threeDS2Container"
></div>
<!-- ko if: (hasInstallments())-->
<div
class=
"field required"
...
...
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