|
7 | 7 | use Magento\Tax\Model\Sales\Total\Quote\SetupUtil;
|
8 | 8 |
|
9 | 9 | $fullTaxDiscountWithTax = [
|
10 |
| - 'config_data' => [ |
11 |
| - 'config_overrides' => |
12 |
| - [ |
13 |
| - Config::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT => 0, |
14 |
| - Config::CONFIG_XML_PATH_DISCOUNT_TAX => 1, |
15 |
| - Config::XML_PATH_ALGORITHM => 'ROW_BASE_CALCULATION', |
16 |
| - Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS => SetupUtil::SHIPPING_TAX_CLASS, |
17 |
| - ], |
18 |
| - 'tax_rate_overrides' => |
19 |
| - [ |
20 |
| - SetupUtil::TAX_RATE_TX => 18, |
21 |
| - SetupUtil::TAX_RATE_SHIPPING => 0, |
22 |
| - ], |
23 |
| - 'tax_rule_overrides' => |
24 |
| - [ |
| 10 | + 'config_data' => [ |
| 11 | + 'config_overrides' => |
25 | 12 | [
|
26 |
| - 'code' => 'Product Tax Rule', |
27 |
| - 'product_tax_class_ids' => |
28 |
| - [ |
29 |
| - SetupUtil::PRODUCT_TAX_CLASS_1 |
30 |
| - ], |
| 13 | + Config::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT => 0, |
| 14 | + Config::CONFIG_XML_PATH_DISCOUNT_TAX => 1, |
| 15 | + Config::XML_PATH_ALGORITHM => 'ROW_BASE_CALCULATION', |
| 16 | + Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS => SetupUtil::SHIPPING_TAX_CLASS, |
31 | 17 | ],
|
| 18 | + 'tax_rate_overrides' => |
32 | 19 | [
|
33 |
| - 'code' => 'Shipping Tax Rule', |
34 |
| - 'product_tax_class_ids' => |
35 |
| - [ |
36 |
| - SetupUtil::SHIPPING_TAX_CLASS |
37 |
| - ], |
38 |
| - 'tax_rate_ids' => |
39 |
| - [ |
40 |
| - SetupUtil::TAX_RATE_SHIPPING, |
41 |
| - ], |
| 20 | + SetupUtil::TAX_RATE_TX => 18, |
| 21 | + SetupUtil::TAX_RATE_SHIPPING => 0, |
42 | 22 | ],
|
43 |
| - ], |
44 |
| - ], |
45 |
| - 'quote_data' => [ |
46 |
| - 'billing_address' => |
47 |
| - [ |
48 |
| - 'region_id' => SetupUtil::REGION_TX, |
49 |
| - ], |
50 |
| - 'shipping_address' => |
51 |
| - [ |
52 |
| - 'region_id' => SetupUtil::REGION_TX, |
53 |
| - ], |
54 |
| - 'items' => |
55 |
| - [ |
| 23 | + 'tax_rule_overrides' => |
56 | 24 | [
|
57 |
| - 'sku' => 'simple1', |
58 |
| - 'price' => 2542.37, |
59 |
| - 'qty' => 2, |
60 |
| - ] |
61 |
| - ], |
62 |
| - 'shipping_method' => 'free', |
63 |
| - 'shopping_cart_rules' => |
64 |
| - [ |
65 |
| - ['discount_amount' => 100], |
66 |
| - ], |
67 |
| - ], |
68 |
| - 'expected_result' => [ |
69 |
| - 'address_data' => |
70 |
| - [ |
71 |
| - 'subtotal' => 5084.74, |
72 |
| - 'base_subtotal' => 5084.74, |
73 |
| - 'subtotal_incl_tax' => 5999.99, |
74 |
| - 'base_subtotal_incl_tax' => 5999.99, |
75 |
| - 'tax_amount' => 915.25, |
76 |
| - 'base_tax_amount' => 915.25, |
77 |
| - 'shipping_amount' => 0, |
78 |
| - 'base_shipping_amount' => 0, |
79 |
| - 'shipping_incl_tax' => 0, |
80 |
| - 'base_shipping_incl_tax' => 0, |
81 |
| - 'shipping_tax_amount' => 0, |
82 |
| - 'base_shipping_tax_amount' => 0, |
83 |
| - 'discount_amount' => -5999.99, |
84 |
| - 'base_discount_amount' => -5999.99, |
85 |
| - 'discount_tax_compensation_amount' => 0, |
86 |
| - 'base_discount_tax_compensation_amount' => 0, |
87 |
| - 'shipping_discount_tax_compensation_amount' => 0, |
88 |
| - 'base_shipping_discount_tax_compensation_amount' => 0, |
89 |
| - 'grand_total' => 0, |
90 |
| - 'base_grand_total' => 0, |
91 |
| - 'applied_taxes' => |
92 | 25 | [
|
93 |
| - SetupUtil::TAX_RATE_TX => |
| 26 | + 'code' => 'Product Tax Rule', |
| 27 | + 'product_tax_class_ids' => |
94 | 28 | [
|
95 |
| - 'percent' => 18, |
96 |
| - 'amount' => 915.25, |
97 |
| - 'base_amount' => 915.25, |
98 |
| - 'rates' => |
99 |
| - [ |
100 |
| - [ |
101 |
| - 'code' => SetupUtil::TAX_RATE_TX, |
102 |
| - 'title' => SetupUtil::TAX_RATE_TX, |
103 |
| - 'percent' => 18, |
104 |
| - ], |
105 |
| - ], |
106 |
| - ] |
| 29 | + SetupUtil::PRODUCT_TAX_CLASS_1 |
| 30 | + ], |
107 | 31 | ],
|
108 |
| - ], |
109 |
| - 'items_data' => |
110 |
| - [ |
111 |
| - 'simple1' => |
112 | 32 | [
|
113 |
| - 'row_total' => 5084.74, |
114 |
| - 'base_row_total' => 5084.74, |
115 |
| - 'tax_percent' => 18, |
116 |
| - 'price' => 2542.37, |
117 |
| - 'base_price' => 2542.37, |
118 |
| - 'price_incl_tax' => 3000, |
119 |
| - 'base_price_incl_tax' => 3000, |
120 |
| - 'row_total_incl_tax' => 5999.99, |
121 |
| - 'base_row_total_incl_tax' => 5999.99, |
122 |
| - 'tax_amount' => 915.25, |
123 |
| - 'base_tax_amount' => 915.25, |
124 |
| - 'discount_amount' => 5999.99, |
125 |
| - 'base_discount_amount' => 5999.99, |
126 |
| - 'discount_percent' => 100, |
127 |
| - 'discount_tax_compensation_amount' => 0, |
128 |
| - 'base_discount_tax_compensation_amount' => 0, |
| 33 | + 'code' => 'Shipping Tax Rule', |
| 34 | + 'product_tax_class_ids' => |
| 35 | + [ |
| 36 | + SetupUtil::SHIPPING_TAX_CLASS |
| 37 | + ], |
| 38 | + 'tax_rate_ids' => |
| 39 | + [ |
| 40 | + SetupUtil::TAX_RATE_SHIPPING, |
| 41 | + ], |
129 | 42 | ],
|
130 |
| - ], |
131 |
| - ] |
| 43 | + ], |
| 44 | + ], |
| 45 | + 'quote_data' => [ |
| 46 | + 'billing_address' => |
| 47 | + [ |
| 48 | + 'region_id' => SetupUtil::REGION_TX, |
| 49 | + ], |
| 50 | + 'shipping_address' => |
| 51 | + [ |
| 52 | + 'region_id' => SetupUtil::REGION_TX, |
| 53 | + ], |
| 54 | + 'items' => |
| 55 | + [ |
| 56 | + [ |
| 57 | + 'sku' => 'simple1', |
| 58 | + 'price' => 2542.37, |
| 59 | + 'qty' => 2, |
| 60 | + ] |
| 61 | + ], |
| 62 | + 'shipping_method' => 'free', |
| 63 | + 'shopping_cart_rules' => |
| 64 | + [ |
| 65 | + ['discount_amount' => 100], |
| 66 | + ], |
| 67 | + ], |
| 68 | + 'expected_result' => [ |
| 69 | + 'address_data' => |
| 70 | + [ |
| 71 | + 'subtotal' => 5084.74, |
| 72 | + 'base_subtotal' => 5084.74, |
| 73 | + 'subtotal_incl_tax' => 5999.99, |
| 74 | + 'base_subtotal_incl_tax' => 5999.99, |
| 75 | + 'tax_amount' => 915.25, |
| 76 | + 'base_tax_amount' => 915.25, |
| 77 | + 'shipping_amount' => 0, |
| 78 | + 'base_shipping_amount' => 0, |
| 79 | + 'shipping_incl_tax' => 0, |
| 80 | + 'base_shipping_incl_tax' => 0, |
| 81 | + 'shipping_tax_amount' => 0, |
| 82 | + 'base_shipping_tax_amount' => 0, |
| 83 | + 'discount_amount' => -5999.99, |
| 84 | + 'base_discount_amount' => -5999.99, |
| 85 | + 'discount_tax_compensation_amount' => 0, |
| 86 | + 'base_discount_tax_compensation_amount' => 0, |
| 87 | + 'shipping_discount_tax_compensation_amount' => 0, |
| 88 | + 'base_shipping_discount_tax_compensation_amount' => 0, |
| 89 | + 'grand_total' => 0, |
| 90 | + 'base_grand_total' => 0, |
| 91 | + 'applied_taxes' => |
| 92 | + [ |
| 93 | + SetupUtil::TAX_RATE_TX => |
| 94 | + [ |
| 95 | + 'percent' => 18, |
| 96 | + 'amount' => 915.25, |
| 97 | + 'base_amount' => 915.25, |
| 98 | + 'rates' => |
| 99 | + [ |
| 100 | + [ |
| 101 | + 'code' => SetupUtil::TAX_RATE_TX, |
| 102 | + 'title' => SetupUtil::TAX_RATE_TX, |
| 103 | + 'percent' => 18, |
| 104 | + ], |
| 105 | + ], |
| 106 | + ] |
| 107 | + ], |
| 108 | + ], |
| 109 | + 'items_data' => |
| 110 | + [ |
| 111 | + 'simple1' => |
| 112 | + [ |
| 113 | + 'row_total' => 5084.74, |
| 114 | + 'base_row_total' => 5084.74, |
| 115 | + 'tax_percent' => 18, |
| 116 | + 'price' => 2542.37, |
| 117 | + 'base_price' => 2542.37, |
| 118 | + 'price_incl_tax' => 3000, |
| 119 | + 'base_price_incl_tax' => 3000, |
| 120 | + 'row_total_incl_tax' => 5999.99, |
| 121 | + 'base_row_total_incl_tax' => 5999.99, |
| 122 | + 'tax_amount' => 915.25, |
| 123 | + 'base_tax_amount' => 915.25, |
| 124 | + 'discount_amount' => 5999.99, |
| 125 | + 'base_discount_amount' => 5999.99, |
| 126 | + 'discount_percent' => 100, |
| 127 | + 'discount_tax_compensation_amount' => 0, |
| 128 | + 'base_discount_tax_compensation_amount' => 0, |
| 129 | + ], |
| 130 | + ], |
| 131 | + ] |
132 | 132 | ];
|
0 commit comments