|
6 | 6 | namespace Commercetools\Core\Cart; |
7 | 7 |
|
8 | 8 | use Commercetools\Core\ApiTestCase; |
| 9 | +use Commercetools\Core\Model\Cart\Cart; |
9 | 10 | use Commercetools\Core\Model\Cart\CartDraft; |
10 | 11 | use Commercetools\Core\Model\Cart\CustomLineItemDraft; |
11 | 12 | use Commercetools\Core\Model\Cart\CustomLineItemDraftCollection; |
|
39 | 40 | use Commercetools\Core\Request\Carts\Command\CartChangeCustomLineItemMoneyAction; |
40 | 41 | use Commercetools\Core\Request\Carts\Command\CartChangeCustomLineItemQuantityAction; |
41 | 42 | use Commercetools\Core\Request\Carts\Command\CartChangeLineItemQuantityAction; |
| 43 | +use Commercetools\Core\Request\Carts\Command\CartChangeTaxRoundingModeAction; |
42 | 44 | use Commercetools\Core\Request\Carts\Command\CartRecalculateAction; |
43 | 45 | use Commercetools\Core\Request\Carts\Command\CartRemoveCustomLineItemAction; |
44 | 46 | use Commercetools\Core\Request\Carts\Command\CartRemoveDiscountCodeAction; |
@@ -276,7 +278,7 @@ public function testUnsetExternalLineItemPriceQuantityChange() |
276 | 278 | $this->assertSame(100, $cart->getLineItems()->current()->getPrice()->getValue()->getCentAmount()); |
277 | 279 | $this->assertSame(200, $cart->getLineItems()->current()->getTotalPrice()->getCentAmount()); |
278 | 280 | } |
279 | | - |
| 281 | + |
280 | 282 | public function testCustomLineItem() |
281 | 283 | { |
282 | 284 | $draft = $this->getDraft(); |
@@ -1112,6 +1114,33 @@ public function testInvalidLocale($locale) |
1112 | 1114 | $this->assertTrue($response->isError()); |
1113 | 1115 | } |
1114 | 1116 |
|
| 1117 | + public function testTaxRoundingMode() |
| 1118 | + { |
| 1119 | + $draft = $this->getDraft(); |
| 1120 | + $cart = $this->createCart($draft); |
| 1121 | + |
| 1122 | + $this->assertSame(Cart::TAX_ROUNDING_MODE_HALF_EVEN, $cart->getTaxRoundingMode()); |
| 1123 | + |
| 1124 | + $request = CartUpdateRequest::ofIdAndVersion($cart->getId(), $cart->getVersion()) |
| 1125 | + ->addAction(CartChangeTaxRoundingModeAction::ofTaxRoundingMode(Cart::TAX_ROUNDING_MODE_HALF_DOWN)) |
| 1126 | + ; |
| 1127 | + $response = $request->executeWithClient($this->getClient()); |
| 1128 | + $cart = $request->mapResponse($response); |
| 1129 | + |
| 1130 | + $this->deleteRequest->setVersion($cart->getVersion()); |
| 1131 | + |
| 1132 | + $this->assertSame(Cart::TAX_ROUNDING_MODE_HALF_DOWN, $cart->getTaxRoundingMode()); |
| 1133 | + } |
| 1134 | + |
| 1135 | + public function testCreateWithTaxRoundingMode() |
| 1136 | + { |
| 1137 | + $draft = $this->getDraft(); |
| 1138 | + $draft->setTaxRoundingMode(Cart::TAX_ROUNDING_MODE_HALF_DOWN); |
| 1139 | + $cart = $this->createCart($draft); |
| 1140 | + |
| 1141 | + $this->assertSame(Cart::TAX_ROUNDING_MODE_HALF_DOWN, $cart->getTaxRoundingMode()); |
| 1142 | + } |
| 1143 | + |
1115 | 1144 | /** |
1116 | 1145 | * @return CartDraft |
1117 | 1146 | */ |
|
0 commit comments