washday-sdk 1.6.42 → 1.6.43

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.
@@ -38,3 +38,45 @@ export const createGlobalCFDI = function (data) {
38
38
  }
39
39
  });
40
40
  };
41
+ export const searchGlobalByPaymentMethodCandidates = function (data) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ try {
44
+ const config = {
45
+ headers: { Authorization: `Bearer ${this.apiToken}` }
46
+ };
47
+ return yield this.axiosInstance.post(`${GET_SET_CFDI}/global-by-payment-method/search`, data, config);
48
+ }
49
+ catch (error) {
50
+ console.error('Error searchGlobalByPaymentMethodCandidates:', error);
51
+ throw error;
52
+ }
53
+ });
54
+ };
55
+ export const previewGlobalByPaymentMethodCFDI = function (data) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ try {
58
+ const config = {
59
+ headers: { Authorization: `Bearer ${this.apiToken}` }
60
+ };
61
+ return yield this.axiosInstance.post(`${GET_SET_CFDI}/global-by-payment-method/preview`, data, config);
62
+ }
63
+ catch (error) {
64
+ console.error('Error previewGlobalByPaymentMethodCFDI:', error);
65
+ throw error;
66
+ }
67
+ });
68
+ };
69
+ export const createGlobalByPaymentMethodCFDI = function (data) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ try {
72
+ const config = {
73
+ headers: { Authorization: `Bearer ${this.apiToken}` }
74
+ };
75
+ return yield this.axiosInstance.post(`${GET_SET_CFDI}/global-by-payment-method`, data, config);
76
+ }
77
+ catch (error) {
78
+ console.error('Error createGlobalByPaymentMethodCFDI:', error);
79
+ throw error;
80
+ }
81
+ });
82
+ };
package/dist/api/index.js CHANGED
@@ -77,6 +77,9 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
77
77
  getCFDIPreviewByOrderId: cfdiEndpoints.getModule.getCFDIPreviewByOrderId,
78
78
  createCFDI: cfdiEndpoints.postModule.createCFDI,
79
79
  createGlobalCFDI: cfdiEndpoints.postModule.createGlobalCFDI,
80
+ searchGlobalByPaymentMethodCandidates: cfdiEndpoints.postModule.searchGlobalByPaymentMethodCandidates,
81
+ previewGlobalByPaymentMethodCFDI: cfdiEndpoints.postModule.previewGlobalByPaymentMethodCFDI,
82
+ createGlobalByPaymentMethodCFDI: cfdiEndpoints.postModule.createGlobalByPaymentMethodCFDI,
80
83
  cancelCFDI: cfdiEndpoints.deleteModule.cancelCFDI
81
84
  });
82
85
  this.review = bindMethods(this, {
@@ -113,6 +113,8 @@ export const fetchOrdersForCFDI = function (params) {
113
113
  "fromDate",
114
114
  "toDate",
115
115
  "storeID",
116
+ "storeIds",
117
+ "includeAllStores",
116
118
  "customerID"
117
119
  ], params);
118
120
  return yield this.axiosInstance.get(`${GET_SET_ORDER_CFDI}/cfdiPreview?${queryParams}`, config);
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as utils from './utils';
2
2
  import WashdayClient from './api';
3
3
  export * from './interfaces/Company';
4
+ export * from './interfaces/Cfdi';
4
5
  export { WashdayClient, utils };
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.42",
3
+ "version": "1.6.43",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1,4 +1,8 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import {
3
+ GlobalByPaymentMethodCFDIPayload,
4
+ SearchGlobalByPaymentMethodCandidatesPayload,
5
+ } from "../../interfaces/Cfdi";
2
6
  import axiosInstance from "../axiosInstance";
3
7
  const GET_SET_CFDI = 'api/cfdi';
4
8
  const GET_SET_ORDERS_CFDI = (orderID: string) => `api/order/${orderID}/cfdi`;
@@ -58,3 +62,48 @@ export const createGlobalCFDI = async function (this: WashdayClientInstance, dat
58
62
  throw error;
59
63
  }
60
64
  };
