washday-sdk 1.0.2 → 1.1.0

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.
Files changed (254) hide show
  1. package/README.md +126 -0
  2. package/babel.config.js +8 -0
  3. package/dist/api/attendance/delete.js +2 -0
  4. package/dist/api/attendance/get.js +83 -0
  5. package/dist/api/attendance/index.js +4 -0
  6. package/dist/api/attendance/post.js +39 -0
  7. package/dist/api/attendance/put.js +25 -0
  8. package/dist/api/auth/index.js +3 -0
  9. package/dist/api/auth/post.js +170 -0
  10. package/dist/api/axiosInstance.js +15 -11
  11. package/dist/api/cashierbox/delete.js +40 -0
  12. package/dist/api/cashierbox/get.js +63 -0
  13. package/dist/api/cashierbox/post.js +42 -0
  14. package/dist/api/cashierbox/put.js +42 -0
  15. package/dist/api/cashups/delete.js +25 -0
  16. package/dist/api/cashups/get.js +60 -0
  17. package/dist/api/cashups/index.js +4 -0
  18. package/dist/api/cashups/post.js +25 -0
  19. package/dist/api/cashups/put.js +52 -0
  20. package/dist/api/cfdi/delete.js +25 -0
  21. package/dist/api/cfdi/get.js +126 -0
  22. package/dist/api/cfdi/index.js +4 -0
  23. package/dist/api/cfdi/post.js +41 -0
  24. package/dist/api/cfdi/put.js +52 -0
  25. package/dist/api/companies/get.js +29 -0
  26. package/dist/api/companies/post.js +41 -0
  27. package/dist/api/companies/put.js +57 -0
  28. package/dist/api/countries/get.js +29 -0
  29. package/dist/api/countries/post.js +1 -0
  30. package/dist/api/countries/put.js +1 -0
  31. package/dist/api/csv/get.js +325 -0
  32. package/dist/api/csv/index.js +1 -0
  33. package/dist/api/customers/delete.js +40 -0
  34. package/dist/api/customers/get.js +75 -20
  35. package/dist/api/customers/index.js +4 -1
  36. package/dist/api/customers/post.js +41 -0
  37. package/dist/api/customers/put.js +52 -0
  38. package/dist/api/discounts/get.js +120 -0
  39. package/dist/api/discounts/post.js +40 -0
  40. package/dist/api/discounts/put.js +68 -0
  41. package/dist/api/index.js +316 -8
  42. package/dist/api/inventory/delete.js +26 -0
  43. package/dist/api/inventory/get.js +62 -0
  44. package/dist/api/inventory/index.js +4 -0
  45. package/dist/api/inventory/post.js +26 -0
  46. package/dist/api/inventory/put.js +41 -0
  47. package/dist/api/order/delete.js +40 -0
  48. package/dist/api/order/get.js +181 -0
  49. package/dist/api/order/index.js +4 -0
  50. package/dist/api/order/post.js +115 -0
  51. package/dist/api/order/put.js +202 -0
  52. package/dist/api/outsourcedOrders/delete.js +25 -0
  53. package/dist/api/outsourcedOrders/get.js +62 -0
  54. package/dist/api/outsourcedOrders/index.js +4 -0
  55. package/dist/api/outsourcedOrders/post.js +25 -0
  56. package/dist/api/outsourcedOrders/put.js +25 -0
  57. package/dist/api/partners/delete.js +25 -0
  58. package/dist/api/partners/get.js +40 -0
  59. package/dist/api/partners/index.js +4 -0
  60. package/dist/api/partners/post.js +25 -0
  61. package/dist/api/partners/put.js +25 -0
  62. package/dist/api/pdf/get.js +43 -0
  63. package/dist/api/pdf/index.js +1 -0
  64. package/dist/api/products/delete.js +40 -0
  65. package/dist/api/products/get.js +25 -0
  66. package/dist/api/products/index.js +4 -0
  67. package/dist/api/products/post.js +60 -0
  68. package/dist/api/products/put.js +40 -0
  69. package/dist/api/publics/get.js +26 -0
  70. package/dist/api/publics/index.js +1 -0
  71. package/dist/api/reports/get.js +303 -0
  72. package/dist/api/reports/index.js +1 -0
  73. package/dist/api/reviews/delete.js +15 -0
  74. package/dist/api/reviews/get.js +41 -0
  75. package/dist/api/reviews/index.js +4 -0
  76. package/dist/api/reviews/post.js +20 -0
  77. package/dist/api/reviews/put.js +52 -0
  78. package/dist/api/routes/delete.js +25 -0
  79. package/dist/api/routes/get.js +95 -0
  80. package/dist/api/routes/index.js +4 -0
  81. package/dist/api/routes/post.js +67 -0
  82. package/dist/api/routes/put.js +54 -0
  83. package/dist/api/sections/delete.js +25 -0
  84. package/dist/api/sections/get.js +71 -0
  85. package/dist/api/sections/index.js +4 -0
  86. package/dist/api/sections/post.js +26 -0
  87. package/dist/api/sections/put.js +25 -0
  88. package/dist/api/staff/delete.js +26 -0
  89. package/dist/api/staff/get.js +40 -0
  90. package/dist/api/staff/post.js +26 -0
  91. package/dist/api/staff/put.js +26 -0
  92. package/dist/api/stores/get.js +110 -0
  93. package/dist/api/stores/post.js +61 -0
  94. package/dist/api/stores/put.js +44 -0
  95. package/dist/api/stripe/get.js +1 -0
  96. package/dist/api/stripe/post.js +71 -0
  97. package/dist/api/stripe/put.js +1 -0
  98. package/dist/api/supplies/delete.js +26 -0
  99. package/dist/api/supplies/get.js +62 -0
  100. package/dist/api/supplies/post.js +26 -0
  101. package/dist/api/supplies/put.js +41 -0
  102. package/dist/api/users/delete.js +26 -0
  103. package/dist/api/users/post.js +25 -0
  104. package/dist/api/users/put.js +29 -0
  105. package/dist/enum/index.js +12 -7
  106. package/dist/index.js +3 -33
  107. package/dist/interfaces/Api.js +1 -3
  108. package/dist/interfaces/Apple.js +16 -0
  109. package/dist/interfaces/Attendance.js +1 -0
  110. package/dist/interfaces/Customer.js +1 -2
  111. package/dist/interfaces/Order.js +1 -2
  112. package/dist/interfaces/Permission.js +1 -2
  113. package/dist/interfaces/Product.js +1 -2
  114. package/dist/interfaces/Section.js +1 -2
  115. package/dist/interfaces/Store.js +1 -2
  116. package/dist/interfaces/StoreImage.js +1 -2
  117. package/dist/interfaces/User.js +1 -2
  118. package/dist/utils/apiUtils.js +9 -0
  119. package/dist/utils/index.js +2 -17
  120. package/dist/utils/orders/calculateOrderTotal.js +30 -21
  121. package/dist/utils/orders/calculateTotalTaxesIncluded.js +55 -29
  122. package/dist/utils/orders/calculateTotalTaxesOverPrice.js +56 -45
  123. package/dist/utils/orders/helpers.js +126 -17
  124. package/dist/utils/orders/index.js +3 -5
  125. package/dist/utils/receipt/generateReceiptHTML.js +157 -0
  126. package/dist/utils/util.js +63 -0
  127. package/docs/README.md +66 -0
  128. package/docs/examples/common-use-cases.md +487 -0
  129. package/docs/getting-started.md +237 -0
  130. package/docs/modules/attendance.md +404 -0
  131. package/jest.config.js +0 -0
  132. package/package.json +12 -4
  133. package/src/api/attendance/delete.ts +1 -0
  134. package/src/api/attendance/get.ts +81 -0
  135. package/src/api/attendance/index.ts +4 -0
  136. package/src/api/attendance/post.ts +37 -0
  137. package/src/api/attendance/put.ts +20 -0
  138. package/src/api/auth/index.ts +3 -0
  139. package/src/api/auth/post.ts +198 -0
  140. package/src/api/axiosInstance.ts +13 -3
  141. package/src/api/cashierbox/delete.ts +28 -0
  142. package/src/api/cashierbox/get.ts +53 -0
  143. package/src/api/cashierbox/post.ts +39 -0
  144. package/src/api/cashierbox/put.ts +32 -0
  145. package/src/api/cashups/delete.ts +15 -0
  146. package/src/api/cashups/get.ts +52 -0
  147. package/src/api/cashups/index.ts +4 -0
  148. package/src/api/cashups/post.ts +23 -0
  149. package/src/api/cashups/put.ts +53 -0
  150. package/src/api/cfdi/delete.ts +21 -0
  151. package/src/api/cfdi/get.ts +119 -0
  152. package/src/api/cfdi/index.ts +4 -0
  153. package/src/api/cfdi/post.ts +60 -0
  154. package/src/api/cfdi/put.ts +53 -0
  155. package/src/api/companies/get.ts +23 -0
  156. package/src/api/companies/post.ts +29 -0
  157. package/src/api/companies/put.ts +43 -0
  158. package/src/api/countries/get.ts +23 -0
  159. package/src/api/countries/post.ts +0 -0
  160. package/src/api/countries/put.ts +0 -0
  161. package/src/api/csv/get.ts +354 -0
  162. package/src/api/csv/index.ts +1 -0
  163. package/src/api/customers/delete.ts +29 -0
  164. package/src/api/customers/get.ts +80 -8
  165. package/src/api/customers/index.ts +4 -0
  166. package/src/api/customers/post.ts +48 -0
  167. package/src/api/customers/put.ts +68 -0
  168. package/src/api/discounts/get.ts +100 -0
  169. package/src/api/discounts/post.ts +35 -0
  170. package/src/api/discounts/put.ts +66 -0
  171. package/src/api/index.ts +318 -11
  172. package/src/api/inventory/delete.ts +16 -0
  173. package/src/api/inventory/get.ts +53 -0
  174. package/src/api/inventory/index.ts +4 -0
  175. package/src/api/inventory/post.ts +22 -0
  176. package/src/api/inventory/put.ts +35 -0
  177. package/src/api/order/delete.ts +29 -0
  178. package/src/api/order/get.ts +207 -0
  179. package/src/api/order/index.ts +4 -0
  180. package/src/api/order/post.ts +118 -0
  181. package/src/api/order/put.ts +224 -0
  182. package/src/api/outsourcedOrders/delete.ts +15 -0
  183. package/src/api/outsourcedOrders/get.ts +54 -0
  184. package/src/api/outsourcedOrders/index.ts +4 -0
  185. package/src/api/outsourcedOrders/post.ts +24 -0
  186. package/src/api/outsourcedOrders/put.ts +21 -0
  187. package/src/api/partners/delete.ts +15 -0
  188. package/src/api/partners/get.ts +28 -0
  189. package/src/api/partners/index.ts +4 -0
  190. package/src/api/partners/post.ts +21 -0
  191. package/src/api/partners/put.ts +21 -0
  192. package/src/api/pdf/get.ts +43 -0
  193. package/src/api/pdf/index.ts +1 -0
  194. package/src/api/products/delete.ts +28 -0
  195. package/src/api/products/get.ts +16 -0
  196. package/src/api/products/index.ts +4 -0
  197. package/src/api/products/post.ts +73 -0
  198. package/src/api/products/put.ts +49 -0
  199. package/src/api/publics/get.ts +16 -0
  200. package/src/api/publics/index.ts +1 -0
  201. package/src/api/reports/get.ts +329 -0
  202. package/src/api/reports/index.ts +1 -0
  203. package/src/api/reviews/delete.ts +15 -0
  204. package/src/api/reviews/get.ts +31 -0
  205. package/src/api/reviews/index.ts +4 -0
  206. package/src/api/reviews/post.ts +20 -0
  207. package/src/api/reviews/put.ts +53 -0
  208. package/src/api/routes/delete.ts +15 -0
  209. package/src/api/routes/get.ts +86 -0
  210. package/src/api/routes/index.ts +4 -0
  211. package/src/api/routes/post.ts +60 -0
  212. package/src/api/routes/put.ts +44 -0
  213. package/src/api/sections/delete.ts +15 -0
  214. package/src/api/sections/get.ts +67 -0
  215. package/src/api/sections/index.ts +4 -0
  216. package/src/api/sections/post.ts +22 -0
  217. package/src/api/sections/put.ts +23 -0
  218. package/src/api/staff/delete.ts +16 -0
  219. package/src/api/staff/get.ts +29 -0
  220. package/src/api/staff/post.ts +17 -0
  221. package/src/api/staff/put.ts +17 -0
  222. package/src/api/stores/get.ts +93 -0
  223. package/src/api/stores/post.ts +49 -0
  224. package/src/api/stores/put.ts +35 -0
  225. package/src/api/stripe/get.ts +0 -0
  226. package/src/api/stripe/post.ts +59 -0
  227. package/src/api/stripe/put.ts +0 -0
  228. package/src/api/supplies/delete.ts +16 -0
  229. package/src/api/supplies/get.ts +53 -0
  230. package/src/api/supplies/post.ts +26 -0
  231. package/src/api/supplies/put.ts +33 -0
  232. package/src/api/users/delete.ts +16 -0
  233. package/src/api/users/post.ts +18 -0
  234. package/src/api/users/put.ts +36 -0
  235. package/src/enum/index.ts +9 -1
  236. package/src/index.ts +1 -4
  237. package/src/interfaces/Api.ts +307 -2
  238. package/src/interfaces/Apple.ts +74 -0
  239. package/src/interfaces/Attendance.ts +45 -0
  240. package/src/interfaces/Customer.ts +15 -11
  241. package/src/interfaces/Order.ts +38 -1
  242. package/src/interfaces/Product.ts +1 -0
  243. package/src/interfaces/Store.ts +41 -0
  244. package/src/utils/apiUtils.ts +11 -0
  245. package/src/utils/index.ts +6 -1
  246. package/src/utils/orders/calculateOrderTotal.test.js +930 -0
  247. package/src/utils/orders/calculateOrderTotal.ts +60 -15
  248. package/src/utils/orders/calculateTotalTaxesIncluded.ts +57 -25
  249. package/src/utils/orders/calculateTotalTaxesOverPrice.ts +57 -41
  250. package/src/utils/orders/helpers.ts +195 -47
  251. package/src/utils/orders/index.ts +3 -1
  252. package/src/utils/receipt/generateReceiptHTML.ts +163 -0
  253. package/src/utils/util.ts +65 -0
  254. package/tsconfig.json +13 -9
