Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ECP-9498' into ECP-9498
Browse files Browse the repository at this point in the history
  • Loading branch information
Can Demiralp committed Oct 24, 2024
2 parents 43bd277 + b9250a1 commit 561fd56
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
25 changes: 16 additions & 9 deletions Gateway/Response/PaymentAuthorisationDetailsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@

namespace Adyen\Payment\Gateway\Response;

use Magento\Payment\Gateway\Helper\SubjectReader;
use Magento\Payment\Gateway\Response\HandlerInterface;
use Magento\Sales\Api\Data\OrderPaymentInterface;

class PaymentAuthorisationDetailsHandler implements HandlerInterface
{
/**
* @param array $handlingSubject
* @param array $response
* @param array $responseCollection
*/
public function handle(array $handlingSubject, array $response)
public function handle(array $handlingSubject, array $responseCollection): void
{
$payment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($handlingSubject);
$payment = SubjectReader::readPayment($handlingSubject);

/** @var OrderPaymentInterface $payment */
$payment = $payment->getPayment();
Expand All @@ -32,12 +34,17 @@ public function handle(array $handlingSubject, array $response)
// no not send order confirmation mail
$payment->getOrder()->setCanSendNewEmailFlag(false);

// set pspReference as transactionId
$payment->setCcTransId($response['pspReference']);
$payment->setLastTransId($response['pspReference']);

// set transaction
$payment->setTransactionId($response['pspReference']);
// for partial payments, non-giftcard payments will always be the last element in the collection
// for non-partial, there is only one response in the collection
$response = end($responseCollection);
if (!empty($response['pspReference'])) {
// set pspReference as transactionId
$payment->setCcTransId($response['pspReference']);
$payment->setLastTransId($response['pspReference']);

// set transaction
$payment->setTransactionId($response['pspReference']);
}

// do not close transaction so you can do a cancel() and void
$payment->setIsTransactionClosed(false);
Expand Down
5 changes: 5 additions & 0 deletions etc/csp_whitelist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,31 @@
<policy id="script-src">
<values>
<value id="adyen" type="host">*.adyen.com</value>
<value id="googlepay" type="host">pay.google.com</value>
</values>
</policy>
<policy id="frame-src">
<values>
<value id="adyen" type="host">*.adyen.com</value>
<value id="googlepay" type="host">pay.google.com</value>
</values>
</policy>
<policy id="img-src">
<values>
<value id="adyen" type="host">*.adyen.com</value>
<value id="googlepay" type="host">pay.google.com</value>
</values>
</policy>
<policy id="connect-src">
<values>
<value id="adyen" type="host">*.adyen.com</value>
<value id="googlepay" type="host">pay.google.com</value>
</values>
</policy>
<policy id="form-action">
<values>
<value id="adyen" type="host">*.adyen.com</value>
<value id="googlepay" type="host">pay.google.com</value>
</values>
</policy>
</policies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ define(
) {
return adyenPaymentMethod.extend({
placeOrderButtonVisible: false,
token: null,
initialize: function () {
this._super();
},
Expand Down Expand Up @@ -58,9 +59,9 @@ define(
}

//Create details array for the payload
let details ={};
let details = {};
if(!!this.token) {
details.orderID= this.token;
details.orderID = this.token;
}
request.details = details;

Expand Down

0 comments on commit 561fd56

Please sign in to comment.