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
9ab56f7e
Commit
9ab56f7e
authored
Nov 06, 2018
by
attilak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move 3D secure to new checkout endpoint
Add Checkout utility factory into Helper\Data
parent
1cda5566
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
35 deletions
+26
-35
Gateway/Validator/CheckoutResponseValidator.php
Gateway/Validator/CheckoutResponseValidator.php
+6
-5
Helper/Data.php
Helper/Data.php
+11
-9
Model/Api/PaymentRequest.php
Model/Api/PaymentRequest.php
+9
-21
No files found.
Gateway/Validator/CheckoutResponseValidator.php
View file @
9ab56f7e
...
...
@@ -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 @
9ab56f7e
...
...
@@ -96,11 +96,6 @@ class Data extends AbstractHelper
*/
protected
$adyenLogger
;
/**
* @var \Adyen\Service\ServiceFactory
*/
protected
$adyenServiceFactory
;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
...
...
@@ -127,7 +122,6 @@ class Data extends AbstractHelper
* @param \Magento\Tax\Model\Calculation $taxCalculation
* @param \Magento\Framework\App\ProductMetadataInterface $productMetadata
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Service\ServiceFactory $adyenServiceFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\App\CacheInterface $cache
*/
...
...
@@ -145,7 +139,6 @@ class Data extends AbstractHelper
\Magento\Tax\Model\Calculation
$taxCalculation
,
\Magento\Framework\App\ProductMetadataInterface
$productMetadata
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
,
\Adyen\Service\ServiceFactory
$adyenServiceFactory
,
\Magento\Store\Model\StoreManagerInterface
$storeManager
,
\Magento\Framework\App\CacheInterface
$cache
...
...
@@ -163,7 +156,6 @@ class Data extends AbstractHelper
$this
->
_taxCalculation
=
$taxCalculation
;
$this
->
productMetadata
=
$productMetadata
;
$this
->
adyenLogger
=
$adyenLogger
;
$this
->
adyenServiceFactory
=
$adyenServiceFactory
;
$this
->
storeManager
=
$storeManager
;
$this
->
cache
=
$cache
;
}
...
...
@@ -1242,7 +1234,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
]))
{
...
...
@@ -1263,4 +1255,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 @
9ab56f7e
...
...
@@ -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