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
6d2c0b75
Commit
6d2c0b75
authored
Nov 07, 2018
by
cyattilakiss
Committed by
GitHub
Nov 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #331 from Adyen/PW-636
PW-636 Move 3D secure to new checkout endpoint /payments/details
parents
81513233
9ab56f7e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
32 deletions
+26
-32
Gateway/Validator/CheckoutResponseValidator.php
Gateway/Validator/CheckoutResponseValidator.php
+6
-5
Helper/Data.php
Helper/Data.php
+11
-6
Model/Api/PaymentRequest.php
Model/Api/PaymentRequest.php
+9
-21
No files found.
Gateway/Validator/CheckoutResponseValidator.php
View file @
6d2c0b75
...
...
@@ -97,14 +97,15 @@ class CheckoutResponseValidator extends AbstractValidator
case
"RedirectShopper"
:
$payment
->
setAdditionalInformation
(
'3dActive'
,
true
);
$issuerUrl
=
$response
[
'redirect'
][
'url'
];
$paReq
=
$response
[
'redirect'
][
'data'
][
'PaReq'
];
$md
=
$response
[
'redirect'
][
'data'
][
'MD'
];
if
(
!
empty
(
$paReq
)
&&
!
empty
(
$md
)
&&
!
empty
(
$issuerUrl
)
)
{
if
(
!
empty
(
$paReq
=
$response
[
'redirect'
][
'data'
][
'PaReq'
])
&&
!
empty
(
$md
=
$response
[
'redirect'
][
'data'
][
'MD'
])
&&
!
empty
(
$issuerUrl
=
$response
[
'redirect'
][
'url'
])
&&
!
empty
(
$paymentData
=
$response
[
'paymentData'
])
)
{
$payment
->
setAdditionalInformation
(
'issuerUrl'
,
$issuerUrl
);
$payment
->
setAdditionalInformation
(
'paRequest'
,
$paReq
);
$payment
->
setAdditionalInformation
(
'md'
,
$md
);
$payment
->
setAdditionalInformation
(
'paymentData'
,
$paymentData
);
}
else
{
$isValid
=
false
;
$errorMsg
=
__
(
'3D secure is not valid.'
);
...
...
Helper/Data.php
View file @
6d2c0b75
...
...
@@ -96,11 +96,6 @@ class Data extends AbstractHelper
*/
protected
$adyenLogger
;
/**
* @var \Adyen\Service\ServiceFactory
*/
protected
$adyenServiceFactory
;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
...
...
@@ -1257,7 +1252,7 @@ class Data extends AbstractHelper
$client
=
$this
->
initializeAdyenClient
();
$service
=
$this
->
adyenServiceFactory
->
createCheckoutUtility
(
$client
);
$service
=
$this
->
createAdyenCheckoutUtilityService
(
$client
);
$respone
=
$service
->
originKeys
(
$params
);
if
(
empty
(
$originKey
=
$respone
[
'originKeys'
][
$url
]))
{
...
...
@@ -1278,4 +1273,14 @@ class Data extends AbstractHelper
return
self
::
CHECKOUT_CONTEXT_URL_LIVE
;
}
/**
* @param \Adyen\Clien $client
* @return \Adyen\Service\CheckoutUtility
* @throws \Adyen\AdyenException
*/
private
function
createAdyenCheckoutUtilityService
(
$client
)
{
return
new
\Adyen\Service\CheckoutUtility
(
$client
);
}
}
Model/Api/PaymentRequest.php
View file @
6d2c0b75
...
...
@@ -78,16 +78,6 @@ class PaymentRequest extends DataObject
$this
->
_appState
=
$context
->
getAppState
();
}
/**
* @param $storeId
* @return mixed
* @throws \Adyen\AdyenException
*/
private
function
createClient
(
$storeId
)
{
$client
=
$this
->
_adyenHelper
->
initializeAdyenClient
(
$storeId
);
return
$client
;
}
/**
* @param $payment
* @return mixed
...
...
@@ -97,25 +87,23 @@ class PaymentRequest extends DataObject
{
$order
=
$payment
->
getOrder
();
$storeId
=
$order
->
getStoreId
();
$merchantAccount
=
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
"merchant_account"
,
$storeId
);
$shopperIp
=
$order
->
getRemoteIp
();
$md
=
$payment
->
getAdditionalInformation
(
'md'
);
$paResponse
=
$payment
->
getAdditionalInformation
(
'paResponse'
);
$paymentData
=
$payment
->
getAdditionalInformation
(
'paymentData'
);
$browserInfo
=
[
'userAgent'
=>
$_SERVER
[
'HTTP_USER_AGENT'
],
'acceptHeader'
=>
$_SERVER
[
'HTTP_ACCEPT'
]];
$request
=
[
"merchantAccount"
=>
$merchantAccount
,
"browserInfo"
=>
$browserInfo
,
"md
"
=>
$md
,
"paResponse"
=>
$paResponse
,
"shopperIP"
=>
$shopperIp
"paymentData"
=>
$paymentData
,
"details"
=>
[
"MD
"
=>
$md
,
"PaRes"
=>
$paResponse
]
];
try
{
$client
=
$this
->
create
Client
(
$storeId
);
$service
=
new
\Adyen\Service\
Paymen
t
(
$client
);
$result
=
$service
->
authorise3D
(
$request
);
$client
=
$this
->
_adyenHelper
->
initializeAdyen
Client
(
$storeId
);
$service
=
new
\Adyen\Service\
Checkou
t
(
$client
);
$result
=
$service
->
paymentsDetails
(
$request
);
}
catch
(
\Adyen\AdyenException
$e
)
{
throw
new
\Magento\Framework\Exception\LocalizedException
(
__
(
'3D secure failed'
));
}
...
...
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