washday-sdk 1.6.78 → 1.6.80

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
@@ -37,6 +37,7 @@ import * as attendanceEndpoints from './attendance';
37
37
  import * as routesEndpoints from './routes';
38
38
  import * as reviewsEndpoints from './reviews';
39
39
  import * as cfdiEndpoints from './cfdi';
40
+ import * as invoiceModuleEndpoints from './invoiceModule';
40
41
  import * as cashupsEndpoints from './cashups';
41
42
  import { deleteUserById } from "./users/delete";
42
43
  import * as partnersEndpoints from './partners';
@@ -84,6 +85,20 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
84
85
  createGlobalByPaymentMethodCFDI: cfdiEndpoints.postModule.createGlobalByPaymentMethodCFDI,
85
86
  cancelCFDI: cfdiEndpoints.deleteModule.cancelCFDI
86
87
  });
88
+ this.invoiceModule = bindMethods(this, {
89
+ getCapabilities: invoiceModuleEndpoints.getModule.getCapabilities,
90
+ getCFDIList: invoiceModuleEndpoints.getModule.getCFDIList,
91
+ getCFDIPreview: invoiceModuleEndpoints.getModule.getCFDIPreview,
92
+ downloadCFDIPDF: invoiceModuleEndpoints.getModule.downloadCFDIPDF,
93
+ downloadCFDIZIP: invoiceModuleEndpoints.getModule.downloadCFDIZIP,
94
+ sendCFDIByEmail: invoiceModuleEndpoints.getModule.sendCFDIByEmail,
95
+ getCFDIProductCatalogs: invoiceModuleEndpoints.getModule.getCFDIProductCatalogs,
96
+ createCFDI: invoiceModuleEndpoints.postModule.createCFDI,
97
+ searchGlobalByPaymentMethodCandidates: invoiceModuleEndpoints.postModule.searchGlobalByPaymentMethodCandidates,
98
+ previewGlobalByPaymentMethodCFDI: invoiceModuleEndpoints.postModule.previewGlobalByPaymentMethodCFDI,
99
+ createGlobalByPaymentMethodCFDI: invoiceModuleEndpoints.postModule.createGlobalByPaymentMethodCFDI,
100
+ cancelCFDI: invoiceModuleEndpoints.deleteModule.cancelCFDI,
101
+ });
87
102
  this.review = bindMethods(this, {
88
103
  getList: reviewsEndpoints.getModule.getList,
89
104
  requestStoreReviewByCustomerId: reviewsEndpoints.getModule.requestStoreReviewByCustomerId,
@@ -0,0 +1,24 @@
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
+ const GET_SET_INVOICE_MODULE_CFDI = "api/invoice-module/cfdi";
11
+ export const cancelCFDI = function (invoiceID, data) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ try {
14
+ const config = {
15
+ headers: { Authorization: `Bearer ${this.apiToken}` }
16
+ };
17
+ return yield this.axiosInstance.delete(`${GET_SET_INVOICE_MODULE_CFDI}/${invoiceID}`, Object.assign(Object.assign({}, config), { data }));
18
+ }
19
+ catch (error) {
20
+ console.error("Error canceling invoice module CFDI:", error);
21
+ throw error;
22
+ }
23
+ });
24
+ };
@@ -0,0 +1,133 @@
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
+ const GET_SET_INVOICE_MODULE_CFDI = "api/invoice-module/cfdi";
12
+ const GET_INVOICE_MODULE_CAPABILITIES = "api/invoice-module/capabilities";
13
+ export const getCapabilities = function () {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ try {
16
+ const config = {
17
+ headers: { Authorization: `Bearer ${this.apiToken}` }
18
+ };
19
+ return yield this.axiosInstance.get(GET_INVOICE_MODULE_CAPABILITIES, config);
20
+ }
21
+ catch (error) {
22
+ console.error("Error fetching invoice module capabilities:", error);
23
+ throw error;
24
+ }
25
+ });
26
+ };
27
+ export const getCFDIList = function () {
28
+ return __awaiter(this, arguments, void 0, function* (params = {}) {
29
+ try {
30
+ const config = {
31
+ headers: { Authorization: `Bearer ${this.apiToken}` }
32
+ };
33
+ const queryParams = generateQueryParamsStr([
34
+ "query",
35
+ "storeId",
36
+ "fromDate",
37
+ "toDate",
38
+ "limit",
39
+ "pageNum"
40
+ ], params);
41
+ return yield this.axiosInstance.get(`${GET_SET_INVOICE_MODULE_CFDI}?${queryParams}`, config);
42
+ }
43
+ catch (error) {
44
+ console.error("Error fetching invoice module CFDI list:", error);
45
+ throw error;
46
+ }
47
+ });
48
+ };
49
+ export const getCFDIPreview = function () {
50
+ return __awaiter(this, arguments, void 0, function* (params = {}) {
51
+ try {
52
+ const config = {
53
+ headers: { Authorization: `Bearer ${this.apiToken}` }
54
+ };
55
+ const queryParams = generateQueryParamsStr([
56
+ "ordersID",
57
+ "customer",
58
+ ], params);
59
+ return yield this.axiosInstance.get(`${GET_SET_INVOICE_MODULE_CFDI}/preview?${queryParams}`, config);
60
+ }
61
+ catch (error) {
62
+ console.error("Error fetching invoice module CFDI preview:", error);
63
+ throw error;
64
+ }
65
+ });
66
+ };
67
+ export const sendCFDIByEmail = function (invoiceID) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ try {
70
+ const config = {
71
+ headers: { Authorization: `Bearer ${this.apiToken}` }
72
+ };
73
+ return yield this.axiosInstance.get(`${GET_SET_INVOICE_MODULE_CFDI}/${invoiceID}/email`, config);
74
+ }
75
+ catch (error) {
76
+ console.error("Error sending invoice module CFDI by email:", error);
77
+ throw error;
78
+ }
79
+ });
80
+ };
81
+ export const downloadCFDIPDF = function (invoiceID) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ try {
84
+ const config = {
85
+ headers: {
86
+ Authorization: `Bearer ${this.apiToken}`,
87
+ },
88
+ responseType: "arraybuffer"
89
+ };
90
+ return yield this.axiosInstance.get(`${GET_SET_INVOICE_MODULE_CFDI}/${invoiceID}/download/pdf`, config);
91
+ }
92
+ catch (error) {
93
+ console.error("Error fetching invoice module CFDI PDF:", error);
94
+ throw error;
95
+ }
96
+ });
97
+ };
98
+ export const downloadCFDIZIP = function (invoiceID) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ try {
101
+ const config = {
102
+ headers: {
103
+ Authorization: `Bearer ${this.apiToken}`,
104
+ },
105
+ responseType: "arraybuffer"
106
+ };
107
+ return yield this.axiosInstance.get(`${GET_SET_INVOICE_MODULE_CFDI}/${invoiceID}/download/zip`, config);
108
+ }
109
+ catch (error) {
110
+ console.error("Error fetching invoice module CFDI ZIP:", error);
111
+ throw error;
112
+ }
113
+ });
114
+ };
115
+ export const getCFDIProductCatalogs = function () {
116
+ return __awaiter(this, arguments, void 0, function* (params = {}) {
117
+ try {
118
+ const config = {
119
+ headers: { Authorization: `Bearer ${this.apiToken}` }
120
+ };
121
+ const queryParams = generateQueryParamsStr([
122
+ "search",
123
+ "q",
124
+ ], params);
125
+ const queryParamsSuffix = queryParams ? `?${queryParams}` : "";
126
+ return yield this.axiosInstance.get(`${GET_SET_INVOICE_MODULE_CFDI}/catalogs/products${queryParamsSuffix}`, config);
127
+ }
128
+ catch (error) {
129
+ console.error("Error fetching invoice module CFDI product catalogs:", error);
130
+ throw error;
131
+ }
132
+ });
133
+ };
@@ -0,0 +1,3 @@
1
+ export * as deleteModule from './delete';
2
+ export * as getModule from './get';
3
+ export * as postModule from './post';
@@ -0,0 +1,66 @@
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
+ const GET_SET_INVOICE_MODULE_CFDI = "api/invoice-module/cfdi";
11
+ export const createCFDI = function (data) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ try {
14
+ const config = {
15
+ headers: { Authorization: `Bearer ${this.apiToken}` }
16
+ };
17
+ return yield this.axiosInstance.post(GET_SET_INVOICE_MODULE_CFDI, data, config);
18
+ }
19
+ catch (error) {
20
+ console.error("Error creating invoice module CFDI:", error);
21
+ throw error;
22
+ }
23
+ });
24
+ };
25
+ export const searchGlobalByPaymentMethodCandidates = function (data) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ try {
28
+ const config = {
29
+ headers: { Authorization: `Bearer ${this.apiToken}` }
30
+ };
31
+ return yield this.axiosInstance.post(`${GET_SET_INVOICE_MODULE_CFDI}/global-by-payment-method/search`, data, config);
32
+ }
33
+ catch (error) {
34
+ console.error("Error searching invoice module global payment method candidates:", error);
35
+ throw error;
36
+ }
37
+ });
38
+ };
39
+ export const previewGlobalByPaymentMethodCFDI = function (data) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ try {
42
+ const config = {
43
+ headers: { Authorization: `Bearer ${this.apiToken}` }
44
+ };
45
+ return yield this.axiosInstance.post(`${GET_SET_INVOICE_MODULE_CFDI}/global-by-payment-method/preview`, data, config);
46
+ }
47
+ catch (error) {
48
+ console.error("Error previewing invoice module global payment method CFDI:", error);
49
+ throw error;
50
+ }
51
+ });
52
+ };
53
+ export const createGlobalByPaymentMethodCFDI = function (data) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ try {
56
+ const config = {
57
+ headers: { Authorization: `Bearer ${this.apiToken}` }
58
+ };
59
+ return yield this.axiosInstance.post(`${GET_SET_INVOICE_MODULE_CFDI}/global-by-payment-method`, data, config);
60
+ }
61
+ catch (error) {
62
+ console.error("Error creating invoice module global payment method CFDI:", error);
63
+ throw error;
64
+ }
65
+ });
66
+ };
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import WashdayClient from './api';
3
3
  export * from './interfaces/Company';
