washday-sdk 0.0.185 → 0.0.187

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.
@@ -33,6 +33,8 @@ export const getList = function (params) {
33
33
  }
34
34
  });
35
35
  };
36
+ //todo: remove
37
+ //@DEPRECATED USE getCFDIPreview instead
36
38
  export const getCFDIPreviewByOrderId = function (id) {
37
39
  return __awaiter(this, void 0, void 0, function* () {
38
40
  try {
@@ -83,7 +85,7 @@ export const sendCFDIByEmail = function (id) {
83
85
  });
84
86
  };
85
87
  // THIS IS FOR WHEN MODAL OPENS AND WE WANT TO GET PREVIEW DATA
86
- export const getGlobalCFDIPreview = function (params) {
88
+ export const getCFDIPreview = function (params) {
87
89
  return __awaiter(this, void 0, void 0, function* () {
88
90
  try {
89
91
  const config = {
@@ -93,7 +95,7 @@ export const getGlobalCFDIPreview = function (params) {
93
95
  'ordersID',
94
96
  'customer',
95
97
  ], params);
96
- return yield axiosInstance.get(`${GET_SET_CFDI}/global/preview?${queryParams}`, config);
98
+ return yield axiosInstance.get(`${GET_SET_CFDI}/preview?${queryParams}`, config);
97
99
  }
98
100
  catch (error) {
99
101
  console.error('Error fetching:', error);
@@ -10,16 +10,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import axiosInstance from "../axiosInstance";
11
11
  const GET_SET_CFDI = 'api/cfdi';
12
12
  const GET_SET_ORDERS_CFDI = (orderID) => `api/order/${orderID}/cfdi`;
13
- export const createCFDI = function (id, data) {
13
+ export const createCFDI = function (data) {
14
14
  return __awaiter(this, void 0, void 0, function* () {
15
15
  try {
16
16
  const config = {
17
17
  headers: { Authorization: `Bearer ${this.apiToken}` }
18
18
  };
19
- return yield axiosInstance.post(`${GET_SET_ORDERS_CFDI(id)}`, data, config);
19
+ return yield axiosInstance.post(GET_SET_CFDI, data, config);
20
20
  }
21
21
  catch (error) {
22
- console.error('Error fetching create:', error);
22
+ console.error('Error createCFDI:', error);
23
23
  throw error;
24
24
  }
25
25
  });
package/dist/api/index.js CHANGED
@@ -61,7 +61,7 @@ const WashdayClient = function WashdayClient(apiToken) {
61
61
  getList: cfdiEndpoints.getModule.getList,
62
62
  downloadCFDIPDF: cfdiEndpoints.getModule.downloadCFDIPDF,
63
63
  sendCFDIByEmail: cfdiEndpoints.getModule.sendCFDIByEmail,
64
- getGlobalCFDIPreview: cfdiEndpoints.getModule.getGlobalCFDIPreview,
64
+ getCFDIPreview: cfdiEndpoints.getModule.getCFDIPreview,
65
65
  getCFDIPreviewByOrderId: cfdiEndpoints.getModule.getCFDIPreviewByOrderId,
66
66
  createCFDI: cfdiEndpoints.postModule.createCFDI,
67
67
  createGlobalCFDI: cfdiEndpoints.postModule.createGlobalCFDI,
@@ -10,13 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import axiosInstance from "../axiosInstance";
11
11
  const GET_PUBLIC = '/api/public';
12
12
  const GET_PUBLIC_ORDERS_ROUTES = '/api/public/orders';
13
- export const getOrderPublicReceipt = function (orderId) {
13
+ export const getOrderPublicReceipt = function (orderPublicToken) {
14
14
  return __awaiter(this, void 0, void 0, function* () {
15
15
  try {
16
16
  const config = {
17
17
  headers: { Authorization: `Bearer ${this.apiToken}` }
18
18
  };
19
- return yield axiosInstance.get(`${GET_PUBLIC_ORDERS_ROUTES}/${orderId}/receipt`, config);
19
+ return yield axiosInstance.get(`${GET_PUBLIC_ORDERS_ROUTES}/${orderPublicToken}/receipt`, config);
20
20
  }
21
21
  catch (error) {
22
22
  console.error('Error fetching getOrderPublicReceipt:', error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.185",
3
+ "version": "0.0.187",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -32,6 +32,8 @@ export const getList = async function (this: WashdayClientInstance, params: {
32
32
  }
33
33
  };
34
34
 
35
+ //todo: remove
36
+ //@DEPRECATED USE getCFDIPreview instead
35
37
  export const getCFDIPreviewByOrderId = async function (this: WashdayClientInstance, id: string): Promise<any> {
36
38
  try {
37
39
  const config = {
@@ -78,7 +80,7 @@ export const sendCFDIByEmail = async function (this: WashdayClientInstance, id:
78
80
  }
79
81
 
80
82
  // THIS IS FOR WHEN MODAL OPENS AND WE WANT TO GET PREVIEW DATA
81
- export const getGlobalCFDIPreview = async function (this: WashdayClientInstance, params: {
83
+ export const getCFDIPreview = async function (this: WashdayClientInstance, params: {
82
84
  ordersID?: string[];
83
85
  customer?: string
84
86
  }): Promise<any> {
@@ -90,7 +92,7 @@ export const getGlobalCFDIPreview = async function (this: WashdayClientInstance,
90
92
  'ordersID',
91
93
  'customer',
92
94
  ], params);
93
- return await axiosInstance.get(`${GET_SET_CFDI}/global/preview?${queryParams}`, config);
95
+ return await axiosInstance.get(`${GET_SET_CFDI}/preview?${queryParams}`, config);
94
96
  } catch (error) {
95
97
  console.error('Error fetching:', error);
96
98
  throw error;
@@ -3,21 +3,30 @@ import axiosInstance from "../axiosInstance";
3
3
  const GET_SET_CFDI = 'api/cfdi';
4
4
  const GET_SET_ORDERS_CFDI = (orderID: string) => `api/order/${orderID}/cfdi`;
5
5
 
6
- export const createCFDI = async function (this: WashdayClientInstance, id: string, data: {
7
- use: string
8
- payment_method: string
9
- payment_form: string
10
- sendEmailInvoice: boolean
11
- date: string
12
- env: 'prod' | 'dev'
6
+ export const createCFDI = async function (this: WashdayClientInstance, data: {
7
+ ordersID: string,
8
+ CFDIInfo: {
9
+ use: string
10
+ payment_method: string
11
+ payment_form: string
12
+ sendEmailInvoice?: boolean
13
+ date: string
14
+ env?: 'prod' | 'dev'
15
+ global?: {
16
+ periodicity: '',
17
+ months: '',
18
+ year: ''
19
+ }
20
+ },
21
+ customer?: string
13
22
  }): Promise<any> {
14
23
  try {
15
24
  const config = {
16
25
  headers: { Authorization: `Bearer ${this.apiToken}` }
17
26
  };
18
- return await axiosInstance.post(`${GET_SET_ORDERS_CFDI(id)}`, data, config);
27
+ return await axiosInstance.post(GET_SET_CFDI, data, config);
19
28
  } catch (error) {
20
- console.error('Error fetching create:', error);
29
+ console.error('Error createCFDI:', error);
21
30
  throw error;
22
31
  }
23
32
  };
package/src/api/index.ts CHANGED
@@ -68,7 +68,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
68
68
  getList: cfdiEndpoints.getModule.getList,
69
69
  downloadCFDIPDF: cfdiEndpoints.getModule.downloadCFDIPDF,
70
70
  sendCFDIByEmail: cfdiEndpoints.getModule.sendCFDIByEmail,
71
- getGlobalCFDIPreview: cfdiEndpoints.getModule.getGlobalCFDIPreview,
71
+ getCFDIPreview: cfdiEndpoints.getModule.getCFDIPreview,
72
72
  getCFDIPreviewByOrderId: cfdiEndpoints.getModule.getCFDIPreviewByOrderId,
73
73
  createCFDI: cfdiEndpoints.postModule.createCFDI,
74
74
  createGlobalCFDI: cfdiEndpoints.postModule.createGlobalCFDI,
@@ -3,12 +3,12 @@ import axiosInstance from "../axiosInstance";
3
3
  const GET_PUBLIC = '/api/public';
4
4
  const GET_PUBLIC_ORDERS_ROUTES = '/api/public/orders';
5
5
 
6
- export const getOrderPublicReceipt = async function (this: WashdayClientInstance, orderId: string): Promise<any> {
6
+ export const getOrderPublicReceipt = async function (this: WashdayClientInstance, orderPublicToken: string): Promise<any> {
7
7
  try {
8
8
  const config = {
9
9
  headers: { Authorization: `Bearer ${this.apiToken}` }
10
10
  };
11
- return await axiosInstance.get(`${GET_PUBLIC_ORDERS_ROUTES}/${orderId}/receipt`, config);
11
+ return await axiosInstance.get(`${GET_PUBLIC_ORDERS_ROUTES}/${orderPublicToken}/receipt`, config);
12
12
  } catch (error) {
13
13
  console.error('Error fetching getOrderPublicReceipt:', error);
14
14
  throw error;
@@ -53,7 +53,7 @@ export interface WashdayClientInstance {
53
53
  getList: typeof cfdiEndpoints.getModule.getList,
54
54
  downloadCFDIPDF: typeof cfdiEndpoints.getModule.downloadCFDIPDF,
55
55
  sendCFDIByEmail: typeof cfdiEndpoints.getModule.sendCFDIByEmail,
56
- getGlobalCFDIPreview: typeof cfdiEndpoints.getModule.getGlobalCFDIPreview,
56
+ getCFDIPreview: typeof cfdiEndpoints.getModule.getCFDIPreview,
57
57
  getCFDIPreviewByOrderId: typeof cfdiEndpoints.getModule.getCFDIPreviewByOrderId,
58
58
  createCFDI: typeof cfdiEndpoints.postModule.createCFDI,
59
59
  createGlobalCFDI: typeof cfdiEndpoints.postModule.createGlobalCFDI