washday-sdk 0.0.174 → 0.0.176

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/dist/api/index.js CHANGED
@@ -36,6 +36,8 @@ import * as reviewsEndpoints from './reviews';
36
36
  import * as cfdiEndpoints from './cfdi';
37
37
  import * as cashupsEndpoints from './cashups';
38
38
  import { deleteUserById } from "./users/delete";
39
+ import * as partnersEndpoints from './partners';
40
+ import * as outsourcedOrdersEndpoints from './outsourcedOrders';
39
41
  function bindMethods(instance, methods) {
40
42
  const boundMethods = {};
41
43
  for (const key in methods) {
@@ -275,5 +277,20 @@ const WashdayClient = function WashdayClient(apiToken) {
275
277
  getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
276
278
  getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
277
279
  });
280
+ this.partners = bindMethods(this, {
281
+ getPartners: partnersEndpoints.getModule.getPartners,
282
+ getPartnerById: partnersEndpoints.getModule.getPartnerById,
283
+ createPartner: partnersEndpoints.postModule.createPartner,
284
+ updatePartnerById: partnersEndpoints.putModule.updatePartnerById,
285
+ deletePartnerById: partnersEndpoints.deleteModule.deletePartnerById,
286
+ });
287
+ this.outsourcedOrders = bindMethods(this, {
288
+ getOutsourcedOrdersByOrder: outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByOrder,
289
+ getOutsourcedOrdersByStore: outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByStore,
290
+ getOutsourcedOrderById: outsourcedOrdersEndpoints.getModule.getOutsourcedOrderById,
291
+ createOutsourcedOrder: outsourcedOrdersEndpoints.postModule.createOutsourcedOrder,
292
+ updateOutsourcedOrderById: outsourcedOrdersEndpoints.putModule.updateOutsourcedOrderById,
293
+ deleteOutsourcedOrderById: outsourcedOrdersEndpoints.deleteModule.deleteOutsourcedOrderById,
294
+ });
278
295
  };
279
296
  export default WashdayClient;
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import axiosInstance from "../axiosInstance";
11
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
11
12
  const GET_SET_ORDER = 'api/v2/order';
12
13
  const GET_SET_ORDER_OLD = 'api/order';
13
14
  const GET_SET_ORDER_PAYMENTLINES = (orderId) => `/api/v2/order/${orderId}/paymentLines`;
@@ -67,13 +68,16 @@ export const setOrderCleaningBySequence = function (sequence, storeId) {
67
68
  }
68
69
  });
69
70
  };
