washday-sdk 1.0.2 → 1.1.1

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 +127 -0
  2. package/babel.config.js +8 -0
  3. package/dist/api/attendance/delete.js +2 -0
  4. package/dist/api/attendance/get.js +89 -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 +67 -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 +88 -0
  135. package/src/api/attendance/index.ts +4 -0
  136. package/src/api/attendance/post.ts +38 -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
package/src/api/index.ts CHANGED
@@ -1,20 +1,327 @@
1
1
  import { WashdayClientInstance } from "../interfaces/Api";
2
- import { getCustomerById, getCustomerHighlightsById } from "./customers/get";
2
+ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "./cashierbox/delete";
3
+ import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "./cashierbox/get";
4
+ import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
5
+ import { updateCashierBoxById, updateCashierBoxMovementById } from "./cashierbox/put";
6
+ import { getCompanyById } from "./companies/get";
7
+ import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
8
+ import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
9
+ import { getCountries } from "./countries/get";
10
+ import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from './discounts/get';
11
+ import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
12
+ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById, updateDiscountCodeById } from "./discounts/put";
13
+ import { deleteStoreStaffById } from "./staff/delete";
14
+ import { getStoreStaff, getStoreStaffById } from "./staff/get";
15
+ import { createStoreStaff } from "./staff/post";
16
+ import { updateStoreStaffById } from "./staff/put";
17
+ import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "./stores/get";
18
+ import { copyStore, createStore, createStoreImage } from "./stores/post";
19
+ import { deleteStoreById, updateStoreById } from "./stores/put";
20
+ import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "./stripe/post";
21
+ import { deleteSupplyById } from "./supplies/delete";
22
+ import { getSupplies, getSupplyById, getSupplyHistory } from "./supplies/get";
23
+ import { createSupply } from "./supplies/post";
24
+ import { addSupplyStock, updateSupplyById } from "./supplies/put";
25
+ import { updateUserById } from "./users/put";
26
+ import * as inventoryEndpoints from './inventory';
27
+ import * as sectionsEndpoints from './sections';
28
+ import * as productsEndpoints from './products';
29
+ import * as customersEndpoints from './customers';
30
+ import * as csvExportEndpoints from './csv';
31
+ import * as pdfExportEndpoints from './pdf';
32
+ import * as reportsExportEndpoints from './reports';
33
+ import * as ordersEndpoints from './order';
34
+ import * as authEndpoints from './auth';
35
+ import * as attendanceEndpoints from './attendance';
36
+ import * as routesEndpoints from './routes';
37
+ import * as reviewsEndpoints from './reviews';
38
+ import * as cfdiEndpoints from './cfdi';
39
+ import * as cashupsEndpoints from './cashups';
40
+ import { deleteUserById } from "./users/delete";
41
+ import { customersAppChangePassword } from './auth/post';
42
+ import * as partnersEndpoints from './partners';
43
+ import * as outsourcedOrdersEndpoints from './outsourcedOrders';
44
+ import * as publicsEndpoints from './publics';
45
+ import { validateUserPin } from "./users/post";
3
46
 
4
47
  type WashdayClientConstructor = {
5
- new(apiToken: string): {
6
- apiToken: string;
7
- };
48
+ new(apiToken: string): WashdayClientInstance
8
49
  };
50
+ function bindMethods<T>(instance: any, methods: any): T {
51
+ const boundMethods: any = {};
52
+ for (const key in methods) {
53
+ if (methods.hasOwnProperty(key) && typeof methods[key] === 'function') {
54
+ boundMethods[key] = methods[key].bind(instance);
55
+ }
56
+ }
57
+ return boundMethods;
58
+ }
9
59
 
10
60
  const WashdayClient: WashdayClientConstructor = function WashdayClient(this: WashdayClientInstance, apiToken: string) {
11
61
  this.apiToken = apiToken;
62
+ this.cashup = bindMethods(this, {
63
+ getList: cashupsEndpoints.getModule.getList,
64
+ getById: cashupsEndpoints.getModule.getById,
65
+ getPreviewDataForCashClose: cashupsEndpoints.getModule.getPreviewDataForCashClose,
66
+ create: cashupsEndpoints.postModule.create,
67
+ deleteCashUpReport: cashupsEndpoints.deleteModule.deleteCashUpReport
68
+ });
69
+ this.cfdi = bindMethods(this, {
70
+ getList: cfdiEndpoints.getModule.getList,
71
+ downloadCFDIPDF: cfdiEndpoints.getModule.downloadCFDIPDF,
72
+ downloadCFDIZIP: cfdiEndpoints.getModule.downloadCFDIZIP,
73
+ sendCFDIByEmail: cfdiEndpoints.getModule.sendCFDIByEmail,
74
+ getCFDIPreview: cfdiEndpoints.getModule.getCFDIPreview,
75
+ getCFDIPreviewByOrderId: cfdiEndpoints.getModule.getCFDIPreviewByOrderId,
76
+ createCFDI: cfdiEndpoints.postModule.createCFDI,
77
+ createGlobalCFDI: cfdiEndpoints.postModule.createGlobalCFDI,
78
+ cancelCFDI: cfdiEndpoints.deleteModule.cancelCFDI
79
+ });
80
+ this.review = bindMethods(this, {
81
+ getList: reviewsEndpoints.getModule.getList,
82
+ requestStoreReviewByCustomerId: reviewsEndpoints.getModule.requestStoreReviewByCustomerId,
83
+ });
84
+ this.routes = bindMethods(this, {
85
+ getOrdersForRoute: routesEndpoints.getModule.getOrdersForRoute,
86
+ getStoreRoutesList: routesEndpoints.getModule.getStoreRoutesList,
87
+ createRoute: routesEndpoints.postModule.createRoute,
88
+ closeStoreRoutes: routesEndpoints.putModule.closeStoreRoutes,
89
+ //NEW V2 ENDPOINTS
90
+ getRoutesByStore: routesEndpoints.getModule.getRoutesByStore,
91
+ createRouteV2: routesEndpoints.postModule.createRouteV2,
92
+ getRouteByIdV2: routesEndpoints.getModule.getRouteByIdV2,
93
+ deleteRouteById: routesEndpoints.deleteModule.deleteRouteById,
94
+ closeRouteById: routesEndpoints.putModule.closeRouteById,
95
+ updateRouteById: routesEndpoints.putModule.updateRouteById,
96
+ getRoutesByDriver: routesEndpoints.getModule.getRoutesByDriver,
97
+ startRoute: routesEndpoints.postModule.startRoute,
98
+ });
99
+ this.publics = bindMethods(this, {
100
+ getOrderPublicReceipt: publicsEndpoints.getModule.getOrderPublicReceipt,
101
+ });
102
+ this.auth = bindMethods(this, {
103
+ customerLoginToken: authEndpoints.postModule.customerLoginToken,
104
+ googleLogin: authEndpoints.postModule.googleLogin,
105
+ appleLogin: authEndpoints.postModule.appleLogin,
106
+ facebookLogin: authEndpoints.postModule.facebookLogin,
107
+ customerRegularLogin: authEndpoints.postModule.customerRegularLogin,
108
+ customerSignUp: authEndpoints.postModule.customerSignUp,
109
+ regularUserLogin: authEndpoints.postModule.regularUserLogin,
110
+ pinLogin: authEndpoints.postModule.pinLogin,
111
+ regularUserTokenLogin: authEndpoints.postModule.regularUserTokenLogin,
112
+ forgotPassword: authEndpoints.postModule.customersAppForgotPassword,
113
+ customersAppForgotPassword: authEndpoints.postModule.customersAppForgotPassword,
114
+ customersAppChangePassword: authEndpoints.postModule.customersAppChangePassword,
115
+ companySignUp: authEndpoints.postModule.companySignUp,
116
+ });
117
+ this.orders = bindMethods(this, {
118
+ getList: ordersEndpoints.getModule.getList,
119
+ getOrdersHeaderSummary: ordersEndpoints.getModule.getOrdersHeaderSummary,
120
+ getById: ordersEndpoints.getModule.getById,
121
+ fetchOrdersForCFDI: ordersEndpoints.getModule.fetchOrdersForCFDI,
122
+ updateById: ordersEndpoints.putModule.updateById,
123
+ updatePaymentLineById: ordersEndpoints.putModule.updatePaymentLineById,
124
+ setOrderCancelledBySequence: ordersEndpoints.putModule.setOrderCancelledBySequence,
125
+ setOrderCleaningBySequence: ordersEndpoints.putModule.setOrderCleaningBySequence,
126
+ setOrderCleanedBySequence: ordersEndpoints.putModule.setOrderCleanedBySequence,
127
+ setOrderCollectedBySequence: ordersEndpoints.putModule.setOrderCollectedBySequence,
128
+ setOrdePickingBySequence: ordersEndpoints.putModule.setOrdePickingBySequence,
129
+ setOrdeDeliveringBySequence: ordersEndpoints.putModule.setOrdeDeliveringBySequence,
130
+ setOrdeDeliveredBySequence: ordersEndpoints.putModule.setOrdeDeliveredBySequence,
131
+ createPaymentLine: ordersEndpoints.postModule.createPaymentLine,
132
+ sendEmailReceipt: ordersEndpoints.postModule.sendEmailReceipt,
133
+ createOrderCustomersApp: ordersEndpoints.postModule.createOrderCustomersApp,
134
+ createOrderUsersApp: ordersEndpoints.postModule.createOrderUsersApp,
135
+ bulkCreatePaymentLines: ordersEndpoints.postModule.bulkCreatePaymentLines,
136
+ createOrderEvidence: ordersEndpoints.postModule.createOrderEvidence,
137
+ getRedeemPointsPreview: ordersEndpoints.postModule.getRedeemPointsPreview,
138
+ deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
139
+ getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
140
+ getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
141
+ setOrderAcceptedBySequence: ordersEndpoints.putModule.setOrderAcceptedBySequence,
142
+ getRequestedOrdersSummary: ordersEndpoints.getModule.getRequestedOrdersSummary,
143
+ bulkCancel: ordersEndpoints.putModule.bulkCancel,
144
+ bulkClean: ordersEndpoints.putModule.bulkClean,
145
+ bulkCollect: ordersEndpoints.putModule.bulkCollect,
146
+ cancelOrderByIdCustomersApp: ordersEndpoints.deleteModule.cancelOrderByIdCustomersApp
147
+ });
148
+ this.customers = bindMethods(this, {
149
+ getCustomers: customersEndpoints.getModule.getList,
150
+ getCustomerById: customersEndpoints.getModule.getCustomerById,
151
+ getCustomerHighlightsById: customersEndpoints.getModule.getCustomerHighlightsById,
152
+ getCustomerOrders: customersEndpoints.getModule.getCustomerOrders,
153
+ getCustomerByIdCustomersApp: customersEndpoints.getModule.getCustomerByIdCustomersApp,
154
+ getCustomerLoyaltyHistory: customersEndpoints.getModule.getCustomerLoyaltyHistory,
155
+ create: customersEndpoints.postModule.create,
156
+ bulkCreate: customersEndpoints.postModule.bulkCreate,
157
+ updateById: customersEndpoints.putModule.updateById,
158
+ deleteById: customersEndpoints.deleteModule.deleteById,
159
+ deleteByIdCustomersApp: customersEndpoints.deleteModule.deleteByIdCustomersApp,
160
+ updateByIdCustomersApp: customersEndpoints.putModule.updateByIdCustomersApp,
161
+ });
162
+ this.stores = bindMethods(this, {
163
+ getStores: getStores,
164
+ getStoreById: getStoreById,
165
+ getStoreImages: getStoreImages,
166
+ getStoresByName: getStoresByName,
167
+ getStoresByIdCustomersApp: getStoresByIdCustomersApp,
168
+ createStore: createStore,
169
+ copyStore: copyStore,
170
+ updateStoreById: updateStoreById,
171
+ createStoreImage: createStoreImage,
172
+ getStoreReviewLink: getStoreReviewLink,
173
+ deleteStoreById: deleteStoreById,
174
+ });
175
+ this.products = bindMethods(this, {
176
+ getById: productsEndpoints.getModule.getById,
177
+ create: productsEndpoints.postModule.create,
178
+ createProductSupply: productsEndpoints.postModule.createProductSupply,
179
+ bulkCreate: productsEndpoints.postModule.bulkCreate,
180
+ deleteById: productsEndpoints.deleteModule.deleteById,
181
+ deleteProductSupplyById: productsEndpoints.deleteModule.deleteProductSupplyById,
182
+ updateById: productsEndpoints.putModule.updateById,
183
+ bulkUpdate: productsEndpoints.putModule.bulkUpdate
184
+ });
185
+ this.users = bindMethods(this, {
186
+ updateUserById: updateUserById,
187
+ deleteUserById: deleteUserById,
188
+ validateUserPin: validateUserPin,
189
+ });
190
+ this.countries = bindMethods(this, {
191
+ getCountries: getCountries,
192
+ });
193
+ this.supplies = bindMethods(this, {
194
+ getSupplies: getSupplies,
195
+ getSupplyById: getSupplyById,
196
+ getSupplyHistory: getSupplyHistory,
197
+ createSupply: createSupply,
198
+ updateSupplyById: updateSupplyById,
199
+ addSupplyStock: addSupplyStock,
200
+ deleteSupplyById: deleteSupplyById,
201
+ });
202
+ this.sections = bindMethods(this, {
203
+ getSections: sectionsEndpoints.getModule.getList,
204
+ getById: sectionsEndpoints.getModule.getById,
205
+ getSectionsByStoreCustomersApp: sectionsEndpoints.getModule.getSectionsByStoreCustomersApp,
206
+ create: sectionsEndpoints.postModule.create,
207
+ deleteById: sectionsEndpoints.deleteModule.deleteById,
208
+ updateById: sectionsEndpoints.putModule.updateById,
209
+ });
210
+ this.inventory = bindMethods(this, {
211
+ getInventory: inventoryEndpoints.getModule.getInventory,
212
+ getById: inventoryEndpoints.getModule.getInventoryById,
213
+ getHistoryById: inventoryEndpoints.getModule.getHistoryById,
214
+ create: inventoryEndpoints.postModule.create,
215
+ deleteById: inventoryEndpoints.deleteModule.deleteById,
216
+ updateById: inventoryEndpoints.putModule.updateById,
217
+ addStock: inventoryEndpoints.putModule.addStock,
218
+ });
219
+ this.cashierboxes = bindMethods(this, {
220
+ getCashierboxesByStoreId: getCashierboxesByStoreId,
221
+ getCashierboxesById: getCashierboxesById,
222
+ getCashierBoxMovementsHistory: getCashierBoxMovementsHistory,
223
+ createCashierBox: createCashierBox,
224
+ updateCashierBoxById: updateCashierBoxById,
225
+ updateCashierBoxMovementById: updateCashierBoxMovementById,
226
+ deleteCashierBoxById: deleteCashierBoxById,
227
+ addCashierBoxMovement: addCashierBoxMovement,
228
+ deleteCashierBoxMovementById: deleteCashierBoxMovementById,
229
+ });
230
+ this.companies = bindMethods(this, {
231
+ getCompanyById: getCompanyById,
232
+ updateCompanyById: updateCompanyById,
233
+ updateCompanyLogoById: updateCompanyLogoById,
234
+ updateCompanyTaxInfoById: updateCompanyTaxInfoById,
235
+ updateCompanyTaxInfoCertificates: updateCompanyTaxInfoCertificates,
236
+ updateCFDIOrgLogo: updateCFDIOrgLogo
237
+ });
238
+ this.stripe = bindMethods(this, {
239
+ createCreateSuscriptionCheckoutSession: createCreateSuscriptionCheckoutSession,
240
+ createCFDISuscrptionCheckoutSession: createCFDISuscrptionCheckoutSession,
241
+ createGetMoreCheckoutSession: createGetMoreCheckoutSession,
242
+ createCustomerPortalSession: createCustomerPortalSession
243
+ });
244
+ this.staff = bindMethods(this, {
245
+ getStoreStaff: getStoreStaff,
246
+ getStoreStaffById: getStoreStaffById,
247
+ updateStoreStaffById: updateStoreStaffById,
248
+ createStoreStaff: createStoreStaff,
249
+ deleteStoreStaffById: deleteStoreStaffById,
250
+ });
251
+ this.discountCodes = bindMethods(this, {
252
+ getDiscountCodes: getDiscountCodes,
253
+ getDiscountCodeById: getDiscountCodeById,
254
+ verifyDiscountCode: verifyDiscountCode,
255
+ verifyDiscountCodeCustomersApp: verifyDiscountCodeCustomersApp,
256
+ createDiscountCode: createDiscountCode,
257
+ deleteDiscountCodeById: deleteDiscountCodeById,
258
+ updateDiscountCodeById: updateDiscountCodeById,
259
+ });
260
+ this.automaticDiscount = bindMethods(this, {
261
+ getAutomaticDiscounts: getAutomaticDiscounts,
262
+ getAvailableAutomaticDiscounts: getAvailableAutomaticDiscounts,
263
+ getAutomaticDiscountById: getAutomaticDiscountById,
264
+ createAutomaticDiscount: createAutomaticDiscount,
265
+ deleteAutomaticDiscountById: deleteAutomaticDiscountById,
266
+ updateAutomaticDiscountById: updateAutomaticDiscountById,
267
+ });
268
+ this.csv = bindMethods(this, {
269
+ exportCustomersList: csvExportEndpoints.getModule.exportCustomersList,
270
+ exportOrdersList: csvExportEndpoints.getModule.exportOrdersList,
271
+ exportProductsList: csvExportEndpoints.getModule.exportProductsList,
272
+ exportCleanedOrdersReport: csvExportEndpoints.getModule.exportCleanedOrdersReport,
273
+ exportSalesReport: csvExportEndpoints.getModule.exportSalesReport,
274
+ exportCustomersReport: csvExportEndpoints.getModule.exportCustomersReport,
275
+ exportSuppliesReport: csvExportEndpoints.getModule.exportSuppliesReport,
276
+ exportDiscountCodesReport: csvExportEndpoints.getModule.exportDiscountCodesReport,
277
+ exportStaffReport: csvExportEndpoints.getModule.exportStaffReport,
278
+ exportProductSalesReport: csvExportEndpoints.getModule.exportProductSalesReport,
279
+ exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
280
+ exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
281
+ });
282
+ this.pdf = bindMethods(this, {
283
+ exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
284
+ });
285
+ this.reports = bindMethods(this, {
286
+ getCleanedOrdersReport: reportsExportEndpoints.getModule.getCleanedOrdersReport,
287
+ getCleanedOrdersGraphDataReport: reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport,
288
+ getSalesReport: reportsExportEndpoints.getModule.getSalesReport,
289
+ getCustomersReport: reportsExportEndpoints.getModule.getCustomersReport,
290
+ getSuppliesReport: reportsExportEndpoints.getModule.getSuppliesReport,
291
+ getDiscountCodesReport: reportsExportEndpoints.getModule.getDiscountCodesReport,
292
+ getStaffReport: reportsExportEndpoints.getModule.getStaffReport,
293
+ getProductSalesReport: reportsExportEndpoints.getModule.getProductSalesReport,
294
+ getPaymentLinesReport: reportsExportEndpoints.getModule.getPaymentLinesReport,
295
+ getUnpaidOrdersReport: reportsExportEndpoints.getModule.getUnpaidOrdersReport,
296
+ getAnnualSalesStatistics: reportsExportEndpoints.getModule.getAnnualSalesStatistics,
297
+ getPaymentMethodStatistics: reportsExportEndpoints.getModule.getPaymentMethodStatistics,
298
+ getProductsStatistics: reportsExportEndpoints.getModule.getProductsStatistics,
299
+ getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
300
+ getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
301
+ });
302
+ this.partners = bindMethods(this, {
303
+ getPartners: partnersEndpoints.getModule.getPartners,
304
+ getPartnerById: partnersEndpoints.getModule.getPartnerById,
305
+ createPartner: partnersEndpoints.postModule.createPartner,
306
+ updatePartnerById: partnersEndpoints.putModule.updatePartnerById,
307
+ deletePartnerById: partnersEndpoints.deleteModule.deletePartnerById,
308
+ });
309
+ this.outsourcedOrders = bindMethods(this, {
310
+ getOutsourcedOrdersByOrder: outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByOrder,
311
+ getOutsourcedOrdersByStore: outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByStore,
312
+ getOutsourcedOrderById: outsourcedOrdersEndpoints.getModule.getOutsourcedOrderById,
313
+ createOutsourcedOrder: outsourcedOrdersEndpoints.postModule.createOutsourcedOrder,
314
+ updateOutsourcedOrderById: outsourcedOrdersEndpoints.putModule.updateOutsourcedOrderById,
315
+ deleteOutsourcedOrderById: outsourcedOrdersEndpoints.deleteModule.deleteOutsourcedOrderById,
316
+ });
317
+ this.attendance = bindMethods(this, {
318
+ getHistory: attendanceEndpoints.getModule.getHistory,
319
+ getStatus: attendanceEndpoints.getModule.getStatus,
320
+ getStoreReport: attendanceEndpoints.getModule.getStoreReport,
321
+ clockIn: attendanceEndpoints.postModule.clockIn,
322
+ clockOut: attendanceEndpoints.postModule.clockOut,
323
+ updateById: attendanceEndpoints.putModule.updateById,
324
+ });
12
325
  } as any;
