foodbot-cart-calculations 1.0.46 → 1.0.47

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.
@@ -35,7 +35,7 @@ function offerCalculation(carts, offer, deliveryCost = 0) {
35
35
  if (offer && offer.offer_discount_type && offer.offer_discount_type == 'buy_x_get_y') {
36
36
  getOfferDetails(carts, offer).then(res => {
37
37
  carts = res
38
- console.log("res",res)
38
+ // console.log("res",res)
39
39
  if (offer && offer.oo_offer_type == 'percentage' && offer.discount_roundoff && offer.discount_roundoff == 1) {
40
40
 
41
41
  // offer.oo_offer_types = JSON.parse(JSON.stringify(offer.oo_offer_type))
@@ -455,7 +455,14 @@ function getOfferDetails(carts, offer = []) {
455
455
  const offerBuyProducts = offer.offer_products.offer_buy_products.map(Number);
456
456
  const offerGetProducts = offer.offer_products.offer_get_products.map(Number);
457
457
  addItemQuantity(carts.item_details, offer).then((data) => {
458
- const descending = data.sort((a, b) => (parseInt(b.amount) > parseInt(a.amount)) ? 1 : -1);
458
+ // const descending = data.sort((a, b) => (parseInt(b.amount) > parseInt(a.amount)) ? 1 : -1);
459
+ let descending = data.sort((a, b) => (parseInt(b.amount) > parseInt(a.amount)) ? 1 : -1);
460
+ descending = data.sort((a, b) => {
461
+ if (a.get && !b.get) return 1; // GET item first
462
+ if (!a.get && b.get) return -1; // Non-GET after
463
+ return 0; // Keep original amount order for ties
464
+ });
465
+
459
466
  let total = 0
460
467
  let buyItemAmount=0;
461
468
  let buyItemss =[]
@@ -480,7 +487,7 @@ function getOfferDetails(carts, offer = []) {
480
487
 
481
488
  function getBuyxGetYOnCondition(descending, cartData, offer,total,buyItemAmount,buyItemss) {
482
489
  return new Promise((resolve, reject) => {
483
- let carts = cartData.item_details;
490
+ let carts = cartData.item_details;
484
491
  const desc = JSON.parse(JSON.stringify(descending));
485
492
  const desc1 = JSON.parse(JSON.stringify(descending));
486
493
  let amount = 0;
@@ -491,8 +498,10 @@ function getBuyxGetYOnCondition(descending, cartData, offer,total,buyItemAmount,
491
498
  return e.item_id;
492
499
  }
493
500
  });
494
-
495
501
 
502
+ // console.log(descending)
503
+ // console.log(buyItemAmount)
504
+ // console.log(buyItemss)
496
505
 
497
506
  const totalCount = parseInt(offer.offer_products.get_item_count) + parseInt(offer.offer_products.buy_item_count);
498
507
  if (buyItems && parseInt(buyItems.length) >= parseInt(offer.offer_products.buy_item_count) && desc.length > 1 && descending.length >= totalCount) {
@@ -515,7 +524,6 @@ function getBuyxGetYOnCondition(descending, cartData, offer,total,buyItemAmount,
515
524
  if (itemIndex == -1) itemIndex = carts.findIndex(obj => obj.item_id == desc[i].item.item_id);
516
525
 
517
526
 
518
-
519
527
  if (offer.oo_offer_type === "percentage") {
520
528
  let itemTotalDiscount = 0;
521
529
 
@@ -568,14 +576,11 @@ function getBuyxGetYOnCondition(descending, cartData, offer,total,buyItemAmount,
568
576
  cartData.totalDiscount = total;
569
577
  }
570
578
 
571
-
572
-
573
579
  if (getCount == offer.offer_products.get_item_count && buyCount == offer.offer_products.buy_item_count) {
574
580
 
575
581
  total = parseFloat(total) + parseFloat(amount);
576
582
  if (offer.offer_products.order_multi_use == 1) {
577
583
  const filterItem = desc1.filter(e => !e.remove);
578
-
579
584
  cartData.item_details = carts
580
585
  getBuyxGetYOnCondition(filterItem, cartData, offer,total,buyItemAmount,buyItemss).then((data) => {
581
586
  resolve(data)
@@ -598,13 +603,10 @@ function getBuyxGetYOnCondition(descending, cartData, offer,total,buyItemAmount,
598
603
  break;
599
604
  }
600
605
  }else{
601
-
602
606
  if(i == desc.length -1){
603
-
604
607
  cartData.discount = cartData.totalDiscount?cartData.totalDiscount:0;
605
608
  resolve(cartData);
606
609
  }
607
-
608
610
  }
609
611
  }
610
612
  } else {
@@ -743,7 +745,7 @@ function addItemQuantity(items, offer) {
743
745
  );
744
746
  offer.offer_products.offer_get_products=offer.offer_products.offer_get_products.map(item =>
745
747
  item.toString().length > 10 ? item : parseInt(item, 10)
746
- );
748
+ )
747
749
  items.forEach(function (element) {
748
750
  let itemId = element.item_id?.toString().length > 10 ? element.item_id : parseInt(element.item_id);
749
751
  if (offer.offer_products.offer_buy_products.includes(itemId) || offer.offer_products.offer_get_products.includes(itemId)) {
@@ -784,6 +786,8 @@ function addItemQuantity(items, offer) {
784
786
  'buy': offer.offer_products.offer_buy_products.includes(itemId),
785
787
  'get': offer.offer_products.offer_get_products.includes(itemId)
786
788
  });
789
+
790
+ // console.log(finalItems)
787
791
  }
788
792
  }
789
793
  }
package/index.js CHANGED
@@ -75,291 +75,778 @@ async function calculateTax(inputJSON) {
75
75
  })
76
76
  }
77
77
 
78
- // let json ={
79
- // "order_items": {
80
- // "item_details": [
81
- // {
82
- // "menu_id": 320,
83
- // "item_id": 9030,
84
- // "category_id": 501768,
85
- // "item_price": 80,
86
- // "item_price_with_modifier": 215,
87
- // "quantity": 1,
88
- // "item_display_text": "daal rice",
89
- // "item_name": "daal rice",
90
- // "tax_rate": 16,
91
- // "item_modifiers": [
92
- // {
93
- // "modifer_cat": 511432,
94
- // "modifier_caetgory_name": "Bebidas sin alcohol",
95
- // "modifier_item_id": 101383,
96
- // "modifier_category_sequence": "0",
97
- // "modifier_sequence": "01",
98
- // "modifier_item_price": 20,
99
- // "modifier_item_name": "Fanta",
100
- // "is_tax_rate_same": 1,
101
- // "tax_rate": 0,
102
- // "quantity": 1,
103
- // "item_id": 9030,
104
- // "tax_id": [
105
- // {
106
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
107
- // }
108
- // ],
109
- // "modifier_trx_id": "ScrxcTSU",
110
- // "linked_product": {
111
- // "product_id": 9081,
112
- // "product_tax_id": [
113
- // {
114
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
115
- // }
116
- // ],
117
- // "product_name": "Dairy Milk",
118
- // "category_id": 501803,
119
- // "ieps_tax": {
120
- // "status": 0
121
- // }
122
- // },
123
- // "tax_amount": "6.400000",
124
- // "tax_array": [
125
- // {
126
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
127
- // "tax_label": "16% IVA",
128
- // "tax_rate": 16,
129
- // "tax_sequence": 1,
130
- // "base_price_effected": 0,
131
- // "tax_amount": "6.400000",
132
- // "base_price": 40,
133
- // "tax_rate_quantity": 0
134
- // }
135
- // ]
136
- // },
137
- // {
138
- // "modifer_cat": 511432,
139
- // "modifier_caetgory_name": "Bebidas sin alcohol",
140
- // "modifier_item_id": 101384,
141
- // "modifier_category_sequence": "0",
142
- // "modifier_sequence": "02",
143
- // "modifier_item_price": 35,
144
- // "modifier_item_name": "Mountain Dew",
145
- // "is_tax_rate_same": 1,
146
- // "tax_rate": 0,
147
- // "quantity": 1,
148
- // "item_id": 9030,
149
- // "tax_id": [
150
- // {
151
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
152
- // }
153
- // ],
154
- // "modifier_trx_id": "BGDqI7yI",
155
- // "linked_product": {
156
- // "product_id": 9081,
157
- // "product_tax_id": [
158
- // {
159
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
160
- // }
161
- // ],
162
- // "product_name": "Dairy Milk",
163
- // "category_id": 501803,
164
- // "ieps_tax": {
165
- // "status": 0
166
- // }
167
- // },
168
- // "tax_amount": "11.200000",
169
- // "tax_array": [
170
- // {
171
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
172
- // "tax_label": "16% IVA",
78
+
79
+ // let json = {
80
+ // "isPos": 1,
81
+ // "order_items": {
82
+ // "item_details": [
83
+ // {
84
+ // "item_id": 16308,
85
+ // "category_id": 3168,
86
+ // "item_price": 69,
87
+ // "quantity": 1,
88
+ // "item_display_text": "Panqué de Plátano❤️",
89
+ // "item_name": "Panqué de Plátano❤️",
173
90
  // "tax_rate": 16,
174
- // "tax_sequence": 1,
175
- // "base_price_effected": 0,
176
- // "tax_amount": "11.200000",
177
- // "base_price": 70,
178
- // "tax_rate_quantity": 0
179
- // }
180
- // ]
181
- // },
182
- // {
183
- // "modifer_cat": 511432,
184
- // "modifier_caetgory_name": "Bebidas sin alcohol",
185
- // "modifier_item_id": 101385,
186
- // "modifier_category_sequence": "0",
187
- // "modifier_sequence": "03",
188
- // "modifier_item_price": 30,
189
- // "modifier_item_name": "Pepsi",
190
- // "is_tax_rate_same": 1,
191
- // "tax_rate": 0,
192
- // "quantity": 1,
193
- // "item_id": 9030,
194
- // "tax_id": [
195
- // {
196
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
197
- // }
198
- // ],
199
- // "modifier_trx_id": "hUiiwipa",
200
- // "linked_product": {
201
- // "product_id": 9081,
202
- // "product_tax_id": [
203
- // {
204
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
205
- // }
206
- // ],
207
- // "product_name": "Dairy Milk",
208
- // "category_id": 501803,
209
- // "ieps_tax": {
210
- // "status": 0
211
- // }
91
+ // "item_modifiers": [],
92
+ // "isPackage": 0,
93
+ // "price_list_id": "1eae7f7d-9c7b-4c6e-96ab-e8375cdbbe65",
94
+ // "item_price_with_modifier": 69,
95
+ // "package_items": [],
96
+ // "item_event": "new",
97
+ // "actual_price": 0,
98
+ // "tax_id": [
99
+ // {
100
+ // "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
101
+ // }
102
+ // ],
103
+ // "ieps_tax": {
104
+ // "status": 0
105
+ // },
106
+ // "menu_id": 633,
107
+ // "item_trx_id": "aKcQ774w",
108
+ // "tax_amount": "9.520000",
109
+ // "tax_array": [
110
+ // {
111
+ // "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
112
+ // "tax_label": "IVA 16%",
113
+ // "tax_rate": 16,
114
+ // "tax_sequence": 1,
115
+ // "base_price_effected": 0,
116
+ // "tax_amount": "9.520000",
117
+ // "base_price": "59.48",
118
+ // "tax_rate_quantity": 0
119
+ // }
120
+ // ],
121
+ // "tax_amount_modifier": "9.520000",
122
+ // "total_tax_amount": "9.520000",
123
+ // "promotion_discount": 0
212
124
  // },
213
- // "tax_amount": "9.600000",
214
- // "tax_array": [
215
- // {
216
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
217
- // "tax_label": "16% IVA",
125
+ // {
126
+ // "menu_id": 633,
127
+ // "item_id": 16279,
128
+ // "category_id": 3167,
129
+ // "item_price": 89,
130
+ // "item_price_with_modifier": 109,
131
+ // "quantity": 1,
132
+ // "item_display_text": "Recovery ",
133
+ // "item_name": "Recovery ",
218
134
  // "tax_rate": 16,
219
- // "tax_sequence": 1,
220
- // "base_price_effected": 0,
221
- // "tax_amount": "9.600000",
222
- // "base_price": 60,
223
- // "tax_rate_quantity": 0
224
- // }
225
- // ]
226
- // },
227
- // {
228
- // "modifer_cat": 511432,
229
- // "modifier_caetgory_name": "Bebidas sin alcohol",
230
- // "modifier_item_id": 101386,
231
- // "modifier_category_sequence": "0",
232
- // "modifier_sequence": "04",
233
- // "modifier_item_price": 20,
234
- // "modifier_item_name": "Spirte",
235
- // "is_tax_rate_same": 1,
135
+ // "item_modifiers": [
136
+ // {
137
+ // "modifier_category_id": 4572,
138
+ // "modifer_cat": 4572,
139
+ // "modifier_caetgory_name": "Elige tu leche M",
140
+ // "modifier_item_id": 36271,
141
+ // "modifier_category_sequence": "0",
142
+ // "modifier_sequence": "00",
143
+ // "modifier_item_price": 20,
144
+ // "modifier_item_name": "Leche de avena",
145
+ // "is_tax_rate_same": 1,
146
+ // "tax_rate": 0,
147
+ // "quantity": 1,
148
+ // "item_id": 16279,
149
+ // "tax_id": [
150
+ // {
151
+ // "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
152
+ // }
153
+ // ],
154
+ // "modifier_trx_id": "5MUTuejd",
155
+ // "linked_product": "",
156
+ // "tax_amount": "2.760000",
157
+ // "tax_array": [
158
+ // {
159
+ // "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
160
+ // "tax_label": "IVA 16%",
161
+ // "tax_rate": 16,
162
+ // "tax_sequence": 1,
163
+ // "base_price_effected": 0,
164
+ // "tax_amount": "2.760000",
165
+ // "base_price": "17.24",
166
+ // "tax_rate_quantity": 0
167
+ // }
168
+ // ]
169
+ // }
170
+ // ],
171
+ // "isPackage": 0,
172
+ // "package_items": [],
173
+ // "actual_price": 0,
174
+ // "item_event": "new",
175
+ // "tax_id": [
176
+ // {
177
+ // "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
178
+ // }
179
+ // ],
180
+ // "ieps_tax": {
181
+ // "status": 0
182
+ // },
183
+ // "item_trx_id": "7uDhbv5L",
184
+ // "special_instruction": "",
185
+ // "tax_amount": "12.280000",
186
+ // "tax_array": [
187
+ // {
188
+ // "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
189
+ // "tax_label": "IVA 16%",
190
+ // "tax_rate": 16,
191
+ // "tax_sequence": 1,
192
+ // "base_price_effected": 0,
193
+ // "tax_amount": "12.280000",
194
+ // "base_price": "76.72",
195
+ // "tax_rate_quantity": 0
196
+ // }
197
+ // ],
198
+ // "tax_amount_modifier": "15.040000",
199
+ // "total_tax_amount": "15.040000",
200
+ // "promotion_discount": 0
201
+ // }
202
+ // ]
203
+ // },
204
+ // "tax_settings": [
205
+ // {
206
+ // "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
207
+ // "tax_label": "IVA 16%",
208
+ // "tax_rate": 16,
209
+ // "tax_sequence": 1,
210
+ // "base_price_effected": 0
211
+ // },
212
+ // {
213
+ // "tax_id": "21036b00-bdb4-4485-aaba-d088a721a67f",
214
+ // "tax_label": "IVA 8%",
215
+ // "tax_rate": 8,
216
+ // "tax_sequence": 1,
217
+ // "base_price_effected": 0
218
+ // },
219
+ // {
220
+ // "tax_id": "e47296aa-b5ae-449f-ab5f-ff50f43a648a",
221
+ // "tax_label": "Sin IVA",
236
222
  // "tax_rate": 0,
237
- // "quantity": 1,
238
- // "item_id": 9030,
239
- // "tax_id": [
240
- // {
241
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
242
- // }
223
+ // "tax_sequence": 3,
224
+ // "base_price_effected": 0
225
+ // },
226
+ // {
227
+ // "tax_id": "21036b00-bdb4-4485-aaba-d088a721a67f1",
228
+ // "tax_label": "IEPS 8%",
229
+ // "tax_rate": 8,
230
+ // "tax_sequence": 2,
231
+ // "base_price_effected": 0
232
+ // }
233
+ // ],
234
+ // "tax_type": 2,
235
+ // "store_value": 0,
236
+ // "delivery_cost": 0,
237
+ // "service_amount": 0,
238
+ // "promotion_applied": {
239
+ // "offer_id": 1818,
240
+ // "offer_type": "regular",
241
+ // "titile": "Condesa: Jugo o Protein Shake Gratis",
242
+ // "subtitle": null,
243
+ // "description": "válido en tienda, un producto por persona, y al darse de alta en el green me rewards . Consumo mínimo $50. Válido hasta el 15/08/25.",
244
+ // "oo_min_amount": 50,
245
+ // "oo_offer_type": "percentage",
246
+ // "oo_offer_value": 100,
247
+ // "offer_discount_type": "buy_x_get_y",
248
+ // "oo_order_type": {
249
+ // "dinein": "no",
250
+ // "takeout": "no",
251
+ // "delivery": "no"
252
+ // },
253
+ // "valid_date_to": "2025-08-15T00:00:00.000Z",
254
+ // "valid_time_to": "23:59:00",
255
+ // "popup_status": 0,
256
+ // "promotion_image": "https://res.cloudinary.com/http-foodbot-ai/image/upload/f_auto,q_auto,fl_lossy/v1753489002/prod/promotion/file1753489002879promotion_hp1eab.jpg",
257
+ // "modifier_category": [
258
+ // "all"
259
+ // ],
260
+ // "is_manager_specific": "no",
261
+ // "discount_roundoff": 0,
262
+ // "offer_products": {
263
+ // "offer_buy_products": [
264
+ // 16251,
265
+ // 16252,
266
+ // 16253,
267
+ // 16254,
268
+ // 16255,
269
+ // 16256,
270
+ // 16257,
271
+ // 16258,
272
+ // 16259,
273
+ // 16260,
274
+ // 16261,
275
+ // 16262,
276
+ // 16263,
277
+ // 16264,
278
+ // 16265,
279
+ // 16266,
280
+ // 16267,
281
+ // 16269,
282
+ // 16270,
283
+ // 16272,
284
+ // 16273,
285
+ // 16274,
286
+ // 16275,
287
+ // 16276,
288
+ // 16277,
289
+ // 16278,
290
+ // 16279,
291
+ // 16280,
292
+ // 16281,
293
+ // 16282,
294
+ // 16283,
295
+ // 16304,
296
+ // 16305,
297
+ // 16306,
298
+ // 16307,
299
+ // 16308,
300
+ // 16309,
301
+ // 16310,
302
+ // 16311,
303
+ // 16312,
304
+ // 16313,
305
+ // 16314,
306
+ // 16315,
307
+ // 16316,
308
+ // 16317,
309
+ // 16318,
310
+ // 16319,
311
+ // 16320,
312
+ // 16321,
313
+ // 16323,
314
+ // 16324,
315
+ // 16325,
316
+ // 16326,
317
+ // 16328,
318
+ // 16329,
319
+ // 16330,
320
+ // 16331,
321
+ // 16333,
322
+ // 16334,
323
+ // 16335,
324
+ // 16336,
325
+ // 16337,
326
+ // 16338,
327
+ // 16339,
328
+ // 16340,
329
+ // 16341,
330
+ // 16343,
331
+ // 16363,
332
+ // 16364,
333
+ // 16367,
334
+ // 16368,
335
+ // 16369,
336
+ // 16370,
337
+ // 16371,
338
+ // 16372,
339
+ // 16373,
340
+ // 16376,
341
+ // 16377,
342
+ // 16378,
343
+ // 16379,
344
+ // 16380,
345
+ // 16385,
346
+ // 16386,
347
+ // 16387,
348
+ // 16388,
349
+ // 16389,
350
+ // 16390,
351
+ // 16401,
352
+ // 16425,
353
+ // 16657,
354
+ // 16667,
355
+ // 16668,
356
+ // 16669,
357
+ // 16670,
358
+ // 16671,
359
+ // 16673,
360
+ // 16674,
361
+ // 16675,
362
+ // 16677,
363
+ // 16678,
364
+ // 16679,
365
+ // 16725,
366
+ // 16875,
367
+ // 16876,
368
+ // 16877,
369
+ // 16878,
370
+ // 16879,
371
+ // 16880,
372
+ // 16886,
373
+ // 16949,
374
+ // 16950,
375
+ // 16951,
376
+ // 16952,
377
+ // 16953,
378
+ // 16954,
379
+ // 16955,
380
+ // 16956,
381
+ // 17093,
382
+ // 17228,
383
+ // 17239,
384
+ // 17240,
385
+ // 17243,
386
+ // 17347,
387
+ // 17359,
388
+ // 17558,
389
+ // 17762,
390
+ // 17908,
391
+ // 17909,
392
+ // 17910,
393
+ // 17911,
394
+ // 17912,
395
+ // 17913,
396
+ // 17914,
397
+ // 17915,
398
+ // 17916,
399
+ // 17917,
400
+ // 17918,
401
+ // 17919,
402
+ // 17920,
403
+ // 17921,
404
+ // 17922,
405
+ // 17923,
406
+ // 17924,
407
+ // 17925,
408
+ // 17926,
409
+ // 17927,
410
+ // 17928,
411
+ // 17929,
412
+ // 17933,
413
+ // 17934,
414
+ // 17971,
415
+ // 18008,
416
+ // 18022,
417
+ // 18117,
418
+ // 18119,
419
+ // 18120,
420
+ // 18121,
421
+ // 18122,
422
+ // 18123,
423
+ // 18124,
424
+ // 18125,
425
+ // 18371,
426
+ // 18372,
427
+ // 18373,
428
+ // 18374,
429
+ // 18375,
430
+ // 18376,
431
+ // 18377,
432
+ // 18378,
433
+ // 18696,
434
+ // 18699,
435
+ // 18700,
436
+ // 18702,
437
+ // 18703,
438
+ // 18707,
439
+ // 18742,
440
+ // 18756,
441
+ // 18758,
442
+ // 18783,
443
+ // 19646,
444
+ // 19647,
445
+ // 19648,
446
+ // 19649,
447
+ // 19650,
448
+ // 19651,
449
+ // 19652,
450
+ // 20430,
451
+ // 20431,
452
+ // 20432,
453
+ // 20433,
454
+ // 20434,
455
+ // 20435,
456
+ // 20436,
457
+ // 20437,
458
+ // 20439,
459
+ // 20648,
460
+ // 20690,
461
+ // 20691,
462
+ // 20692,
463
+ // 20693,
464
+ // 20694,
465
+ // 20695,
466
+ // 20696,
467
+ // 20697,
468
+ // 20698,
469
+ // 20699,
470
+ // 20700,
471
+ // 20701,
472
+ // 20702,
473
+ // 20703,
474
+ // 20704,
475
+ // 21189,
476
+ // 21190,
477
+ // 21191,
478
+ // 21192,
479
+ // 21193,
480
+ // 21194,
481
+ // 21240,
482
+ // 21241,
483
+ // 21242,
484
+ // 21243,
485
+ // 21286,
486
+ // 21359,
487
+ // 21360,
488
+ // 21361,
489
+ // 21362,
490
+ // 21363,
491
+ // 21364,
492
+ // 21365,
493
+ // 21366,
494
+ // 21367,
495
+ // 21368,
496
+ // 21369,
497
+ // 21371,
498
+ // 21373,
499
+ // 21374,
500
+ // 21375,
501
+ // 21376,
502
+ // 21377,
503
+ // 21378,
504
+ // 21379,
505
+ // 21380,
506
+ // 21381,
507
+ // 21383,
508
+ // 21384,
509
+ // 21385,
510
+ // 21386,
511
+ // 21387,
512
+ // 21388,
513
+ // 21390,
514
+ // 21393,
515
+ // 21394,
516
+ // 21395,
517
+ // 21396,
518
+ // 21397,
519
+ // 21398,
520
+ // 21399,
521
+ // 21400,
522
+ // 21401,
523
+ // 21402,
524
+ // 21403,
525
+ // 21404,
526
+ // 21405,
527
+ // 21406,
528
+ // 21407,
529
+ // 21408,
530
+ // 21409,
531
+ // 21410,
532
+ // 21412,
533
+ // 21413,
534
+ // 21414,
535
+ // 21415,
536
+ // 21416,
537
+ // 21417,
538
+ // 21418,
539
+ // 21419,
540
+ // 21420,
541
+ // 21421,
542
+ // 21422,
543
+ // 21423,
544
+ // 21424,
545
+ // 21425,
546
+ // 21426,
547
+ // 21427,
548
+ // 21428,
549
+ // 21429,
550
+ // 21430,
551
+ // 21431,
552
+ // 21432,
553
+ // 21433,
554
+ // 21434,
555
+ // 21435,
556
+ // 21436,
557
+ // 21437,
558
+ // 21439,
559
+ // 21440,
560
+ // 21441,
561
+ // 21442,
562
+ // 21443,
563
+ // 21444,
564
+ // 21445,
565
+ // 21446,
566
+ // 21447,
567
+ // 21448,
568
+ // 21449,
569
+ // 21450,
570
+ // 21451,
571
+ // 21452,
572
+ // 21453,
573
+ // 21454,
574
+ // 21455,
575
+ // 21456,
576
+ // 21459,
577
+ // 21461,
578
+ // 21462,
579
+ // 21463,
580
+ // 21464,
581
+ // 21465,
582
+ // 21466,
583
+ // 21467,
584
+ // 21468,
585
+ // 21469,
586
+ // 21470,
587
+ // 21471,
588
+ // 21472,
589
+ // 21476,
590
+ // 21477,
591
+ // 21478,
592
+ // 21479,
593
+ // 21480,
594
+ // 21481,
595
+ // 21482,
596
+ // 21483,
597
+ // 21484,
598
+ // 21485,
599
+ // 21486,
600
+ // 21487,
601
+ // 21488,
602
+ // 21489,
603
+ // 21490,
604
+ // 21491,
605
+ // 21492,
606
+ // 21493,
607
+ // 21494,
608
+ // 21495,
609
+ // 21496,
610
+ // 21497,
611
+ // 21498,
612
+ // 21499,
613
+ // 21500,
614
+ // 21501,
615
+ // 21502,
616
+ // 21503,
617
+ // 21504,
618
+ // 21505,
619
+ // 21506,
620
+ // 21507,
621
+ // 21508,
622
+ // 21509,
623
+ // 21510,
624
+ // 21511,
625
+ // 21512,
626
+ // 21513,
627
+ // 21514,
628
+ // 21515,
629
+ // 21516,
630
+ // 21517,
631
+ // 21518,
632
+ // 21519,
633
+ // 21520,
634
+ // 21521,
635
+ // 21524,
636
+ // 21525,
637
+ // 21526,
638
+ // 21527,
639
+ // 21528,
640
+ // 21529,
641
+ // 21530,
642
+ // 21531,
643
+ // 21532,
644
+ // 21533,
645
+ // 21534,
646
+ // 21535,
647
+ // 21536,
648
+ // 21537,
649
+ // 21538,
650
+ // 21539,
651
+ // 21540,
652
+ // 21541,
653
+ // 21542,
654
+ // 21544,
655
+ // 21545,
656
+ // 21546,
657
+ // 21547,
658
+ // 21548,
659
+ // 21549,
660
+ // 21550,
661
+ // 21596,
662
+ // 21616,
663
+ // 21799,
664
+ // 22263,
665
+ // 22300,
666
+ // 22301,
667
+ // 22340,
668
+ // 22341,
669
+ // 22473,
670
+ // 22474,
671
+ // 22598,
672
+ // 22648,
673
+ // 22649,
674
+ // 22650,
675
+ // 22651,
676
+ // 22652,
677
+ // 22653,
678
+ // 22764,
679
+ // 22765,
680
+ // 23161,
681
+ // 23162,
682
+ // 23163,
683
+ // 23164,
684
+ // 23165,
685
+ // 23167,
686
+ // 23168,
687
+ // 23170,
688
+ // 23171,
689
+ // 23172,
690
+ // 23173,
691
+ // 23174,
692
+ // 23175,
693
+ // 23176,
694
+ // 23177,
695
+ // 23178,
696
+ // 23179,
697
+ // 23180,
698
+ // 23181,
699
+ // 23206,
700
+ // 23207,
701
+ // 23342,
702
+ // 23355,
703
+ // 23356,
704
+ // 23357,
705
+ // 23358,
706
+ // 23528,
707
+ // 23762,
708
+ // 23763,
709
+ // 23764,
710
+ // 23776,
711
+ // 23865,
712
+ // 23867,
713
+ // 23868,
714
+ // 23869,
715
+ // 23870,
716
+ // 23872,
717
+ // 23874,
718
+ // 23875,
719
+ // 23877,
720
+ // 23879,
721
+ // 23880,
722
+ // 23881,
723
+ // 23882,
724
+ // 23883,
725
+ // 23885,
726
+ // 23886,
727
+ // 23887,
728
+ // 23955,
729
+ // 23957,
730
+ // 23959,
731
+ // 23960,
732
+ // 23962,
733
+ // 23963,
734
+ // 23964,
735
+ // 23965,
736
+ // 23966,
737
+ // 23967,
738
+ // 23969,
739
+ // 23985,
740
+ // 24007,
741
+ // 24010,
742
+ // 24011,
743
+ // 24012,
744
+ // 24013,
745
+ // 24038,
746
+ // 24042,
747
+ // 24043,
748
+ // 24744,
749
+ // 24745,
750
+ // 24746,
751
+ // 24747,
752
+ // 24761,
753
+ // 24765,
754
+ // 24766,
755
+ // 24772,
756
+ // 24883,
757
+ // 24884,
758
+ // 25166,
759
+ // 25168,
760
+ // 25192,
761
+ // 25193,
762
+ // 25369,
763
+ // 25372,
764
+ // 25409,
765
+ // 25418,
766
+ // 25446,
767
+ // 25447,
768
+ // 25466,
769
+ // 25467,
770
+ // 25468,
771
+ // 25469,
772
+ // 25470,
773
+ // 25847,
774
+ // 25848,
775
+ // 25861,
776
+ // 25862,
777
+ // 25863,
778
+ // 25864,
779
+ // 25907,
780
+ // 25923,
781
+ // 25924,
782
+ // 25925,
783
+ // 25930,
784
+ // 25931,
785
+ // 25932,
786
+ // 25933,
787
+ // 25934,
788
+ // 25936,
789
+ // 25937,
790
+ // 25939,
791
+ // 25940,
792
+ // 25941,
793
+ // 25987,
794
+ // 25988,
795
+ // 25989,
796
+ // 25990,
797
+ // 26053,
798
+ // 26090,
799
+ // 26112,
800
+ // 26189
243
801
  // ],
244
- // "modifier_trx_id": "TfPyHHK7",
245
- // "linked_product": "",
246
- // "tax_amount": "6.400000",
247
- // "tax_array": [
248
- // {
249
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
250
- // "tax_label": "16% IVA",
251
- // "tax_rate": 16,
252
- // "tax_sequence": 1,
253
- // "base_price_effected": 0,
254
- // "tax_amount": "6.400000",
255
- // "base_price": 40,
256
- // "tax_rate_quantity": 0
257
- // }
258
- // ]
259
- // },
260
- // {
261
- // "modifer_cat": 511432,
262
- // "modifier_caetgory_name": "Bebidas sin alcohol",
263
- // "modifier_item_id": 101387,
264
- // "modifier_category_sequence": "0",
265
- // "modifier_sequence": "05",
266
- // "modifier_item_price": 30,
267
- // "modifier_item_name": "Thumbs Up",
268
- // "is_tax_rate_same": 1,
269
- // "tax_rate": 0,
270
- // "quantity": 1,
271
- // "item_id": 9030,
272
- // "tax_id": [
273
- // {
274
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
275
- // }
802
+ // "offer_get_products": [
803
+ // "16275",
804
+ // "16276",
805
+ // "16277",
806
+ // "16278",
807
+ // "16281",
808
+ // "16282",
809
+ // "16306",
810
+ // "18065",
811
+ // "23875",
812
+ // "23877",
813
+ // "24744",
814
+ // "24746",
815
+ // "25923",
816
+ // "16279",
817
+ // "16280",
818
+ // "16304",
819
+ // "16305",
820
+ // "17910",
821
+ // "16367",
822
+ // "16368",
823
+ // "16369",
824
+ // "16370",
825
+ // "25924",
826
+ // "21405",
827
+ // "21406",
828
+ // "21407",
829
+ // "21408",
830
+ // "21409",
831
+ // "21410",
832
+ // "21411",
833
+ // "21476",
834
+ // "21477",
835
+ // "21478",
836
+ // "21479"
276
837
  // ],
277
- // "modifier_trx_id": "5Yw17Q21",
278
- // "linked_product": "",
279
- // "tax_amount": "9.600000",
280
- // "tax_array": [
281
- // {
282
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
283
- // "tax_label": "16% IVA",
284
- // "tax_rate": 16,
285
- // "tax_sequence": 1,
286
- // "base_price_effected": 0,
287
- // "tax_amount": "9.600000",
288
- // "base_price": 60,
289
- // "tax_rate_quantity": 0
290
- // }
838
+ // "buy_item_count": 1,
839
+ // "get_item_count": 1,
840
+ // "order_multi_use": 1,
841
+ // "order_modifiercost_use": 0,
842
+ // "modifier_category": [
843
+ // "all"
291
844
  // ]
292
- // }
293
- // ],
294
- // "isPackage": 0,
295
- // "package_items": [],
296
- // "actual_price": 0,
297
- // "item_event": "new",
298
- // "tax_id": [
299
- // {
300
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003"
301
- // }
302
- // ],
303
- // "ieps_tax": {
304
- // "status": 0
305
845
  // },
306
- // "item_trx_id": "6nfb34q9",
307
- // "special_instruction": "",
308
- // "tax_amount": "25.600000",
309
- // "tax_array": [
310
- // {
311
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
312
- // "tax_label": "16% IVA",
313
- // "tax_rate": 16,
314
- // "tax_sequence": 1,
315
- // "base_price_effected": 0,
316
- // "tax_amount": "25.600000",
317
- // "base_price": 160,
318
- // "tax_rate_quantity": 0
319
- // }
320
- // ],
321
- // "tax_amount_modifier": "68.800000",
322
- // "total_tax_amount": "68.800000",
323
- // "active": true,
324
- // "promotion_discount": 0
325
- // }
326
- // ]
327
- // },
328
- // "tax_settings": [
329
- // {
330
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120003",
331
- // "tax_label": "16% IVA",
332
- // "tax_rate": 16,
333
- // "tax_sequence": 1,
334
- // "base_price_effected": 0
335
- // },
336
- // {
337
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac120002",
338
- // "tax_label": "8% IVA",
339
- // "tax_rate": 8,
340
- // "tax_sequence": 1,
341
- // "base_price_effected": 0
342
- // },
343
- // {
344
- // "tax_id": "9dc9be72-ba23-11ec-8422-0242ac12000200",
345
- // "tax_label": "0% IVA",
346
- // "tax_rate": 0,
347
- // "tax_sequence": 3,
348
- // "base_price_effected": 0
349
- // },
350
- // {
351
- // "tax_id": "21036b00-bdb4-4485-aaba-d088a721a67f1",
352
- // "tax_label": "IEPS 8%",
353
- // "tax_rate": 8,
354
- // "tax_sequence": 2,
355
- // "base_price_effected": 0
846
+ // "get_item_count": 1,
847
+ // "index": 3
356
848
  // }
357
- // ],
358
- // "tax_type": 1,
359
- // "store_value": 0,
360
- // "delivery_cost": 0,
361
- // "service_amount": 0
362
- // }
849
+ // };
363
850
 
364
851
  // calculateTax(json).then(res=>{
365
852
  // // console.log(JSON.stringify(res))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foodbot-cart-calculations",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
4
4
  "description": "Package for cart calculations in which it performs discount distribution and tax distribution on order",
5
5
  "main": "index.js",
6
6
  "scripts": {