diff --git a/Gateway/Response/PaymentAuthorisationDetailsHandler.php b/Gateway/Response/PaymentAuthorisationDetailsHandler.php index 63a3a7115..13e73e894 100644 --- a/Gateway/Response/PaymentAuthorisationDetailsHandler.php +++ b/Gateway/Response/PaymentAuthorisationDetailsHandler.php @@ -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(); @@ -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); diff --git a/etc/csp_whitelist.xml b/etc/csp_whitelist.xml index 1de54c94f..c77209712 100644 --- a/etc/csp_whitelist.xml +++ b/etc/csp_whitelist.xml @@ -4,26 +4,31 @@ *.adyen.com + pay.google.com *.adyen.com + pay.google.com *.adyen.com + pay.google.com *.adyen.com + pay.google.com *.adyen.com + pay.google.com diff --git a/view/frontend/web/js/view/payment/method-renderer/adyen-paypal-method.js b/view/frontend/web/js/view/payment/method-renderer/adyen-paypal-method.js index db1b54ad7..bd7eb634b 100644 --- a/view/frontend/web/js/view/payment/method-renderer/adyen-paypal-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/adyen-paypal-method.js @@ -26,6 +26,7 @@ define( ) { return adyenPaymentMethod.extend({ placeOrderButtonVisible: false, + token: null, initialize: function () { this._super(); }, @@ -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;