4
4
  export * from './interfaces/Config';
5
5
  export * from './interfaces/Cfdi';
6
+ export * from './interfaces/InvoiceModule';
6
7
  export * from './interfaces/Auth';
7
8
  export * from './interfaces/Customer';
8
9
  export * from './interfaces/DomainUrls';
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.78",
3
+ "version": "1.6.80",
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,7 @@ import * as attendanceEndpoints from './attendance';
38
38
  import * as routesEndpoints from './routes';
39
39
  import * as reviewsEndpoints from './reviews';
40
40
  import * as cfdiEndpoints from './cfdi';
41
+ import * as invoiceModuleEndpoints from './invoiceModule';
41
42
  import * as cashupsEndpoints from './cashups';
42
43
  import { deleteUserById } from "./users/delete";
43
44
  import { customersAppChangePassword } from './auth/post';
@@ -91,6 +92,20 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
91
92
  createGlobalByPaymentMethodCFDI: cfdiEndpoints.postModule.createGlobalByPaymentMethodCFDI,
92
93
  cancelCFDI: cfdiEndpoints.deleteModule.cancelCFDI
93
94
  });
95
+ this.invoiceModule = bindMethods(this, {
96
+ getCapabilities: invoiceModuleEndpoints.getModule.getCapabilities,
97
+ getCFDIList: invoiceModuleEndpoints.getModule.getCFDIList,
98
+ getCFDIPreview: invoiceModuleEndpoints.getModule.getCFDIPreview,
99
+ downloadCFDIPDF: invoiceModuleEndpoints.getModule.downloadCFDIPDF,
100
+ downloadCFDIZIP: invoiceModuleEndpoints.getModule.downloadCFDIZIP,
101
+ sendCFDIByEmail: invoiceModuleEndpoints.getModule.sendCFDIByEmail,
102
+ getCFDIProductCatalogs: invoiceModuleEndpoints.getModule.getCFDIProductCatalogs,
103
+ createCFDI: invoiceModuleEndpoints.postModule.createCFDI,
104
+ searchGlobalByPaymentMethodCandidates: invoiceModuleEndpoints.postModule.searchGlobalByPaymentMethodCandidates,
105
+ previewGlobalByPaymentMethodCFDI: invoiceModuleEndpoints.postModule.previewGlobalByPaymentMethodCFDI,
106
+ createGlobalByPaymentMethodCFDI: invoiceModuleEndpoints.postModule.createGlobalByPaymentMethodCFDI,
107
+ cancelCFDI: invoiceModuleEndpoints.deleteModule.cancelCFDI,
108
+ });
94
109
  this.review = bindMethods(this, {
95
110
  getList: reviewsEndpoints.getModule.getList,
96
111
  requestStoreReviewByCustomerId: reviewsEndpoints.getModule.requestStoreReviewByCustomerId,
@@ -111,6 +126,8 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
111
126
  updateRouteById: routesEndpoints.putModule.updateRouteById,
112
127
  getRoutesByDriver: routesEndpoints.getModule.getRoutesByDriver,
113
128
  getRoutes: routesEndpoints.getModule.getRoutes,
129
+ getRoutesPage: routesEndpoints.getModule.getRoutesPage,
130
+ getRoutesByStorePage: routesEndpoints.getModule.getRoutesByStorePage,
114
131
  startRoute: routesEndpoints.postModule.startRoute,
115
132
  reorderRouteOrders: routesEndpoints.patchModule.reorderRouteOrders,
116
133
  });
