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
b8fc725c
Commit
b8fc725c
authored
Oct 28, 2019
by
cyattilakiss
Committed by
GitHub
Oct 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved logging to track payment and order flow at cc payments (#557)
parent
566c2b82
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
2 deletions
+49
-2
Gateway/Request/CcAuthorizationDataBuilder.php
Gateway/Request/CcAuthorizationDataBuilder.php
+20
-0
Model/AdyenPaymentProcess.php
Model/AdyenPaymentProcess.php
+16
-1
Model/AdyenThreeDS2Process.php
Model/AdyenThreeDS2Process.php
+13
-1
No files found.
Gateway/Request/CcAuthorizationDataBuilder.php
View file @
b8fc725c
...
...
@@ -27,6 +27,24 @@ use Magento\Payment\Gateway\Request\BuilderInterface;
class
CcAuthorizationDataBuilder
implements
BuilderInterface
{
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
private
$adyenLogger
;
/**
* CcAuthorizationDataBuilder constructor.
*
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
*/
public
function
__construct
(
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
)
{
$this
->
adyenLogger
=
$adyenLogger
;
}
/**
* @param array $buildSubject
* @return array|mixed
...
...
@@ -50,6 +68,8 @@ class CcAuthorizationDataBuilder implements BuilderInterface
throw
new
\Magento\Framework\Exception\LocalizedException
(
__
(
$errorMsg
));
}
$this
->
adyenLogger
->
addAdyenDebug
(
"Place order started for order: "
.
$request
[
'merchantReference'
]);
return
$request
;
}
}
Model/AdyenPaymentProcess.php
View file @
b8fc725c
...
...
@@ -67,6 +67,11 @@ class AdyenPaymentProcess implements AdyenPaymentProcessInterface
*/
private
$threeDS2ResponseValidator
;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
private
$adyenLogger
;
/**
* AdyenPaymentProcess constructor.
*
...
...
@@ -87,7 +92,8 @@ class AdyenPaymentProcess implements AdyenPaymentProcessInterface
\Adyen\Payment\Gateway\Http\TransferFactory
$transferFactory
,
\Adyen\Payment\Gateway\Http\Client\TransactionPayment
$transactionPayment
,
\Adyen\Payment\Gateway\Validator\CheckoutResponseValidator
$checkoutResponseValidator
,
\Adyen\Payment\Gateway\Validator\ThreeDS2ResponseValidator
$threeDS2ResponseValidator
\Adyen\Payment\Gateway\Validator\ThreeDS2ResponseValidator
$threeDS2ResponseValidator
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
)
{
$this
->
context
=
$context
;
...
...
@@ -98,6 +104,7 @@ class AdyenPaymentProcess implements AdyenPaymentProcessInterface
$this
->
transactionPayment
=
$transactionPayment
;
$this
->
checkoutResponseValidator
=
$checkoutResponseValidator
;
$this
->
threeDS2ResponseValidator
=
$threeDS2ResponseValidator
;
$this
->
adyenLogger
=
$adyenLogger
;
}
/**
...
...
@@ -148,6 +155,9 @@ class AdyenPaymentProcess implements AdyenPaymentProcessInterface
// Setting the orderid to null, so that we generate a new one for each /payments call
$quote
->
setReservedOrderId
(
null
);
$reference
=
$quote
->
reserveOrderId
()
->
getReservedOrderId
();
$this
->
adyenLogger
->
addAdyenDebug
(
"CC payment started for order: "
.
$reference
);
$requestBody
=
$this
->
adyenRequestHelper
->
buildPaymentData
(
$requestBody
,
$amount
,
$currencyCode
,
$reference
,
$paymentMethod
);
// Browser data builder
...
...
@@ -204,6 +214,11 @@ class AdyenPaymentProcess implements AdyenPaymentProcessInterface
// To actually save the additional info changes into the quote
$quote
->
save
();
$this
->
adyenLogger
->
addAdyenDebug
(
"CC payment finished for order: "
.
$quote
->
getReservedOrderId
());
if
(
!
empty
(
$paymentsResponse
[
'resultCode'
]))
{
$this
->
adyenLogger
->
addAdyenDebug
(
'Result code: '
.
$paymentsResponse
[
'resultCode'
]);
}
// Original flow can continue, return to frontend and place the order
return
$this
->
adyenHelper
->
buildThreeDS2ProcessResponseJson
();
}
...
...
Model/AdyenThreeDS2Process.php
View file @
b8fc725c
...
...
@@ -37,6 +37,11 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface
*/
private
$adyenHelper
;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
private
$adyenLogger
;
/**
* AdyenThreeDS2Process constructor.
*
...
...
@@ -45,11 +50,13 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface
*/
public
function
__construct
(
\Magento\Checkout\Model\Session
$checkoutSession
,
\Adyen\Payment\Helper\Data
$adyenHelper
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
)
{
$this
->
checkoutSession
=
$checkoutSession
;
$this
->
adyenHelper
=
$adyenHelper
;
$this
->
adyenLogger
=
$adyenLogger
;
}
/**
...
...
@@ -123,6 +130,11 @@ class AdyenThreeDS2Process implements AdyenThreeDS2ProcessInterface
// To actually save the additional info changes into the quote
$quote
->
save
();
$this
->
adyenLogger
->
addAdyenDebug
(
"CC payment finished for order: "
.
$quote
->
getReservedOrderId
());
if
(
!
empty
(
$result
[
'resultCode'
]))
{
$this
->
adyenLogger
->
addAdyenDebug
(
'Result code: '
.
$result
[
'resultCode'
]);
}
// 3DS2 flow is done, original place order flow can continue from frontend
return
$this
->
adyenHelper
->
buildThreeDS2ProcessResponseJson
();
}
...
...
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