Skip to content

Commit 9f2b10c

Browse files
committed
ACP2E-2134: VAT calculation wrong - price limited to 100,000,000 maximum based on currency
1 parent ca30c47 commit 9f2b10c

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

app/code/Magento/Quote/etc/db_schema.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@
244244
comment="Weight"/>
245245
<column xsi:type="decimal" name="qty" scale="4" precision="12" unsigned="false" nullable="false" default="0"
246246
comment="Qty"/>
247-
<column xsi:type="decimal" name="price" scale="4" precision="12" unsigned="false" nullable="false" default="0"
247+
<column xsi:type="decimal" name="price" scale="4" precision="20" unsigned="false" nullable="false" default="0"
248248
comment="Price"/>
249-
<column xsi:type="decimal" name="base_price" scale="4" precision="12" unsigned="false" nullable="false"
249+
<column xsi:type="decimal" name="base_price" scale="4" precision="20" unsigned="false" nullable="false"
250250
default="0" comment="Base Price"/>
251-
<column xsi:type="decimal" name="custom_price" scale="4" precision="12" unsigned="false" nullable="true"
251+
<column xsi:type="decimal" name="custom_price" scale="4" precision="20" unsigned="false" nullable="true"
252252
comment="Custom Price"/>
253253
<column xsi:type="decimal" name="discount_percent" scale="4" precision="12" unsigned="false" nullable="true"
254254
default="0" comment="Discount Percent"/>

dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\Quote\Model;
99

1010
use Magento\Catalog\Api\ProductRepositoryInterface;
11+
use Magento\Catalog\Test\Fixture\Product as ProductFixture;
1112
use Magento\Checkout\Model\Session as CheckoutSession;
1213
use Magento\Customer\Api\CustomerRepositoryInterface;
1314
use Magento\Customer\Api\Data\CustomerInterface;
@@ -25,6 +26,11 @@
2526
use Magento\Quote\Api\Data\CartInterface;
2627
use Magento\Quote\Api\Data\CartItemInterface;
2728
use Magento\Quote\Api\Data\CartItemInterfaceFactory;
29+
use Magento\Quote\Test\Fixture\AddProductToCart as AddProductToCartFixture;
30+
use Magento\Quote\Test\Fixture\GuestCart as GuestCartFixture;
31+
use Magento\TestFramework\Fixture\DataFixture;
32+
use Magento\TestFramework\Fixture\DataFixtureStorage;
33+
use Magento\TestFramework\Fixture\DataFixtureStorageManager;
2834
use Magento\TestFramework\Helper\Bootstrap;
2935
use Magento\TestFramework\Quote\Model\GetQuoteByReservedOrderId;
3036
use PHPUnit\Framework\TestCase;
@@ -81,6 +87,11 @@ class QuoteTest extends TestCase
8187
/** @var ExtensibleDataObjectConverter */
8288
private $extensibleDataObjectConverter;
8389

90+
/**
91+
* @var DataFixtureStorage
92+
*/
93+
private $fixtures;
94+
8495
/**
8596
* @inheritdoc
8697
*/
@@ -102,6 +113,7 @@ protected function setUp(): void
102113
$this->customerResourceModel = $this->objectManager->get(CustomerResourceModel::class);
103114
$this->groupFactory = $this->objectManager->get(GroupFactory::class);
104115
$this->extensibleDataObjectConverter = $this->objectManager->get(ExtensibleDataObjectConverter::class);
116+
$this->fixtures = $this->objectManager->get(DataFixtureStorageManager::class)->getStorage();
105117
}
106118

107119
/**
@@ -809,4 +821,23 @@ public function testIsMultiShippingModeEnabledAfterQuoteItemRemoved(): void
809821
);
810822
}
811823
}
824+
825+
#[
826+
DataFixture(ProductFixture::class, ['price' => 922903400.00], as: 'product'),
827+
DataFixture(GuestCartFixture::class, as: 'cart'),
828+
DataFixture(
829+
AddProductToCartFixture::class,
830+
['cart_id' => '$cart.id$', 'product_id' => '$product.id$', 'qty' => 1]
831+
),
832+
]
833+
public function testQuoteItemWithPriceGreaterThan100Millions()
834+
{
835+
$product = $this->fixtures->get('product');
836+
$cart = $this->fixtures->get('cart');
837+
$item = $cart->getItemsCollection(false)->fetchItem();
838+
$this->assertEquals(
839+
round((float)$product->getPrice(), 2),
840+
round((float)$item->getPrice(), 2)
841+
);
842+
}
812843
}

0 commit comments

Comments
 (0)