70
- export const setOrderCleanedBySequence = function (sequence, storeId, data) {
71
+ export const setOrderCleanedBySequence = function (sequence, storeId, data, params) {
71
72
  return __awaiter(this, void 0, void 0, function* () {
72
73
  try {
73
74
  const config = {
74
75
  headers: { Authorization: `Bearer ${this.apiToken}` }
75
76
  };
76
- return yield axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cleaned`, data, config);
77
+ const queryParams = generateQueryParamsStr([
78
+ 'markOutsourcedAsReturned',
79
+ ], params);
80
+ return yield axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cleaned?${queryParams}`, data, config);
77
81
  }
78
82
  catch (error) {
79
83
  console.error('Error fetching setOrderCleanedBySequence:', error);
@@ -165,13 +169,16 @@ export const bulkCancel = function (storeId, body) {
165
169
  }
166
170
  });
167
171
  };
168
- export const bulkClean = function (storeId, body) {
172
+ export const bulkClean = function (storeId, body, params) {
169
173
  return __awaiter(this, void 0, void 0, function* () {
170
174
  try {
171
175
  const config = {
172
176
  headers: { Authorization: `Bearer ${this.apiToken}` }
173
177
  };
174
- return yield axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean`, body, config);
178
+ const queryParams = generateQueryParamsStr([
179
+ 'markOutsourcedAsReturned',
180
+ ], params);
181
+ return yield axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean?${queryParams}`, body, config);
175
182
  }
176
183
  catch (error) {
177
184
  console.error('Error fetching bulkClean:', error);
@@ -0,0 +1,25 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axiosInstance from "../axiosInstance";
11
+ const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
12
+ export const deleteOutsourcedOrderById = function (id) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ const config = {
16
+ headers: { Authorization: `Bearer ${this.apiToken}` }
17
+ };
18
+ return yield axiosInstance.delete(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, config);
19
+ }
20
+ catch (error) {
21
+ console.error('Error fetching deleteOutsourcedOrderById:', error);
22
+ throw error;
23
+ }
24
+ });
25
+ };
@@ -0,0 +1,61 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
11
+ import axiosInstance from "../axiosInstance";
12
+ const GET_OUTSOURCED_ORDERS_BY_STORE = 'api/store/:storeId/outsourced-orders';
13
+ const GET_OUTSOURCED_ORDERS_BY_ORDER = 'api/orders/:orderId/outsourced-orders';
14
+ const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
15
+ export const getOutsourcedOrdersByOrder = function (orderId) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ try {
18
+ const config = {
19
+ headers: { Authorization: `Bearer ${this.apiToken}` }
20
+ };
21
+ return yield axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_ORDER.replace(':orderId', orderId)}`, config);
22
+ }
23
+ catch (error) {
24
+ console.error('Error fetching getOutsourcedOrdersByOrder:', error);
25
+ throw error;
26
+ }
27
+ });
28
+ };
29
+ export const getOutsourcedOrdersByStore = function (params) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ try {
32
+ const config = {
33
+ headers: { Authorization: `Bearer ${this.apiToken}` }
34
+ };
35
+ const queryParams = generateQueryParamsStr([
36
+ 'statuses',
37
+ 'page',
38
+ 'limit'
39
+ ], params);
40
+ return yield axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_STORE.replace(':storeId', params.storeId)}?${queryParams}`, config);
41
+ }
42
+ catch (error) {
43
+ console.error('Error fetching getOutsourcedOrdersByStore:', error);
44
+ throw error;
45
+ }
46
+ });
47
+ };
48
+ export const getOutsourcedOrderById = function (id) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ try {
51
+ const config = {
52
+ headers: { Authorization: `Bearer ${this.apiToken}` }
53
+ };
54
+ return yield axiosInstance.get(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, config);
55
+ }
56
+ catch (error) {
57
+ console.error('Error fetching getOutsourcedOrderById:', error);
58
+ throw error;
59
+ }
60
+ });
61
+ };
@@ -0,0 +1,4 @@
1
+ export * as getModule from './get';
2
+ export * as postModule from './post';
3
+ export * as putModule from './put';
4
+ export * as deleteModule from './delete';
@@ -0,0 +1,25 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axiosInstance from "../axiosInstance";
11
+ const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
12
+ export const createOutsourcedOrder = function (data) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ const config = {
16
+ headers: { Authorization: `Bearer ${this.apiToken}` }
17
+ };
18
+ return yield axiosInstance.post(GET_SET_OUTSOURCED_ORDERS, data, config);
19
+ }
20
+ catch (error) {
21
+ console.error('Error fetching createOutsourcedOrder:', error);
22
+ throw error;
23
+ }
24
+ });
25
+ };
@@ -0,0 +1,25 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axiosInstance from "../axiosInstance";
11
+ const GET_SET_OUTSOURCED_ORDERS = 'api/outsourced-orders';
12
+ export const updateOutsourcedOrderById = function (id, data) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ const config = {
16
+ headers: { Authorization: `Bearer ${this.apiToken}` }
17
+ };
18
+ return yield axiosInstance.put(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, data, config);
19
+ }
20
+ catch (error) {
21
+ console.error('Error fetching updateOutsourcedOrderById:', error);
22
+ throw error;
23
+ }
24
+ });
25
+ };
@@ -0,0 +1,25 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axiosInstance from "../axiosInstance";
11
+ const GET_SET_PARTNERS = 'api/partners';
12
+ export const deletePartnerById = function (id) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ const config = {
16
+ headers: { Authorization: `Bearer ${this.apiToken}` }
17
+ };
18
+ return yield axiosInstance.delete(`${GET_SET_PARTNERS}/${id}`, config);
19
+ }
20
+ catch (error) {
21
+ console.error('Error fetching deletePartnerById:', error);
22
+ throw error;
23
+ }
24
+ });
25
+ };
@@ -0,0 +1,40 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axiosInstance from "../axiosInstance";
11
+ const GET_SET_PARTNERS = 'api/partners';
12
+ export const getPartners = function () {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ //THIS WILL FETCH ALL COMPANY PARTNERS
16
+ const config = {
17
+ headers: { Authorization: `Bearer ${this.apiToken}` }
18
+ };
19
+ return yield axiosInstance.get(`${GET_SET_PARTNERS}`, config);
20
+ }
21
+ catch (error) {
22
+ console.error('Error fetching getPartners:', error);
23
+ throw error;
24
+ }
25
+ });
26
+ };
27
+ export const getPartnerById = function (id) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ try {
30
+ const config = {
31
+ headers: { Authorization: `Bearer ${this.apiToken}` }
32
+ };
33
+ return yield axiosInstance.get(`${GET_SET_PARTNERS}/${id}`, config);
34
+ }
35
+ catch (error) {
36
+ console.error('Error fetching getPartnerById:', error);
37
+ throw error;
38
+ }
39
+ });
40
+ };
@@ -0,0 +1,4 @@
1
+ export * as getModule from './get';
2
+ export * as postModule from './post';
3
+ export * as putModule from './put';
4
+ export * as deleteModule from './delete';
@@ -0,0 +1,25 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axiosInstance from "../axiosInstance";
11
+ const GET_SET_PARTNERS = 'api/partners';
12
+ export const createPartner = function (data) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ const config = {
16
+ headers: { Authorization: `Bearer ${this.apiToken}` }
17
+ };
18
+ return yield axiosInstance.post(GET_SET_PARTNERS, data, config);
19
+ }
20
+ catch (error) {
21
+ console.error('Error fetching createPartner:', error);
22
+ throw error;
23
+ }
24
+ });
25
+ };
@@ -0,0 +1,25 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axiosInstance from "../axiosInstance";
11
+ const GET_SET_PARTNERS = 'api/partners';
12
+ export const updatePartnerById = function (id, data) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ const config = {
16
+ headers: { Authorization: `Bearer ${this.apiToken}` }
17
+ };
18
+ return yield axiosInstance.put(`${GET_SET_PARTNERS}/${id}`, data, config);
19
+ }
20
+ catch (error) {
21
+ console.error('Error fetching updatePartnerById:', error);
22
+ throw error;
23
+ }
24
+ });
25
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.174",
3
+ "version": "0.0.176",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/api/index.ts CHANGED
@@ -38,6 +38,8 @@ import * as cfdiEndpoints from './cfdi';
38
38
  import * as cashupsEndpoints from './cashups';