65
+
66
+ export const searchGlobalByPaymentMethodCandidates = async function (
67
+ this: WashdayClientInstance,
68
+ data: SearchGlobalByPaymentMethodCandidatesPayload
69
+ ): Promise<any> {
70
+ try {
71
+ const config = {
72
+ headers: { Authorization: `Bearer ${this.apiToken}` }
73
+ };
74
+ return await this.axiosInstance.post(`${GET_SET_CFDI}/global-by-payment-method/search`, data, config);
75
+ } catch (error) {
76
+ console.error('Error searchGlobalByPaymentMethodCandidates:', error);
77
+ throw error;
78
+ }
79
+ };
80
+
81
+ export const previewGlobalByPaymentMethodCFDI = async function (
82
+ this: WashdayClientInstance,
83
+ data: GlobalByPaymentMethodCFDIPayload
84
+ ): Promise<any> {
85
+ try {
86
+ const config = {
87
+ headers: { Authorization: `Bearer ${this.apiToken}` }
88
+ };
89
+ return await this.axiosInstance.post(`${GET_SET_CFDI}/global-by-payment-method/preview`, data, config);
90
+ } catch (error) {
91
+ console.error('Error previewGlobalByPaymentMethodCFDI:', error);
92
+ throw error;
93
+ }
94
+ };
95
+
96
+ export const createGlobalByPaymentMethodCFDI = async function (
97
+ this: WashdayClientInstance,
98
+ data: GlobalByPaymentMethodCFDIPayload
99
+ ): Promise<any> {
100
+ try {
101
+ const config = {
102
+ headers: { Authorization: `Bearer ${this.apiToken}` }
103
+ };
104
+ return await this.axiosInstance.post(`${GET_SET_CFDI}/global-by-payment-method`, data, config);
105
+ } catch (error) {
106
+ console.error('Error createGlobalByPaymentMethodCFDI:', error);
107
+ throw error;
108
+ }
109
+ };
package/src/api/index.ts CHANGED
@@ -84,6 +84,9 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
84
84
  getCFDIPreviewByOrderId: cfdiEndpoints.getModule.getCFDIPreviewByOrderId,
85
85
  createCFDI: cfdiEndpoints.postModule.createCFDI,
86
86
  createGlobalCFDI: cfdiEndpoints.postModule.createGlobalCFDI,
87
+ searchGlobalByPaymentMethodCandidates: cfdiEndpoints.postModule.searchGlobalByPaymentMethodCandidates,
88
+ previewGlobalByPaymentMethodCFDI: cfdiEndpoints.postModule.previewGlobalByPaymentMethodCFDI,
89
+ createGlobalByPaymentMethodCFDI: cfdiEndpoints.postModule.createGlobalByPaymentMethodCFDI,
87
90
  cancelCFDI: cfdiEndpoints.deleteModule.cancelCFDI
88
91
  });
