foodbot-cart-calculations 1.0.44 → 1.0.46
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/calculations.js +3 -18
- package/functions/pointsCalculation.js +0 -12
- package/functions/promotionCalculation.js +8 -13
- package/index.js +3 -3
- package/package.json +1 -1
- package/response.json +0 -254
- package/sampleInput.json +0 -242
package/calculations.js
CHANGED
|
@@ -94,24 +94,9 @@ function applyDistribution(body) {
|
|
|
94
94
|
|
|
95
95
|
mainCart.tip_amount = parseFloat(tipValue).toFixed(2);
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const serviceAmount = parseFloat(service_amount || 0);
|
|
101
|
-
|
|
102
|
-
const deliveryCovered = body.loyalty_points_details?.enable_delivery_points_usage === 1 && storeValue >= cartTotal + deliveryCost;
|
|
103
|
-
const serviceCovered = body.loyalty_points_details?.enable_service_charge_usage === 1 && storeValue >= cartTotal + deliveryCost + serviceAmount;
|
|
104
|
-
|
|
105
|
-
if (!deliveryCovered) {
|
|
106
|
-
mainCart.final_amount += deliveryCost;
|
|
107
|
-
mainCart.cash_expected += deliveryCost;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (!serviceCovered) {
|
|
111
|
-
mainCart.final_amount += serviceAmount;
|
|
112
|
-
mainCart.cash_expected += serviceAmount;
|
|
113
|
-
}
|
|
114
|
-
|
|
97
|
+
mainCart.final_amount = parseFloat(mainCart.final_amount) + parseFloat(delivery_cost) + parseFloat(service_amount);
|
|
98
|
+
mainCart.cash_expected = parseFloat(mainCart.cash_expected) + parseFloat(delivery_cost) + parseFloat(service_amount);
|
|
99
|
+
|
|
115
100
|
//In a case when calculation of order done from pos.
|
|
116
101
|
if (body.tip_type && body.tip_type == 'percentage' && body.isPos && body.isPos == 1) {
|
|
117
102
|
tipValue = (mainCart.final_amount * parseInt(tipValueReq)) / 100;
|
|
@@ -39,18 +39,6 @@ function getPointsDiscount(cartObject, points, userDetails) {
|
|
|
39
39
|
let count = 0;
|
|
40
40
|
let storeAmount = points.store_value ?? (points.original_store_value ?? 0);
|
|
41
41
|
let indexes = [];
|
|
42
|
-
// Attach delivery and service amount if configured
|
|
43
|
-
cartObject.delivery_cost = cartObject.delivery_cost || 0;
|
|
44
|
-
cartObject.service_amount = cartObject.service_amount || 0;
|
|
45
|
-
|
|
46
|
-
if (points.enable_delivery_points_usage === 1) {
|
|
47
|
-
storeAmount = parseFloat(storeAmount) + parseFloat(cartObject.delivery_cost);
|
|
48
|
-
}
|
|
49
|
-
if (points.enable_service_charge_usage === 1) {
|
|
50
|
-
storeAmount = parseFloat(storeAmount) + parseFloat(cartObject.service_amount);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
storeAmount = parseFloat(storeAmount).toFixed(2);
|
|
54
42
|
|
|
55
43
|
if (points.redeem_categories && points.redeem_categories != '') {
|
|
56
44
|
itemsTotal = 0;
|
|
@@ -164,7 +164,7 @@ function getCategorySpeificOffer(carts, offer) {
|
|
|
164
164
|
if (offer.oo_offer_type == 'percentage') {
|
|
165
165
|
let itemTotalDiscount = 0
|
|
166
166
|
itemAmount = ((parseFloat(element.item_price) * parseFloat(element.quantity)) * parseFloat(offer.oo_offer_value)) / 100;
|
|
167
|
-
itemTotalDiscount = parseFloat(itemTotalDiscount) + parseFloat(itemAmount)
|
|
167
|
+
itemTotalDiscount = (parseFloat(itemTotalDiscount) + parseFloat(itemAmount)).toFixed(2)
|
|
168
168
|
let itemDiscount = parseFloat(itemAmount).toFixed(2);
|
|
169
169
|
|
|
170
170
|
total = parseFloat(total) + parseFloat(itemDiscount)
|
|
@@ -181,7 +181,7 @@ function getCategorySpeificOffer(carts, offer) {
|
|
|
181
181
|
let modiItemAmount = 0
|
|
182
182
|
modiItemAmount = (((parseFloat(modi.modifier_item_price) * parseFloat(modi.quantity))) * element.quantity * parseFloat(offer.oo_offer_value)) / 100;
|
|
183
183
|
|
|
184
|
-
itemTotalDiscount = parseFloat(itemTotalDiscount) + parseFloat(modiItemAmount)
|
|
184
|
+
itemTotalDiscount = (parseFloat(itemTotalDiscount) + parseFloat(modiItemAmount)).toFixed(2)
|
|
185
185
|
let discount = parseFloat(modiItemAmount).toFixed(2)
|
|
186
186
|
total = parseFloat(total) + parseFloat(discount)
|
|
187
187
|
total = parseFloat(total).toFixed(2);
|
|
@@ -232,7 +232,7 @@ function getCategorySpeificOffer(carts, offer) {
|
|
|
232
232
|
modiItemAmount = ((parseFloat(modi.modifier_item_price) * parseInt(modi.quantity)) * element.quantity) * parseFloat(singlePriceDiscount);
|
|
233
233
|
|
|
234
234
|
modiItemAmount = parseFloat(modiItemAmount).toFixed(2)
|
|
235
|
-
itemTotalDiscount = parseFloat(itemTotalDiscount) + parseFloat(modiItemAmount)
|
|
235
|
+
itemTotalDiscount = (parseFloat(itemTotalDiscount) + parseFloat(modiItemAmount)).toFixed(2)
|
|
236
236
|
total = parseFloat(total) + parseFloat(modiItemAmount)
|
|
237
237
|
total = parseFloat(total).toFixed(2);
|
|
238
238
|
carts.item_details[index].package_items[packageItemIndex].modifiers[modiIndex].promotion_discount = parseFloat(modiItemAmount).toFixed(2)
|
|
@@ -281,7 +281,7 @@ function getCategorySpeificOffer(carts, offer) {
|
|
|
281
281
|
if (offer.oo_offer_type == 'percentage') {
|
|
282
282
|
let itemTotalDiscount = 0
|
|
283
283
|
itemAmount = ((parseFloat(element.item_price) * parseFloat(element.quantity)) * parseFloat(offer.oo_offer_value)) / 100;
|
|
284
|
-
itemTotalDiscount = parseFloat(itemTotalDiscount) + parseFloat(itemAmount)
|
|
284
|
+
itemTotalDiscount = parseFloat(itemTotalDiscount) + parseFloat(itemAmount).toFixed(2)
|
|
285
285
|
let itemDiscount = parseFloat(itemAmount).toFixed(2)
|
|
286
286
|
|
|
287
287
|
total = parseFloat(total) + parseFloat(itemDiscount)
|
|
@@ -295,7 +295,7 @@ function getCategorySpeificOffer(carts, offer) {
|
|
|
295
295
|
let modiItemAmount = 0
|
|
296
296
|
modiItemAmount = (((parseFloat(modi.modifier_item_price) * parseFloat(modi.quantity))) * element.quantity * parseFloat(offer.oo_offer_value)) / 100;
|
|
297
297
|
|
|
298
|
-
itemTotalDiscount = parseFloat(itemTotalDiscount) + parseFloat(modiItemAmount)
|
|
298
|
+
itemTotalDiscount = (parseFloat(itemTotalDiscount) + parseFloat(modiItemAmount)).toFixed(2)
|
|
299
299
|
let discount = parseFloat(modiItemAmount).toFixed(2)
|
|
300
300
|
total = parseFloat(total) + parseFloat(discount)
|
|
301
301
|
total = parseFloat(total).toFixed(2);
|
|
@@ -329,7 +329,7 @@ function getCategorySpeificOffer(carts, offer) {
|
|
|
329
329
|
modiItemAmount = ((parseFloat(modi.modifier_item_price) * parseInt(modi.quantity)) * element.quantity) * parseFloat(singlePriceDiscount);
|
|
330
330
|
|
|
331
331
|
modiItemAmount = parseFloat(modiItemAmount).toFixed(2)
|
|
332
|
-
itemTotalDiscount = parseFloat(itemTotalDiscount) + parseFloat(modiItemAmount)
|
|
332
|
+
itemTotalDiscount = (parseFloat(itemTotalDiscount) + parseFloat(modiItemAmount)).toFixed(2)
|
|
333
333
|
total = parseFloat(total) + parseFloat(modiItemAmount)
|
|
334
334
|
total = parseFloat(total).toFixed(2);
|
|
335
335
|
carts.item_details[index].item_modifiers[modiIndex].promotion_discount = parseFloat(modiItemAmount).toFixed(2)
|
|
@@ -359,7 +359,7 @@ function getCategorySpeificOffer(carts, offer) {
|
|
|
359
359
|
|
|
360
360
|
total = parseFloat(total).toFixed(2)
|
|
361
361
|
|
|
362
|
-
itemTotalDiscount = parseFloat(itemTotalDiscount) + parseFloat(itemAmount)
|
|
362
|
+
itemTotalDiscount = (parseFloat(itemTotalDiscount) + parseFloat(itemAmount)).toFixed(2)
|
|
363
363
|
remaningOfferAmount = remaningOfferAmount - itemAmount
|
|
364
364
|
carts.item_details[index].promotion_discount = (parseFloat(carts.item_details[index].promotion_discount) + parseFloat(itemAmount)).toFixed(2);
|
|
365
365
|
carts.item_details[index].promotion_discount_modifier = (parseFloat(carts.item_details[index].promotion_discount_modifier) + parseFloat(itemAmount)).toFixed(2);
|
|
@@ -376,13 +376,8 @@ function getCategorySpeificOffer(carts, offer) {
|
|
|
376
376
|
let difference = Number(offerAmount) - Number(total)
|
|
377
377
|
difference = parseFloat(difference).toFixed(2)
|
|
378
378
|
difference = Math.abs(difference)
|
|
379
|
-
|
|
380
379
|
if (indexes.length > 0) {
|
|
381
380
|
|
|
382
|
-
// console.log("difference", difference)
|
|
383
|
-
// console.log("total", total)
|
|
384
|
-
// console.log("offerAmount", offerAmount)
|
|
385
|
-
|
|
386
381
|
carts.item_details[indexes[0]].promotion_discount = (Number(total) < Number(offerAmount)) ? parseFloat(carts.item_details[indexes[0]].promotion_discount) + parseFloat(difference) : parseFloat(carts.item_details[indexes[0]].promotion_discount) - difference
|
|
387
382
|
carts.item_details[indexes[0]].promotion_discount = parseFloat(carts.item_details[indexes[0]].promotion_discount).toFixed(2)
|
|
388
383
|
|
|
@@ -394,7 +389,7 @@ function getCategorySpeificOffer(carts, offer) {
|
|
|
394
389
|
total = parseFloat(total).toFixed(2)
|
|
395
390
|
}
|
|
396
391
|
}
|
|
397
|
-
|
|
392
|
+
console.log("total", total)
|
|
398
393
|
carts.discount = total
|
|
399
394
|
resolve(carts);
|
|
400
395
|
}
|
package/index.js
CHANGED
|
@@ -360,9 +360,9 @@ async function calculateTax(inputJSON) {
|
|
|
360
360
|
// "delivery_cost": 0,
|
|
361
361
|
// "service_amount": 0
|
|
362
362
|
// }
|
|
363
|
-
|
|
363
|
+
|
|
364
364
|
// calculateTax(json).then(res=>{
|
|
365
|
-
// console.log(JSON.stringify(res))
|
|
365
|
+
// // console.log(JSON.stringify(res))
|
|
366
366
|
|
|
367
367
|
// const jsonResponse = JSON.stringify(res, null, 2); // Format the JSON with indentation
|
|
368
368
|
// const filePath = path.join(__dirname, 'response.json'); // File path in the same directory
|
|
@@ -378,5 +378,5 @@ async function calculateTax(inputJSON) {
|
|
|
378
378
|
// }).catch(err=>{
|
|
379
379
|
// console.log(err)
|
|
380
380
|
// })
|
|
381
|
-
|
|
381
|
+
|
|
382
382
|
module.exports = { calculateTax }
|
package/package.json
CHANGED
package/response.json
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"status": "success",
|
|
3
|
-
"status_code": 201,
|
|
4
|
-
"message": "Tax calculated successfully with few details missing",
|
|
5
|
-
"missing_optional_fields": [
|
|
6
|
-
"order_type",
|
|
7
|
-
"restaurant_id",
|
|
8
|
-
"branch_id",
|
|
9
|
-
"request_id"
|
|
10
|
-
],
|
|
11
|
-
"data": {
|
|
12
|
-
"order_items": {
|
|
13
|
-
"order_type": "delivery",
|
|
14
|
-
"request_id": "9d63b0f16dda84ec",
|
|
15
|
-
"restaurant_id": 511,
|
|
16
|
-
"brand_id": "7c16f7c1-cec4-11ed-8648-129754d6b903",
|
|
17
|
-
"branch_id": 2808,
|
|
18
|
-
"item_details": [
|
|
19
|
-
{
|
|
20
|
-
"menu_id": 658,
|
|
21
|
-
"item_id": 17361,
|
|
22
|
-
"item_image": "https://res.cloudinary.com/http-foodbot-ai/image/upload/f_auto,q_auto,fl_lossy/v1710223116/prod/menu_item/file1710223116748menu_item_y0adnc.jpg",
|
|
23
|
-
"category_id": 3363,
|
|
24
|
-
"item_price": 120,
|
|
25
|
-
"item_price_with_modifier": 120,
|
|
26
|
-
"quantity": 1,
|
|
27
|
-
"item_modifiers": [],
|
|
28
|
-
"item_display_text": "Chicken Malai Kabab",
|
|
29
|
-
"item_name": "Chicken Malai Kabab",
|
|
30
|
-
"tax_rate": 16,
|
|
31
|
-
"isPackage": 0,
|
|
32
|
-
"package_items": [],
|
|
33
|
-
"actual_price": 120,
|
|
34
|
-
"item_event": "new",
|
|
35
|
-
"tax_id": [
|
|
36
|
-
{
|
|
37
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
"ieps_tax": {
|
|
41
|
-
"status": 0
|
|
42
|
-
},
|
|
43
|
-
"special_instruction": "",
|
|
44
|
-
"item_key": "17361-",
|
|
45
|
-
"promotion_discount_modifier": 0,
|
|
46
|
-
"total_item_price": 120,
|
|
47
|
-
"tax_amount": "0.000000",
|
|
48
|
-
"tax_array": [
|
|
49
|
-
{
|
|
50
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
|
|
51
|
-
"tax_label": "IVA 16%",
|
|
52
|
-
"tax_rate": 16,
|
|
53
|
-
"tax_sequence": 1,
|
|
54
|
-
"base_price_effected": 0,
|
|
55
|
-
"tax_amount": "0.000000",
|
|
56
|
-
"base_price": "0.00",
|
|
57
|
-
"tax_rate_quantity": 0
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
"tax_amount_modifier": "0.000000",
|
|
61
|
-
"total_tax_amount": "0.000000",
|
|
62
|
-
"point_discount_status": true,
|
|
63
|
-
"points_discount": "120.00",
|
|
64
|
-
"points_discount_modifier": 120,
|
|
65
|
-
"promotion_discount": 0
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"menu_id": 658,
|
|
69
|
-
"item_id": 21328,
|
|
70
|
-
"item_image": "https://res.cloudinary.com/http-foodbot-ai/image/upload/f_auto,q_auto,fl_lossy/v1726842156/prod/menu_item/file1726842156041menu_item_iux2iq.jpg",
|
|
71
|
-
"category_id": 3363,
|
|
72
|
-
"item_price": 230,
|
|
73
|
-
"item_price_with_modifier": 240,
|
|
74
|
-
"quantity": 1,
|
|
75
|
-
"item_modifiers": [
|
|
76
|
-
{
|
|
77
|
-
"modifer_cat": 3217,
|
|
78
|
-
"modifier_category_id": 3217,
|
|
79
|
-
"modifier_caetgory_name": "Chicken Modifier",
|
|
80
|
-
"modifier_item_id": 35014,
|
|
81
|
-
"modifier_sequence": "00",
|
|
82
|
-
"modifier_item_price": 10,
|
|
83
|
-
"modifier_item_name": "chciken 01",
|
|
84
|
-
"is_tax_rate_same": 1,
|
|
85
|
-
"ieps_tax": null,
|
|
86
|
-
"tax_rate": 0,
|
|
87
|
-
"quantity": 1,
|
|
88
|
-
"item_id": 21328,
|
|
89
|
-
"tax_id": [
|
|
90
|
-
{
|
|
91
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
|
|
92
|
-
}
|
|
93
|
-
],
|
|
94
|
-
"modifier_trx_id": "51ac-3372-53e9",
|
|
95
|
-
"linked_product": "",
|
|
96
|
-
"price_list_id": "d5f30af5-5d66-4cf0-864b-b2eca45407c4",
|
|
97
|
-
"promotion_discount_modifier": 0,
|
|
98
|
-
"tax_amount": "0.000000",
|
|
99
|
-
"tax_array": [
|
|
100
|
-
{
|
|
101
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
|
|
102
|
-
"tax_label": "IVA 16%",
|
|
103
|
-
"tax_rate": 16,
|
|
104
|
-
"tax_sequence": 1,
|
|
105
|
-
"base_price_effected": 0,
|
|
106
|
-
"tax_amount": "0.000000",
|
|
107
|
-
"base_price": "0.00",
|
|
108
|
-
"tax_rate_quantity": 0
|
|
109
|
-
}
|
|
110
|
-
],
|
|
111
|
-
"points_discount": "10.00"
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
"item_display_text": "Irani Chicken Kebab 02",
|
|
115
|
-
"item_name": "Irani Chicken Kebab 02",
|
|
116
|
-
"tax_rate": 16,
|
|
117
|
-
"isPackage": 0,
|
|
118
|
-
"package_items": [],
|
|
119
|
-
"actual_price": 230,
|
|
120
|
-
"item_event": "new",
|
|
121
|
-
"tax_id": [
|
|
122
|
-
{
|
|
123
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
|
|
124
|
-
}
|
|
125
|
-
],
|
|
126
|
-
"ieps_tax": {
|
|
127
|
-
"status": 0
|
|
128
|
-
},
|
|
129
|
-
"special_instruction": "",
|
|
130
|
-
"item_key": "21328-3217:35014-1",
|
|
131
|
-
"promotion_discount_modifier": 0,
|
|
132
|
-
"total_item_price": 240,
|
|
133
|
-
"tax_amount": "0.000000",
|
|
134
|
-
"tax_array": [
|
|
135
|
-
{
|
|
136
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
|
|
137
|
-
"tax_label": "IVA 16%",
|
|
138
|
-
"tax_rate": 16,
|
|
139
|
-
"tax_sequence": 1,
|
|
140
|
-
"base_price_effected": 0,
|
|
141
|
-
"tax_amount": "0.000000",
|
|
142
|
-
"base_price": "0.00",
|
|
143
|
-
"tax_rate_quantity": 0
|
|
144
|
-
}
|
|
145
|
-
],
|
|
146
|
-
"tax_amount_modifier": "0.000000",
|
|
147
|
-
"total_tax_amount": "0.000000",
|
|
148
|
-
"point_discount_status": true,
|
|
149
|
-
"points_discount": "230.00",
|
|
150
|
-
"points_discount_modifier": "360.00",
|
|
151
|
-
"promotion_discount": 0
|
|
152
|
-
}
|
|
153
|
-
],
|
|
154
|
-
"is_delivery_discount": false,
|
|
155
|
-
"total": "360.00",
|
|
156
|
-
"discount": "0.00",
|
|
157
|
-
"points_redeem_message": "",
|
|
158
|
-
"store_value": "360.00",
|
|
159
|
-
"point_discount_amount": "360.00",
|
|
160
|
-
"points_discount": "360.00",
|
|
161
|
-
"cartTotal": "0.00",
|
|
162
|
-
"tax_amount": "0.000000",
|
|
163
|
-
"merged_tax_array": [
|
|
164
|
-
{
|
|
165
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
|
|
166
|
-
"tax_label": "IVA 16%",
|
|
167
|
-
"tax_rate": 16,
|
|
168
|
-
"tax_sequence": 1,
|
|
169
|
-
"base_price_effected": 0,
|
|
170
|
-
"tax_amount": "0.000000",
|
|
171
|
-
"base_price": "0.000000",
|
|
172
|
-
"tax_rate_quantity": 0
|
|
173
|
-
}
|
|
174
|
-
],
|
|
175
|
-
"cart_total_with_tax": "0.00",
|
|
176
|
-
"sub_total": "0.00",
|
|
177
|
-
"total_after_tax": "0.00",
|
|
178
|
-
"final_amount": "NaN",
|
|
179
|
-
"cash_expected": "NaN",
|
|
180
|
-
"delivery_cost": 0,
|
|
181
|
-
"service_amount": 0
|
|
182
|
-
},
|
|
183
|
-
"tax_settings": [
|
|
184
|
-
{
|
|
185
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
|
|
186
|
-
"tax_label": "IVA 16%",
|
|
187
|
-
"tax_rate": 16,
|
|
188
|
-
"tax_sequence": 1,
|
|
189
|
-
"base_price_effected": 0
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
"tax_id": "21036b00-bdb4-4485-aaba-d088a721a67f",
|
|
193
|
-
"tax_label": "IVA 8%",
|
|
194
|
-
"tax_rate": 8,
|
|
195
|
-
"tax_sequence": 1,
|
|
196
|
-
"base_price_effected": 0
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
"tax_id": "e47296aa-b5ae-449f-ab5f-ff50f43a648a",
|
|
200
|
-
"tax_label": "Sin IVA",
|
|
201
|
-
"tax_rate": 0,
|
|
202
|
-
"tax_sequence": 3,
|
|
203
|
-
"base_price_effected": 0
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
"tax_id": "21036b00-bdb4-4485-aaba-d088a721a67f1",
|
|
207
|
-
"tax_label": "IEPS 8%",
|
|
208
|
-
"tax_rate": 8,
|
|
209
|
-
"tax_sequence": 2,
|
|
210
|
-
"base_price_effected": 0
|
|
211
|
-
}
|
|
212
|
-
],
|
|
213
|
-
"tip_type": "percentage",
|
|
214
|
-
"tip_value": "",
|
|
215
|
-
"tax_type": 2,
|
|
216
|
-
"delivery_cost": 20,
|
|
217
|
-
"service_amount": 0,
|
|
218
|
-
"store_value": "360.00",
|
|
219
|
-
"store_value_without_roundoff": 20500,
|
|
220
|
-
"loyalty_points_details": {
|
|
221
|
-
"points": 410,
|
|
222
|
-
"redeemable": "yes",
|
|
223
|
-
"store_value": 380,
|
|
224
|
-
"redeem_categories": [
|
|
225
|
-
{
|
|
226
|
-
"product_id": "All",
|
|
227
|
-
"category_id": "All"
|
|
228
|
-
}
|
|
229
|
-
],
|
|
230
|
-
"original_store_value": 20500,
|
|
231
|
-
"status": true,
|
|
232
|
-
"points_redeemed": 8,
|
|
233
|
-
"show_purchase": false,
|
|
234
|
-
"point_amount": 380,
|
|
235
|
-
"full_redemption": true,
|
|
236
|
-
"enable_delivery_points_usage": 1
|
|
237
|
-
},
|
|
238
|
-
"user_detais": {
|
|
239
|
-
"member_id": "05361296-42b5-4aa9-a44c-ec57e56c822f",
|
|
240
|
-
"first_name": "JOHN",
|
|
241
|
-
"last_name": "Wix",
|
|
242
|
-
"country_code": "52",
|
|
243
|
-
"created_on": "2025-07-22T06:29:05.189Z",
|
|
244
|
-
"reward_plan_name": "General ",
|
|
245
|
-
"reward_plan_id": 66,
|
|
246
|
-
"calling_code": "52",
|
|
247
|
-
"name": "JOHN Wix"
|
|
248
|
-
},
|
|
249
|
-
"discount": "0.00",
|
|
250
|
-
"final_amount": 0,
|
|
251
|
-
"cash_expected": 0,
|
|
252
|
-
"tip_amount": "0.00"
|
|
253
|
-
}
|
|
254
|
-
}
|
package/sampleInput.json
DELETED
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"order_items": {
|
|
3
|
-
"order_type": "delivery",
|
|
4
|
-
"request_id": "9d63b0f16dda84ec",
|
|
5
|
-
"restaurant_id": 511,
|
|
6
|
-
"brand_id": "7c16f7c1-cec4-11ed-8648-129754d6b903",
|
|
7
|
-
"branch_id": 2808,
|
|
8
|
-
"item_details": [
|
|
9
|
-
{
|
|
10
|
-
"menu_id": 658,
|
|
11
|
-
"item_id": 17361,
|
|
12
|
-
"item_image": "https://res.cloudinary.com/http-foodbot-ai/image/upload/f_auto,q_auto,fl_lossy/v1710223116/prod/menu_item/file1710223116748menu_item_y0adnc.jpg",
|
|
13
|
-
"category_id": 3363,
|
|
14
|
-
"item_price": 120,
|
|
15
|
-
"item_price_with_modifier": 120,
|
|
16
|
-
"quantity": 1,
|
|
17
|
-
"item_modifiers": [],
|
|
18
|
-
"item_display_text": "Chicken Malai Kabab",
|
|
19
|
-
"item_name": "Chicken Malai Kabab",
|
|
20
|
-
"tax_rate": 16,
|
|
21
|
-
"isPackage": 0,
|
|
22
|
-
"package_items": [],
|
|
23
|
-
"actual_price": 120,
|
|
24
|
-
"item_event": "new",
|
|
25
|
-
"tax_id": [
|
|
26
|
-
{
|
|
27
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
|
-
"ieps_tax": {
|
|
31
|
-
"status": 0
|
|
32
|
-
},
|
|
33
|
-
"special_instruction": "",
|
|
34
|
-
"item_key": "17361-",
|
|
35
|
-
"promotion_discount_modifier": 0,
|
|
36
|
-
"total_item_price": 120,
|
|
37
|
-
"point_discount_status": true,
|
|
38
|
-
"points_discount": "120.00",
|
|
39
|
-
"points_discount_modifier": 120,
|
|
40
|
-
"tax_amount": "0.000000",
|
|
41
|
-
"tax_array": [
|
|
42
|
-
{
|
|
43
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
|
|
44
|
-
"tax_label": "IVA 16%",
|
|
45
|
-
"tax_rate": 16,
|
|
46
|
-
"tax_sequence": 1,
|
|
47
|
-
"base_price_effected": 0,
|
|
48
|
-
"tax_amount": "0.000000",
|
|
49
|
-
"base_price": "0.00",
|
|
50
|
-
"tax_rate_quantity": 0
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
"tax_amount_modifier": "0.000000",
|
|
54
|
-
"total_tax_amount": "0.000000",
|
|
55
|
-
"promotion_discount": 0
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"menu_id": 658,
|
|
59
|
-
"item_id": 21328,
|
|
60
|
-
"item_image": "https://res.cloudinary.com/http-foodbot-ai/image/upload/f_auto,q_auto,fl_lossy/v1726842156/prod/menu_item/file1726842156041menu_item_iux2iq.jpg",
|
|
61
|
-
"category_id": 3363,
|
|
62
|
-
"item_price": 230,
|
|
63
|
-
"item_price_with_modifier": 240,
|
|
64
|
-
"quantity": 1,
|
|
65
|
-
"item_modifiers": [
|
|
66
|
-
{
|
|
67
|
-
"modifer_cat": 3217,
|
|
68
|
-
"modifier_category_id": 3217,
|
|
69
|
-
"modifier_caetgory_name": "Chicken Modifier",
|
|
70
|
-
"modifier_item_id": 35014,
|
|
71
|
-
"modifier_sequence": "00",
|
|
72
|
-
"modifier_item_price": 10,
|
|
73
|
-
"modifier_item_name": "chciken 01",
|
|
74
|
-
"is_tax_rate_same": 1,
|
|
75
|
-
"ieps_tax": null,
|
|
76
|
-
"tax_rate": 0,
|
|
77
|
-
"quantity": 1,
|
|
78
|
-
"item_id": 21328,
|
|
79
|
-
"tax_id": [
|
|
80
|
-
{
|
|
81
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
"modifier_trx_id": "51ac-3372-53e9",
|
|
85
|
-
"linked_product": "",
|
|
86
|
-
"price_list_id": "d5f30af5-5d66-4cf0-864b-b2eca45407c4",
|
|
87
|
-
"promotion_discount_modifier": 0,
|
|
88
|
-
"points_discount": "10.00",
|
|
89
|
-
"tax_amount": "0.000000",
|
|
90
|
-
"tax_array": [
|
|
91
|
-
{
|
|
92
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
|
|
93
|
-
"tax_label": "IVA 16%",
|
|
94
|
-
"tax_rate": 16,
|
|
95
|
-
"tax_sequence": 1,
|
|
96
|
-
"base_price_effected": 0,
|
|
97
|
-
"tax_amount": "0.000000",
|
|
98
|
-
"base_price": "0.00",
|
|
99
|
-
"tax_rate_quantity": 0
|
|
100
|
-
}
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
"item_display_text": "Irani Chicken Kebab 02",
|
|
105
|
-
"item_name": "Irani Chicken Kebab 02",
|
|
106
|
-
"tax_rate": 16,
|
|
107
|
-
"isPackage": 0,
|
|
108
|
-
"package_items": [],
|
|
109
|
-
"actual_price": 230,
|
|
110
|
-
"item_event": "new",
|
|
111
|
-
"tax_id": [
|
|
112
|
-
{
|
|
113
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
|
|
114
|
-
}
|
|
115
|
-
],
|
|
116
|
-
"ieps_tax": {
|
|
117
|
-
"status": 0
|
|
118
|
-
},
|
|
119
|
-
"special_instruction": "",
|
|
120
|
-
"item_key": "21328-3217:35014-1",
|
|
121
|
-
"promotion_discount_modifier": 0,
|
|
122
|
-
"total_item_price": 240,
|
|
123
|
-
"point_discount_status": true,
|
|
124
|
-
"points_discount": "230.00",
|
|
125
|
-
"points_discount_modifier": "380.00",
|
|
126
|
-
"tax_amount": "0.000000",
|
|
127
|
-
"tax_array": [
|
|
128
|
-
{
|
|
129
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
|
|
130
|
-
"tax_label": "IVA 16%",
|
|
131
|
-
"tax_rate": 16,
|
|
132
|
-
"tax_sequence": 1,
|
|
133
|
-
"base_price_effected": 0,
|
|
134
|
-
"tax_amount": "0.000000",
|
|
135
|
-
"base_price": "0.00",
|
|
136
|
-
"tax_rate_quantity": 0
|
|
137
|
-
}
|
|
138
|
-
],
|
|
139
|
-
"tax_amount_modifier": "0.000000",
|
|
140
|
-
"total_tax_amount": "0.000000",
|
|
141
|
-
"promotion_discount": 0
|
|
142
|
-
}
|
|
143
|
-
],
|
|
144
|
-
"is_delivery_discount": false,
|
|
145
|
-
"total": "380.00",
|
|
146
|
-
"discount": "0.00",
|
|
147
|
-
"points_redeem_message": "",
|
|
148
|
-
"store_value": "380.00",
|
|
149
|
-
"point_discount_amount": "380.00",
|
|
150
|
-
"points_discount": "380.00",
|
|
151
|
-
"cartTotal": "0.00",
|
|
152
|
-
"tax_amount": "0.000000",
|
|
153
|
-
"merged_tax_array": [
|
|
154
|
-
{
|
|
155
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
|
|
156
|
-
"tax_label": "IVA 16%",
|
|
157
|
-
"tax_rate": 16,
|
|
158
|
-
"tax_sequence": 1,
|
|
159
|
-
"base_price_effected": 0,
|
|
160
|
-
"tax_amount": "0.000000",
|
|
161
|
-
"base_price": "0.000000",
|
|
162
|
-
"tax_rate_quantity": 0
|
|
163
|
-
}
|
|
164
|
-
],
|
|
165
|
-
"cart_total_with_tax": "0.00",
|
|
166
|
-
"sub_total": "0.00",
|
|
167
|
-
"total_after_tax": "0.00",
|
|
168
|
-
"final_amount": "NaN",
|
|
169
|
-
"cash_expected": "NaN"
|
|
170
|
-
},
|
|
171
|
-
"tax_settings": [
|
|
172
|
-
{
|
|
173
|
-
"tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
|
|
174
|
-
"tax_label": "IVA 16%",
|
|
175
|
-
"tax_rate": 16,
|
|
176
|
-
"tax_sequence": 1,
|
|
177
|
-
"base_price_effected": 0
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
"tax_id": "21036b00-bdb4-4485-aaba-d088a721a67f",
|
|
181
|
-
"tax_label": "IVA 8%",
|
|
182
|
-
"tax_rate": 8,
|
|
183
|
-
"tax_sequence": 1,
|
|
184
|
-
"base_price_effected": 0
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
"tax_id": "e47296aa-b5ae-449f-ab5f-ff50f43a648a",
|
|
188
|
-
"tax_label": "Sin IVA",
|
|
189
|
-
"tax_rate": 0,
|
|
190
|
-
"tax_sequence": 3,
|
|
191
|
-
"base_price_effected": 0
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
"tax_id": "21036b00-bdb4-4485-aaba-d088a721a67f1",
|
|
195
|
-
"tax_label": "IEPS 8%",
|
|
196
|
-
"tax_rate": 8,
|
|
197
|
-
"tax_sequence": 2,
|
|
198
|
-
"base_price_effected": 0
|
|
199
|
-
}
|
|
200
|
-
],
|
|
201
|
-
"tip_type": "percentage",
|
|
202
|
-
"tip_value": "",
|
|
203
|
-
"tax_type": 2,
|
|
204
|
-
"delivery_cost": 20,
|
|
205
|
-
"service_amount": 0,
|
|
206
|
-
"store_value": "380.00",
|
|
207
|
-
"store_value_without_roundoff": 20500,
|
|
208
|
-
"loyalty_points_details": {
|
|
209
|
-
"points": 410,
|
|
210
|
-
"redeemable": "yes",
|
|
211
|
-
"store_value": 380,
|
|
212
|
-
"redeem_categories": [
|
|
213
|
-
{
|
|
214
|
-
"product_id": "All",
|
|
215
|
-
"category_id": "All"
|
|
216
|
-
}
|
|
217
|
-
],
|
|
218
|
-
"original_store_value": 20500,
|
|
219
|
-
"status": true,
|
|
220
|
-
"points_redeemed": 8,
|
|
221
|
-
"show_purchase": false,
|
|
222
|
-
"point_amount": 380,
|
|
223
|
-
"full_redemption": true,
|
|
224
|
-
"enable_delivery_points_usage": 1,
|
|
225
|
-
"enable_service_charge_usage": 0
|
|
226
|
-
},
|
|
227
|
-
"user_detais": {
|
|
228
|
-
"member_id": "05361296-42b5-4aa9-a44c-ec57e56c822f",
|
|
229
|
-
"first_name": "JOHN",
|
|
230
|
-
"last_name": "Wix",
|
|
231
|
-
"country_code": "52",
|
|
232
|
-
"created_on": "2025-07-22T06:29:05.189Z",
|
|
233
|
-
"reward_plan_name": "General ",
|
|
234
|
-
"reward_plan_id": 66,
|
|
235
|
-
"calling_code": "52",
|
|
236
|
-
"name": "JOHN Wix"
|
|
237
|
-
},
|
|
238
|
-
"discount": "0.00",
|
|
239
|
-
"final_amount": 20,
|
|
240
|
-
"cash_expected": 20,
|
|
241
|
-
"tip_amount": "0.00"
|
|
242
|
-
}
|