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
94871263
Commit
94871263
authored
May 28, 2020
by
Attila Kiss
Committed by
GitHub
May 28, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into PW-2383
parents
5aa57ee7
88e7d0e4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
44 deletions
+13
-44
Controller/Process/Result.php
Controller/Process/Result.php
+12
-13
Gateway/Http/Client/TransactionAuthorization.php
Gateway/Http/Client/TransactionAuthorization.php
+0
-6
Gateway/Http/Client/TransactionPayment.php
Gateway/Http/Client/TransactionPayment.php
+0
-5
Gateway/Request/PaymentDataBuilder.php
Gateway/Request/PaymentDataBuilder.php
+1
-3
Helper/Requests.php
Helper/Requests.php
+0
-17
No files found.
Controller/Process/Result.php
View file @
94871263
...
...
@@ -107,7 +107,14 @@ class Result extends \Magento\Framework\App\Action\Action
$session
->
getQuote
()
->
setIsActive
(
false
)
->
save
();
$this
->
_redirect
(
'checkout/onepage/success'
,
[
'_query'
=>
[
'utm_nooverride'
=>
'1'
]]);
}
else
{
$this
->
_cancel
(
$response
);
$this
->
_adyenLogger
->
addAdyenResult
(
sprintf
(
'Payment for order %s was unsuccessful, '
.
'it will be cancelled when the OFFER_CLOSED notification has been processed.'
,
$this
->
_order
->
getIncrementId
()
)
);
$this
->
restoreCart
(
$response
);
$failReturnPath
=
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'return_path'
);
$this
->
_redirect
(
$failReturnPath
);
}
...
...
@@ -121,17 +128,13 @@ class Result extends \Magento\Framework\App\Action\Action
/**
* @param $response
*/
protected
function
_cancel
(
$response
)
protected
function
restoreCart
(
$response
)
{
$session
=
$this
->
_session
;
// restore the quote
$session
->
restoreQuote
();
$order
=
$this
->
_order
;
$this
->
_adyenHelper
->
cancelOrder
(
$order
);
if
(
isset
(
$response
[
'authResult'
])
&&
$response
[
'authResult'
]
==
\Adyen\Payment\Model\Notification
::
CANCELLED
)
{
$this
->
messageManager
->
addError
(
__
(
'You have cancelled the order. Please try again'
));
}
else
{
...
...
@@ -270,17 +273,13 @@ class Result extends \Magento\Framework\App\Action\Action
$this
->
_adyenLogger
->
addAdyenResult
(
'Do nothing wait for the notification'
);
break
;
case
Notification
::
CANCELLED
:
$this
->
_adyenLogger
->
addAdyenResult
(
'Cancel or Hold the order'
);
case
Notification
::
ERROR
:
$this
->
_adyenLogger
->
addAdyenResult
(
'Cancel or Hold the order on OFFER_CLOSED notification'
);
$result
=
false
;
break
;
case
Notification
::
REFUSED
:
// if refused there will be a AUTHORIZATION : FALSE notification send only exception is idea
$this
->
_adyenLogger
->
addAdyenResult
(
'Cancel or Hold the order'
);
$result
=
false
;
break
;
case
Notification
::
ERROR
:
//attempt to hold/cancel
$this
->
_adyenLogger
->
addAdyenResult
(
'Cancel or Hold the order'
);
$this
->
_adyenLogger
->
addAdyenResult
(
'Cancel or Hold the order on AUTHORISATION success = false notification'
);
$result
=
false
;
break
;
default
:
...
...
Gateway/Http/Client/TransactionAuthorization.php
View file @
94871263
...
...
@@ -64,14 +64,8 @@ class TransactionAuthorization implements ClientInterface
public
function
placeRequest
(
\Magento\Payment\Gateway\Http\TransferInterface
$transferObject
)
{
$request
=
$transferObject
->
getBody
();
$headers
=
$transferObject
->
getHeaders
();
$requestOptions
=
[];
if
(
!
empty
(
$headers
[
'idempotencyKey'
]))
{
$requestOptions
[
'idempotencyKey'
]
=
$headers
[
'idempotencyKey'
];
}
// call lib
$service
=
new
\Adyen\Service\Payment
(
$this
->
client
);
...
...
Gateway/Http/Client/TransactionPayment.php
View file @
94871263
...
...
@@ -63,7 +63,6 @@ class TransactionPayment implements ClientInterface
public
function
placeRequest
(
\Magento\Payment\Gateway\Http\TransferInterface
$transferObject
)
{
$request
=
$transferObject
->
getBody
();
$headers
=
$transferObject
->
getHeaders
();
// If the payments call is already done return the request
if
(
!
empty
(
$request
[
'resultCode'
]))
{
...
...
@@ -77,10 +76,6 @@ class TransactionPayment implements ClientInterface
$requestOptions
=
[];
if
(
!
empty
(
$headers
[
'idempotencyKey'
]))
{
$requestOptions
[
'idempotencyKey'
]
=
$headers
[
'idempotencyKey'
];
}
$request
=
$this
->
applicationInfo
->
addMerchantApplicationIntoRequest
(
$request
);
try
{
...
...
Gateway/Request/PaymentDataBuilder.php
View file @
94871263
...
...
@@ -63,9 +63,7 @@ class PaymentDataBuilder implements BuilderInterface
$paymentMethod
=
$payment
->
getMethod
();
$request
[
'body'
]
=
$this
->
adyenRequestsHelper
->
buildPaymentData
([],
$amount
,
$currencyCode
,
$reference
,
$paymentMethod
);
$request
[
'headers'
]
=
$this
->
adyenRequestsHelper
->
addIdempotencyKey
([],
$paymentMethod
,
$reference
);
return
$request
;
}
}
Helper/Requests.php
View file @
94871263
...
...
@@ -492,21 +492,4 @@ class Requests extends AbstractHelper
return
$address
;
}
/**
* Only adds idempotency key if payment method is adyen_hpp for now
*
* @param array $request
* @param $paymentMethod
* @param $idempotencyKey
* @return array
*/
public
function
addIdempotencyKey
(
$request
=
[],
$paymentMethod
,
$idempotencyKey
)
{
if
(
!
empty
(
$paymentMethod
)
&&
$paymentMethod
==
'adyen_hpp'
)
{
$request
[
'idempotencyKey'
]
=
$idempotencyKey
;
}
return
$request
;
}
}
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