89
92
  this.review = bindMethods(this, {
@@ -125,7 +125,9 @@ export const getCFDIOrdersByDateAndStore = async function (this: WashdayClientIn
125
125
  export const fetchOrdersForCFDI = async function (this: WashdayClientInstance, params: {
126
126
  fromDate: string
127
127
  toDate: string
128
- storeID: string
128
+ storeID?: string
129
+ storeIds?: string[]
130
+ includeAllStores?: boolean
129
131
  customerID?: string
130
132
  }): Promise<any> {
131
133
  try {
@@ -136,6 +138,8 @@ export const fetchOrdersForCFDI = async function (this: WashdayClientInstance, p
136
138
  "fromDate",
137
139
  "toDate",
138
140
  "storeID",
141
+ "storeIds",
142
+ "includeAllStores",
139
143
  "customerID"
140
144
  ], params);
141
145
  return await this.axiosInstance.get(`${GET_SET_ORDER_CFDI}/cfdiPreview?${queryParams}`, config);
@@ -206,4 +210,4 @@ export const getRequestedOrdersSummary = async function (this: WashdayClientInst
206
210
  console.error('Error fetching:', error);
207
211
  throw error;
208
212
  }
209
- }
213
+ }
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as utils from './utils';
2
2
  import WashdayClient from './api';
3
3
  export * from './interfaces/Company';
4
+ export * from './interfaces/Cfdi';
4
5
 
5
6
  export { WashdayClient, utils };
@@ -68,7 +68,10 @@ export interface WashdayClientInstance {
68
68
  getCFDIPreview: typeof cfdiEndpoints.getModule.getCFDIPreview,
69
69
  getCFDIPreviewByOrderId: typeof cfdiEndpoints.getModule.getCFDIPreviewByOrderId,
70
70
  createCFDI: typeof cfdiEndpoints.postModule.createCFDI,
71
- createGlobalCFDI: typeof cfdiEndpoints.postModule.createGlobalCFDI
71
+ createGlobalCFDI: typeof cfdiEndpoints.postModule.createGlobalCFDI,
72
+ searchGlobalByPaymentMethodCandidates: typeof cfdiEndpoints.postModule.searchGlobalByPaymentMethodCandidates,
73
+ previewGlobalByPaymentMethodCFDI: typeof cfdiEndpoints.postModule.previewGlobalByPaymentMethodCFDI,
74
+ createGlobalByPaymentMethodCFDI: typeof cfdiEndpoints.postModule.createGlobalByPaymentMethodCFDI,
72
75
  cancelCFDI: typeof cfdiEndpoints.deleteModule.cancelCFDI
73
76
  }
74
77
  auth: {
@@ -0,0 +1,71 @@
1
+ export type GlobalPaymentMethod = "cash" | "card" | "transfer" | "mercadopago";
2
+
3
+ export type GlobalPaymentMethodTaxSource = "order_taxes" | "no_taxes";
4
+
5
+ export interface GlobalPaymentMethodCfdiSettings {
6
+ product_key?: string;
7
+ unit_key?: string;
8
+ unit_name?: string;
9
+ tax_included?: boolean;
10
+ tax_source?: GlobalPaymentMethodTaxSource;
11
+ }
12
+
13
+ export interface GlobalPaymentMethodStoreFilters {
14
+ storeIds?: string[];
15
+ includeAllStores?: boolean;
16
+ }
17
+
18
+ export interface SearchGlobalByPaymentMethodCandidatesPayload extends GlobalPaymentMethodStoreFilters {
19
+ paymentMethod: GlobalPaymentMethod;
20
+ dateFrom: string;
21
+ dateTo: string;
22
+ }
23
+
24
+ export interface GlobalByPaymentMethodCandidate {
25
+ paymentLineId: string;
26
+ orderId: string;
27
+ orderSequence?: number | string;
28
+ folioPrefix?: string;
29
+ folio: string;
30
+ storeId: string;
31
+ storeName: string;
32
+ customerId?: string | null;
33
+ customerName?: string;
34
+ paymentDate: string | Date;
35
+ paymentMethod: GlobalPaymentMethod;
36
+ amountPaid: number;
37
+ defaultDescription: string;
38
+ isEligible: boolean;
39
+ ineligibilityReason?: string | null;
40
+ }
41
+
42
+ export interface SearchGlobalByPaymentMethodCandidatesResponse {
43
+ items: GlobalByPaymentMethodCandidate[];
44
+ summary: {
45
+ count: number;
46
+ totalAmount: number;
47
+ };
48
+ }
49
+
50
+ export interface GlobalByPaymentMethodSelectedLine {
51
+ paymentLineId: string;
52
+ description?: string;
53
+ }
54
+
55
+ export interface GlobalByPaymentMethodCFDIPayload extends SearchGlobalByPaymentMethodCandidatesPayload {
56
+ date?: string;
57
+ sendEmailInvoice?: boolean;
58
+ global: {
59
+ periodicity: string;
60
+ months: string;
61
+ year: string;
62
+ };
63
+ paymentLines: GlobalByPaymentMethodSelectedLine[];
64
+ }
65
+
66
+ export interface CreateGlobalByPaymentMethodCFDIResponse {
67
+ facturapiInvoiceID: string;
68
+ uuid?: string;
69
+ relatedPaymentLinesCount: number;
70
+ invoice?: any;
71
+ }
@@ -1,3 +1,5 @@
1
+ import { GlobalPaymentMethodCfdiSettings } from "./Cfdi";
2
+
1
3
  export interface ISubscriptionBillingInfo {
2
4
  legalName: string;
3
5
  rfc: string;
@@ -9,3 +11,22 @@ export interface ISubscriptionBillingInfo {
9
11
  export interface UpdateCompanySubscriptionBillingInfoPayload {
10
12
  subscriptionBillingInfo: ISubscriptionBillingInfo;
11
13
  }
14
+
15
+ export interface ICompanyTaxInfo {
16
+ name?: string;
17
+ legal_name?: string;
18
+ tax_system?: string;
19
+ website?: string;
20
+ support_email?: string;
21
+ phone?: string;
22
+ address?: {
23
+ zip?: string;
24
+ street?: string;
25
+ exterior?: string;
26
+ };
27
+ cfdiEmailSettings?: {
28
+ enabled: boolean;
29
+ email: string;
30
+ };
31
+ globalPaymentMethodCfdiSettings?: GlobalPaymentMethodCfdiSettings;
32
+ }
@@ -43,6 +43,19 @@ export interface IOrderPaymentLines {
43
43
  description: string,
44
44
  createdBy: IUser | string,
45
45
  facturapiPaymentInvoiceID?: string | null,
46
+ facturapiInvoiceID?: string | null,
47
+ facturapiInvoiceUUID?: string | null,
48
+ facturapiInvoiceType?: 'global_payment_method' | 'global_order' | 'order' | 'payment_complement' | '' | null,
49
+ invoicedAmount?: number,
50
+ invoiceAllocationStatus?: 'pending' | 'invoiced' | 'cancelled' | '' | null,
51
+ invoiceAllocationDate?: Date | string | null,
52
+ invoiceAllocationStoreId?: string | null,
53
+ invoiceAllocationMeta?: {
54
+ method?: 'cash' | 'card' | 'transfer' | 'mercadopago',
55
+ companyId?: string,
56
+ orderId?: string,
57
+ [key: string]: any
58
+ },
46
59
  }
47
60
 
48
61
  export interface IOrder {