39
39
  import { deleteUserById } from "./users/delete";
40
40
  import { customersAppChangePassword } from './auth/post';
41
+ import * as partnersEndpoints from './partners';
42
+ import * as outsourcedOrdersEndpoints from './outsourcedOrders';
41
43
 
42
44
  type WashdayClientConstructor = {
43
45
  new(apiToken: string): WashdayClientInstance
@@ -282,6 +284,21 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
282
284
  getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
283
285
  getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
284
286
  });
287
+ this.partners = bindMethods(this, {
288
+ getPartners: partnersEndpoints.getModule.getPartners,
289
+ getPartnerById: partnersEndpoints.getModule.getPartnerById,
290
+ createPartner: partnersEndpoints.postModule.createPartner,
291
+ updatePartnerById: partnersEndpoints.putModule.updatePartnerById,
292
+ deletePartnerById: partnersEndpoints.deleteModule.deletePartnerById,
293
+ });
294
+ this.outsourcedOrders = bindMethods(this, {
295
+ getOutsourcedOrdersByOrder: outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByOrder,
296
+ getOutsourcedOrdersByStore: outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByStore,
297
+ getOutsourcedOrderById: outsourcedOrdersEndpoints.getModule.getOutsourcedOrderById,
298
+ createOutsourcedOrder: outsourcedOrdersEndpoints.postModule.createOutsourcedOrder,
299
+ updateOutsourcedOrderById: outsourcedOrdersEndpoints.putModule.updateOutsourcedOrderById,
300
+ deleteOutsourcedOrderById: outsourcedOrdersEndpoints.deleteModule.deleteOutsourcedOrderById,
301
+ });
285
302
  } as any;
286
303
 
287
304
  export default WashdayClient;
@@ -1,6 +1,7 @@
1
1
  import { AxiosResponse } from "axios";
2
2
  import { WashdayClientInstance } from "../../interfaces/Api";
3
3
  import axiosInstance from "../axiosInstance";
4
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
4
5
  const GET_SET_ORDER = 'api/v2/order';
5
6
  const GET_SET_ORDER_OLD = 'api/order';
