foodbot-cart-calculations 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/functions/pointsCalculation.js +2 -2
- package/functions/promotionCalculation.js +2 -3
- package/index.js +750 -67
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ function getPointsDiscount(cartObject, points, userDetails) {
|
|
|
35
35
|
if (!points) {
|
|
36
36
|
resolve(0);
|
|
37
37
|
} else {
|
|
38
|
-
let pointsAmount =
|
|
38
|
+
let pointsAmount = 0;
|
|
39
39
|
let count = 0;
|
|
40
40
|
let storeAmount = points.store_value;
|
|
41
41
|
let indexes = [];
|
|
@@ -74,7 +74,7 @@ function getPointsDiscount(cartObject, points, userDetails) {
|
|
|
74
74
|
|
|
75
75
|
if (count == carts.length) {
|
|
76
76
|
let singlePriceDiscount = pointsAmount / itemsTotal;
|
|
77
|
-
singlePriceDiscount = parseFloat(singlePriceDiscount).toFixed(6);
|
|
77
|
+
singlePriceDiscount = (itemsTotal && itemsTotal > 0)?parseFloat(singlePriceDiscount).toFixed(6):0;
|
|
78
78
|
|
|
79
79
|
let storeValue = 0
|
|
80
80
|
let itemDiscount = 0;
|
|
@@ -852,8 +852,6 @@ function getFreeProductOffer(cartObject, offer) {
|
|
|
852
852
|
});
|
|
853
853
|
});
|
|
854
854
|
|
|
855
|
-
var cartItem = JSON.parse(JSON.stringify(carts));
|
|
856
|
-
|
|
857
855
|
if (carts) {
|
|
858
856
|
carts.map((a) => {
|
|
859
857
|
a.promotion_discount = 0;
|
|
@@ -866,6 +864,8 @@ function getFreeProductOffer(cartObject, offer) {
|
|
|
866
864
|
var count = 0;
|
|
867
865
|
var offerAmount = offer.oo_offer_value;
|
|
868
866
|
offer.offer_products.offer_discount_products = offer.offer_products.offer_discount_products.map(Number);
|
|
867
|
+
|
|
868
|
+
var cartItem = carts;
|
|
869
869
|
|
|
870
870
|
if (offer.offer_products.order_modifiercost_use == 1) {
|
|
871
871
|
cartItem.sort(function (a, b) {
|
|
@@ -878,7 +878,6 @@ function getFreeProductOffer(cartObject, offer) {
|
|
|
878
878
|
}
|
|
879
879
|
|
|
880
880
|
var maxProduct = offer.offer_products.max_product;
|
|
881
|
-
|
|
882
881
|
cartItem.forEach((element, index) => {
|
|
883
882
|
var ItemIndex = carts.findIndex((x) => x.item_id == element.item_id && !x.remove);
|
|
884
883
|
|
package/index.js
CHANGED
|
@@ -72,74 +72,757 @@ async function calculateTax(inputJSON) {
|
|
|
72
72
|
})
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
let json ={
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
75
|
+
// let json ={
|
|
76
|
+
// "tax_settings": [
|
|
77
|
+
// {
|
|
78
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
|
|
79
|
+
// "tax_label": "16% IVA",
|
|
80
|
+
// "tax_rate": 16,
|
|
81
|
+
// "tax_sequence": 1,
|
|
82
|
+
// "base_price_effected": 0
|
|
83
|
+
// },
|
|
84
|
+
// {
|
|
85
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120002",
|
|
86
|
+
// "tax_label": "8% IVA",
|
|
87
|
+
// "tax_rate": 8,
|
|
88
|
+
// "tax_sequence": 1,
|
|
89
|
+
// "base_price_effected": 0
|
|
90
|
+
// },
|
|
91
|
+
// {
|
|
92
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac12000200",
|
|
93
|
+
// "tax_label": "0% IVA",
|
|
94
|
+
// "tax_rate": 0,
|
|
95
|
+
// "tax_sequence": 3,
|
|
96
|
+
// "base_price_effected": 0
|
|
97
|
+
// },
|
|
98
|
+
// {
|
|
99
|
+
// "tax_id": "21036b00-bdb4-4485-aaba-d088a721a67f1",
|
|
100
|
+
// "tax_label": "IEPS 8%",
|
|
101
|
+
// "tax_rate": 8,
|
|
102
|
+
// "tax_sequence": 2,
|
|
103
|
+
// "base_price_effected": 0
|
|
104
|
+
// }
|
|
105
|
+
// ],
|
|
106
|
+
// "tax_type": 2,
|
|
107
|
+
// "order_items": {
|
|
108
|
+
// "order_type": "dinein",
|
|
109
|
+
// "item_details": [
|
|
110
|
+
// {
|
|
111
|
+
// "item_id": 8595,
|
|
112
|
+
// "category_id": 501550,
|
|
113
|
+
// "item_price": 122,
|
|
114
|
+
// "menu_name": "SIngle Menu",
|
|
115
|
+
// "category_name": "Special Burgers",
|
|
116
|
+
// "quantity": 1,
|
|
117
|
+
// "item_display_text": "Cheese Burger 🍔",
|
|
118
|
+
// "item_name": "Cheese Burger 🍔",
|
|
119
|
+
// "tax_rate": 16,
|
|
120
|
+
// "item_modifiers": [
|
|
121
|
+
// {
|
|
122
|
+
// "modifer_cat": 511432,
|
|
123
|
+
// "modifier_caetgory_name": "Drinks ",
|
|
124
|
+
// "modifier_item_id": 100911,
|
|
125
|
+
// "modifier_sequence": 0,
|
|
126
|
+
// "modifier_item_price": 20,
|
|
127
|
+
// "modifier_item_name": "Sprite",
|
|
128
|
+
// "is_tax_rate_same": 1,
|
|
129
|
+
// "tax_rate": 0,
|
|
130
|
+
// "quantity": 1,
|
|
131
|
+
// "item_id": 8595,
|
|
132
|
+
// "tax_id": [
|
|
133
|
+
// {
|
|
134
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
|
|
135
|
+
// }
|
|
136
|
+
// ],
|
|
137
|
+
// "modifier_trx_id": "4317-1d15-7bf8",
|
|
138
|
+
// "linked_product": "",
|
|
139
|
+
// "tax_amount": "2.758621",
|
|
140
|
+
// "tax_array": [
|
|
141
|
+
// {
|
|
142
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
|
|
143
|
+
// "tax_label": "16% IVA",
|
|
144
|
+
// "tax_rate": 16,
|
|
145
|
+
// "tax_sequence": 1,
|
|
146
|
+
// "base_price_effected": 0,
|
|
147
|
+
// "tax_amount": "2.758621",
|
|
148
|
+
// "base_price": "17.241379",
|
|
149
|
+
// "tax_rate_quantity": 0
|
|
150
|
+
// }
|
|
151
|
+
// ],
|
|
152
|
+
// "redeem_promotion_id": 5011767
|
|
153
|
+
// },
|
|
154
|
+
// {
|
|
155
|
+
// "modifer_cat": 511432,
|
|
156
|
+
// "modifier_caetgory_name": "Drinks ",
|
|
157
|
+
// "modifier_item_id": 100912,
|
|
158
|
+
// "modifier_sequence": 0,
|
|
159
|
+
// "modifier_item_price": 25,
|
|
160
|
+
// "modifier_item_name": "Cocacola",
|
|
161
|
+
// "is_tax_rate_same": 1,
|
|
162
|
+
// "tax_rate": 0,
|
|
163
|
+
// "quantity": 1,
|
|
164
|
+
// "item_id": 8595,
|
|
165
|
+
// "tax_id": [
|
|
166
|
+
// {
|
|
167
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
|
|
168
|
+
// }
|
|
169
|
+
// ],
|
|
170
|
+
// "modifier_trx_id": "ba8b-c9ed-2386",
|
|
171
|
+
// "linked_product": "",
|
|
172
|
+
// "tax_amount": "3.448276",
|
|
173
|
+
// "tax_array": [
|
|
174
|
+
// {
|
|
175
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
|
|
176
|
+
// "tax_label": "16% IVA",
|
|
177
|
+
// "tax_rate": 16,
|
|
178
|
+
// "tax_sequence": 1,
|
|
179
|
+
// "base_price_effected": 0,
|
|
180
|
+
// "tax_amount": "3.448276",
|
|
181
|
+
// "base_price": "21.551724",
|
|
182
|
+
// "tax_rate_quantity": 0
|
|
183
|
+
// }
|
|
184
|
+
// ],
|
|
185
|
+
// "redeem_promotion_id": 5011767
|
|
186
|
+
// }
|
|
187
|
+
// ],
|
|
188
|
+
// "isPackage": 0,
|
|
189
|
+
// "price_list_id": "56e55ca6-d246-11ed-8811-0e2fd5e35c29",
|
|
190
|
+
// "item_price_with_modifier": 167,
|
|
191
|
+
// "package_items": [],
|
|
192
|
+
// "item_event": "update",
|
|
193
|
+
// "actual_price": 0,
|
|
194
|
+
// "tax_id": [
|
|
195
|
+
// {
|
|
196
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
|
|
197
|
+
// }
|
|
198
|
+
// ],
|
|
199
|
+
// "menu_id": 210,
|
|
200
|
+
// "item_trx_id": "b1e3-96f1-2cd8",
|
|
201
|
+
// "special_instruction": "",
|
|
202
|
+
// "ieps_tax": {
|
|
203
|
+
// "status": 1,
|
|
204
|
+
// "ieps_details": {
|
|
205
|
+
// "type": "2",
|
|
206
|
+
// "tax_id": 5
|
|
207
|
+
// }
|
|
208
|
+
// },
|
|
209
|
+
// "sync": true,
|
|
210
|
+
// "wa_user_info": {
|
|
211
|
+
// "user_id": 382,
|
|
212
|
+
// "user_name": "Lee Jung-suk",
|
|
213
|
+
// "version": 1,
|
|
214
|
+
// "added_at": "2024-03-29 05:06:36"
|
|
215
|
+
// },
|
|
216
|
+
// "tax_amount": "21.827586",
|
|
217
|
+
// "tax_array": [
|
|
218
|
+
// {
|
|
219
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
|
|
220
|
+
// "tax_label": "16% IVA",
|
|
221
|
+
// "tax_rate": 16,
|
|
222
|
+
// "tax_sequence": 1,
|
|
223
|
+
// "base_price_effected": 0,
|
|
224
|
+
// "tax_amount": "16.827586",
|
|
225
|
+
// "base_price": "105.172414",
|
|
226
|
+
// "tax_rate_quantity": 5
|
|
227
|
+
// },
|
|
228
|
+
// {
|
|
229
|
+
// "base_price_effected": 0,
|
|
230
|
+
// "tax_sequence": 2,
|
|
231
|
+
// "tax_label": "IEPS",
|
|
232
|
+
// "ieps_type": 2,
|
|
233
|
+
// "tax_id": "absolute",
|
|
234
|
+
// "tax_rate": 0.049914,
|
|
235
|
+
// "tax_amount": "5.000000",
|
|
236
|
+
// "base_price": 100.172414,
|
|
237
|
+
// "tax_rate_quantity": 5
|
|
238
|
+
// }
|
|
239
|
+
// ],
|
|
240
|
+
// "tax_amount_modifier": "28.034483",
|
|
241
|
+
// "total_tax_amount": "28.034483",
|
|
242
|
+
// "order_version": 1,
|
|
243
|
+
// "redeem_promotion_id": 5011767,
|
|
244
|
+
// "promotion_discount_modifier": "83.64",
|
|
245
|
+
// "promotion_discount": 0
|
|
246
|
+
// },
|
|
247
|
+
// {
|
|
248
|
+
// "item_id": 8595,
|
|
249
|
+
// "category_id": 501550,
|
|
250
|
+
// "item_price": 122,
|
|
251
|
+
// "menu_name": "SIngle Menu",
|
|
252
|
+
// "category_name": "Special Burgers",
|
|
253
|
+
// "quantity": 1,
|
|
254
|
+
// "item_display_text": "Cheese Burger 🍔",
|
|
255
|
+
// "item_name": "Cheese Burger 🍔",
|
|
256
|
+
// "tax_rate": 16,
|
|
257
|
+
// "item_modifiers": [
|
|
258
|
+
// {
|
|
259
|
+
// "modifer_cat": 511432,
|
|
260
|
+
// "modifier_caetgory_name": "Drinks ",
|
|
261
|
+
// "modifier_item_id": 100911,
|
|
262
|
+
// "modifier_sequence": 0,
|
|
263
|
+
// "modifier_item_price": 20,
|
|
264
|
+
// "modifier_item_name": "Sprite",
|
|
265
|
+
// "is_tax_rate_same": 1,
|
|
266
|
+
// "tax_rate": 0,
|
|
267
|
+
// "quantity": 1,
|
|
268
|
+
// "item_id": 8595,
|
|
269
|
+
// "tax_id": [
|
|
270
|
+
// {
|
|
271
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
|
|
272
|
+
// }
|
|
273
|
+
// ],
|
|
274
|
+
// "modifier_trx_id": "7ee0-bb85-9839",
|
|
275
|
+
// "linked_product": "",
|
|
276
|
+
// "tax_amount": "2.758621",
|
|
277
|
+
// "tax_array": [
|
|
278
|
+
// {
|
|
279
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
|
|
280
|
+
// "tax_label": "16% IVA",
|
|
281
|
+
// "tax_rate": 16,
|
|
282
|
+
// "tax_sequence": 1,
|
|
283
|
+
// "base_price_effected": 0,
|
|
284
|
+
// "tax_amount": "2.758621",
|
|
285
|
+
// "base_price": "17.241379",
|
|
286
|
+
// "tax_rate_quantity": 0
|
|
287
|
+
// }
|
|
288
|
+
// ],
|
|
289
|
+
// "redeem_promotion_id": 5011767
|
|
290
|
+
// }
|
|
291
|
+
// ],
|
|
292
|
+
// "isPackage": 0,
|
|
293
|
+
// "price_list_id": "56e55ca6-d246-11ed-8811-0e2fd5e35c29",
|
|
294
|
+
// "item_price_with_modifier": 142,
|
|
295
|
+
// "package_items": [],
|
|
296
|
+
// "item_event": "update",
|
|
297
|
+
// "actual_price": 0,
|
|
298
|
+
// "tax_id": [
|
|
299
|
+
// {
|
|
300
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
|
|
301
|
+
// }
|
|
302
|
+
// ],
|
|
303
|
+
// "menu_id": 210,
|
|
304
|
+
// "item_trx_id": "8c6f-db9f-ad64",
|
|
305
|
+
// "special_instruction": "",
|
|
306
|
+
// "ieps_tax": {
|
|
307
|
+
// "status": 1,
|
|
308
|
+
// "ieps_details": {
|
|
309
|
+
// "type": "2",
|
|
310
|
+
// "tax_id": 5
|
|
311
|
+
// }
|
|
312
|
+
// },
|
|
313
|
+
// "sync": true,
|
|
314
|
+
// "wa_user_info": {
|
|
315
|
+
// "user_id": 382,
|
|
316
|
+
// "user_name": "Lee Jung-suk",
|
|
317
|
+
// "version": 2,
|
|
318
|
+
// "added_at": "2024-04-01 04:24:21"
|
|
319
|
+
// },
|
|
320
|
+
// "tax_amount": "21.827586",
|
|
321
|
+
// "tax_array": [
|
|
322
|
+
// {
|
|
323
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
|
|
324
|
+
// "tax_label": "16% IVA",
|
|
325
|
+
// "tax_rate": 16,
|
|
326
|
+
// "tax_sequence": 1,
|
|
327
|
+
// "base_price_effected": 0,
|
|
328
|
+
// "tax_amount": "16.827586",
|
|
329
|
+
// "base_price": "105.172414",
|
|
330
|
+
// "tax_rate_quantity": 5
|
|
331
|
+
// },
|
|
332
|
+
// {
|
|
333
|
+
// "base_price_effected": 0,
|
|
334
|
+
// "tax_sequence": 2,
|
|
335
|
+
// "tax_label": "IEPS",
|
|
336
|
+
// "ieps_type": 2,
|
|
337
|
+
// "tax_id": "absolute",
|
|
338
|
+
// "tax_rate": 0.049914,
|
|
339
|
+
// "tax_amount": "5.000000",
|
|
340
|
+
// "base_price": 100.172414,
|
|
341
|
+
// "tax_rate_quantity": 5
|
|
342
|
+
// }
|
|
343
|
+
// ],
|
|
344
|
+
// "tax_amount_modifier": "24.586207",
|
|
345
|
+
// "total_tax_amount": "24.586207",
|
|
346
|
+
// "order_version": 2,
|
|
347
|
+
// "redeem_promotion_id": 5011767,
|
|
348
|
+
// "promotion_discount_modifier": "71.09",
|
|
349
|
+
// "promotion_discount": 0
|
|
350
|
+
// },
|
|
351
|
+
// {
|
|
352
|
+
// "item_id": 8595,
|
|
353
|
+
// "category_id": 501550,
|
|
354
|
+
// "item_price": 122,
|
|
355
|
+
// "menu_name": "SIngle Menu",
|
|
356
|
+
// "category_name": "Special Burgers",
|
|
357
|
+
// "quantity": 1,
|
|
358
|
+
// "item_display_text": "Cheese Burger 🍔",
|
|
359
|
+
// "item_name": "Cheese Burger 🍔",
|
|
360
|
+
// "tax_rate": 16,
|
|
361
|
+
// "item_modifiers": [
|
|
362
|
+
// {
|
|
363
|
+
// "modifer_cat": 511432,
|
|
364
|
+
// "modifier_caetgory_name": "Drinks ",
|
|
365
|
+
// "modifier_item_id": 100911,
|
|
366
|
+
// "modifier_sequence": 0,
|
|
367
|
+
// "modifier_item_price": 20,
|
|
368
|
+
// "modifier_item_name": "Sprite",
|
|
369
|
+
// "is_tax_rate_same": 1,
|
|
370
|
+
// "tax_rate": 0,
|
|
371
|
+
// "quantity": 1,
|
|
372
|
+
// "item_id": 8595,
|
|
373
|
+
// "tax_id": [
|
|
374
|
+
// {
|
|
375
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
|
|
376
|
+
// }
|
|
377
|
+
// ],
|
|
378
|
+
// "modifier_trx_id": "3196-0707-a583",
|
|
379
|
+
// "linked_product": "",
|
|
380
|
+
// "tax_amount": "2.758621",
|
|
381
|
+
// "tax_array": [
|
|
382
|
+
// {
|
|
383
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
|
|
384
|
+
// "tax_label": "16% IVA",
|
|
385
|
+
// "tax_rate": 16,
|
|
386
|
+
// "tax_sequence": 1,
|
|
387
|
+
// "base_price_effected": 0,
|
|
388
|
+
// "tax_amount": "2.758621",
|
|
389
|
+
// "base_price": "17.241379",
|
|
390
|
+
// "tax_rate_quantity": 0
|
|
391
|
+
// }
|
|
392
|
+
// ],
|
|
393
|
+
// "redeem_promotion_id": 5011767
|
|
394
|
+
// }
|
|
395
|
+
// ],
|
|
396
|
+
// "isPackage": 0,
|
|
397
|
+
// "price_list_id": "56e55ca6-d246-11ed-8811-0e2fd5e35c29",
|
|
398
|
+
// "item_price_with_modifier": 142,
|
|
399
|
+
// "package_items": [],
|
|
400
|
+
// "item_event": "update",
|
|
401
|
+
// "actual_price": 0,
|
|
402
|
+
// "tax_id": [
|
|
403
|
+
// {
|
|
404
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
|
|
405
|
+
// }
|
|
406
|
+
// ],
|
|
407
|
+
// "menu_id": 210,
|
|
408
|
+
// "item_trx_id": "fe42-3d45-8b3d",
|
|
409
|
+
// "special_instruction": "",
|
|
410
|
+
// "ieps_tax": {
|
|
411
|
+
// "status": 1,
|
|
412
|
+
// "ieps_details": {
|
|
413
|
+
// "type": "2",
|
|
414
|
+
// "tax_id": 5
|
|
415
|
+
// }
|
|
416
|
+
// },
|
|
417
|
+
// "sync": true,
|
|
418
|
+
// "wa_user_info": {
|
|
419
|
+
// "user_id": 382,
|
|
420
|
+
// "user_name": "Lee Jung-suk",
|
|
421
|
+
// "version": 3,
|
|
422
|
+
// "added_at": "2024-04-01 04:32:48"
|
|
423
|
+
// },
|
|
424
|
+
// "tax_amount": "21.827586",
|
|
425
|
+
// "tax_array": [
|
|
426
|
+
// {
|
|
427
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
|
|
428
|
+
// "tax_label": "16% IVA",
|
|
429
|
+
// "tax_rate": 16,
|
|
430
|
+
// "tax_sequence": 1,
|
|
431
|
+
// "base_price_effected": 0,
|
|
432
|
+
// "tax_amount": "16.827586",
|
|
433
|
+
// "base_price": "105.172414",
|
|
434
|
+
// "tax_rate_quantity": 5
|
|
435
|
+
// },
|
|
436
|
+
// {
|
|
437
|
+
// "base_price_effected": 0,
|
|
438
|
+
// "tax_sequence": 2,
|
|
439
|
+
// "tax_label": "IEPS",
|
|
440
|
+
// "ieps_type": 2,
|
|
441
|
+
// "tax_id": "absolute",
|
|
442
|
+
// "tax_rate": 0.049914,
|
|
443
|
+
// "tax_amount": "5.000000",
|
|
444
|
+
// "base_price": 100.172414,
|
|
445
|
+
// "tax_rate_quantity": 5
|
|
446
|
+
// }
|
|
447
|
+
// ],
|
|
448
|
+
// "tax_amount_modifier": "24.586207",
|
|
449
|
+
// "total_tax_amount": "24.586207",
|
|
450
|
+
// "order_version": 3,
|
|
451
|
+
// "redeem_promotion_id": 5011767,
|
|
452
|
+
// "promotion_discount_modifier": "71.09",
|
|
453
|
+
// "promotion_discount": 0
|
|
454
|
+
// },
|
|
455
|
+
// {
|
|
456
|
+
// "item_id": 8595,
|
|
457
|
+
// "category_id": 501550,
|
|
458
|
+
// "item_price": 122,
|
|
459
|
+
// "menu_name": "SIngle Menu",
|
|
460
|
+
// "category_name": "Special Burgers",
|
|
461
|
+
// "quantity": 1,
|
|
462
|
+
// "item_display_text": "Cheese Burger 🍔",
|
|
463
|
+
// "item_name": "Cheese Burger 🍔",
|
|
464
|
+
// "tax_rate": 16,
|
|
465
|
+
// "item_modifiers": [
|
|
466
|
+
// {
|
|
467
|
+
// "modifer_cat": 511432,
|
|
468
|
+
// "modifier_caetgory_name": "Drinks ",
|
|
469
|
+
// "modifier_item_id": 100911,
|
|
470
|
+
// "modifier_sequence": 0,
|
|
471
|
+
// "modifier_item_price": 20,
|
|
472
|
+
// "modifier_item_name": "Sprite",
|
|
473
|
+
// "is_tax_rate_same": 1,
|
|
474
|
+
// "tax_rate": 0,
|
|
475
|
+
// "quantity": 1,
|
|
476
|
+
// "item_id": 8595,
|
|
477
|
+
// "tax_id": [
|
|
478
|
+
// {
|
|
479
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
|
|
480
|
+
// }
|
|
481
|
+
// ],
|
|
482
|
+
// "modifier_trx_id": "d8bc-ddcd-bfe5",
|
|
483
|
+
// "linked_product": "",
|
|
484
|
+
// "redeem_promotion_id": 5011767,
|
|
485
|
+
// "tax_amount": "2.758621",
|
|
486
|
+
// "tax_array": [
|
|
487
|
+
// {
|
|
488
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
|
|
489
|
+
// "tax_label": "16% IVA",
|
|
490
|
+
// "tax_rate": 16,
|
|
491
|
+
// "tax_sequence": 1,
|
|
492
|
+
// "base_price_effected": 0,
|
|
493
|
+
// "tax_amount": "2.758621",
|
|
494
|
+
// "base_price": "17.241379",
|
|
495
|
+
// "tax_rate_quantity": 0
|
|
496
|
+
// }
|
|
497
|
+
// ]
|
|
498
|
+
// }
|
|
499
|
+
// ],
|
|
500
|
+
// "isPackage": 0,
|
|
501
|
+
// "price_list_id": "56e55ca6-d246-11ed-8811-0e2fd5e35c29",
|
|
502
|
+
// "item_price_with_modifier": 142,
|
|
503
|
+
// "package_items": [],
|
|
504
|
+
// "item_event": "update",
|
|
505
|
+
// "actual_price": 0,
|
|
506
|
+
// "tax_id": [
|
|
507
|
+
// {
|
|
508
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
|
|
509
|
+
// }
|
|
510
|
+
// ],
|
|
511
|
+
// "menu_id": 210,
|
|
512
|
+
// "item_trx_id": "d9ab-97e4-f606",
|
|
513
|
+
// "special_instruction": "",
|
|
514
|
+
// "ieps_tax": {
|
|
515
|
+
// "status": 1,
|
|
516
|
+
// "ieps_details": {
|
|
517
|
+
// "type": "2",
|
|
518
|
+
// "tax_id": 5
|
|
519
|
+
// }
|
|
520
|
+
// },
|
|
521
|
+
// "sync": true,
|
|
522
|
+
// "wa_user_info": {
|
|
523
|
+
// "user_id": 382,
|
|
524
|
+
// "user_name": "Lee Jung-suk",
|
|
525
|
+
// "version": 4,
|
|
526
|
+
// "added_at": "2024-04-01 04:46:07"
|
|
527
|
+
// },
|
|
528
|
+
// "redeem_promotion_id": 5011767,
|
|
529
|
+
// "promotion_discount_modifier": "71.09",
|
|
530
|
+
// "tax_amount": "21.827586",
|
|
531
|
+
// "tax_array": [
|
|
532
|
+
// {
|
|
533
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
|
|
534
|
+
// "tax_label": "16% IVA",
|
|
535
|
+
// "tax_rate": 16,
|
|
536
|
+
// "tax_sequence": 1,
|
|
537
|
+
// "base_price_effected": 0,
|
|
538
|
+
// "tax_amount": "16.827586",
|
|
539
|
+
// "base_price": "105.172414",
|
|
540
|
+
// "tax_rate_quantity": 5
|
|
541
|
+
// },
|
|
542
|
+
// {
|
|
543
|
+
// "base_price_effected": 0,
|
|
544
|
+
// "tax_sequence": 2,
|
|
545
|
+
// "tax_label": "IEPS",
|
|
546
|
+
// "ieps_type": 2,
|
|
547
|
+
// "tax_id": "absolute",
|
|
548
|
+
// "tax_rate": 0.049914,
|
|
549
|
+
// "tax_amount": "5.000000",
|
|
550
|
+
// "base_price": 100.172414,
|
|
551
|
+
// "tax_rate_quantity": 5
|
|
552
|
+
// }
|
|
553
|
+
// ],
|
|
554
|
+
// "tax_amount_modifier": "24.586207",
|
|
555
|
+
// "total_tax_amount": "24.586207",
|
|
556
|
+
// "order_version": 4,
|
|
557
|
+
// "promotion_discount": 0
|
|
558
|
+
// },
|
|
559
|
+
// {
|
|
560
|
+
// "item_id": 8595,
|
|
561
|
+
// "category_id": 501550,
|
|
562
|
+
// "item_price": 122,
|
|
563
|
+
// "menu_name": "SIngle Menu",
|
|
564
|
+
// "category_name": "Special Burgers",
|
|
565
|
+
// "quantity": 1,
|
|
566
|
+
// "item_display_text": "Cheese Burger 🍔",
|
|
567
|
+
// "item_name": "Cheese Burger 🍔",
|
|
568
|
+
// "tax_rate": 16,
|
|
569
|
+
// "item_modifiers": [
|
|
570
|
+
// {
|
|
571
|
+
// "modifer_cat": 511432,
|
|
572
|
+
// "modifier_caetgory_name": "Drinks ",
|
|
573
|
+
// "modifier_item_id": 100911,
|
|
574
|
+
// "modifier_sequence": 0,
|
|
575
|
+
// "modifier_item_price": 20,
|
|
576
|
+
// "modifier_item_name": "Sprite",
|
|
577
|
+
// "is_tax_rate_same": 1,
|
|
578
|
+
// "tax_rate": 0,
|
|
579
|
+
// "quantity": 1,
|
|
580
|
+
// "item_id": 8595,
|
|
581
|
+
// "tax_id": [
|
|
582
|
+
// {
|
|
583
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
|
|
584
|
+
// }
|
|
585
|
+
// ],
|
|
586
|
+
// "modifier_trx_id": "c3b8-a367-4bbd",
|
|
587
|
+
// "linked_product": "",
|
|
588
|
+
// "redeem_promotion_id": 5011767,
|
|
589
|
+
// "tax_amount": "2.758621",
|
|
590
|
+
// "tax_array": [
|
|
591
|
+
// {
|
|
592
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
|
|
593
|
+
// "tax_label": "16% IVA",
|
|
594
|
+
// "tax_rate": 16,
|
|
595
|
+
// "tax_sequence": 1,
|
|
596
|
+
// "base_price_effected": 0,
|
|
597
|
+
// "tax_amount": "2.758621",
|
|
598
|
+
// "base_price": "17.241379",
|
|
599
|
+
// "tax_rate_quantity": 0
|
|
600
|
+
// }
|
|
601
|
+
// ]
|
|
602
|
+
// }
|
|
603
|
+
// ],
|
|
604
|
+
// "isPackage": 0,
|
|
605
|
+
// "price_list_id": "56e55ca6-d246-11ed-8811-0e2fd5e35c29",
|
|
606
|
+
// "item_price_with_modifier": 142,
|
|
607
|
+
// "package_items": [],
|
|
608
|
+
// "item_event": "update",
|
|
609
|
+
// "actual_price": 0,
|
|
610
|
+
// "tax_id": [
|
|
611
|
+
// {
|
|
612
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
|
|
613
|
+
// }
|
|
614
|
+
// ],
|
|
615
|
+
// "menu_id": 210,
|
|
616
|
+
// "item_trx_id": "3546-1fdf-8b16",
|
|
617
|
+
// "special_instruction": "",
|
|
618
|
+
// "ieps_tax": {
|
|
619
|
+
// "status": 1,
|
|
620
|
+
// "ieps_details": {
|
|
621
|
+
// "type": "2",
|
|
622
|
+
// "tax_id": 5
|
|
623
|
+
// }
|
|
624
|
+
// },
|
|
625
|
+
// "sync": true,
|
|
626
|
+
// "wa_user_info": {
|
|
627
|
+
// "user_id": 382,
|
|
628
|
+
// "user_name": "Lee Jung-suk",
|
|
629
|
+
// "version": 5,
|
|
630
|
+
// "added_at": "2024-04-01 04:53:04"
|
|
631
|
+
// },
|
|
632
|
+
// "redeem_promotion_id": 5011767,
|
|
633
|
+
// "promotion_discount_modifier": "71.09",
|
|
634
|
+
// "tax_amount": "21.827586",
|
|
635
|
+
// "tax_array": [
|
|
636
|
+
// {
|
|
637
|
+
// "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
|
|
638
|
+
// "tax_label": "16% IVA",
|
|
639
|
+
// "tax_rate": 16,
|
|
640
|
+
// "tax_sequence": 1,
|
|
641
|
+
// "base_price_effected": 0,
|
|
642
|
+
// "tax_amount": "16.827586",
|
|
643
|
+
// "base_price": "105.172414",
|
|
644
|
+
// "tax_rate_quantity": 5
|
|
645
|
+
// },
|
|
646
|
+
// {
|
|
647
|
+
// "base_price_effected": 0,
|
|
648
|
+
// "tax_sequence": 2,
|
|
649
|
+
// "tax_label": "IEPS",
|
|
650
|
+
// "ieps_type": 2,
|
|
651
|
+
// "tax_id": "absolute",
|
|
652
|
+
// "tax_rate": 0.049914,
|
|
653
|
+
// "tax_amount": "5.000000",
|
|
654
|
+
// "base_price": 100.172414,
|
|
655
|
+
// "tax_rate_quantity": 5
|
|
656
|
+
// }
|
|
657
|
+
// ],
|
|
658
|
+
// "tax_amount_modifier": "24.586207",
|
|
659
|
+
// "total_tax_amount": "24.586207",
|
|
660
|
+
// "order_version": 5,
|
|
661
|
+
// "promotion_discount": 0
|
|
662
|
+
// }
|
|
663
|
+
// ]
|
|
664
|
+
// },
|
|
665
|
+
// "order_type": "dinein",
|
|
666
|
+
// "request_id": "82ec2674b088fcaa",
|
|
667
|
+
// "restaurant_id": 400,
|
|
668
|
+
// "branch_id": 1803,
|
|
669
|
+
// "loyalty_points_details": {
|
|
670
|
+
// "points": 2997,
|
|
671
|
+
// "redeemable": "yes",
|
|
672
|
+
// "store_value": "2997.00",
|
|
673
|
+
// "redeem_categories": [
|
|
674
|
+
// {
|
|
675
|
+
// "product_id": "All",
|
|
676
|
+
// "category_id": "All"
|
|
677
|
+
// }
|
|
678
|
+
// ],
|
|
679
|
+
// "status": false,
|
|
680
|
+
// "points_redeemed": 0
|
|
681
|
+
// },
|
|
682
|
+
// "store_value": 2997,
|
|
683
|
+
// "user_detais": {
|
|
684
|
+
// "first_name": "Sahil Sharma",
|
|
685
|
+
// "name": "Sahil Sharma",
|
|
686
|
+
// "member_id": "e8556b91-c29f-4bd3-80e3-1fa1e7f8b7f8",
|
|
687
|
+
// "phone_number": "9103180340",
|
|
688
|
+
// "mobile": "9103180340",
|
|
689
|
+
// "store_value": 2997,
|
|
690
|
+
// "reward_plan_id": 22,
|
|
691
|
+
// "reward_plan_name": "new plan"
|
|
692
|
+
// },
|
|
693
|
+
// "promotion_applied": {
|
|
694
|
+
// "offer_id": 5011839,
|
|
695
|
+
// "en_id": 26040,
|
|
696
|
+
// "offer_type": "user_specific",
|
|
697
|
+
// "validity_from": "1-Abr-2024",
|
|
698
|
+
// "validity_to": "27-Mar-2025",
|
|
699
|
+
// "description": "FOOD COMBO OFFERS",
|
|
700
|
+
// "promotion_image": "https://res.cloudinary.com/dn2mchqlr/image/upload/f_auto,q_auto,fl_lossy/v1708081791/stage/spec.%20promo/file1708081791221sp_g0fnnf.jpg",
|
|
701
|
+
// "titile": "FOOD COMBO OFFERS",
|
|
702
|
+
// "subtitle": "valid untill",
|
|
703
|
+
// "oo_min_amount": 1,
|
|
704
|
+
// "oo_offer_type": "percentage",
|
|
705
|
+
// "oo_offer_value": 75,
|
|
706
|
+
// "offer_discount_type": "free_product",
|
|
707
|
+
// "max_product": "1",
|
|
708
|
+
// "modifier_category": [
|
|
709
|
+
// "all"
|
|
710
|
+
// ],
|
|
711
|
+
// "valid_days": "Lun a Vie",
|
|
712
|
+
// "popup_status": 1,
|
|
713
|
+
// "oo_order_type": {
|
|
714
|
+
// "dinein": "no",
|
|
715
|
+
// "takeout": "yes",
|
|
716
|
+
// "delivery": "yes"
|
|
717
|
+
// },
|
|
718
|
+
// "promotion_code": null,
|
|
719
|
+
// "discount_roundoff": 1,
|
|
720
|
+
// "oo_status": 3,
|
|
721
|
+
// "redeem_description": null,
|
|
722
|
+
// "redeem_timer": 0,
|
|
723
|
+
// "redeemption_intiated_timestamp": null,
|
|
724
|
+
// "redeem_source": null,
|
|
725
|
+
// "status": 0,
|
|
726
|
+
// "offer_products": {
|
|
727
|
+
// "offer_discount_products": [
|
|
728
|
+
// 24,
|
|
729
|
+
// 641,
|
|
730
|
+
// 643,
|
|
731
|
+
// 645,
|
|
732
|
+
// 646,
|
|
733
|
+
// 647,
|
|
734
|
+
// 648,
|
|
735
|
+
// 650,
|
|
736
|
+
// 653,
|
|
737
|
+
// 654,
|
|
738
|
+
// 656,
|
|
739
|
+
// 691,
|
|
740
|
+
// 898,
|
|
741
|
+
// 921,
|
|
742
|
+
// 927,
|
|
743
|
+
// 3861,
|
|
744
|
+
// 5565,
|
|
745
|
+
// 5568,
|
|
746
|
+
// 5572,
|
|
747
|
+
// 5573,
|
|
748
|
+
// 5587,
|
|
749
|
+
// 5594,
|
|
750
|
+
// 5595,
|
|
751
|
+
// 5636,
|
|
752
|
+
// 5717,
|
|
753
|
+
// 8595,
|
|
754
|
+
// 8596,
|
|
755
|
+
// 8597,
|
|
756
|
+
// 8607,
|
|
757
|
+
// 8610,
|
|
758
|
+
// 8612,
|
|
759
|
+
// 8613,
|
|
760
|
+
// 8614,
|
|
761
|
+
// 8615,
|
|
762
|
+
// 8616,
|
|
763
|
+
// 8617,
|
|
764
|
+
// 8618,
|
|
765
|
+
// 8619,
|
|
766
|
+
// 8620,
|
|
767
|
+
// 8621,
|
|
768
|
+
// 8622,
|
|
769
|
+
// 8623,
|
|
770
|
+
// 8625,
|
|
771
|
+
// 8626,
|
|
772
|
+
// 8629,
|
|
773
|
+
// 8632,
|
|
774
|
+
// 8633,
|
|
775
|
+
// 8634,
|
|
776
|
+
// 8635,
|
|
777
|
+
// 8673,
|
|
778
|
+
// 8711,
|
|
779
|
+
// 8777,
|
|
780
|
+
// 8780,
|
|
781
|
+
// 8781,
|
|
782
|
+
// 8782,
|
|
783
|
+
// 8785,
|
|
784
|
+
// 8811,
|
|
785
|
+
// 8816,
|
|
786
|
+
// 8817,
|
|
787
|
+
// 8818,
|
|
788
|
+
// 8833,
|
|
789
|
+
// 8834,
|
|
790
|
+
// 8835,
|
|
791
|
+
// 8836,
|
|
792
|
+
// 8837,
|
|
793
|
+
// 8856,
|
|
794
|
+
// 8857,
|
|
795
|
+
// 8858,
|
|
796
|
+
// 8859,
|
|
797
|
+
// 8861,
|
|
798
|
+
// 8862,
|
|
799
|
+
// 8863,
|
|
800
|
+
// 8864,
|
|
801
|
+
// 8885,
|
|
802
|
+
// 8901,
|
|
803
|
+
// 8902,
|
|
804
|
+
// 8906,
|
|
805
|
+
// 8910,
|
|
806
|
+
// 8911
|
|
807
|
+
// ],
|
|
808
|
+
// "package_items": [],
|
|
809
|
+
// "order_multi_use": 1,
|
|
810
|
+
// "order_modifiercost_use": 1,
|
|
811
|
+
// "modifier_category": [
|
|
812
|
+
// "all"
|
|
813
|
+
// ],
|
|
814
|
+
// "max_product": "1"
|
|
815
|
+
// },
|
|
816
|
+
// "promotion_id": 5011839,
|
|
817
|
+
// "promotion_type": "user_specific"
|
|
818
|
+
// }
|
|
819
|
+
// }
|
|
137
820
|
|
|
138
|
-
calculateTax(json).then(res=>{
|
|
139
|
-
|
|
140
|
-
}).catch(err=>{
|
|
141
|
-
|
|
142
|
-
})
|
|
821
|
+
// calculateTax(json).then(res=>{
|
|
822
|
+
// console.log(JSON.stringify(res))
|
|
823
|
+
// }).catch(err=>{
|
|
824
|
+
// console.log(err)
|
|
825
|
+
// })
|
|
143
826
|
|
|
144
827
|
module.exports = { calculateTax }
|
|
145
828
|
|
package/package.json
CHANGED