13
326
 
14
- WashdayClient.prototype.customers = {
15
- getCustomerById: getCustomerById,
16
- getCustomerHighlightsById: getCustomerHighlightsById
17
- };
18
-
19
-
20
- export default WashdayClient;
327
+ export default WashdayClient;
@@ -0,0 +1,16 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+ const GET_SET_INVENTORY = (storeId: string) => `api/store/${storeId}/inventory`;
4
+
5
+ export const deleteById = async function (this: WashdayClientInstance, storeId: string, id: string): Promise<any> {
6
+ try {
7
+ const config = {
8
+ headers: { Authorization: `Bearer ${this.apiToken}` }
9
+ };
10
+ const response = await axiosInstance.delete(`${GET_SET_INVENTORY(storeId)}/${id}`, config);
11
+ return response;
12
+ } catch (error) {
13
+ console.error('Error fetching deleteById:', error);
14
+ throw error;
15
+ }
16
+ };
@@ -0,0 +1,53 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+
4
+ const GET_SET_INVENTORY = (storeId: string) => `api/store/${storeId}/inventory`;
5
+
6
+ export const getInventory = async function (this: WashdayClientInstance, storeId: string, queryParams?: string): Promise<any> {
7
+ try {
8
+ const config = {
9
+ headers: { Authorization: `Bearer ${this.apiToken}` }
10
+ };
11
+ const response = await axiosInstance.get(`${GET_SET_INVENTORY(storeId)}?${queryParams}`, config);
12
+ return response;
13
+ } catch (error) {
14
+ console.error('Error fetching getInventory:', error);
15
+ throw error;
16
+ }
17
+ };
18
+
19
+ export const getInventoryById = async function (this: WashdayClientInstance, storeId: string, id: string): Promise<any> {
20
+ try {
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
+ };
24
+ return await axiosInstance.get(`${GET_SET_INVENTORY(storeId)}/${id}`, config);
25
+ } catch (error) {
26
+ console.error('Error fetching getInventoryById:', error);
27
+ throw error;
28
+ }
29
+ };
30
+
31
+ export const getHistoryById = async function (this: WashdayClientInstance, storeId: string, id: string, params?: {
32
+ pageNum: number;
33
+ limit: number
34
+ }): Promise<any> {
35
+ try {
36
+ const config = {
37
+ headers: { Authorization: `Bearer ${this.apiToken}` }
38
+ };
39
+ let queryParams = '';
40
+ if (params?.hasOwnProperty('pageNum')) {
41
+ queryParams += `pageNum=${params?.pageNum}`
42
+ }
43
+ if (params?.hasOwnProperty('limit')) {
44
+ queryParams += `&limit=${params?.limit}`
45
+ }
46
+ const response = await axiosInstance.get(`${GET_SET_INVENTORY(storeId)}/${id}/history?${queryParams}`, config);
47
+ return response;
48
+ } catch (error) {
49
+ console.error('Error fetching getInventoryHistory:', error);
50
+ throw error;
51
+ }
52
+ };
53
+
@@ -0,0 +1,4 @@
1
+ export * as deleteModule from './delete';
2
+ export * as getModule from './get';
3
+ export * as postModule from './post';
4
+ export * as putModule from './put';
@@ -0,0 +1,22 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+
4
+ const GET_SET_INVENTORY = (storeId: string) => `api/store/${storeId}/inventory`;
5
+
6
+ export const create = async function (this: WashdayClientInstance, storeId: string, data: {
7
+ product: string;
8
+ stock: number;
9
+ alertOnStock: number;
10
+ stockActivityHistory: Array<any>
11
+ }): Promise<any> {
12
+ try {
13
+ const config = {
14
+ headers: { Authorization: `Bearer ${this.apiToken}` }
15
+ };
16
+ const response = await axiosInstance.post(`${GET_SET_INVENTORY(storeId)}`, data, config);
17
+ return response;
18
+ } catch (error) {
19
+ console.error('Error fetching create:', error);
20
+ throw error;
21
+ }
22
+ };
@@ -0,0 +1,35 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+
4
+ const GET_SET_INVENTORY = (storeId: string) => `api/store/${storeId}/inventory`;
5
+
6
+ export const updateById = async function (this: WashdayClientInstance, storeId: string, id: string, data: {
7
+ alertOnStock: number;
8
+ }): Promise<any> {
9
+ try {
10
+ const config = {
11
+ headers: { Authorization: `Bearer ${this.apiToken}` }
12
+ };
13
+ const response = await axiosInstance.put(`${GET_SET_INVENTORY(storeId)}/${id}`, data, config);
14
+ return response;
15
+ } catch (error) {
16
+ console.error('Error fetching updateById:', error);
17
+ throw error;
18
+ }
19
+ };
20
+
21
+ export const addStock = async function (this: WashdayClientInstance, storeId: string, id: string, data: {
22
+ newStock: number;
23
+ date: string;
24
+ }): Promise<any> {
25
+ try {
26
+ const config = {
27
+ headers: { Authorization: `Bearer ${this.apiToken}` }
28
+ };
29
+ const response = await axiosInstance.put(`${GET_SET_INVENTORY(storeId)}/${id}/add-stock`, data, config);
30
+ return response;
31
+ } catch (error) {
32
+ console.error('Error fetching addStock:', error);
33
+ throw error;
34
+ }
35
+ };
@@ -0,0 +1,29 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+ const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
4
+ const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
5
+
6
+ export const deletePaymentLineById = async function (this: WashdayClientInstance, orderId: string, id: string): Promise<any> {
7
+ try {
8
+ const config = {
9
+ headers: { Authorization: `Bearer ${this.apiToken}` }
10
+ };
11
+ return await axiosInstance.delete(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, config);
12
+ } catch (error) {
13
+ console.error('Error fetching deleteById:', error);
14
+ throw error;
15
+ }
16
+ };
17
+
18
+
19
+ export const cancelOrderByIdCustomersApp = async function (this: WashdayClientInstance, id: string): Promise<any> {
20
+ try {
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
+ };
24
+ return await axiosInstance.delete(`${GET_SET_ORDER_CUSTOMERS_APP}/${id}`, config);
25
+ } catch (error) {
26
+ console.error('Error fetching cancelOrderByIdCustomersApp:', error);
27
+ throw error;
28
+ }
29
+ };