6
7
  const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
@@ -83,12 +84,17 @@ export const setOrderCleaningBySequence = async function (this: WashdayClientIns
83
84
  export const setOrderCleanedBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string, data: {
84
85
  cleanedDateTime: string,
85
86
  readyDateTime: string
87
+ }, params?: {
88
+ 'markOutsourcedAsReturned': boolean,
86
89
  }): Promise<any> {
87
90
  try {
88
91
  const config = {
89
92
  headers: { Authorization: `Bearer ${this.apiToken}` }
90
93
  };
91
- return await axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cleaned`, data, config);
94
+ const queryParams = generateQueryParamsStr([
95
+ 'markOutsourcedAsReturned',
96
+ ], params);
97
+ return await axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cleaned?${queryParams}`, data, config);
92
98
  } catch (error) {
93
99
  console.error('Error fetching setOrderCleanedBySequence:', error);
94
100
  throw error;
@@ -183,12 +189,17 @@ export const bulkClean = async function (this: WashdayClientInstance, storeId: s
183
189
  ordersIds: string[]
184
190
  cleanedDateTime: string
185
191
  readyDateTime: string
192
+ }, params?: {
193
+ 'markOutsourcedAsReturned': boolean,
186
194
  }): Promise<AxiosResponse<any, any>> {
187
195
  try {
188
196
  const config = {
189
197
  headers: { Authorization: `Bearer ${this.apiToken}` }
190
198
  };
191
- return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean`, body, config);
199
+ const queryParams = generateQueryParamsStr([
200
+ 'markOutsourcedAsReturned',
201
+ ], params);
202
+ return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean?${queryParams}`, body, config);
192
203
  } catch (error) {
193
204
  console.error('Error fetching bulkClean:', error);
194
205
  throw error;
@@ -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,52 @@
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
+ page?: number,
24
+ limit?: number,
25
+ }): Promise<any> {
26
+ try {
27
+ const config = {
28
+ headers: { Authorization: `Bearer ${this.apiToken}` }
29
+ };
30
+ const queryParams = generateQueryParamsStr([
31
+ 'statuses',
32
+ 'page',
33
+ 'limit'
34
+ ], params);
35
+ return await axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_STORE.replace(':storeId', params.storeId)}?${queryParams}`, config);
36
+ } catch (error) {
37
+ console.error('Error fetching getOutsourcedOrdersByStore:', error);
38
+ throw error;
39
+ }
40
+ };
41
+
42
+ export const getOutsourcedOrderById = async function (this: WashdayClientInstance, id: string): Promise<any> {
43
+ try {
44
+ const config = {
45
+ headers: { Authorization: `Bearer ${this.apiToken}` }
46
+ };
47
+ return await axiosInstance.get(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, config);
48
+ } catch (error) {
49
+ console.error('Error fetching getOutsourcedOrderById:', error);
50
+ throw error;
51
+ }
52
+ };
@@ -0,0 +1,4 @@
1
+ export * as getModule from './get';
2
+ export * as postModule from './post';
3
+ export * as putModule from './put';
4
+ export * as deleteModule from './delete';
@@ -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
+ };
@@ -0,0 +1,28 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+ const GET_SET_PARTNERS = 'api/partners';
4
+
5
+ export const getPartners = async function (this: WashdayClientInstance): Promise<any> {
6
+ try {
7
+ //THIS WILL FETCH ALL COMPANY PARTNERS
8
+ const config = {
9
+ headers: { Authorization: `Bearer ${this.apiToken}` }
10
+ };
11
+ return await axiosInstance.get(`${GET_SET_PARTNERS}`, config);
12
+ } catch (error) {
13
+ console.error('Error fetching getPartners:', error);
14
+ throw error;
15
+ }
16
+ };
17
+
18
+ export const getPartnerById = async function (this: WashdayClientInstance, id: string): Promise<any> {
19
+ try {
20
+ const config = {
21
+ headers: { Authorization: `Bearer ${this.apiToken}` }
22
+ };
23
+ return await axiosInstance.get(`${GET_SET_PARTNERS}/${id}`, config);
24
+ } catch (error) {
25
+ console.error('Error fetching getPartnerById:', error);
26
+ throw error;
27
+ }
28
+ };
@@ -0,0 +1,4 @@
1
+ export * as getModule from './get';
2
+ export * as postModule from './post';
3
+ export * as putModule from './put';
4
+ export * as deleteModule from './delete';
@@ -0,0 +1,21 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import { IAddress } from "../../interfaces/Customer";
3
+ import axiosInstance from "../axiosInstance";
4
+ const GET_SET_PARTNERS = 'api/partners';
5
+
6
+ export const createPartner = async function (this: WashdayClientInstance, data: {
7
+ name: string,
8
+ contactEmail?: string,
9
+ contactPhone?: string,
10
+ address?: IAddress
11
+ }): Promise<any> {
12
+ try {
13
+ const config = {
14
+ headers: { Authorization: `Bearer ${this.apiToken}` }
15
+ };
16
+ return await axiosInstance.post(GET_SET_PARTNERS, data, config);
17
+ } catch (error) {
18
+ console.error('Error fetching createPartner:', error);
19
+ throw error;
20
+ }
21
+ };
@@ -0,0 +1,21 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import { IAddress } from "../../interfaces/Customer";
3
+ import axiosInstance from "../axiosInstance";
4
+ const GET_SET_PARTNERS = 'api/partners';
5
+
6
+ export const updatePartnerById = async function (this: WashdayClientInstance, id: string, data: {
7
+ name: string,
8
+ contactEmail?: string,
9
+ contactPhone?: string,
10
+ address?: IAddress
11
+ }): Promise<any> {
12
+ try {
13
+ const config = {
14
+ headers: { Authorization: `Bearer ${this.apiToken}` }
15
+ };
16
+ return await axiosInstance.put(`${GET_SET_PARTNERS}/${id}`, data, config);
17
+ } catch (error) {
18
+ console.error('Error fetching updatePartnerById:', error);
19
+ throw error;
20
+ }
21
+ };
@@ -24,6 +24,8 @@ export const create = async function (this: WashdayClientInstance, data: {
24
24
  invoice_product_unit_key: string;
25
25
  invoice_product_unit_name: string;
26
26
  productSupplies: Array<any>
27
+ isOutsourced?: boolean
28
+ outsourcingPartner?: string
27
29
  }): Promise<any> {
28
30
  try {
29
31
  const config = {
@@ -33,6 +33,8 @@ export const updateById = async function (this: WashdayClientInstance, id: strin
33
33
  invoice_description?: string,
34
34
  invoice_product_unit_key?: string
35
35
  invoice_product_unit_name?: string
36
+ isOutsourced?: boolean
37
+ outsourcingPartner?: string
36
38
  }): Promise<any> {
37
39
  try {
38
40
  const config = {
@@ -36,6 +36,8 @@ import * as cfdiEndpoints from '../api/cfdi';
36
36
  import * as cashupsEndpoints from '../api/cashups';
37
37
  import * as authEndpoints from '../api/auth';
38
38
  import { deleteUserById } from "../api/users/delete";
39
+ import * as partnersEndpoints from '../api/partners';
40
+ import * as outsourcedOrdersEndpoints from '../api/outsourcedOrders';
39
41
 
40
42
  export interface WashdayClientInstance {
41
43
  apiToken: string;
@@ -263,4 +265,17 @@ export interface WashdayClientInstance {
263
265
  getMonthSalesStatistics: typeof reportsExportEndpoints.getModule.getMonthSalesStatistics;
264
266
  getPopularDaysStatistics: typeof reportsExportEndpoints.getModule.getPopularDaysStatistics;
265
267
  };
268
+ partners: {
269
+ getPartners: typeof partnersEndpoints.getModule.getPartners;
270
+ getPartnerById: typeof partnersEndpoints.getModule.getPartnerById;
271
+ createPartner: typeof partnersEndpoints.postModule.createPartner;
272
+ updatePartnerById: typeof partnersEndpoints.putModule.updatePartnerById;
273
+ };
274
+ outsourcedOrders: {
275
+ getOutsourcedOrdersByOrder: typeof outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByOrder;
276
+ getOutsourcedOrdersByStore: typeof outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByStore;
277
+ getOutsourcedOrderById: typeof outsourcedOrdersEndpoints.getModule.getOutsourcedOrderById;
278
+ createOutsourcedOrder: typeof outsourcedOrdersEndpoints.postModule.createOutsourcedOrder;
279
+ updateOutsourcedOrderById: typeof outsourcedOrdersEndpoints.putModule.updateOutsourcedOrderById;
280
+ };
266
281
  }