@@ -0,0 +1,19 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import { InvoiceModuleCancelCFDIRequest } from "../../interfaces/InvoiceModule";
3
+
4
+ const GET_SET_INVOICE_MODULE_CFDI = "api/invoice-module/cfdi";
5
+
6
+ export const cancelCFDI = async function (this: WashdayClientInstance, invoiceID: string, data: InvoiceModuleCancelCFDIRequest): Promise<any> {
7
+ try {
8
+ const config = {
9
+ headers: { Authorization: `Bearer ${this.apiToken}` }
10
+ };
11
+ return await this.axiosInstance.delete(`${GET_SET_INVOICE_MODULE_CFDI}/${invoiceID}`, {
12
+ ...config,
13
+ data
14
+ });
15
+ } catch (error) {
16
+ console.error("Error canceling invoice module CFDI:", error);
17
+ throw error;
18
+ }
19
+ };
@@ -0,0 +1,118 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import {
3
+ InvoiceModuleCFDIListParams,
4
+ InvoiceModuleCFDIProductCatalogsParams,
5
+ InvoiceModuleCFDIPreviewParams,
6
+ } from "../../interfaces/InvoiceModule";
7
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
8
+
9
+ const GET_SET_INVOICE_MODULE_CFDI = "api/invoice-module/cfdi";
10
+ const GET_INVOICE_MODULE_CAPABILITIES = "api/invoice-module/capabilities";
11
+
12
+ export const getCapabilities = async function (this: WashdayClientInstance): Promise<any> {
13
+ try {
14
+ const config = {
15
+ headers: { Authorization: `Bearer ${this.apiToken}` }
16
+ };
17
+ return await this.axiosInstance.get(GET_INVOICE_MODULE_CAPABILITIES, config);
18
+ } catch (error) {
19
+ console.error("Error fetching invoice module capabilities:", error);
20
+ throw error;
21
+ }
22
+ };
23
+
24
+ export const getCFDIList = async function (this: WashdayClientInstance, params: InvoiceModuleCFDIListParams = {}): Promise<any> {
25
+ try {
26
+ const config = {
27
+ headers: { Authorization: `Bearer ${this.apiToken}` }
28
+ };
29
+ const queryParams = generateQueryParamsStr([
30
+ "query",
31
+ "storeId",
32
+ "fromDate",
33
+ "toDate",
34
+ "limit",
35
+ "pageNum"
36
+ ], params);
37
+
38
+ return await this.axiosInstance.get(`${GET_SET_INVOICE_MODULE_CFDI}?${queryParams}`, config);
39
+ } catch (error) {
40
+ console.error("Error fetching invoice module CFDI list:", error);
41
+ throw error;
42
+ }
43
+ };
44
+
45
+ export const getCFDIPreview = async function (this: WashdayClientInstance, params: InvoiceModuleCFDIPreviewParams = {}): Promise<any> {
46
+ try {
47
+ const config = {
48
+ headers: { Authorization: `Bearer ${this.apiToken}` }
49
+ };
50
+ const queryParams = generateQueryParamsStr([
51
+ "ordersID",
52
+ "customer",
53
+ ], params);
54
+ return await this.axiosInstance.get(`${GET_SET_INVOICE_MODULE_CFDI}/preview?${queryParams}`, config);
55
+ } catch (error) {
56
+ console.error("Error fetching invoice module CFDI preview:", error);
57
+ throw error;
58
+ }
59
+ };
60
+
61
+ export const sendCFDIByEmail = async function (this: WashdayClientInstance, invoiceID: string): Promise<any> {
62
+ try {
63
+ const config = {
64
+ headers: { Authorization: `Bearer ${this.apiToken}` }
65
+ };
66
+ return await this.axiosInstance.get(`${GET_SET_INVOICE_MODULE_CFDI}/${invoiceID}/email`, config);
67
+ } catch (error) {
68
+ console.error("Error sending invoice module CFDI by email:", error);
69
+ throw error;
70
+ }
71
+ };
72
+
73
+ export const downloadCFDIPDF = async function (this: WashdayClientInstance, invoiceID: string): Promise<any> {
74
+ try {
75
+ const config = {
76
+ headers: {
77
+ Authorization: `Bearer ${this.apiToken}`,
78
+ },
79
+ responseType: "arraybuffer" as const
80
+ };
81
+ return await this.axiosInstance.get(`${GET_SET_INVOICE_MODULE_CFDI}/${invoiceID}/download/pdf`, config);
82
+ } catch (error) {
83
+ console.error("Error fetching invoice module CFDI PDF:", error);
84
+ throw error;
85
+ }
86
+ };
87
+
88
+ export const downloadCFDIZIP = async function (this: WashdayClientInstance, invoiceID: string): Promise<any> {
89
+ try {
90
+ const config = {
91
+ headers: {
92
+ Authorization: `Bearer ${this.apiToken}`,
93
+ },
94
+ responseType: "arraybuffer" as const
95
+ };
96
+ return await this.axiosInstance.get(`${GET_SET_INVOICE_MODULE_CFDI}/${invoiceID}/download/zip`, config);
97
+ } catch (error) {
98
+ console.error("Error fetching invoice module CFDI ZIP:", error);
99
+ throw error;
100
+ }
101
+ };
102
+
103
+ export const getCFDIProductCatalogs = async function (this: WashdayClientInstance, params: InvoiceModuleCFDIProductCatalogsParams = {}): Promise<any> {
104
+ try {
105
+ const config = {
106
+ headers: { Authorization: `Bearer ${this.apiToken}` }
107
+ };
108
+ const queryParams = generateQueryParamsStr([
109
+ "search",
110
+ "q",
111
+ ], params);
112
+ const queryParamsSuffix = queryParams ? `?${queryParams}` : "";
113
+ return await this.axiosInstance.get(`${GET_SET_INVOICE_MODULE_CFDI}/catalogs/products${queryParamsSuffix}`, config);
114
+ } catch (error) {
115
+ console.error("Error fetching invoice module CFDI product catalogs:", error);
116
+ throw error;
117
+ }
118
+ };
@@ -0,0 +1,3 @@
1
+ export * as deleteModule from './delete';
2
+ export * as getModule from './get';
3
+ export * as postModule from './post';
@@ -0,0 +1,65 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import {
3
+ InvoiceModuleCreateCFDIRequest,
4
+ InvoiceModuleGlobalByPaymentMethodCFDIRequest,
5
+ InvoiceModuleSearchGlobalByPaymentMethodCandidatesRequest,
6
+ } from "../../interfaces/InvoiceModule";
7
+
8
+ const GET_SET_INVOICE_MODULE_CFDI = "api/invoice-module/cfdi";
9
+
10
+ export const createCFDI = async function (this: WashdayClientInstance, data: InvoiceModuleCreateCFDIRequest): Promise<any> {
11
+ try {
12
+ const config = {
13
+ headers: { Authorization: `Bearer ${this.apiToken}` }
14
+ };
15
+ return await this.axiosInstance.post(GET_SET_INVOICE_MODULE_CFDI, data, config);
16
+ } catch (error) {
17
+ console.error("Error creating invoice module CFDI:", error);
18
+ throw error;
19
+ }
20
+ };
21
+
22
+ export const searchGlobalByPaymentMethodCandidates = async function (
23
+ this: WashdayClientInstance,
24
+ data: InvoiceModuleSearchGlobalByPaymentMethodCandidatesRequest
25
+ ): Promise<any> {
26
+ try {
27
+ const config = {
28
+ headers: { Authorization: `Bearer ${this.apiToken}` }
29
+ };
30
+ return await this.axiosInstance.post(`${GET_SET_INVOICE_MODULE_CFDI}/global-by-payment-method/search`, data, config);
31
+ } catch (error) {
32
+ console.error("Error searching invoice module global payment method candidates:", error);
33
+ throw error;
34
+ }
35
+ };
36
+
37
+ export const previewGlobalByPaymentMethodCFDI = async function (
38
+ this: WashdayClientInstance,
39
+ data: InvoiceModuleGlobalByPaymentMethodCFDIRequest
40
+ ): Promise<any> {
41
+ try {
42
+ const config = {
43
+ headers: { Authorization: `Bearer ${this.apiToken}` }
44
+ };
45
+ return await this.axiosInstance.post(`${GET_SET_INVOICE_MODULE_CFDI}/global-by-payment-method/preview`, data, config);
46
+ } catch (error) {
47
+ console.error("Error previewing invoice module global payment method CFDI:", error);
48
+ throw error;
49
+ }
50
+ };
51
+
52
+ export const createGlobalByPaymentMethodCFDI = async function (
53
+ this: WashdayClientInstance,
54
+ data: InvoiceModuleGlobalByPaymentMethodCFDIRequest
55
+ ): Promise<any> {
56
+ try {
57
+ const config = {
58
+ headers: { Authorization: `Bearer ${this.apiToken}` }
59
+ };
60
+ return await this.axiosInstance.post(`${GET_SET_INVOICE_MODULE_CFDI}/global-by-payment-method`, data, config);
61
+ } catch (error) {
62
+ console.error("Error creating invoice module global payment method CFDI:", error);
63
+ throw error;
64
+ }
65
+ };
@@ -18,6 +18,25 @@ export type RouteListQuery = {
18
18
  createdTo?: string,
19
19
  };
