washday-sdk 0.0.91 → 0.0.93
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/cfdi/get.js +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/order/get.js +35 -0
- package/package.json +1 -1
- package/src/api/cfdi/get.ts +1 -1
- package/src/api/index.ts +1 -0
- package/src/api/order/get.ts +36 -0
- package/src/interfaces/Api.ts +1 -0
package/dist/api/cfdi/get.js
CHANGED
package/dist/api/index.js
CHANGED
|
@@ -65,6 +65,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
65
65
|
this.orders = bindMethods(this, {
|
|
66
66
|
getList: ordersEndpoints.getModule.getList,
|
|
67
67
|
getById: ordersEndpoints.getModule.getById,
|
|
68
|
+
fetchOrdersForCFDI: ordersEndpoints.getModule.fetchOrdersForCFDI,
|
|
68
69
|
updateById: ordersEndpoints.putModule.updateById,
|
|
69
70
|
updatePaymentLineById: ordersEndpoints.putModule.updatePaymentLineById,
|
|
70
71
|
createPaymentLine: ordersEndpoints.postModule.createPaymentLine,
|
package/dist/api/order/get.js
CHANGED
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
11
11
|
import axiosInstance from "../axiosInstance";
|
|
12
12
|
const GET_SET_ORDER = 'api/v2/order';
|
|
13
|
+
const GET_SET_ORDER_CFDI = 'api/v2/orders';
|
|
13
14
|
export const getList = function (params) {
|
|
14
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
16
|
try {
|
|
@@ -56,3 +57,37 @@ export const getById = function (id) {
|
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
};
|
|
60
|
+
export const getCFDIOrdersByDateAndStore = function (id) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
try {
|
|
63
|
+
const config = {
|
|
64
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
65
|
+
};
|
|
66
|
+
return yield axiosInstance.get(`${GET_SET_ORDER}/${id}`, config);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
console.error('Error fetching:', error);
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
export const fetchOrdersForCFDI = function (params) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
try {
|
|
77
|
+
const config = {
|
|
78
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
79
|
+
};
|
|
80
|
+
const queryParams = generateQueryParamsStr([
|
|
81
|
+
"fromDate",
|
|
82
|
+
"toDate",
|
|
83
|
+
"storeID",
|
|
84
|
+
"customerID"
|
|
85
|
+
], params);
|
|
86
|
+
return yield axiosInstance.get(`${GET_SET_ORDER_CFDI}/cfdiPreview?${queryParams}`, config);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.error('Error fetching:', error);
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
package/package.json
CHANGED
package/src/api/cfdi/get.ts
CHANGED
|
@@ -77,7 +77,7 @@ export const sendCFDIByEmail = async function (this: WashdayClientInstance, id:
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
// THIS IS FOR WHEN MODAL OPENS AND WE WANT TO GET PREVIEW DATA
|
|
81
81
|
export const getGlobalCFDIPreview = async function (this: WashdayClientInstance, params: {
|
|
82
82
|
ordersID?: string[];
|
|
83
83
|
customerId?: string
|
package/src/api/index.ts
CHANGED
|
@@ -71,6 +71,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
71
71
|
this.orders = bindMethods(this, {
|
|
72
72
|
getList: ordersEndpoints.getModule.getList,
|
|
73
73
|
getById: ordersEndpoints.getModule.getById,
|
|
74
|
+
fetchOrdersForCFDI: ordersEndpoints.getModule.fetchOrdersForCFDI,
|
|
74
75
|
updateById: ordersEndpoints.putModule.updateById,
|
|
75
76
|
updatePaymentLineById: ordersEndpoints.putModule.updatePaymentLineById,
|
|
76
77
|
createPaymentLine: ordersEndpoints.postModule.createPaymentLine,
|
package/src/api/order/get.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { IOrder } from "../../interfaces/Order";
|
|
|
3
3
|
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
4
4
|
import axiosInstance from "../axiosInstance";
|
|
5
5
|
const GET_SET_ORDER = 'api/v2/order';
|
|
6
|
+
const GET_SET_ORDER_CFDI = 'api/v2/orders';
|
|
6
7
|
|
|
7
8
|
export const getList = async function (this: WashdayClientInstance, params: {
|
|
8
9
|
store: string | undefined,
|
|
@@ -61,4 +62,39 @@ export const getById = async function (this: WashdayClientInstance, id: string):
|
|
|
61
62
|
console.error('Error fetching:', error);
|
|
62
63
|
throw error;
|
|
63
64
|
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const getCFDIOrdersByDateAndStore = async function (this: WashdayClientInstance, id: string): Promise<IOrder> {
|
|
68
|
+
try {
|
|
69
|
+
const config = {
|
|
70
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
71
|
+
};
|
|
72
|
+
return await axiosInstance.get(`${GET_SET_ORDER}/${id}`, config);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error('Error fetching:', error);
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const fetchOrdersForCFDI = async function (this: WashdayClientInstance, params: {
|
|
80
|
+
fromDate: string
|
|
81
|
+
toDate: string
|
|
82
|
+
storeID: string
|
|
83
|
+
customerID?: string
|
|
84
|
+
}): Promise<any> {
|
|
85
|
+
try {
|
|
86
|
+
const config = {
|
|
87
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
88
|
+
};
|
|
89
|
+
const queryParams = generateQueryParamsStr([
|
|
90
|
+
"fromDate",
|
|
91
|
+
"toDate",
|
|
92
|
+
"storeID",
|
|
93
|
+
"customerID"
|
|
94
|
+
], params);
|
|
95
|
+
return await axiosInstance.get(`${GET_SET_ORDER_CFDI}/cfdiPreview?${queryParams}`, config);
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error('Error fetching:', error);
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
64
100
|
}
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -57,6 +57,7 @@ export interface WashdayClientInstance {
|
|
|
57
57
|
orders: {
|
|
58
58
|
getList: typeof ordersEndpoints.getModule.getList;
|
|
59
59
|
getById: typeof ordersEndpoints.getModule.getById;
|
|
60
|
+
fetchOrdersForCFDI: typeof ordersEndpoints.getModule.fetchOrdersForCFDI;
|
|
60
61
|
updateById: typeof ordersEndpoints.putModule.updateById;
|
|
61
62
|
updatePaymentLineById: typeof ordersEndpoints.putModule.updatePaymentLineById;
|
|
62
63
|
createPaymentLine: typeof ordersEndpoints.postModule.createPaymentLine;
|