From debe8a86a388453af384614af49a7343772b77b1 Mon Sep 17 00:00:00 2001 From: Can Demiralp Date: Fri, 24 Oct 2025 14:21:23 +0200 Subject: [PATCH] [ECP-9834-v9] Remove tax amount condition from L2/L3 ESD builder --- .../AdditionalDataLevel23DataBuilder.php | 6 --- .../AdditionalDataLevel23DataBuilderTest.php | 42 ------------------- 2 files changed, 48 deletions(-) diff --git a/Gateway/Request/AdditionalDataLevel23DataBuilder.php b/Gateway/Request/AdditionalDataLevel23DataBuilder.php index 0ed6a23059..783b79fc0f 100644 --- a/Gateway/Request/AdditionalDataLevel23DataBuilder.php +++ b/Gateway/Request/AdditionalDataLevel23DataBuilder.php @@ -67,12 +67,6 @@ public function build(array $buildSubject): array $order = $payment->getOrder(); $currencyCode = $this->chargedCurrency->getOrderAmountCurrency($order)->getCurrencyCode(); - // `totalTaxAmount` field is required and L2/L3 data can not be generated without this field. - if (empty($order->getTaxAmount()) || $order->getTaxAmount() < 0 || $order->getTaxAmount() === 0) { - $this->adyenLogger->warning(__('L2/L3 data can not be generated if tax amount is zero.')); - return $request; - } - $additionalDataLevel23 = [ self::ENHANCED_SCHEME_DATA_PREFIX . '.orderDate' => date('dmy', time()), self::ENHANCED_SCHEME_DATA_PREFIX . '.customerReference' => diff --git a/Test/Unit/Gateway/Request/AdditionalDataLevel23DataBuilderTest.php b/Test/Unit/Gateway/Request/AdditionalDataLevel23DataBuilderTest.php index 77ce4ab6eb..6405f2c455 100644 --- a/Test/Unit/Gateway/Request/AdditionalDataLevel23DataBuilderTest.php +++ b/Test/Unit/Gateway/Request/AdditionalDataLevel23DataBuilderTest.php @@ -190,46 +190,4 @@ public function testLevel23DataConfigurationDisabled() $result = $this->additionalDataBuilder->build($buildSubject); $this->assertEmpty($result); } - - protected static function taxAmountDataProvider(): array - { - return [ - ['taxAmount' => 0], - ['taxAmount' => null], - ['taxAmount' => -1] - ]; - } - - /** - * @dataProvider taxAmountDataProvider - * - * @param $taxAmount - * @return void - * @throws NoSuchEntityException - */ - public function testLevel23DataInvalidTaxAmounts($taxAmount) - { - $storeId = 1; - $currencyCode = 'USD'; - - $this->chargedCurrencyMock->method('getOrderAmountCurrency') - ->willReturn(new AdyenAmountCurrency(null, $currencyCode)); - - $this->storeMock->method('getId')->willReturn($storeId); - $this->configMock->method('sendLevel23AdditionalData')->with($storeId)->willReturn(true); - - $orderMock = $this->createMock(Order::class); - $orderMock->method('getTaxAmount')->willReturn($taxAmount); - - $paymentMock = $this->createMock(Payment::class); - $paymentMock->method('getOrder')->willReturn($orderMock); - - $paymentDataObjectMock = $this->createMock(PaymentDataObject::class); - $paymentDataObjectMock->method('getPayment')->willReturn($paymentMock); - - $buildSubject = ['payment' => $paymentDataObjectMock, 'order' => $orderMock]; - - $result = $this->additionalDataBuilder->build($buildSubject); - $this->assertEmpty($result); - } }