foodbot-cart-calculations 1.0.45 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foodbot-cart-calculations",
3
- "version": "1.0.45",
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": {
package/response.json DELETED
@@ -1,239 +0,0 @@
1
- {
2
- "status": "success",
3
- "status_code": 200,
4
- "message": "Tax calculated successfully",
5
- "data": {
6
- "order_type": "delivery",
7
- "request_id": "259629f21a457bb4",
8
- "restaurant_id": 1158,
9
- "brand_id": "18f3f889-5f82-4268-9340-61ffac64d30a",
10
- "branch_id": 3168,
11
- "order_items": {
12
- "item_details": [
13
- {
14
- "menu_id": 662,
15
- "item_id": 21239,
16
- "item_image": "https://res.cloudinary.com/http-foodbot-ai/image/upload/f_auto,q_auto,fl_lossy/v1724495427/prod/menu_item/file1724495427370menu_item_pbh8lf.jpg",
17
- "category_id": 3888,
18
- "item_price": 145,
19
- "item_price_with_modifier": 145,
20
- "quantity": 1,
21
- "item_modifiers": [
22
- {
23
- "modifer_cat": 5040,
24
- "modifier_category_id": 5040,
25
- "modifier_caetgory_name": "Elige tu base ",
26
- "modifier_item_id": 30321,
27
- "modifier_sequence": "00",
28
- "modifier_item_price": 0,
29
- "modifier_item_name": "Arroz spicy",
30
- "is_tax_rate_same": 1,
31
- "ieps_tax": null,
32
- "tax_rate": 0,
33
- "quantity": 1,
34
- "item_id": 21239,
35
- "tax_id": [
36
- {
37
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
38
- }
39
- ],
40
- "modifier_trx_id": "4052-4d0e-b968",
41
- "linked_product": "",
42
- "price_list_id": "2e6524d5-803e-4839-933b-758d16457bd1",
43
- "promotion_discount_modifier": 0,
44
- "tax_amount": "0.000000",
45
- "tax_array": [
46
- {
47
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
48
- "tax_label": "IVA 16%",
49
- "tax_rate": 16,
50
- "tax_sequence": 1,
51
- "base_price_effected": 0,
52
- "tax_amount": "0.000000",
53
- "base_price": "0.00",
54
- "tax_rate_quantity": 0
55
- }
56
- ],
57
- "points_discount": "0.00"
58
- },
59
- {
60
- "modifer_cat": 5045,
61
- "modifier_category_id": 5045,
62
- "modifier_caetgory_name": "Elige tu salsa",
63
- "modifier_item_id": 30331,
64
- "modifier_sequence": "10",
65
- "modifier_item_price": 0,
66
- "modifier_item_name": "Salsa Schezwan",
67
- "is_tax_rate_same": 1,
68
- "ieps_tax": null,
69
- "tax_rate": 0,
70
- "quantity": 1,
71
- "item_id": 21239,
72
- "tax_id": [
73
- {
74
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
75
- }
76
- ],
77
- "modifier_trx_id": "6681-4517-48a6",
78
- "linked_product": "",
79
- "price_list_id": "2e6524d5-803e-4839-933b-758d16457bd1",
80
- "promotion_discount_modifier": 0,
81
- "tax_amount": "0.000000",
82
- "tax_array": [
83
- {
84
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
85
- "tax_label": "IVA 16%",
86
- "tax_rate": 16,
87
- "tax_sequence": 1,
88
- "base_price_effected": 0,
89
- "tax_amount": "0.000000",
90
- "base_price": "0.00",
91
- "tax_rate_quantity": 0
92
- }
93
- ],
94
- "points_discount": "0.00"
95
- }
96
- ],
97
- "item_display_text": "Beef n' broccoli",
98
- "item_name": "Beef n' broccoli",
99
- "tax_rate": 16,
100
- "isPackage": 0,
101
- "package_items": [],
102
- "actual_price": 145,
103
- "item_event": "new",
104
- "tax_id": [
105
- {
106
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
107
- }
108
- ],
109
- "ieps_tax": {
110
- "status": 0
111
- },
112
- "special_instruction": "",
113
- "item_key": "21239-5040:30321-1|5045:30331-1",
114
- "promotion_discount_modifier": 0,
115
- "total_item_price": 145,
116
- "tax_amount": "0.000000",
117
- "tax_array": [
118
- {
119
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
120
- "tax_label": "IVA 16%",
121
- "tax_rate": 16,
122
- "tax_sequence": 1,
123
- "base_price_effected": 0,
124
- "tax_amount": "0.000000",
125
- "base_price": "0.00",
126
- "tax_rate_quantity": 0
127
- }
128
- ],
129
- "tax_amount_modifier": "0.000000",
130
- "total_tax_amount": "0.000000",
131
- "point_discount_status": true,
132
- "points_discount": "180.00",
133
- "points_discount_modifier": "180.00",
134
- "promotion_discount": 0
135
- }
136
- ],
137
- "is_delivery_discount": true,
138
- "total": "145.00",
139
- "discount": "0.00",
140
- "points_redeem_message": "",
141
- "store_value": 180,
142
- "point_discount_amount": 180,
143
- "points_discount": 180,
144
- "cartTotal": "0.00",
145
- "tax_amount": "0.000000",
146
- "merged_tax_array": [
147
- {
148
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
149
- "tax_label": "IVA 16%",
150
- "tax_rate": 16,
151
- "tax_sequence": 1,
152
- "base_price_effected": 0,
153
- "tax_amount": "0.000000",
154
- "base_price": "0.000000",
155
- "tax_rate_quantity": 0
156
- }
157
- ],
158
- "cart_total_with_tax": "0.00",
159
- "sub_total": "0.00",
160
- "total_after_tax": "0.00",
161
- "final_amount": "NaN",
162
- "cash_expected": "NaN",
163
- "delivery_discount": "35.00",
164
- "service_discount": 0,
165
- "is_service_discount": false
166
- },
167
- "tax_settings": [
168
- {
169
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
170
- "tax_label": "IVA 16%",
171
- "tax_rate": 16,
172
- "tax_sequence": 1,
173
- "base_price_effected": 0
174
- },
175
- {
176
- "tax_id": "21036b00-bdb4-4485-aaba-d088a721a67f",
177
- "tax_label": "IVA 8%",
178
- "tax_rate": 8,
179
- "tax_sequence": 1,
180
- "base_price_effected": 0
181
- },
182
- {
183
- "tax_id": "e47296aa-b5ae-449f-ab5f-ff50f43a648a",
184
- "tax_label": "Sin IVA",
185
- "tax_rate": 0,
186
- "tax_sequence": 3,
187
- "base_price_effected": 0
188
- },
189
- {
190
- "tax_id": "21036b00-bdb4-4485-aaba-d088a721a67f1",
191
- "tax_label": "IEPS 8%",
192
- "tax_rate": 8,
193
- "tax_sequence": 2,
194
- "base_price_effected": 0
195
- }
196
- ],
197
- "tip_type": "absolute",
198
- "tip_value": 0,
199
- "tax_type": 2,
200
- "delivery_cost": 5,
201
- "service_amount": "10",
202
- "store_value": 180,
203
- "store_value_without_roundoff": 406,
204
- "loyalty_points_details": {
205
- "points": 406,
206
- "redeemable": "yes",
207
- "store_value": 180,
208
- "redeem_categories": [
209
- {
210
- "product_id": "All",
211
- "category_id": "All"
212
- }
213
- ],
214
- "original_store_value": 406,
215
- "status": true,
216
- "points_redeemed": 180,
217
- "show_purchase": false,
218
- "point_amount": 180,
219
- "full_redemption": true,
220
- "enable_delivery_points_usage": 1,
221
- "enable_service_charge_usage": 1
222
- },
223
- "user_detais": {
224
- "member_id": "35a7920d-653c-4156-9fbd-0c2d6f00629f",
225
- "first_name": "Spider",
226
- "last_name": "Man",
227
- "country_code": "52",
228
- "created_on": "2025-07-28T12:30:57.280Z",
229
- "reward_plan_name": "Refer Plan new test",
230
- "reward_plan_id": 14,
231
- "calling_code": "52",
232
- "name": "Spider Man"
233
- },
234
- "discount": "0.00",
235
- "final_amount": 15,
236
- "cash_expected": 15,
237
- "tip_amount": "0.00"
238
- }
239
- }
package/sampleInput.json DELETED
@@ -1,231 +0,0 @@
1
- {
2
- "order_type": "delivery",
3
- "request_id": "259629f21a457bb4",
4
- "restaurant_id": 1158,
5
- "brand_id": "18f3f889-5f82-4268-9340-61ffac64d30a",
6
- "branch_id": 3168,
7
- "order_items": {
8
- "item_details": [
9
- {
10
- "menu_id": 662,
11
- "item_id": 21239,
12
- "item_image": "https://res.cloudinary.com/http-foodbot-ai/image/upload/f_auto,q_auto,fl_lossy/v1724495427/prod/menu_item/file1724495427370menu_item_pbh8lf.jpg",
13
- "category_id": 3888,
14
- "item_price": 145,
15
- "item_price_with_modifier": 145,
16
- "quantity": 1,
17
- "item_modifiers": [
18
- {
19
- "modifer_cat": 5040,
20
- "modifier_category_id": 5040,
21
- "modifier_caetgory_name": "Elige tu base ",
22
- "modifier_item_id": 30321,
23
- "modifier_sequence": "00",
24
- "modifier_item_price": 0,
25
- "modifier_item_name": "Arroz spicy",
26
- "is_tax_rate_same": 1,
27
- "ieps_tax": null,
28
- "tax_rate": 0,
29
- "quantity": 1,
30
- "item_id": 21239,
31
- "tax_id": [
32
- {
33
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
34
- }
35
- ],
36
- "modifier_trx_id": "4052-4d0e-b968",
37
- "linked_product": "",
38
- "price_list_id": "2e6524d5-803e-4839-933b-758d16457bd1",
39
- "promotion_discount_modifier": 0,
40
- "points_discount": "0.00",
41
- "tax_amount": "0.000000",
42
- "tax_array": [
43
- {
44
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
45
- "tax_label": "IVA 16%",
46
- "tax_rate": 16,
47
- "tax_sequence": 1,
48
- "base_price_effected": 0,
49
- "tax_amount": "0.000000",
50
- "base_price": "0.00",
51
- "tax_rate_quantity": 0
52
- }
53
- ]
54
- },
55
- {
56
- "modifer_cat": 5045,
57
- "modifier_category_id": 5045,
58
- "modifier_caetgory_name": "Elige tu salsa",
59
- "modifier_item_id": 30331,
60
- "modifier_sequence": "10",
61
- "modifier_item_price": 0,
62
- "modifier_item_name": "Salsa Schezwan",
63
- "is_tax_rate_same": 1,
64
- "ieps_tax": null,
65
- "tax_rate": 0,
66
- "quantity": 1,
67
- "item_id": 21239,
68
- "tax_id": [
69
- {
70
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
71
- }
72
- ],
73
- "modifier_trx_id": "6681-4517-48a6",
74
- "linked_product": "",
75
- "price_list_id": "2e6524d5-803e-4839-933b-758d16457bd1",
76
- "promotion_discount_modifier": 0,
77
- "points_discount": "0.00",
78
- "tax_amount": "0.000000",
79
- "tax_array": [
80
- {
81
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
82
- "tax_label": "IVA 16%",
83
- "tax_rate": 16,
84
- "tax_sequence": 1,
85
- "base_price_effected": 0,
86
- "tax_amount": "0.000000",
87
- "base_price": "0.00",
88
- "tax_rate_quantity": 0
89
- }
90
- ]
91
- }
92
- ],
93
- "item_display_text": "Beef n' broccoli",
94
- "item_name": "Beef n' broccoli",
95
- "tax_rate": 16,
96
- "isPackage": 0,
97
- "package_items": [],
98
- "actual_price": 145,
99
- "item_event": "new",
100
- "tax_id": [
101
- {
102
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021"
103
- }
104
- ],
105
- "ieps_tax": {
106
- "status": 0
107
- },
108
- "special_instruction": "",
109
- "item_key": "21239-5040:30321-1|5045:30331-1",
110
- "promotion_discount_modifier": 0,
111
- "total_item_price": 145,
112
- "point_discount_status": true,
113
- "points_discount": "145.00",
114
- "points_discount_modifier": "145.00",
115
- "tax_amount": "0.000000",
116
- "tax_array": [
117
- {
118
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
119
- "tax_label": "IVA 16%",
120
- "tax_rate": 16,
121
- "tax_sequence": 1,
122
- "base_price_effected": 0,
123
- "tax_amount": "0.000000",
124
- "base_price": "0.00",
125
- "tax_rate_quantity": 0
126
- }
127
- ],
128
- "tax_amount_modifier": "0.000000",
129
- "total_tax_amount": "0.000000",
130
- "promotion_discount": 0
131
- }
132
- ],
133
- "is_delivery_discount": false,
134
- "total": "145.00",
135
- "discount": "0.00",
136
- "points_redeem_message": "",
137
- "store_value": "145.00",
138
- "point_discount_amount": "145.00",
139
- "points_discount": "145.00",
140
- "cartTotal": "0.00",
141
- "tax_amount": "0.000000",
142
- "merged_tax_array": [
143
- {
144
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
145
- "tax_label": "IVA 16%",
146
- "tax_rate": 16,
147
- "tax_sequence": 1,
148
- "base_price_effected": 0,
149
- "tax_amount": "0.000000",
150
- "base_price": "0.000000",
151
- "tax_rate_quantity": 0
152
- }
153
- ],
154
- "cart_total_with_tax": "0.00",
155
- "sub_total": "0.00",
156
- "total_after_tax": "0.00",
157
- "final_amount": "NaN",
158
- "cash_expected": "NaN"
159
- },
160
- "tax_settings": [
161
- {
162
- "tax_id": "425a195c-3b37-11ed-af0e-42010ad46021",
163
- "tax_label": "IVA 16%",
164
- "tax_rate": 16,
165
- "tax_sequence": 1,
166
- "base_price_effected": 0
167
- },
168
- {
169
- "tax_id": "21036b00-bdb4-4485-aaba-d088a721a67f",
170
- "tax_label": "IVA 8%",
171
- "tax_rate": 8,
172
- "tax_sequence": 1,
173
- "base_price_effected": 0
174
- },
175
- {
176
- "tax_id": "e47296aa-b5ae-449f-ab5f-ff50f43a648a",
177
- "tax_label": "Sin IVA",
178
- "tax_rate": 0,
179
- "tax_sequence": 3,
180
- "base_price_effected": 0
181
- },
182
- {
183
- "tax_id": "21036b00-bdb4-4485-aaba-d088a721a67f1",
184
- "tax_label": "IEPS 8%",
185
- "tax_rate": 8,
186
- "tax_sequence": 2,
187
- "base_price_effected": 0
188
- }
189
- ],
190
- "tip_type": "absolute",
191
- "tip_value": 0,
192
- "tax_type": 2,
193
- "delivery_cost": "40",
194
- "service_amount": "10",
195
- "store_value": "150.00",
196
- "store_value_without_roundoff": 406,
197
- "loyalty_points_details": {
198
- "points": 406,
199
- "redeemable": "yes",
200
- "store_value": 150,
201
- "redeem_categories": [
202
- {
203
- "product_id": "All",
204
- "category_id": "All"
205
- }
206
- ],
207
- "original_store_value": 406,
208
- "status": true,
209
- "points_redeemed": 150,
210
- "show_purchase": false,
211
- "point_amount": 150,
212
- "full_redemption": true,
213
- "enable_delivery_points_usage": 1,
214
- "enable_service_charge_usage": 1
215
- },
216
- "user_detais": {
217
- "member_id": "35a7920d-653c-4156-9fbd-0c2d6f00629f",
218
- "first_name": "Spider",
219
- "last_name": "Man",
220
- "country_code": "52",
221
- "created_on": "2025-07-28T12:30:57.280Z",
222
- "reward_plan_name": "Refer Plan new test",
223
- "reward_plan_id": 14,
224
- "calling_code": "52",
225
- "name": "Spider Man"
226
- },
227
- "discount": "0.00",
228
- "final_amount": 50,
229
- "cash_expected": 50,
230
- "tip_amount": "0.00"
231
- }