We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 6d7e8fd1 authored by Alexandros Moraitis's avatar Alexandros Moraitis Committed by GitHub

[PW-2236] Remove idempotency from alternative payment methods (#721)

* Remove idempotency from alternative payment methods

* Fix sonar cloud code smell
parent 83a35dd9
...@@ -64,14 +64,8 @@ class TransactionAuthorization implements ClientInterface ...@@ -64,14 +64,8 @@ class TransactionAuthorization implements ClientInterface
public function placeRequest(\Magento\Payment\Gateway\Http\TransferInterface $transferObject) public function placeRequest(\Magento\Payment\Gateway\Http\TransferInterface $transferObject)
{ {
$request = $transferObject->getBody(); $request = $transferObject->getBody();
$headers = $transferObject->getHeaders();
$requestOptions = []; $requestOptions = [];
if (!empty($headers['idempotencyKey'])) {
$requestOptions['idempotencyKey'] = $headers['idempotencyKey'];
}
// call lib // call lib
$service = new \Adyen\Service\Payment($this->client); $service = new \Adyen\Service\Payment($this->client);
......
...@@ -63,7 +63,6 @@ class TransactionPayment implements ClientInterface ...@@ -63,7 +63,6 @@ class TransactionPayment implements ClientInterface
public function placeRequest(\Magento\Payment\Gateway\Http\TransferInterface $transferObject) public function placeRequest(\Magento\Payment\Gateway\Http\TransferInterface $transferObject)
{ {
$request = $transferObject->getBody(); $request = $transferObject->getBody();
$headers = $transferObject->getHeaders();
// If the payments call is already done return the request // If the payments call is already done return the request
if (!empty($request['resultCode'])) { if (!empty($request['resultCode'])) {
...@@ -77,10 +76,6 @@ class TransactionPayment implements ClientInterface ...@@ -77,10 +76,6 @@ class TransactionPayment implements ClientInterface
$requestOptions = []; $requestOptions = [];
if (!empty($headers['idempotencyKey'])) {
$requestOptions['idempotencyKey'] = $headers['idempotencyKey'];
}
$request = $this->applicationInfo->addMerchantApplicationIntoRequest($request); $request = $this->applicationInfo->addMerchantApplicationIntoRequest($request);
try { try {
......
...@@ -63,9 +63,7 @@ class PaymentDataBuilder implements BuilderInterface ...@@ -63,9 +63,7 @@ class PaymentDataBuilder implements BuilderInterface
$paymentMethod = $payment->getMethod(); $paymentMethod = $payment->getMethod();
$request['body'] = $this->adyenRequestsHelper->buildPaymentData([], $amount, $currencyCode, $reference, $paymentMethod); $request['body'] = $this->adyenRequestsHelper->buildPaymentData([], $amount, $currencyCode, $reference, $paymentMethod);
$request['headers'] = $this->adyenRequestsHelper->addIdempotencyKey([], $paymentMethod, $reference);
return $request; return $request;
} }
} }
...@@ -492,21 +492,4 @@ class Requests extends AbstractHelper ...@@ -492,21 +492,4 @@ class Requests extends AbstractHelper
return $address; 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;
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment