Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions Gateway/Request/AdditionalDataLevel23DataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Loading