Skip to content

Commit

Permalink
Merge branch 'main' into ECP-9498
Browse files Browse the repository at this point in the history
  • Loading branch information
khushboo-singhvi authored Oct 23, 2024
2 parents 4e7ce99 + 3ee5a3e commit b9250a1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 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

0 comments on commit b9250a1

Please sign in to comment.