20
20
 
21
+ export type RoutePageQuery = RouteListQuery & {
22
+ pageNum?: number | string,
23
+ limit?: number | string,
24
+ };
25
+
26
+ export type RouteStorePageQuery = {
27
+ pageNum?: number | string,
28
+ limit?: number | string,
29
+ };
30
+
31
+ export type RouteListPageResponse = {
32
+ routes: IRoute[],
33
+ totalRowsCount: number,
34
+ totalPages: number,
35
+ pageNum: number,
36
+ limit: number,
37
+ hasNextPage: boolean,
38
+ };
39
+
21
40
  //@deprecated
22
41
  export const getOrdersForRoute = async function (this: WashdayClientInstance, params: {
23
42
  store: string | undefined,
@@ -65,6 +84,26 @@ export const getRoutesByStore = async function (this: WashdayClientInstance, sto
65
84
  }
66
85
  };
67
86
 
87
+ export const getRoutesByStorePage = async function (
88
+ this: WashdayClientInstance,
89
+ storeId: string,
90
+ query: RouteStorePageQuery = {}
91
+ ): Promise<{ data: { data: RouteListPageResponse } }> {
92
+ try {
93
+ const config = {
94
+ headers: { Authorization: `Bearer ${this.apiToken}` }
95
+ };
96
+ const queryParams = generateQueryParamsStr([
97
+ 'pageNum',
98
+ 'limit',
99
+ ], query);
100
+ return await this.axiosInstance.get(`${GET_STORE_ROUTES_BY_ID.replace(':id', storeId)}?${queryParams}`, config);
101
+ } catch (error) {
102
+ console.error('Error fetching getRoutesByStorePage:', error);
103
+ throw error;
104
+ }
105
+ };
106
+
68
107
  export const getRouteByIdV2 = async function (this: WashdayClientInstance, routeId: string): Promise<{ data: { data: IRoute } }> {
69
108
  try {
70
109
  const config = {
@@ -129,3 +168,25 @@ export const getRoutes = async function (this: WashdayClientInstance, query: Rou
129
168
  throw error;
130
169
  }
131
170
  };
171
+
172
+ export const getRoutesPage = async function (this: WashdayClientInstance, query: RoutePageQuery = {}): Promise<{ data: { data: RouteListPageResponse } }> {
173
+ try {
174
+ const config = {
175
+ headers: { Authorization: `Bearer ${this.apiToken}` }
176
+ };
177
+ const queryParams = generateQueryParamsStr([
178
+ 'scope',
179
+ 'storeIds',
180
+ 'status',
181
+ 'driver',
182
+ 'createdFrom',
183
+ 'createdTo',
184
+ 'pageNum',
185
+ 'limit',
186
+ ], query);
187
+ return await this.axiosInstance.get(`${GET_ROUTE}?${queryParams}`, config);
188
+ } catch (error) {
189
+ console.error('Error fetching getRoutesPage:', error);
190
+ throw error;
191
+ }
192
+ };
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@ import WashdayClient from './api';
3
3
  export * from './interfaces/Company';
4
4
  export * from './interfaces/Config';
5
5
  export * from './interfaces/Cfdi';
6
+ export * from './interfaces/InvoiceModule';
6
7
  export * from './interfaces/Auth';
7
8
  export * from './interfaces/Customer';
8
9
  export * from './interfaces/DomainUrls';
@@ -35,6 +35,7 @@ import * as ordersEndpoints from '../api/order';
35
35
  import * as routesEndpoints from '../api/routes';
36
36
  import * as reviewsEndpoints from '../api/reviews';
37
37
  import * as cfdiEndpoints from '../api/cfdi';
38
+ import * as invoiceModuleEndpoints from '../api/invoiceModule';
38
39
  import * as cashupsEndpoints from '../api/cashups';
39
40
  import * as authEndpoints from '../api/auth';
40
41
  import * as attendanceEndpoints from '../api/attendance';
@@ -76,6 +77,20 @@ export interface WashdayClientInstance {
76
77
  createGlobalByPaymentMethodCFDI: typeof cfdiEndpoints.postModule.createGlobalByPaymentMethodCFDI,
77
78
  cancelCFDI: typeof cfdiEndpoints.deleteModule.cancelCFDI
78
79
  }
80
+ invoiceModule: {
81
+ getCapabilities: typeof invoiceModuleEndpoints.getModule.getCapabilities,
82
+ getCFDIList: typeof invoiceModuleEndpoints.getModule.getCFDIList,
83
+ getCFDIPreview: typeof invoiceModuleEndpoints.getModule.getCFDIPreview,
84
+ downloadCFDIPDF: typeof invoiceModuleEndpoints.getModule.downloadCFDIPDF,
85
+ downloadCFDIZIP: typeof invoiceModuleEndpoints.getModule.downloadCFDIZIP,
86
+ sendCFDIByEmail: typeof invoiceModuleEndpoints.getModule.sendCFDIByEmail,
87
+ getCFDIProductCatalogs: typeof invoiceModuleEndpoints.getModule.getCFDIProductCatalogs,
88
+ createCFDI: typeof invoiceModuleEndpoints.postModule.createCFDI,
89
+ searchGlobalByPaymentMethodCandidates: typeof invoiceModuleEndpoints.postModule.searchGlobalByPaymentMethodCandidates,
90
+ previewGlobalByPaymentMethodCFDI: typeof invoiceModuleEndpoints.postModule.previewGlobalByPaymentMethodCFDI,
91
+ createGlobalByPaymentMethodCFDI: typeof invoiceModuleEndpoints.postModule.createGlobalByPaymentMethodCFDI,
92
+ cancelCFDI: typeof invoiceModuleEndpoints.deleteModule.cancelCFDI,
93
+ }
79
94
  auth: {
80
95
  customerLoginToken: typeof authEndpoints.postModule.customerLoginToken;
81
96
  googleLogin: typeof authEndpoints.postModule.googleLogin;
@@ -113,6 +128,8 @@ export interface WashdayClientInstance {
113
128
  updateRouteById: typeof routesEndpoints.putModule.updateRouteById,
114
129
  getRoutesByDriver: typeof routesEndpoints.getModule.getRoutesByDriver,
115
130
  getRoutes: typeof routesEndpoints.getModule.getRoutes,
131
+ getRoutesPage: typeof routesEndpoints.getModule.getRoutesPage,
132
+ getRoutesByStorePage: typeof routesEndpoints.getModule.getRoutesByStorePage,
116
133
  startRoute: typeof routesEndpoints.postModule.startRoute,
117
134
  reorderRouteOrders: typeof routesEndpoints.patchModule.reorderRouteOrders,
118
135
  },