@@ -0,0 +1,930 @@
1
+ // myModule.test.js
2
+ import { calculateOrderTotal } from "./index";
3
+
4
+ describe("Calculate Order Total tests", () => {
5
+ let ORDER_DEMO = {
6
+ orderDto: {
7
+ deliveryDateFormatted: "lunes 08 abr.",
8
+ pickupInfo: null,
9
+ deliveryInfo: {
10
+ date: "2024-04-09T05:00:00.000Z",
11
+ fromTime: "2024-04-08T21:00:00.000Z",
12
+ },
13
+ express: false,
14
+ products: [
15
+ {
16
+ extraAmount: 0,
17
+ type: "weight",
18
+ showInApp: true,
19
+ order: 0,
20
+ invoice_description: "",
21
+ invoice_product_key: "",
22
+ invoice_product_unit_key: "",
23
+ invoice_product_unit_name: "",
24
+ productType: "storeProduct",
25
+ _id: "62d186387ec9330016319594",
26
+ name: "Lavado por kilo",
27
+ price: 17,
28
+ expressPrice: 20,
29
+ pieces: "1",
30
+ sku: "lavxkilo",
31
+ overlayText: "Lavado por kilo",
32
+ image: "6184782c3927a40018e36dea",
33
+ taxExemptOne: false,
34
+ taxExemptTwo: false,
35
+ taxExemptThree: false,
36
+ isActive: true,
37
+ store: "629c267812db5b001692adae",
38
+ owner: "629c267812db5b001692ada4",
39
+ productSupplies: [
40
+ {
41
+ usageAmount: 25,
42
+ _id: "62d6151fac2fc200166d0304",
43
+ supplyId: "62d35942c642440016cfcda8",
44
+ },
45
+ ],
46
+ __v: 1,
47
+ discountAmount: 0,
48
+ quantity: 3.7,
49
+ productId: "62d186387ec9330016319594",
50
+ qty: 3.7,
51
+ },
52
+ ],
53
+ taxesType: "included",
54
+ total: 62.9,
55
+ customer: "66147eecae83bb001540dd96",
56
+ store: "629c267812db5b001692adae",
57
+ paymentMethod: "delivery",
58
+ notifyBy: "none",
59
+ pickup: false,
60
+ delivery: false,
61
+ phone: "",
62
+ email: "",
63
+ address: "",
64
+ notes: "",
65
+ privateNotes: "",
66
+ creditApplied: 0,
67
+ amountPaid: 0,
68
+ customerInfo: {
69
+ password: "",
70
+ google: false,
71
+ facebook: false,
72
+ apple: false,
73
+ useStoreApp: false,
74
+ discount: 0,
75
+ credit: 0,
76
+ isActive: true,
77
+ createdDate: "2024-04-08T23:34:04.586Z",
78
+ stripeCustomerId: "",
79
+ invoiceInfo: {
80
+ _id: "66147eecae83bb001540dd95",
81
+ legal_name: "",
82
+ tax_system: "",
83
+ zipCode: "",
84
+ },
85
+ _id: "66147eecae83bb001540dd96",
86
+ name: "Carlos Piña 🍍",
87
+ phone: "",
88
+ address: "",
89
+ notes: "",
90
+ privateNotes: "",
91
+ rfc: "",
92
+ createdBy: "62d194d77ec933001631e831",
93
+ createdIn: "629c267812db5b001692adae",
94
+ company: "629c267712db5b001692ad9e",
95
+ paymentMethods: [],
96
+ __v: 0,
97
+ title: "Carlos Piña 🍍",
98
+ id: "66147eecae83bb001540dd96",
99
+ },
100
+ customerName: "Carlos Piña 🍍",
101
+ pickingUpDateTime: null,
102
+ cleanedDateTime: null,
103
+ readyDateTime: null,
104
+ deliveringDateTime: null,
105
+ collectedDateTime: null,
106
+ cancelledDateTime: null,
107
+ paidDateTime: null,
108
+ status: "cleaning",
109
+ prepaidAmount: 0,
110
+ prepaidPaymentMethod: "",
111
+ customerDiscount: 0,
112
+ productTotal: 54.22,
113
+ taxesTotal: 8.68,
114
+ productTotalWithoutDiscount: 54.22,
115
+ totalDiscountAmount: 0,
116
+ shippingServiceTotal: 0,
117
+ discountsToApply: [],
118
+ usePrepaid: false,
119
+ cashierBox: "629c267812db5b001692adb3",
120
+ discountCode: "",
121
+ buyAndGetProducts: [],
122
+ deliveryRoute: null,
123
+ pickupRoute: null,
124
+ createdDate: "2024-04-08T23:34:48.950Z",
125
+ },
126
+ customer: {
127
+ customer: {
128
+ password: "",
129
+ google: false,
130
+ facebook: false,
131
+ apple: false,
132
+ useStoreApp: false,
133
+ discount: 0,
134
+ credit: 0,
135
+ isActive: true,
136
+ createdDate: "2024-04-08T23:34:04.586Z",
137
+ stripeCustomerId: "",
138
+ invoiceInfo: {
139
+ _id: "66147eecae83bb001540dd95",
140
+ legal_name: "",
141
+ tax_system: "",
142
+ zipCode: "",
143
+ },
144
+ _id: "66147eecae83bb001540dd96",
145
+ name: "Carlos Piña 🍍",
146
+ phone: "",
147
+ address: "",
148
+ notes: "",
149
+ privateNotes: "",
150
+ rfc: "",
151
+ createdBy: "62d194d77ec933001631e831",
152
+ createdIn: "629c267812db5b001692adae",
153
+ company: "629c267712db5b001692ad9e",
154
+ paymentMethods: [],
155
+ __v: 0,
156
+ },
157
+ },
158
+ store: {
159
+ taxesType: "included",
160
+ notificationConfig: {
161
+ notifyOrderCreated: false,
162
+ notifyPickedUp: false,
163
+ notifyCleaned: true,
164
+ notifyCollected: false,
165
+ notifyDelivered: false,
166
+ notifyOwnerOnOrderCreated: false,
167
+ notifyEmail: "",
168
+ _id: "62a2d05fd0a7c800160869bc",
169
+ },
170
+ paymentConfig: {
171
+ defaultPaymentMethod: "delivery",
172
+ _id: "63650e8dcfa0e30016729776",
173
+ },
174
+ orderPageConfig: {
175
+ defaultDeliveryDate: "0",
176
+ defaultDeliveryTime: "18:00",
177
+ defaultNotifyMethod: "none",
178
+ printTicketAfterOrder: true,
179
+ shippingServiceCost: 0,
180
+ showProductSearchBarWeb: true,
181
+ _id: "6407b53301a1aa00141b217e",
182
+ },
183
+ _id: "629c267812db5b001692adae",
184
+ name: "Clean & Go",
185
+ phone: "9983524573",
186
+ inventory: [],
187
+ discountCodes: [
188
+ {
189
+ type: "percentage",
190
+ value: 14,
191
+ products: [
192
+ "62d1893f7ec933001631ab24",
193
+ "62d189697ec933001631acab",
194
+ "62d19a287ec933001632156f",
195
+ "62d199117ec9330016320ec0",
196
+ "62d198e07ec9330016320cc7",
197
+ "62d191d67ec933001631cd76",
198
+ "62d191747ec933001631c9cc",
199
+ "62d191ad7ec933001631cbef",
200
+ ],
201
+ applyToAllProducts: false,
202
+ applyOnceOnOrder: false,
203
+ hasUseLimit: false,
204
+ useLimitQty: 0,
205
+ usedCounter: 0,
206
+ onePerCustomer: true,
207
+ isActive: true,
208
+ buyAndGetConditions: [],
209
+ _id: "62d1ae1b7ec9330016328166",
210
+ name: "Anfitriones Airbnb",
211
+ code: "AIRBNBANF",
212
+ fromDate: "2022-07-01T05:00:00.000Z",
213
+ toDate: "2022-08-01T04:59:59.999Z",
214
+ fromTime: "00:00",
215
+ toTime: "23:59",
216
+ createdBy: "629c267812db5b001692ada4",
217
+ createdAt: "2022-07-15T18:12:43.506Z",
218
+ updatedAt: "2022-07-15T18:12:43.506Z",
219
+ },
220
+ {
221
+ type: "percentage",
222
+ value: 20,
223
+ products: [],
224
+ applyToAllProducts: true,
225
+ applyOnceOnOrder: false,
226
+ hasUseLimit: false,
227
+ useLimitQty: 0,
228
+ usedCounter: 0,
229
+ onePerCustomer: true,
230
+ isActive: true,
231
+ buyAndGetConditions: [],
232
+ _id: "635821305b689d0016c97f8c",
233
+ name: "Descuento por comentarios",
234
+ code: "20DESC01",
235
+ fromDate: "2022-01-01T05:00:00.000Z",
236
+ toDate: "2023-01-01T04:59:59.999Z",
237
+ fromTime: "00:00",
238
+ toTime: "23:59",
239
+ createdBy: "629c267812db5b001692ada4",
240
+ createdAt: "2022-10-25T17:47:28.314Z",
241
+ updatedAt: "2022-10-25T17:47:28.314Z",
242
+ },
243
+ {
244
+ type: "percentage",
245
+ value: 20,
246
+ products: [],
247
+ applyToAllProducts: true,
248
+ applyOnceOnOrder: false,
249
+ hasUseLimit: false,
250
+ useLimitQty: 0,
251
+ usedCounter: 0,
252
+ onePerCustomer: true,
253
+ isActive: true,
254
+ buyAndGetConditions: [],
255
+ _id: "6359c5d21332cf00168c5008",
256
+ name: "Descuento por comentario",
257
+ code: "20DESC02",
258
+ fromDate: "2022-01-01T05:00:00.000Z",
259
+ toDate: "2023-01-01T04:59:59.999Z",
260
+ fromTime: "00:00",
261
+ toTime: "23:59",
262
+ createdBy: "62d194d77ec933001631e831",
263
+ createdAt: "2022-10-26T23:42:10.732Z",
264
+ updatedAt: "2022-10-26T23:42:10.732Z",
265
+ },
266
+ {
267
+ type: "percentage",
268
+ value: 19,
269
+ products: [],
270
+ applyToAllProducts: true,
271
+ applyOnceOnOrder: false,
272
+ hasUseLimit: false,
273
+ useLimitQty: 0,
274
+ usedCounter: 0,
275
+ onePerCustomer: true,
276
+ isActive: true,
277
+ buyAndGetConditions: [],
278
+ _id: "6359c5ef1332cf00168c516d",
279
+ name: "Descuento por comentario",
280
+ code: "20DESC03",
281
+ fromDate: "2022-01-01T05:00:00.000Z",
282
+ toDate: "2023-01-01T04:59:59.999Z",
283
+ fromTime: "00:00",
284
+ toTime: "23:59",
285
+ createdBy: "62d194d77ec933001631e831",
286
+ createdAt: "2022-10-26T23:42:39.555Z",
287
+ updatedAt: "2022-10-26T23:42:39.555Z",
288
+ },
289
+ {
290
+ type: "percentage",
291
+ value: 20,
292
+ products: [],
293
+ applyToAllProducts: true,
294
+ applyOnceOnOrder: false,
295
+ hasUseLimit: false,
296
+ useLimitQty: 0,
297
+ usedCounter: 0,
298
+ onePerCustomer: true,
299
+ isActive: true,
300
+ buyAndGetConditions: [],
301
+ _id: "6359c60c1332cf00168c52c6",
302
+ name: "Descuento por comentario",
303
+ code: "20DESC04",
304
+ fromDate: "2022-01-01T05:00:00.000Z",
305
+ toDate: "2023-01-01T04:59:59.999Z",
306
+ fromTime: "00:00",
307
+ toTime: "23:59",
308
+ createdBy: "62d194d77ec933001631e831",
309
+ createdAt: "2022-10-26T23:43:08.577Z",
310
+ updatedAt: "2022-10-26T23:43:08.577Z",
311
+ },
312
+ {
313
+ type: "percentage",
314
+ value: 20,
315
+ products: [],
316
+ applyToAllProducts: true,
317
+ applyOnceOnOrder: false,
318
+ hasUseLimit: false,
319
+ useLimitQty: 0,
320
+ usedCounter: 0,
321
+ onePerCustomer: true,
322
+ isActive: true,
323
+ buyAndGetConditions: [],
324
+ _id: "6359c6261332cf00168c5468",
325
+ name: "Descuento por comentario",
326
+ code: "20DESC05",
327
+ fromDate: "2022-01-01T05:00:00.000Z",
328
+ toDate: "2023-01-01T04:59:59.999Z",
329
+ fromTime: "00:00",
330
+ toTime: "23:59",
331
+ createdBy: "62d194d77ec933001631e831",
332
+ createdAt: "2022-10-26T23:43:34.663Z",
333
+ updatedAt: "2022-10-26T23:43:34.663Z",
334
+ },
335
+ ],
336
+ taxOne: {
337
+ _id: "658bb2f376aa7b001482888c",
338
+ value: 16,
339
+ name: "IVA",
340
+ },
341
+ taxThree: null,
342
+ taxTwo: null,
343
+ },
344
+ hasShippingCost: false,
345
+ storeDiscounts: [],
346
+ discountCodeObj: null,
347
+ };
348
+ beforeEach(() => {
349
+ // Run this setup function before each test case
350
+ ORDER_DEMO = {
351
+ orderDto: {
352
+ deliveryDateFormatted: "lunes 08 abr.",
353
+ pickupInfo: null,
354
+ deliveryInfo: {
355
+ date: "2024-04-09T05:00:00.000Z",
356
+ fromTime: "2024-04-08T21:00:00.000Z",
357
+ },
358
+ express: false,
359
+ products: [
360
+ {
361
+ extraAmount: 0,
362
+ type: "weight",
363
+ showInApp: true,
364
+ order: 0,
365
+ invoice_description: "",
366
+ invoice_product_key: "",
367
+ invoice_product_unit_key: "",
368
+ invoice_product_unit_name: "",
369
+ productType: "storeProduct",
370
+ _id: "62d186387ec9330016319594",
371
+ name: "Lavado por kilo",
372
+ price: 17,
373
+ expressPrice: 20,
374
+ pieces: "1",
375
+ sku: "lavxkilo",
376
+ overlayText: "Lavado por kilo",
377
+ image: "6184782c3927a40018e36dea",
378
+ taxExemptOne: false,
379
+ taxExemptTwo: false,
380
+ taxExemptThree: false,
381
+ isActive: true,
382
+ store: "629c267812db5b001692adae",
383
+ owner: "629c267812db5b001692ada4",
384
+ productSupplies: [
385
+ {
386
+ usageAmount: 25,
387
+ _id: "62d6151fac2fc200166d0304",
388
+ supplyId: "62d35942c642440016cfcda8",
389
+ },
390
+ ],
391
+ __v: 1,
392
+ discountAmount: 0,
393
+ quantity: 3.7,
394
+ productId: "62d186387ec9330016319594",
395
+ qty: 3.7,
396
+ },
397
+ ],
398
+ taxesType: "included",
399
+ total: 62.9,
400
+ customer: "66147eecae83bb001540dd96",
401
+ store: "629c267812db5b001692adae",
402
+ paymentMethod: "delivery",
403
+ notifyBy: "none",
404
+ pickup: false,
405
+ delivery: false,
406
+ phone: "",
407
+ email: "",
408
+ address: "",
409
+ notes: "",
410
+ privateNotes: "",
411
+ creditApplied: 0,
412
+ amountPaid: 0,
413
+ customerInfo: {
414
+ password: "",
415
+ google: false,
416
+ facebook: false,
417
+ apple: false,
418
+ useStoreApp: false,
419
+ discount: 0,
420
+ credit: 0,
421
+ isActive: true,
422
+ createdDate: "2024-04-08T23:34:04.586Z",
423
+ stripeCustomerId: "",
424
+ invoiceInfo: {
425
+ _id: "66147eecae83bb001540dd95",
426
+ legal_name: "",
427
+ tax_system: "",
428
+ zipCode: "",
429
+ },
430
+ _id: "66147eecae83bb001540dd96",
431
+ name: "Carlos Piña 🍍",
432
+ phone: "",
433
+ address: "",
434
+ notes: "",
435
+ privateNotes: "",
436
+ rfc: "",
437
+ createdBy: "62d194d77ec933001631e831",
438
+ createdIn: "629c267812db5b001692adae",
439
+ company: "629c267712db5b001692ad9e",
440
+ paymentMethods: [],
441
+ __v: 0,
442
+ title: "Carlos Piña 🍍",
443
+ id: "66147eecae83bb001540dd96",
444
+ },
445
+ customerName: "Carlos Piña 🍍",
446
+ pickingUpDateTime: null,
447
+ cleanedDateTime: null,
448
+ readyDateTime: null,
449
+ deliveringDateTime: null,
450
+ collectedDateTime: null,
451
+ cancelledDateTime: null,
452
+ paidDateTime: null,
453
+ status: "cleaning",
454
+ prepaidAmount: 0,
455
+ prepaidPaymentMethod: "",
456
+ customerDiscount: 0,
457
+ productTotal: 54.22,
458
+ taxesTotal: 8.68,
459
+ productTotalWithoutDiscount: 54.22,
460
+ totalDiscountAmount: 0,
461
+ shippingServiceTotal: 0,
462
+ discountsToApply: [],
463
+ usePrepaid: false,
464
+ cashierBox: "629c267812db5b001692adb3",
465
+ discountCode: "",
466
+ buyAndGetProducts: [],
467
+ deliveryRoute: null,
468
+ pickupRoute: null,
469
+ createdDate: "2024-04-08T23:34:48.950Z",
470
+ },
471
+ customer: {
472
+ customer: {
473
+ password: "",
474
+ google: false,
475
+ facebook: false,
476
+ apple: false,
477
+ useStoreApp: false,
478
+ discount: 0,
479
+ credit: 0,
480
+ isActive: true,
481
+ createdDate: "2024-04-08T23:34:04.586Z",
482
+ stripeCustomerId: "",
483
+ invoiceInfo: {
484
+ _id: "66147eecae83bb001540dd95",
485
+ legal_name: "",
486
+ tax_system: "",
487
+ zipCode: "",
488
+ },
489
+ _id: "66147eecae83bb001540dd96",
490
+ name: "Carlos Piña 🍍",
491
+ phone: "",
492
+ address: "",
493
+ notes: "",
494
+ privateNotes: "",
495
+ rfc: "",
496
+ createdBy: "62d194d77ec933001631e831",
497
+ createdIn: "629c267812db5b001692adae",
498
+ company: "629c267712db5b001692ad9e",
499
+ paymentMethods: [],
500
+ __v: 0,
501
+ },
502
+ },
503
+ store: {
504
+ taxesType: "included",
505
+ notificationConfig: {
506
+ notifyOrderCreated: false,
507
+ notifyPickedUp: false,
508
+ notifyCleaned: true,
509
+ notifyCollected: false,
510
+ notifyDelivered: false,
511
+ notifyOwnerOnOrderCreated: false,
512
+ notifyEmail: "",
513
+ _id: "62a2d05fd0a7c800160869bc",
514
+ },
515
+ paymentConfig: {
516
+ defaultPaymentMethod: "delivery",
517
+ _id: "63650e8dcfa0e30016729776",
518
+ },
519
+ orderPageConfig: {
520
+ defaultDeliveryDate: "0",
521
+ defaultDeliveryTime: "18:00",
522
+ defaultNotifyMethod: "none",
523
+ printTicketAfterOrder: true,
524
+ shippingServiceCost: 0,
525
+ showProductSearchBarWeb: true,
526
+ _id: "6407b53301a1aa00141b217e",
527
+ },
528
+ _id: "629c267812db5b001692adae",
529
+ name: "Clean & Go",
530
+ phone: "9983524573",
531
+ inventory: [],
532
+ discountCodes: [
533
+ {
534
+ type: "percentage",
535
+ value: 14,
536
+ products: [
537
+ "62d1893f7ec933001631ab24",
538
+ "62d189697ec933001631acab",
539
+ "62d19a287ec933001632156f",
540
+ "62d199117ec9330016320ec0",
541
+ "62d198e07ec9330016320cc7",
542
+ "62d191d67ec933001631cd76",
543
+ "62d191747ec933001631c9cc",
544
+ "62d191ad7ec933001631cbef",
545
+ ],
546
+ applyToAllProducts: false,
547
+ applyOnceOnOrder: false,
548
+ hasUseLimit: false,
549
+ useLimitQty: 0,
550
+ usedCounter: 0,
551
+ onePerCustomer: true,
552
+ isActive: true,
553
+ buyAndGetConditions: [],
554
+ _id: "62d1ae1b7ec9330016328166",
555
+ name: "Anfitriones Airbnb",
556
+ code: "AIRBNBANF",
557
+ fromDate: "2022-07-01T05:00:00.000Z",
558
+ toDate: "2022-08-01T04:59:59.999Z",
559
+ fromTime: "00:00",
560
+ toTime: "23:59",
561
+ createdBy: "629c267812db5b001692ada4",
562
+ createdAt: "2022-07-15T18:12:43.506Z",
563
+ updatedAt: "2022-07-15T18:12:43.506Z",
564
+ },
565
+ {
566
+ type: "percentage",
567
+ value: 20,
568
+ products: [],
569
+ applyToAllProducts: true,
570
+ applyOnceOnOrder: false,
571
+ hasUseLimit: false,
572
+ useLimitQty: 0,
573
+ usedCounter: 0,
574
+ onePerCustomer: true,
575
+ isActive: true,
576
+ buyAndGetConditions: [],
577
+ _id: "635821305b689d0016c97f8c",
578
+ name: "Descuento por comentarios",
579
+ code: "20DESC01",
580
+ fromDate: "2022-01-01T05:00:00.000Z",
581
+ toDate: "2023-01-01T04:59:59.999Z",
582
+ fromTime: "00:00",
583
+ toTime: "23:59",
584
+ createdBy: "629c267812db5b001692ada4",
585
+ createdAt: "2022-10-25T17:47:28.314Z",
586
+ updatedAt: "2022-10-25T17:47:28.314Z",
587
+ },
588
+ {
589
+ type: "percentage",
590
+ value: 20,
591
+ products: [],
592
+ applyToAllProducts: true,
593
+ applyOnceOnOrder: false,
594
+ hasUseLimit: false,
595
+ useLimitQty: 0,
596
+ usedCounter: 0,
597
+ onePerCustomer: true,
598
+ isActive: true,
599
+ buyAndGetConditions: [],
600
+ _id: "6359c5d21332cf00168c5008",
601
+ name: "Descuento por comentario",
602
+ code: "20DESC02",
603
+ fromDate: "2022-01-01T05:00:00.000Z",
604
+ toDate: "2023-01-01T04:59:59.999Z",
605
+ fromTime: "00:00",
606
+ toTime: "23:59",
607
+ createdBy: "62d194d77ec933001631e831",
608
+ createdAt: "2022-10-26T23:42:10.732Z",
609
+ updatedAt: "2022-10-26T23:42:10.732Z",
610
+ },
611
+ {
612
+ type: "percentage",
613
+ value: 19,
614
+ products: [],
615
+ applyToAllProducts: true,
616
+ applyOnceOnOrder: false,
617
+ hasUseLimit: false,
618
+ useLimitQty: 0,
619
+ usedCounter: 0,
620
+ onePerCustomer: true,
621
+ isActive: true,
622
+ buyAndGetConditions: [],
623
+ _id: "6359c5ef1332cf00168c516d",
624
+ name: "Descuento por comentario",
625
+ code: "20DESC03",
626
+ fromDate: "2022-01-01T05:00:00.000Z",
627
+ toDate: "2023-01-01T04:59:59.999Z",
628
+ fromTime: "00:00",
629
+ toTime: "23:59",
630
+ createdBy: "62d194d77ec933001631e831",
631
+ createdAt: "2022-10-26T23:42:39.555Z",
632
+ updatedAt: "2022-10-26T23:42:39.555Z",
633
+ },
634
+ {
635
+ type: "percentage",
636
+ value: 20,
637
+ products: [],
638
+ applyToAllProducts: true,
639
+ applyOnceOnOrder: false,
640
+ hasUseLimit: false,
641
+ useLimitQty: 0,
642
+ usedCounter: 0,
643
+ onePerCustomer: true,
644
+ isActive: true,
645
+ buyAndGetConditions: [],
646
+ _id: "6359c60c1332cf00168c52c6",
647
+ name: "Descuento por comentario",
648
+ code: "20DESC04",
649
+ fromDate: "2022-01-01T05:00:00.000Z",
650
+ toDate: "2023-01-01T04:59:59.999Z",
651
+ fromTime: "00:00",
652
+ toTime: "23:59",
653
+ createdBy: "62d194d77ec933001631e831",
654
+ createdAt: "2022-10-26T23:43:08.577Z",
655
+ updatedAt: "2022-10-26T23:43:08.577Z",
656
+ },
657
+ {
658
+ type: "percentage",
659
+ value: 20,
660
+ products: [],
661
+ applyToAllProducts: true,
662
+ applyOnceOnOrder: false,
663
+ hasUseLimit: false,
664
+ useLimitQty: 0,
665
+ usedCounter: 0,
666
+ onePerCustomer: true,
667
+ isActive: true,
668
+ buyAndGetConditions: [],
669
+ _id: "6359c6261332cf00168c5468",
670
+ name: "Descuento por comentario",
671
+ code: "20DESC05",
672
+ fromDate: "2022-01-01T05:00:00.000Z",
673
+ toDate: "2023-01-01T04:59:59.999Z",
674
+ fromTime: "00:00",
675
+ toTime: "23:59",
676
+ createdBy: "62d194d77ec933001631e831",
677
+ createdAt: "2022-10-26T23:43:34.663Z",
678
+ updatedAt: "2022-10-26T23:43:34.663Z",
679
+ },
680
+ ],
681
+ taxOne: {
682
+ _id: "658bb2f376aa7b001482888c",
683
+ value: 16,
684
+ name: "IVA",
685
+ },
686
+ taxThree: null,
687
+ taxTwo: null,
688
+ },
689
+ hasShippingCost: false,
690
+ storeDiscounts: [],
691
+ discountCodeObj: null,
692
+ };
693
+ });
694
+
695
+ it("test calculateOrderTotal taxes included no extra amount", () => {
696
+ // Test case
697
+ ORDER_DEMO.store.taxesType = "included";
698
+ ORDER_DEMO.taxesType = "included";
699
+ const { orderDto, customer, store, storeDiscounts, discountCodeObj } =
700
+ ORDER_DEMO;
701
+
702
+ const { ...informationNewPackage } = calculateOrderTotal(
703
+ orderDto,
704
+ { customer },
705
+ store,
706
+ orderDto.delivery || orderDto.pickup,
707
+ // storeDiscounts.data?.discounts || [],
708
+ storeDiscounts,
709
+ discountCodeObj
710
+ );
711
+
712
+ const res = {
713
+ totalDiscountAmount: informationNewPackage.totalDiscountAmount,
714
+ totalQuantity: informationNewPackage.totalQuantity,
715
+ totalImportWithDiscount: informationNewPackage.productTotal,
716
+ totalImportWithoutDiscount:
717
+ informationNewPackage.productTotalWithoutDiscount,
718
+ totalImporTaxes: informationNewPackage.taxesTotal,
719
+ shippingCost: informationNewPackage.shippingServiceTotal,
720
+ total: informationNewPackage.total,
721
+ };
722
+ expect(res).toEqual({
723
+ totalDiscountAmount: 0,
724
+ totalQuantity: 3.7,
725
+ totalImportWithDiscount: 54.22,
726
+ totalImportWithoutDiscount: 54.22,
727
+ totalImporTaxes: 8.68,
728
+ shippingCost: 0,
729
+ total: 54.22 + 8.68,
730
+ });
731
+ });
732
+
733
+
734
+ it("test calculateOrderTotal taxes over_price no extra amount", () => {
735
+ // Test case
736
+ ORDER_DEMO.store.taxesType = "over_price";
737
+ ORDER_DEMO.taxesType = "over_price";
738
+ const {
739
+ orderDto,
740
+ customer,
741
+ store,
742
+ hasShippingCost,
743
+ storeDiscounts,
744
+ discountCodeObj,
745
+ } = ORDER_DEMO;
746
+
747
+ const { ...informationNewPackage } = calculateOrderTotal(
748
+ orderDto,
749
+ { customer },
750
+ store,
751
+ orderDto.delivery || orderDto.pickup,
752
+ // storeDiscounts.data?.discounts || [],
753
+ storeDiscounts,
754
+ discountCodeObj
755
+ );
756
+
757
+ const res = {
758
+ totalDiscountAmount: informationNewPackage.totalDiscountAmount,
759
+ totalQuantity: informationNewPackage.totalQuantity,
760
+ totalImportWithDiscount: informationNewPackage.productTotal,
761
+ totalImportWithoutDiscount:
762
+ informationNewPackage.productTotalWithoutDiscount,
763
+ totalImporTaxes: informationNewPackage.taxesTotal,
764
+ shippingCost: informationNewPackage.shippingServiceTotal,
765
+ total: informationNewPackage.total,
766
+ };
767
+ expect(res).toEqual(
768
+ {
769
+ totalDiscountAmount: 0,
770
+ totalQuantity: 3.7,
771
+ totalImportWithDiscount: 62.9,
772
+ totalImportWithoutDiscount: 62.9,
773
+ totalImporTaxes: 10.06,
774
+ shippingCost: 0,
775
+ total: 72.96,
776
+ });
777
+ });
778
+
779
+ it("test calculateOrderTotal taxes included with extra amount", () => {
780
+ // Test case
781
+ ORDER_DEMO.orderDto.products[0].extraAmount = 50;
782
+ const {
783
+ orderDto,
784
+ customer,
785
+ store,
786
+ hasShippingCost,
787
+ storeDiscounts,
788
+ discountCodeObj,
789
+ } = ORDER_DEMO;
790
+
791
+ const { ...informationNewPackage } = calculateOrderTotal(
792
+ orderDto,
793
+ { customer },
794
+ store,
795
+ orderDto.delivery || orderDto.pickup,
796
+ // storeDiscounts.data?.discounts || [],
797
+ storeDiscounts,
798
+ discountCodeObj
799
+ );
800
+
801
+ const res = {
802
+ totalDiscountAmount: informationNewPackage.totalDiscountAmount,
803
+ totalQuantity: informationNewPackage.totalQuantity,
804
+ totalImportWithDiscount: informationNewPackage.productTotal,
805
+ totalImportWithoutDiscount:
806
+ informationNewPackage.productTotalWithoutDiscount,
807
+ totalImporTaxes: informationNewPackage.taxesTotal,
808
+ shippingCost: informationNewPackage.shippingServiceTotal,
809
+ total: informationNewPackage.total,
810
+ total: informationNewPackage.total,
811
+ };
812
+
813
+ expect(res).toEqual({
814
+ total: 112.9,
815
+ totalDiscountAmount: 0,
816
+ totalQuantity: 3.7,
817
+ totalImportWithDiscount: 97.33,
818
+ totalImportWithoutDiscount: 97.33,
819
+ totalImporTaxes: 15.57,
820
+ shippingCost: 0,
821
+ });
822
+ });
823
+
824
+ it("test calculateOrderTotal taxes over_price with extra amount", () => {
825
+ // Test case
826
+ ORDER_DEMO.orderDto.products[0].extraAmount = 50;
827
+ ORDER_DEMO.store.taxesType = "over_price";
828
+ ORDER_DEMO.taxesType = "over_price";
829
+ const {
830
+ orderDto,
831
+ customer,
832
+ store,
833
+ storeDiscounts,
834
+ discountCodeObj,
835
+ } = ORDER_DEMO;
836
+
837
+ const { ...informationNewPackage } = calculateOrderTotal(
838
+ orderDto,
839
+ { customer },
840
+ store,
841
+ orderDto.delivery || orderDto.pickup,
842
+ // storeDiscounts.data?.discounts || [],
843
+ storeDiscounts,
844
+ discountCodeObj
845
+ );
846
+
847
+ const res = {
848
+ totalDiscountAmount: informationNewPackage.totalDiscountAmount,
849
+ totalQuantity: informationNewPackage.totalQuantity,
850
+ totalImportWithDiscount: informationNewPackage.productTotal,
851
+ totalImportWithoutDiscount:
852
+ informationNewPackage.productTotalWithoutDiscount,
853
+ totalImporTaxes: informationNewPackage.taxesTotal,
854
+ shippingCost: informationNewPackage.shippingServiceTotal,
855
+ total: informationNewPackage.total,
856
+ total: informationNewPackage.total,
857
+ };
858
+
859
+ expect(res).toEqual({
860
+ total: 112.9 + 18.06,
861
+ totalDiscountAmount: 0,
862
+ totalQuantity: 3.7,
863
+ totalImportWithDiscount: 112.9,
864
+ totalImportWithoutDiscount: 112.9,
865
+ totalImporTaxes: 18.06,
866
+ shippingCost: 0,
867
+ });
868
+ });
869
+
870
+ it("test calculateOrderTotal taxes over_price with discount and sin extra amount", () => {
871
+ // Configurar el escenario:
872
+ // - Se asigna extraAmount = 0
873
+ // - Se activa un discountCode en orderDto y se provee un objeto discountCodeObj con descuento del 20%
874
+ ORDER_DEMO.orderDto.products[0].extraAmount = 0;
875
+ ORDER_DEMO.orderDto.discountCode = "DISCOUNT20";
876
+ ORDER_DEMO.discountCodeObj = {
877
+ type: "percentage",
878
+ value: 20,
879
+ applyToAllProducts: true,
880
+ products: [] // para todos, se ignora el filtrado
881
+ };
882
+ ORDER_DEMO.store.taxesType = "over_price";
883
+ ORDER_DEMO.taxesType = "over_price";
884
+
885
+ const { orderDto, customer, store, storeDiscounts, discountCodeObj } = ORDER_DEMO;
886
+
887
+ const informationNewPackage = calculateOrderTotal(
888
+ orderDto,
889
+ { customer },
890
+ store,
891
+ orderDto.delivery || orderDto.pickup,
892
+ storeDiscounts,
893
+ ORDER_DEMO.discountCodeObj
894
+ );
895
+
896
+ // Con un precio base de 17, cantidad 3.7 y sin extraAmount:
897
+ // - Importe original sin descuento: 17 x 3.7 = 62.9
898
+ // - Con descuento del 20%: descuento por unidad = 17 x 0.20 = 3.4,
899
+ // precio descontado = 17 - 3.4 = 13.6,
900
+ // importe de producto con descuento = 13.6 x 3.7 = 50.32.
901
+ // - Impuestos (16% sobre subtotal): 112.9 es el subtotal si no se aplica descuento;
902
+ // pero en "over_price" se calcula sobre (precio descontado x qty + extraAmount):
903
+ // subtotal = 50.32, impuestos = 50.32 x 0.16 = 8.0512 ≈ 8.05.
904
+ // - Total a cobrar = 50.32 + 8.05 = 58.37.
905
+ // - El totalDiscountAmount (total de descuento aplicado) es 3.4 x 3.7 = 12.58.
906
+
907
+ const res = {
908
+ totalDiscountAmount: informationNewPackage.totalDiscountAmount,
909
+ totalQuantity: informationNewPackage.totalQuantity,
910
+ totalImportWithDiscount: informationNewPackage.productTotal,
911
+ totalImportWithoutDiscount: informationNewPackage.productTotalWithoutDiscount,
912
+ totalImporTaxes: informationNewPackage.taxesTotal,
913
+ shippingCost: informationNewPackage.shippingServiceTotal,
914
+ total: informationNewPackage.total,
915
+ };
916
+
917
+ expect(res).toEqual({
918
+ totalDiscountAmount: 12.58,
919
+ totalQuantity: 3.7,
920
+ totalImportWithDiscount: 50.32,
921
+ totalImportWithoutDiscount: 62.9,
922
+ totalImporTaxes: 8.05,
923
+ shippingCost: 0,
924
+ total: 58.37,
925
+ });
926
+ });
927
+
928
+
929
+ // Add more test cases as needed
930
+ });