diff --git a/Gateway/Http/Client/TransactionPayment.php b/Gateway/Http/Client/TransactionPayment.php index 1e4cb800b..57d6474f8 100644 --- a/Gateway/Http/Client/TransactionPayment.php +++ b/Gateway/Http/Client/TransactionPayment.php @@ -162,6 +162,11 @@ public function placeRequest(TransferInterface $transferObject): array $this->adyenHelper->logResponse($responseData); } catch (AdyenException $e) { $this->adyenHelper->logAdyenException($e); + + $responseObj['error'] = $e->getMessage(); + $responseObj['errorCode'] = $e->getAdyenErrorCode(); + + $responseCollection[] = $responseObj; } return $responseCollection; diff --git a/Gateway/Validator/CheckoutResponseValidator.php b/Gateway/Validator/CheckoutResponseValidator.php index 102177dfd..b2e59bbc5 100644 --- a/Gateway/Validator/CheckoutResponseValidator.php +++ b/Gateway/Validator/CheckoutResponseValidator.php @@ -62,6 +62,10 @@ public function validate(array $validationSubject): ResultInterface // Extract all the payment responses $responseCollection = $validationSubject['response']; unset($validationSubject['response']); + + // hasOnlyGiftCards is needed later but cannot be processed as a response + unset($responseCollection['hasOnlyGiftCards']); + // Assign the remaining items to $commandSubject $commandSubject = $validationSubject; @@ -69,8 +73,6 @@ public function validate(array $validationSubject): ResultInterface throw new ValidatorException(__("No responses were provided")); } - // hasOnlyGiftCards is needed later but cannot be processed as a response - unset($responseCollection['hasOnlyGiftCards']); foreach ($responseCollection as $thisResponse) { $responseSubject = array_merge($commandSubject, ['response' => $thisResponse]); $this->validateResponse($responseSubject); @@ -90,11 +92,12 @@ private function validateResponse($responseSubject): void $payment->setAdditionalInformation('3dActive', false); - // validate result + // Handle empty result for unexpected cases if (empty($response['resultCode'])) { $this->handleEmptyResultCode($response); } + // Handle the `/payments` response $this->validateResult($response, $payment); } diff --git a/Test/Unit/Gateway/Http/Client/TransactionPaymentTest.php b/Test/Unit/Gateway/Http/Client/TransactionPaymentTest.php index 492c65ebc..3b1be8746 100644 --- a/Test/Unit/Gateway/Http/Client/TransactionPaymentTest.php +++ b/Test/Unit/Gateway/Http/Client/TransactionPaymentTest.php @@ -11,6 +11,7 @@ namespace Adyen\Payment\Test\Unit\Gateway\Http\Client; +use Adyen\AdyenException; use Adyen\Model\Checkout\ApplicationInfo; use Adyen\Model\Checkout\PaymentRequest; use Adyen\Model\Checkout\PaymentResponse as CheckoutPaymentResponse; @@ -87,6 +88,23 @@ public function testPlaceRequestWithResultCode() $this->assertEquals($requestBody, $result); } + public function testPlaceRequestWithoutResultCode() + { + $transferObjectMock = $this->createMock(TransferInterface::class); + + $requestBody = ['amount' => ['value' => 1000]]; + $transferObjectMock->method('getBody')->willReturn($requestBody); + $transferObjectMock->method('getClientConfig')->willReturn(['storeId' => 1]); + + $clientMock = $this->createMock(PaymentsApi::class); + $clientMock->method('payments')->willThrowException(new AdyenException()); + + $this->adyenHelperMock->method('initializePaymentsApi')->willReturn($clientMock); + + $response = $this->transactionPayment->placeRequest($transferObjectMock); + $this->assertArrayHasKey('errorCode', $response[0]); + } + public function testPlaceRequestGeneratesIdempotencyKey() { $requestBody = ['reference' => 'ABC12345', 'amount' => ['value' => 100], 'applicationInfo' => $this->applicationInfoMock]; diff --git a/VERSION b/VERSION index 31476ce15..327451916 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -9.8.1 +9.9.1 diff --git a/composer.json b/composer.json index 6b22bf829..3f6ebb8cd 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "adyen/module-payment", "description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.", "type": "magento2-module", - "version": "9.8.1", + "version": "9.9.1", "license": "MIT", "repositories": [ { diff --git a/etc/config.xml b/etc/config.xml index c205ab519..dd7997bbd 100755 --- a/etc/config.xml +++ b/etc/config.xml @@ -2207,6 +2207,72 @@ Stored DANA AdyenPaymentDanaVaultFacade + + 0 + AdyenPaymentKcpNaverpayFacade + NaverPay + 0 + 0 + authorize + 1 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 1 + adyen-alternative-payment-method + + + 0 + AdyenPaymentKcpPaycoFacade + PayCo + 0 + 0 + authorize + 1 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 1 + adyen-alternative-payment-method + + + 0 + AdyenPaymentKcpCreditcardFacade + Credit Card via KCP + 0 + 0 + authorize + 1 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + adyen-alternative-payment-method + diff --git a/etc/db_schema.xml b/etc/db_schema.xml index b27cee6c3..6f6147481 100644 --- a/etc/db_schema.xml +++ b/etc/db_schema.xml @@ -68,6 +68,9 @@ + + + diff --git a/etc/db_schema_whitelist.json b/etc/db_schema_whitelist.json index 8be925e25..d0067f852 100644 --- a/etc/db_schema_whitelist.json +++ b/etc/db_schema_whitelist.json @@ -62,7 +62,8 @@ "ADYEN_NOTIFICATION_PSPREFERENCE": true, "ADYEN_NOTIFICATION_EVENT_CODE": true, "ADYEN_NOTIFICATION_PSPREFERENCE_EVENT_CODE": true, - "ADYEN_NOTIFICATION_MERCHANT_REFERENCE_EVENT_CODE": true + "ADYEN_NOTIFICATION_MERCHANT_REFERENCE_EVENT_CODE": true, + "ADYEN_NOTIFICATION_CREATED_AT": true }, "constraint": { "PRIMARY": true @@ -110,4 +111,4 @@ "PRIMARY": true } } -} \ No newline at end of file +} diff --git a/etc/di.xml b/etc/di.xml index 7b4cdc553..b87676dff 100755 --- a/etc/di.xml +++ b/etc/di.xml @@ -4236,4 +4236,85 @@ adyen_dana_vault + + + adyen_kcp_naverpay + Magento\Payment\Block\Form + Adyen\Payment\Block\Info\PaymentMethodInfo + AdyenPaymentKcpNaverpayValueHandlerPool + AdyenPaymentValidatorPool + AdyenPaymentCommandPool + + + + + + AdyenPaymentKcpNaverpayConfigValueHandler + + + + + + AdyenPaymentKcpNaverpayConfig + + + + + adyen_kcp_naverpay + + + + + adyen_kcp_payco + Magento\Payment\Block\Form + Adyen\Payment\Block\Info\PaymentMethodInfo + AdyenPaymentKcpPaycoValueHandlerPool + AdyenPaymentValidatorPool + AdyenPaymentCommandPool + + + + + + AdyenPaymentKcpPaycoConfigValueHandler + + + + + + AdyenPaymentKcpPaycoConfig + + + + + adyen_kcp_payco + + + + + adyen_kcp_creditcard + Magento\Payment\Block\Form + Adyen\Payment\Block\Info\PaymentMethodInfo + AdyenPaymentKcpCreditcardValueHandlerPool + AdyenPaymentValidatorPool + AdyenPaymentCommandPool + + + + + + AdyenPaymentKcpCreditcardConfigValueHandler + + + + + + AdyenPaymentKcpCreditcardConfig + + + + + adyen_kcp_creditcard + + \ No newline at end of file diff --git a/etc/events.xml b/etc/events.xml index 0a6acaf76..152061321 100644 --- a/etc/events.xml +++ b/etc/events.xml @@ -302,4 +302,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index f1ea6027d..34576cb77 100755 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -111,6 +111,9 @@ paypo upi dana + kcp_naverpay + kcp_payco + kcp_creditcard Adyen_Payment/js/view/payment/method-renderer/adyen-cc-method diff --git a/etc/graphql/di.xml b/etc/graphql/di.xml index 06b46a633..ca8deea49 100644 --- a/etc/graphql/di.xml +++ b/etc/graphql/di.xml @@ -92,6 +92,9 @@ Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm + Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm + Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm + Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm diff --git a/etc/payment.xml b/etc/payment.xml index e1f64a6a2..5c9920a18 100755 --- a/etc/payment.xml +++ b/etc/payment.xml @@ -263,5 +263,14 @@ 1 + + 1 + + + 1 + + + 1 + \ No newline at end of file diff --git a/view/base/web/images/logos/kcp_creditcard.svg b/view/base/web/images/logos/kcp_creditcard.svg new file mode 100644 index 000000000..48c5245d4 --- /dev/null +++ b/view/base/web/images/logos/kcp_creditcard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/view/base/web/images/logos/kcp_naverpay.svg b/view/base/web/images/logos/kcp_naverpay.svg new file mode 100644 index 000000000..806b94f60 --- /dev/null +++ b/view/base/web/images/logos/kcp_naverpay.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/view/base/web/images/logos/kcp_payco.svg b/view/base/web/images/logos/kcp_payco.svg new file mode 100644 index 000000000..803d06625 --- /dev/null +++ b/view/base/web/images/logos/kcp_payco.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/view/frontend/layout/checkout_index_index.xml b/view/frontend/layout/checkout_index_index.xml index 3c8fcf436..076a3d1ca 100755 --- a/view/frontend/layout/checkout_index_index.xml +++ b/view/frontend/layout/checkout_index_index.xml @@ -317,6 +317,15 @@ true + + true + + + true + + + true + diff --git a/view/frontend/layout/multishipping_checkout_billing.xml b/view/frontend/layout/multishipping_checkout_billing.xml index af5b0653d..64d663f2b 100644 --- a/view/frontend/layout/multishipping_checkout_billing.xml +++ b/view/frontend/layout/multishipping_checkout_billing.xml @@ -101,6 +101,9 @@ Adyen_Payment::form/multishipping/abstract-form.phtml Adyen_Payment::form/multishipping/abstract-form.phtml Adyen_Payment::form/multishipping/abstract-form.phtml + Adyen_Payment::form/multishipping/abstract-form.phtml + Adyen_Payment::form/multishipping/abstract-form.phtml + Adyen_Payment::form/multishipping/abstract-form.phtml false