washday-sdk 1.0.1 → 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.
- package/README.md +126 -0
- package/babel.config.js +8 -0
- package/dist/api/attendance/delete.js +2 -0
- package/dist/api/attendance/get.js +83 -0
- package/dist/api/attendance/index.js +4 -0
- package/dist/api/attendance/post.js +39 -0
- package/dist/api/attendance/put.js +25 -0
- package/dist/api/auth/index.js +3 -0
- package/dist/api/auth/post.js +170 -0
- package/dist/api/axiosInstance.js +46 -0
- package/dist/api/cashierbox/delete.js +40 -0
- package/dist/api/cashierbox/get.js +63 -0
- package/dist/api/cashierbox/post.js +42 -0
- package/dist/api/cashierbox/put.js +42 -0
- package/dist/api/cashups/delete.js +25 -0
- package/dist/api/cashups/get.js +60 -0
- package/dist/api/cashups/index.js +4 -0
- package/dist/api/cashups/post.js +25 -0
- package/dist/api/cashups/put.js +52 -0
- package/dist/api/cfdi/delete.js +25 -0
- package/dist/api/cfdi/get.js +126 -0
- package/dist/api/cfdi/index.js +4 -0
- package/dist/api/cfdi/post.js +41 -0
- package/dist/api/cfdi/put.js +52 -0
- package/dist/api/companies/get.js +29 -0
- package/dist/api/companies/post.js +41 -0
- package/dist/api/companies/put.js +57 -0
- package/dist/api/countries/get.js +29 -0
- package/dist/api/countries/post.js +1 -0
- package/dist/api/countries/put.js +1 -0
- package/dist/api/csv/get.js +325 -0
- package/dist/api/csv/index.js +1 -0
- package/dist/api/customers/delete.js +40 -0
- package/dist/api/customers/get.js +106 -0
- package/dist/api/customers/index.js +4 -0
- package/dist/api/customers/post.js +41 -0
- package/dist/api/customers/put.js +52 -0
- package/dist/api/discounts/get.js +120 -0
- package/dist/api/discounts/post.js +40 -0
- package/dist/api/discounts/put.js +68 -0
- package/dist/api/index.js +319 -0
- package/dist/api/inventory/delete.js +26 -0
- package/dist/api/inventory/get.js +62 -0
- package/dist/api/inventory/index.js +4 -0
- package/dist/api/inventory/post.js +26 -0
- package/dist/api/inventory/put.js +41 -0
- package/dist/api/order/delete.js +40 -0
- package/dist/api/order/get.js +181 -0
- package/dist/api/order/index.js +4 -0
- package/dist/api/order/post.js +115 -0
- package/dist/api/order/put.js +202 -0
- package/dist/api/outsourcedOrders/delete.js +25 -0
- package/dist/api/outsourcedOrders/get.js +62 -0
- package/dist/api/outsourcedOrders/index.js +4 -0
- package/dist/api/outsourcedOrders/post.js +25 -0
- package/dist/api/outsourcedOrders/put.js +25 -0
- package/dist/api/partners/delete.js +25 -0
- package/dist/api/partners/get.js +40 -0
- package/dist/api/partners/index.js +4 -0
- package/dist/api/partners/post.js +25 -0
- package/dist/api/partners/put.js +25 -0
- package/dist/api/pdf/get.js +43 -0
- package/dist/api/pdf/index.js +1 -0
- package/dist/api/products/delete.js +40 -0
- package/dist/api/products/get.js +25 -0
- package/dist/api/products/index.js +4 -0
- package/dist/api/products/post.js +60 -0
- package/dist/api/products/put.js +40 -0
- package/dist/api/publics/get.js +26 -0
- package/dist/api/publics/index.js +1 -0
- package/dist/api/reports/get.js +303 -0
- package/dist/api/reports/index.js +1 -0
- package/dist/api/reviews/delete.js +15 -0
- package/dist/api/reviews/get.js +41 -0
- package/dist/api/reviews/index.js +4 -0
- package/dist/api/reviews/post.js +20 -0
- package/dist/api/reviews/put.js +52 -0
- package/dist/api/routes/delete.js +25 -0
- package/dist/api/routes/get.js +95 -0
- package/dist/api/routes/index.js +4 -0
- package/dist/api/routes/post.js +67 -0
- package/dist/api/routes/put.js +54 -0
- package/dist/api/sections/delete.js +25 -0
- package/dist/api/sections/get.js +71 -0
- package/dist/api/sections/index.js +4 -0
- package/dist/api/sections/post.js +26 -0
- package/dist/api/sections/put.js +25 -0
- package/dist/api/staff/delete.js +26 -0
- package/dist/api/staff/get.js +40 -0
- package/dist/api/staff/post.js +26 -0
- package/dist/api/staff/put.js +26 -0
- package/dist/api/stores/get.js +110 -0
- package/dist/api/stores/post.js +61 -0
- package/dist/api/stores/put.js +44 -0
- package/dist/api/stripe/get.js +1 -0
- package/dist/api/stripe/post.js +71 -0
- package/dist/api/stripe/put.js +1 -0
- package/dist/api/supplies/delete.js +26 -0
- package/dist/api/supplies/get.js +62 -0
- package/dist/api/supplies/post.js +26 -0
- package/dist/api/supplies/put.js +41 -0
- package/dist/api/users/delete.js +26 -0
- package/dist/api/users/post.js +25 -0
- package/dist/api/users/put.js +29 -0
- package/dist/enum/index.js +12 -7
- package/dist/index.js +3 -28
- package/dist/interfaces/Api.js +1 -0
- package/dist/interfaces/Apple.js +16 -0
- package/dist/interfaces/Attendance.js +1 -0
- package/dist/interfaces/Customer.js +1 -2
- package/dist/interfaces/Order.js +1 -2
- package/dist/interfaces/Permission.js +1 -2
- package/dist/interfaces/Product.js +1 -2
- package/dist/interfaces/Section.js +1 -2
- package/dist/interfaces/Store.js +1 -2
- package/dist/interfaces/StoreImage.js +1 -2
- package/dist/interfaces/User.js +1 -2
- package/dist/utils/apiUtils.js +9 -0
- package/dist/utils/index.js +2 -17
- package/dist/utils/orders/calculateOrderTotal.js +30 -21
- package/dist/utils/orders/calculateTotalTaxesIncluded.js +55 -29
- package/dist/utils/orders/calculateTotalTaxesOverPrice.js +56 -45
- package/dist/utils/orders/helpers.js +126 -17
- package/dist/utils/orders/index.js +3 -5
- package/dist/utils/receipt/generateReceiptHTML.js +157 -0
- package/dist/utils/util.js +63 -0
- package/docs/README.md +66 -0
- package/docs/examples/common-use-cases.md +487 -0
- package/docs/getting-started.md +237 -0
- package/docs/modules/attendance.md +404 -0
- package/jest.config.js +0 -0
- package/package.json +12 -4
- package/src/api/attendance/delete.ts +1 -0
- package/src/api/attendance/get.ts +81 -0
- package/src/api/attendance/index.ts +4 -0
- package/src/api/attendance/post.ts +37 -0
- package/src/api/attendance/put.ts +20 -0
- package/src/api/auth/index.ts +3 -0
- package/src/api/auth/post.ts +198 -0
- package/src/api/axiosInstance.ts +13 -3
- package/src/api/cashierbox/delete.ts +28 -0
- package/src/api/cashierbox/get.ts +53 -0
- package/src/api/cashierbox/post.ts +39 -0
- package/src/api/cashierbox/put.ts +32 -0
- package/src/api/cashups/delete.ts +15 -0
- package/src/api/cashups/get.ts +52 -0
- package/src/api/cashups/index.ts +4 -0
- package/src/api/cashups/post.ts +23 -0
- package/src/api/cashups/put.ts +53 -0
- package/src/api/cfdi/delete.ts +21 -0
- package/src/api/cfdi/get.ts +119 -0
- package/src/api/cfdi/index.ts +4 -0
- package/src/api/cfdi/post.ts +60 -0
- package/src/api/cfdi/put.ts +53 -0
- package/src/api/companies/get.ts +23 -0
- package/src/api/companies/post.ts +29 -0
- package/src/api/companies/put.ts +43 -0
- package/src/api/countries/get.ts +23 -0
- package/src/api/countries/post.ts +0 -0
- package/src/api/countries/put.ts +0 -0
- package/src/api/csv/get.ts +354 -0
- package/src/api/csv/index.ts +1 -0
- package/src/api/customers/delete.ts +29 -0
- package/src/api/customers/get.ts +83 -12
- package/src/api/customers/index.ts +4 -0
- package/src/api/customers/post.ts +48 -0
- package/src/api/customers/put.ts +68 -0
- package/src/api/discounts/get.ts +100 -0
- package/src/api/discounts/post.ts +35 -0
- package/src/api/discounts/put.ts +66 -0
- package/src/api/index.ts +320 -12
- package/src/api/inventory/delete.ts +16 -0
- package/src/api/inventory/get.ts +53 -0
- package/src/api/inventory/index.ts +4 -0
- package/src/api/inventory/post.ts +22 -0
- package/src/api/inventory/put.ts +35 -0
- package/src/api/order/delete.ts +29 -0
- package/src/api/order/get.ts +207 -0
- package/src/api/order/index.ts +4 -0
- package/src/api/order/post.ts +118 -0
- package/src/api/order/put.ts +224 -0
- package/src/api/outsourcedOrders/delete.ts +15 -0
- package/src/api/outsourcedOrders/get.ts +54 -0
- package/src/api/outsourcedOrders/index.ts +4 -0
- package/src/api/outsourcedOrders/post.ts +24 -0
- package/src/api/outsourcedOrders/put.ts +21 -0
- package/src/api/partners/delete.ts +15 -0
- package/src/api/partners/get.ts +28 -0
- package/src/api/partners/index.ts +4 -0
- package/src/api/partners/post.ts +21 -0
- package/src/api/partners/put.ts +21 -0
- package/src/api/pdf/get.ts +43 -0
- package/src/api/pdf/index.ts +1 -0
- package/src/api/products/delete.ts +28 -0
- package/src/api/products/get.ts +16 -0
- package/src/api/products/index.ts +4 -0
- package/src/api/products/post.ts +73 -0
- package/src/api/products/put.ts +49 -0
- package/src/api/publics/get.ts +16 -0
- package/src/api/publics/index.ts +1 -0
- package/src/api/reports/get.ts +329 -0
- package/src/api/reports/index.ts +1 -0
- package/src/api/reviews/delete.ts +15 -0
- package/src/api/reviews/get.ts +31 -0
- package/src/api/reviews/index.ts +4 -0
- package/src/api/reviews/post.ts +20 -0
- package/src/api/reviews/put.ts +53 -0
- package/src/api/routes/delete.ts +15 -0
- package/src/api/routes/get.ts +86 -0
- package/src/api/routes/index.ts +4 -0
- package/src/api/routes/post.ts +60 -0
- package/src/api/routes/put.ts +44 -0
- package/src/api/sections/delete.ts +15 -0
- package/src/api/sections/get.ts +67 -0
- package/src/api/sections/index.ts +4 -0
- package/src/api/sections/post.ts +22 -0
- package/src/api/sections/put.ts +23 -0
- package/src/api/staff/delete.ts +16 -0
- package/src/api/staff/get.ts +29 -0
- package/src/api/staff/post.ts +17 -0
- package/src/api/staff/put.ts +17 -0
- package/src/api/stores/get.ts +93 -0
- package/src/api/stores/post.ts +49 -0
- package/src/api/stores/put.ts +35 -0
- package/src/api/stripe/get.ts +0 -0
- package/src/api/stripe/post.ts +59 -0
- package/src/api/stripe/put.ts +0 -0
- package/src/api/supplies/delete.ts +16 -0
- package/src/api/supplies/get.ts +53 -0
- package/src/api/supplies/post.ts +26 -0
- package/src/api/supplies/put.ts +33 -0
- package/src/api/users/delete.ts +16 -0
- package/src/api/users/post.ts +18 -0
- package/src/api/users/put.ts +36 -0
- package/src/enum/index.ts +9 -1
- package/src/index.ts +1 -4
- package/src/interfaces/Api.ts +308 -0
- package/src/interfaces/Apple.ts +74 -0
- package/src/interfaces/Attendance.ts +45 -0
- package/src/interfaces/Customer.ts +15 -11
- package/src/interfaces/Order.ts +38 -1
- package/src/interfaces/Product.ts +1 -0
- package/src/interfaces/Store.ts +41 -0
- package/src/utils/apiUtils.ts +11 -0
- package/src/utils/index.ts +6 -1
- package/src/utils/orders/calculateOrderTotal.test.js +930 -0
- package/src/utils/orders/calculateOrderTotal.ts +60 -15
- package/src/utils/orders/calculateTotalTaxesIncluded.ts +57 -25
- package/src/utils/orders/calculateTotalTaxesOverPrice.ts +57 -41
- package/src/utils/orders/helpers.ts +195 -47
- package/src/utils/orders/index.ts +3 -1
- package/src/utils/receipt/generateReceiptHTML.ts +163 -0
- package/src/utils/util.ts +65 -0
- package/tsconfig.json +13 -9
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { GenericAbortSignal } from "axios";
|
|
2
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
3
|
+
import { IOrder } from "../../interfaces/Order";
|
|
4
|
+
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
5
|
+
import axiosInstance from "../axiosInstance";
|
|
6
|
+
const GET_SET_ORDER = 'api/v2/order';
|
|
7
|
+
const GET_SET_ORDER_CFDI = 'api/v2/orders';
|
|
8
|
+
const GET_HEADER_SUMMARY = 'api/orderHeaderSummary';
|
|
9
|
+
const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
|
|
10
|
+
|
|
11
|
+
export const getList = async function (this: WashdayClientInstance, params: {
|
|
12
|
+
store: string | undefined,
|
|
13
|
+
storeId: string | undefined,
|
|
14
|
+
status: string | undefined,
|
|
15
|
+
name: string | undefined,
|
|
16
|
+
phone: string | undefined,
|
|
17
|
+
email: string | undefined,
|
|
18
|
+
fromDate: string | undefined,
|
|
19
|
+
toDate: string | undefined,
|
|
20
|
+
sequence: string | undefined,
|
|
21
|
+
pageNum: string | undefined,
|
|
22
|
+
limit: string | undefined,
|
|
23
|
+
sequenceSort: string,
|
|
24
|
+
cleanedDateTime: string | undefined,
|
|
25
|
+
readyDateTime: string | undefined,
|
|
26
|
+
collectedDateTime: string | undefined,
|
|
27
|
+
q: string | undefined,
|
|
28
|
+
pickupFromDate: string | undefined,
|
|
29
|
+
pickupToDate: string | undefined,
|
|
30
|
+
deliveryFromDate: string | undefined,
|
|
31
|
+
deliveryToDate: string | undefined,
|
|
32
|
+
signal?: GenericAbortSignal,
|
|
33
|
+
fetchSection?: string,
|
|
34
|
+
cfdiId?: string,
|
|
35
|
+
}, options?: { signal?: GenericAbortSignal }): Promise<any> {
|
|
36
|
+
try {
|
|
37
|
+
const config = {
|
|
38
|
+
headers: { Authorization: `Bearer ${this.apiToken}` },
|
|
39
|
+
signal: options?.signal || params.signal || undefined
|
|
40
|
+
};
|
|
41
|
+
const queryParams = generateQueryParamsStr([
|
|
42
|
+
'store',
|
|
43
|
+
'storeId',
|
|
44
|
+
'status',
|
|
45
|
+
'name',
|
|
46
|
+
'phone',
|
|
47
|
+
'email',
|
|
48
|
+
'fromDate',
|
|
49
|
+
'toDate',
|
|
50
|
+
'sequence',
|
|
51
|
+
'pageNum',
|
|
52
|
+
'limit',
|
|
53
|
+
'sequenceSort',
|
|
54
|
+
'cleanedDateTime',
|
|
55
|
+
'readyDateTime',
|
|
56
|
+
'collectedDateTime',
|
|
57
|
+
'q',
|
|
58
|
+
'pickupFromDate',
|
|
59
|
+
'pickupToDate',
|
|
60
|
+
'deliveryFromDate',
|
|
61
|
+
'deliveryToDate',
|
|
62
|
+
'fetchSection',
|
|
63
|
+
'cfdiId',
|
|
64
|
+
], params);
|
|
65
|
+
// ], { ...params, q: params.q ? encodeURIComponent(params.q) : undefined });
|
|
66
|
+
return await axiosInstance.get(`${GET_SET_ORDER}?${queryParams}`, config);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error('Error fetching getList orders:', error);
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const getOrdersHeaderSummary = async function (this: WashdayClientInstance, params: {
|
|
74
|
+
store?: string,
|
|
75
|
+
status?: string,
|
|
76
|
+
}): Promise<any> {
|
|
77
|
+
try {
|
|
78
|
+
const config = {
|
|
79
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
80
|
+
};
|
|
81
|
+
const queryParams = generateQueryParamsStr([
|
|
82
|
+
'store',
|
|
83
|
+
'status',
|
|
84
|
+
], params);
|
|
85
|
+
|
|
86
|
+
return await axiosInstance.get(`${GET_HEADER_SUMMARY}?${queryParams}`, config);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error('Error fetching getOrdersHeaderSummary :', error);
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const getById = async function (this: WashdayClientInstance, id: string, params?: {
|
|
94
|
+
fetchSection?: string,
|
|
95
|
+
}, options?: { signal?: GenericAbortSignal }): Promise<IOrder> {
|
|
96
|
+
try {
|
|
97
|
+
const config = {
|
|
98
|
+
headers: { Authorization: `Bearer ${this.apiToken}` },
|
|
99
|
+
signal: options?.signal || undefined
|
|
100
|
+
};
|
|
101
|
+
const queryParams = generateQueryParamsStr([
|
|
102
|
+
'fetchSection',
|
|
103
|
+
], params);
|
|
104
|
+
return await axiosInstance.get(`${GET_SET_ORDER}/${id}?${queryParams}`, config);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
console.error('Error fetching:', error);
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export const getCFDIOrdersByDateAndStore = async function (this: WashdayClientInstance, id: string): Promise<IOrder> {
|
|
112
|
+
try {
|
|
113
|
+
const config = {
|
|
114
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
115
|
+
};
|
|
116
|
+
return await axiosInstance.get(`${GET_SET_ORDER}/${id}`, config);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.error('Error fetching:', error);
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export const fetchOrdersForCFDI = async function (this: WashdayClientInstance, params: {
|
|
124
|
+
fromDate: string
|
|
125
|
+
toDate: string
|
|
126
|
+
storeID: string
|
|
127
|
+
customerID?: string
|
|
128
|
+
}): Promise<any> {
|
|
129
|
+
try {
|
|
130
|
+
const config = {
|
|
131
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
132
|
+
};
|
|
133
|
+
const queryParams = generateQueryParamsStr([
|
|
134
|
+
"fromDate",
|
|
135
|
+
"toDate",
|
|
136
|
+
"storeID",
|
|
137
|
+
"customerID"
|
|
138
|
+
], params);
|
|
139
|
+
return await axiosInstance.get(`${GET_SET_ORDER_CFDI}/cfdiPreview?${queryParams}`, config);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.error('Error fetching:', error);
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const getListCustomersApp = async function (this: WashdayClientInstance, params: {
|
|
147
|
+
storeId: string | undefined,
|
|
148
|
+
status: string | undefined,
|
|
149
|
+
customerId: string | undefined,
|
|
150
|
+
fromDate: string | undefined,
|
|
151
|
+
toDate: string | undefined,
|
|
152
|
+
sequence: string | undefined,
|
|
153
|
+
pageNum: string | undefined,
|
|
154
|
+
limit: string | undefined,
|
|
155
|
+
sequenceSort: string,
|
|
156
|
+
cleanedDateTime: string | undefined,
|
|
157
|
+
readyDateTime: string | undefined,
|
|
158
|
+
collectedDateTime: string | undefined,
|
|
159
|
+
}): Promise<any> {
|
|
160
|
+
try {
|
|
161
|
+
const config = {
|
|
162
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
163
|
+
};
|
|
164
|
+
const queryParams = generateQueryParamsStr([
|
|
165
|
+
'storeId',
|
|
166
|
+
'status',
|
|
167
|
+
'customerId',
|
|
168
|
+
'fromDate',
|
|
169
|
+
'toDate',
|
|
170
|
+
'sequence',
|
|
171
|
+
'pageNum',
|
|
172
|
+
'limit',
|
|
173
|
+
'sequenceSort',
|
|
174
|
+
'cleanedDateTime',
|
|
175
|
+
'readyDateTime',
|
|
176
|
+
'collectedDateTime',
|
|
177
|
+
], params);
|
|
178
|
+
return await axiosInstance.get(`${GET_SET_ORDER_CUSTOMERS_APP}?${queryParams}`, config);
|
|
179
|
+
} catch (error) {
|
|
180
|
+
console.error('Error fetching getListCustomersApp orders:', error);
|
|
181
|
+
throw error;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export const getByIdCustomersApp = async function (this: WashdayClientInstance, id: string): Promise<IOrder> {
|
|
186
|
+
try {
|
|
187
|
+
const config = {
|
|
188
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
189
|
+
};
|
|
190
|
+
return await axiosInstance.get(`${GET_SET_ORDER_CUSTOMERS_APP}/${id}`, config);
|
|
191
|
+
} catch (error) {
|
|
192
|
+
console.error('Error fetching:', error);
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export const getRequestedOrdersSummary = async function (this: WashdayClientInstance, storeIds: string): Promise<any> {
|
|
198
|
+
try {
|
|
199
|
+
const config = {
|
|
200
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
201
|
+
};
|
|
202
|
+
return await axiosInstance.get(`${GET_SET_ORDER}/requested-summary?storeIds=${storeIds}`, config);
|
|
203
|
+
} catch (error) {
|
|
204
|
+
console.error('Error fetching:', error);
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { AxiosResponse } from "axios";
|
|
2
|
+
import { PaymentMethodsEnum } from "../../enum";
|
|
3
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
4
|
+
import { OrderDto } from "../../interfaces/Order";
|
|
5
|
+
import axiosInstance from "../axiosInstance";
|
|
6
|
+
const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
|
|
7
|
+
const GET_SET_ORDER = 'api/v2/order';
|
|
8
|
+
const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
|
|
9
|
+
|
|
10
|
+
export const createPaymentLine = async function (this: WashdayClientInstance, id: string, data: {
|
|
11
|
+
amountPaid: number,
|
|
12
|
+
cashierBox: string,
|
|
13
|
+
paymentMethod: string
|
|
14
|
+
paymentDate: Date,
|
|
15
|
+
pinUserId?: string
|
|
16
|
+
}): Promise<any> {
|
|
17
|
+
try {
|
|
18
|
+
const config = {
|
|
19
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
20
|
+
};
|
|
21
|
+
return await axiosInstance.post(`${GET_SET_ORDER_PAYMENTLINES(id)}`, data, config);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error('Error fetching create:', error);
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export const sendEmailReceipt = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
30
|
+
try {
|
|
31
|
+
const config = {
|
|
32
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
33
|
+
};
|
|
34
|
+
return await axiosInstance.post(`${GET_SET_ORDER}/${id}/sendEmailReceipt`, {}, config);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error('Error fetching create:', error);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const createOrderCustomersApp = async function (this: WashdayClientInstance, data: OrderDto): Promise<any> {
|
|
42
|
+
try {
|
|
43
|
+
const config = {
|
|
44
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
45
|
+
};
|
|
46
|
+
return await axiosInstance.post(`${GET_SET_ORDER_CUSTOMERS_APP}`, data, config);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error('Error fetching createOrderCustomersApp:', error);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const createOrderUsersApp = async function (this: WashdayClientInstance, data: OrderDto): Promise<any> {
|
|
54
|
+
try {
|
|
55
|
+
const config = {
|
|
56
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
57
|
+
};
|
|
58
|
+
return await axiosInstance.post(`${GET_SET_ORDER}`, data, config);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error('Error fetching createOrderUsersApp:', error);
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const bulkCreatePaymentLines = async function (this: WashdayClientInstance, storeId: string, body: {
|
|
66
|
+
paymentLines: {
|
|
67
|
+
sequence: string;
|
|
68
|
+
orderId: string
|
|
69
|
+
paymentMethod: PaymentMethodsEnum;
|
|
70
|
+
amount: number;
|
|
71
|
+
cashierBoxId: string;
|
|
72
|
+
paymentDate: Date;
|
|
73
|
+
pinUserId?: string;
|
|
74
|
+
}[],
|
|
75
|
+
}): Promise<AxiosResponse<any, any>> {
|
|
76
|
+
try {
|
|
77
|
+
const config = {
|
|
78
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
79
|
+
};
|
|
80
|
+
return await axiosInstance.post(`${GET_SET_ORDER}/${storeId}/bulkPaymentLines`, body, config);
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error('Error fetching bulkCreatePaymentLines:', error);
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
export const createOrderEvidence = async function (this: WashdayClientInstance, orderId: string, data: FormData): Promise<any> {
|
|
89
|
+
try {
|
|
90
|
+
const config = {
|
|
91
|
+
headers: {
|
|
92
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
93
|
+
// 'Content-Type': 'multipart/form-data',
|
|
94
|
+
'Content-Type': false
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
return await axiosInstance.post(`${GET_SET_ORDER}/${orderId}/evidence`, data, config);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.error('Error fetching createOrderEvidence:', error);
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const getRedeemPointsPreview = async function (this: WashdayClientInstance, data: {
|
|
105
|
+
customerId: string;
|
|
106
|
+
storeId: string;
|
|
107
|
+
orderTotal: number;
|
|
108
|
+
}): Promise<any> {
|
|
109
|
+
try {
|
|
110
|
+
const config = {
|
|
111
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
112
|
+
};
|
|
113
|
+
return await axiosInstance.post(`${GET_SET_ORDER}/redeemPointsPreview`, data, config);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error('Error fetching getRedeemPointsPreview:', error);
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { AxiosResponse } from "axios";
|
|
2
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
3
|
+
import axiosInstance from "../axiosInstance";
|
|
4
|
+
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
5
|
+
const GET_SET_ORDER = 'api/v2/order';
|
|
6
|
+
const GET_SET_ORDER_OLD = 'api/order';
|
|
7
|
+
const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
|
|
8
|
+
|
|
9
|
+
export const updateById = async function (this: WashdayClientInstance, id: string, data: {
|
|
10
|
+
status?: string,
|
|
11
|
+
products?: any[],
|
|
12
|
+
buyAndGetProducts?: any[],
|
|
13
|
+
customer?: string,
|
|
14
|
+
discountCode?: string | null,
|
|
15
|
+
notes?: string,
|
|
16
|
+
privateNotes?: string,
|
|
17
|
+
delivery?: boolean,
|
|
18
|
+
pickup?: boolean,
|
|
19
|
+
express?: boolean,
|
|
20
|
+
deliveryInfo?: {
|
|
21
|
+
date: Date,
|
|
22
|
+
fromTime: string,
|
|
23
|
+
toTime?: string
|
|
24
|
+
},
|
|
25
|
+
pickupInfo?: {
|
|
26
|
+
date: Date,
|
|
27
|
+
fromTime: string,
|
|
28
|
+
toTime?: string
|
|
29
|
+
},
|
|
30
|
+
notifyBy?: string,
|
|
31
|
+
}): Promise<any> {
|
|
32
|
+
try {
|
|
33
|
+
const config = {
|
|
34
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
35
|
+
};
|
|
36
|
+
return await axiosInstance.put(`${GET_SET_ORDER}/${id}`, data, config);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('Error fetching updateById:', error);
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const updatePaymentLineById = async function (this: WashdayClientInstance, orderId: string, id: string, data: {
|
|
44
|
+
amountPaid: number
|
|
45
|
+
updatedDate: Date
|
|
46
|
+
pinUserId?: string
|
|
47
|
+
}): Promise<any> {
|
|
48
|
+
try {
|
|
49
|
+
const config = {
|
|
50
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
51
|
+
};
|
|
52
|
+
return await axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.error('Error fetching updateById:', error);
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const setOrderCancelledBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string, data: {
|
|
60
|
+
cancelledDateTime: string
|
|
61
|
+
}): Promise<any> {
|
|
62
|
+
try {
|
|
63
|
+
const config = {
|
|
64
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
65
|
+
};
|
|
66
|
+
return await axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cancelled`, data, config);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error('Error fetching setOrderCancelledBySequence:', error);
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const setOrderCleaningBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string): Promise<any> {
|
|
74
|
+
try {
|
|
75
|
+
const config = {
|
|
76
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
77
|
+
};
|
|
78
|
+
return await axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cleaning`, {}, config);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error('Error fetching setOrderCleaningBySequence:', error);
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const setOrderCleanedBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string, data: {
|
|
86
|
+
cleanedDateTime: string,
|
|
87
|
+
readyDateTime: string
|
|
88
|
+
}, params?: {
|
|
89
|
+
'markOutsourcedAsReturned': boolean,
|
|
90
|
+
}): Promise<any> {
|
|
91
|
+
try {
|
|
92
|
+
const config = {
|
|
93
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
94
|
+
};
|
|
95
|
+
const queryParams = generateQueryParamsStr([
|
|
96
|
+
'markOutsourcedAsReturned',
|
|
97
|
+
], params);
|
|
98
|
+
return await axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cleaned?${queryParams}`, data, config);
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error('Error fetching setOrderCleanedBySequence:', error);
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const setOrderCollectedBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string, data: {
|
|
106
|
+
collectedDateTime: string;
|
|
107
|
+
collectWithAmountDue?: boolean,
|
|
108
|
+
pinUserId?: string
|
|
109
|
+
}): Promise<any> {
|
|
110
|
+
try {
|
|
111
|
+
const config = {
|
|
112
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
113
|
+
};
|
|
114
|
+
return await axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/collected`, data, config);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
console.error('Error fetching setOrderCollectedBySequence:', error);
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const setOrdePickingBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string, data: {
|
|
122
|
+
pickingUpDateTime: string
|
|
123
|
+
}): Promise<any> {
|
|
124
|
+
try {
|
|
125
|
+
const config = {
|
|
126
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
127
|
+
};
|
|
128
|
+
return await axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/picking`, data, config);
|
|
129
|
+
} catch (error) {
|
|
130
|
+
console.error('Error fetching setOrdePickingBySequence:', error);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const setOrdeDeliveringBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string, data: {
|
|
136
|
+
deliveringDateTime: string
|
|
137
|
+
}): Promise<any> {
|
|
138
|
+
try {
|
|
139
|
+
const config = {
|
|
140
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
141
|
+
};
|
|
142
|
+
return await axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/delivering`, data, config);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
console.error('Error fetching setOrdeDeliveringBySequence:', error);
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const setOrdeDeliveredBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string, data: {
|
|
150
|
+
collectedDateTime: string
|
|
151
|
+
}): Promise<any> {
|
|
152
|
+
try {
|
|
153
|
+
const config = {
|
|
154
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
155
|
+
};
|
|
156
|
+
return await axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/delivered`, data, config);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
console.error('Error fetching setOrdeDeliveredBySequence:', error);
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export const setOrderAcceptedBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string): Promise<any> {
|
|
164
|
+
try {
|
|
165
|
+
const config = {
|
|
166
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
167
|
+
};
|
|
168
|
+
return await axiosInstance.put(`${GET_SET_ORDER}/${sequence}/${storeId}/accepted`, {}, config);
|
|
169
|
+
} catch (error) {
|
|
170
|
+
console.error('Error fetching setOrderAcceptedBySequence:', error);
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const bulkCancel = async function (this: WashdayClientInstance, storeId: string, body: {
|
|
176
|
+
ordersIds: string[]
|
|
177
|
+
cancelledDateTime: string
|
|
178
|
+
}): Promise<AxiosResponse<any, any>> {
|
|
179
|
+
try {
|
|
180
|
+
const config = {
|
|
181
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
182
|
+
};
|
|
183
|
+
return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkCancel`, body, config);
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.error('Error fetching bulkCancel:', error);
|
|
186
|
+
throw error;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export const bulkClean = async function (this: WashdayClientInstance, storeId: string, body: {
|
|
191
|
+
ordersIds: string[]
|
|
192
|
+
cleanedDateTime: string
|
|
193
|
+
readyDateTime: string
|
|
194
|
+
}, params?: {
|
|
195
|
+
'markOutsourcedAsReturned': boolean,
|
|
196
|
+
}): Promise<AxiosResponse<any, any>> {
|
|
197
|
+
try {
|
|
198
|
+
const config = {
|
|
199
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
200
|
+
};
|
|
201
|
+
const queryParams = generateQueryParamsStr([
|
|
202
|
+
'markOutsourcedAsReturned',
|
|
203
|
+
], params);
|
|
204
|
+
return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean?${queryParams}`, body, config);
|
|
205
|
+
} catch (error) {
|
|
206
|
+
console.error('Error fetching bulkClean:', error);
|
|
207
|
+
throw error;
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export const bulkCollect = async function (this: WashdayClientInstance, storeId: string, body: {
|
|
212
|
+
ordersIds: string[]
|
|
213
|
+
collectedDateTime: string
|
|
214
|
+
}): Promise<AxiosResponse<any, any>> {
|
|
215
|
+
try {
|
|
216
|
+
const config = {
|
|
217
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
218
|
+
};
|
|
219
|
+
return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkCollect`, body, config);
|
|
220
|
+
} catch (error) {
|
|
221
|
+
console.error('Error fetching bulkCollect:', error);
|
|
222
|
+
throw error;
|
|
223
|
+
}
|
|
224
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
4
|
+
|
|
5
|
+
export const deleteOutsourcedOrderById = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
6
|
+
try {
|
|
7
|
+
const config = {
|
|
8
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
9
|
+
};
|
|
10
|
+
return await axiosInstance.delete(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, config);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error('Error fetching deleteOutsourcedOrderById:', error);
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
3
|
+
import axiosInstance from "../axiosInstance";
|
|
4
|
+
const GET_OUTSOURCED_ORDERS_BY_STORE = 'api/store/:storeId/outsourced-orders'
|
|
5
|
+
const GET_OUTSOURCED_ORDERS_BY_ORDER = 'api/orders/:orderId/outsourced-orders';
|
|
6
|
+
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
7
|
+
|
|
8
|
+
export const getOutsourcedOrdersByOrder = async function (this: WashdayClientInstance, orderId: string): Promise<any> {
|
|
9
|
+
try {
|
|
10
|
+
const config = {
|
|
11
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
12
|
+
};
|
|
13
|
+
return await axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_ORDER.replace(':orderId', orderId)}`, config);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error('Error fetching getOutsourcedOrdersByOrder:', error);
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const getOutsourcedOrdersByStore = async function (this: WashdayClientInstance, params: {
|
|
21
|
+
storeId: string,
|
|
22
|
+
statuses?: string[],
|
|
23
|
+
sequence?: string,
|
|
24
|
+
page?: number,
|
|
25
|
+
limit?: number,
|
|
26
|
+
}): Promise<any> {
|
|
27
|
+
try {
|
|
28
|
+
const config = {
|
|
29
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
30
|
+
};
|
|
31
|
+
const queryParams = generateQueryParamsStr([
|
|
32
|
+
'statuses',
|
|
33
|
+
'page',
|
|
34
|
+
'limit',
|
|
35
|
+
'sequence'
|
|
36
|
+
], params);
|
|
37
|
+
return await axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_STORE.replace(':storeId', params.storeId)}?${queryParams}`, config);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error('Error fetching getOutsourcedOrdersByStore:', error);
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const getOutsourcedOrderById = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
45
|
+
try {
|
|
46
|
+
const config = {
|
|
47
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
48
|
+
};
|
|
49
|
+
return await axiosInstance.get(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, config);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error('Error fetching getOutsourcedOrderById:', error);
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
4
|
+
|
|
5
|
+
export const createOutsourcedOrder = async function (this: WashdayClientInstance, data: {
|
|
6
|
+
partner?: string;
|
|
7
|
+
outsourcedStatus?: "pending" | "in_process" | "returned";
|
|
8
|
+
sentDate?: Date;
|
|
9
|
+
receivedDate?: Date;
|
|
10
|
+
externalOrderId?: string;
|
|
11
|
+
order: string;
|
|
12
|
+
orderProduct?: string;
|
|
13
|
+
store: string;
|
|
14
|
+
}): Promise<any> {
|
|
15
|
+
try {
|
|
16
|
+
const config = {
|
|
17
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
18
|
+
};
|
|
19
|
+
return await axiosInstance.post(GET_SET_OUTSOURCED_ORDERS, data, config);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error('Error fetching createOutsourcedOrder:', error);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
|
|
4
|
+
|
|
5
|
+
export const updateOutsourcedOrderById = async function (this: WashdayClientInstance, id: string, data: {
|
|
6
|
+
partner?: string,
|
|
7
|
+
outsourcedStatus?: "pending" | "in_process" | "returned",
|
|
8
|
+
sentDate?: Date,
|
|
9
|
+
receivedDate?: Date,
|
|
10
|
+
externalOrderId?: string,
|
|
11
|
+
}): Promise<any> {
|
|
12
|
+
try {
|
|
13
|
+
const config = {
|
|
14
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
15
|
+
};
|
|
16
|
+
return await axiosInstance.put(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, data, config);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error('Error fetching updateOutsourcedOrderById:', error);
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_PARTNERS = 'api/partners';
|
|
4
|
+
|
|
5
|
+
export const deletePartnerById = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
6
|
+
try {
|
|
7
|
+
const config = {
|
|
8
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
9
|
+
};
|
|
10
|
+
return await axiosInstance.delete(`${GET_SET_PARTNERS}/${id}`, config);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error('Error fetching deletePartnerById:', error);
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
};
|