@zauru-sdk/services 1.0.77 → 1.0.79

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.
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.deleteInvoiceOrder = exports.updateInvoiceOrder = exports.createInvoiceOrder = exports.getInvoicesByAgencyId = void 0;
6
+ exports.deleteInvoiceOrder = exports.updateInvoiceOrder = exports.createInvoiceOrder = exports.createInvoice = exports.getInvoicesByAgencyId = void 0;
7
7
  const common_1 = require("@zauru-sdk/common");
8
8
  const common_js_1 = require("../common.js");
9
9
  const httpGraphQL_js_1 = __importDefault(require("./httpGraphQL.js"));
@@ -40,19 +40,47 @@ async function getInvoicesByAgencyId(session, id) {
40
40
  });
41
41
  }
42
42
  exports.getInvoicesByAgencyId = getInvoicesByAgencyId;
43
+ /**
44
+ * createInvoice
45
+ * @param headers
46
+ * @param body
47
+ * @returns
48
+ */
49
+ async function createInvoice(headers, body) {
50
+ return (0, common_1.handlePossibleAxiosErrors)(async () => {
51
+ const sendBody = {
52
+ ...body,
53
+ invoice_details_attributes: (0, common_1.arrayToObject)(body.invoice_details),
54
+ tag_ids: ["", ...(body.tagging_invoices?.map((x) => x.tag_id) ?? [])],
55
+ };
56
+ if (sendBody.deleted_invoice_details)
57
+ delete sendBody.deleted_invoice_details;
58
+ if (sendBody.__rvfInternalFormId)
59
+ delete sendBody.__rvfInternalFormId;
60
+ if (sendBody.invoice_details)
61
+ delete sendBody.invoice_details;
62
+ if (sendBody.tagging_invoices)
63
+ delete sendBody.tagging_invoices;
64
+ console.log("ENVIANDO: ", JSON.stringify(sendBody));
65
+ const response = await httpZauru_js_1.default.post(`/sales/unpaid_invoices.json`, { invoice: sendBody }, { headers });
66
+ return response.data;
67
+ });
68
+ }
69
+ exports.createInvoice = createInvoice;
43
70
  /**
44
71
  * createInvoiceOrder
45
72
  * @param headers
46
73
  * @param body
47
74
  * @returns
48
75
  */
49
- async function createInvoiceOrder(headers, body) {
76
+ async function createInvoiceOrder(headers, body, esFactura = false) {
50
77
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
51
78
  const sendBody = {
52
79
  ...body,
53
- issued: false, // Esto lo hace una órden y no una factura
80
+ issued: esFactura, //(false) - Esto lo hace una órden y no una factura
54
81
  invoice_details_attributes: (0, common_1.arrayToObject)(body.invoice_details),
55
- tag_ids: body.tagging_invoices?.map((x) => x.tag_id) ?? [],
82
+ tag_ids: ["", ...(body.tagging_invoices?.map((x) => x.tag_id) ?? [])],
83
+ taxable: esFactura ? 1 : 0,
56
84
  };
57
85
  if (sendBody.deleted_invoice_details)
58
86
  delete sendBody.deleted_invoice_details;
@@ -60,6 +88,8 @@ async function createInvoiceOrder(headers, body) {
60
88
  delete sendBody.__rvfInternalFormId;
61
89
  if (sendBody.invoice_details)
62
90
  delete sendBody.invoice_details;
91
+ if (sendBody.tagging_invoices)
92
+ delete sendBody.tagging_invoices;
63
93
  const response = await httpZauru_js_1.default.post(`/sales/orders.json`, { invoice: sendBody }, { headers });
64
94
  return response.data;
65
95
  });
@@ -37,12 +37,12 @@ async function createMotivoRechazo(headers, session, body) {
37
37
  });
38
38
  }
39
39
  exports.createMotivoRechazo = createMotivoRechazo;
40
- async function updateMotivosRechazo(headers, session, id) {
40
+ async function updateMotivosRechazo(headers, session, id, Nombre) {
41
41
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
42
42
  const { recepciones_rejection_types_webapp_table_id } = await (0, common_js_1.getVariablesByName)(headers, session, [
43
43
  "recepciones_rejection_types_webapp_table_id",
44
44
  ]);
45
- const response = await (0, zauru_web_app_tables_js_1.deleteWebAppTableRegister)(headers, recepciones_rejection_types_webapp_table_id, id);
45
+ const response = await (0, zauru_web_app_tables_js_1.updateWebAppTableRegister)(headers, recepciones_rejection_types_webapp_table_id, id, { Nombre });
46
46
  return response;
47
47
  });
48
48
  }
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.deletePayeeCategory = exports.updatePayeeCategory = exports.createPayeeCategory = exports.updatePayee = exports.deletePayee = exports.createPayee = exports.getClientCategories = exports.getProviderCategories = exports.getPayeeCategories = exports.getPayeeCategoriesByNotesMatch = exports.getPayeesByCategoryId = exports.getPayee = exports.getProviders = exports.getPayees = void 0;
6
+ exports.deletePayeeCategory = exports.updatePayeeCategory = exports.createPayeeCategory = exports.updatePayee = exports.deletePayee = exports.createPayee = exports.getClientCategories = exports.getProviderCategories = exports.getPayeeCategories = exports.getPayeeCategoriesByNotesMatch = exports.getPayeesByCategoryId = exports.getCreatePayee = exports.getPayee = exports.getProviders = exports.getPayees = void 0;
7
7
  const common_1 = require("@zauru-sdk/common");
8
8
  const httpGraphQL_js_1 = __importDefault(require("./httpGraphQL.js"));
9
9
  const common_js_1 = require("../common.js");
@@ -64,6 +64,22 @@ async function getPayee(session, id) {
64
64
  });
65
65
  }
66
66
  exports.getPayee = getPayee;
67
+ /**
68
+ * getCreatePayee
69
+ * @param headers
70
+ * @param session
71
+ * @param id
72
+ * @returns
73
+ */
74
+ async function getCreatePayee(headers, search) {
75
+ return (0, common_1.handlePossibleAxiosErrors)(async () => {
76
+ const response = await httpZauru_js_1.default.post(`/settings/payees/search_payee.json`, search, {
77
+ headers,
78
+ });
79
+ return response.data;
80
+ });
81
+ }
82
+ exports.getCreatePayee = getCreatePayee;
67
83
  /**
68
84
  * getPayeesByCategoryId
69
85
  * @param session
@@ -345,6 +345,7 @@ const getGraphQLPurchaseOrderBetweenDates = (session, dates, config = {
345
345
  itemId: config.itemId,
346
346
  payeeCategoryId: config.payeeCategoryId,
347
347
  betweenIssueDate: config.betweenIssueDate,
348
+ payeeId: config.payeeId,
348
349
  id_number: config.id_number,
349
350
  });
350
351
  const variables = {
@@ -33,19 +33,46 @@ export async function getInvoicesByAgencyId(session, id) {
33
33
  return registers;
34
34
  });
35
35
  }
36
+ /**
37
+ * createInvoice
38
+ * @param headers
39
+ * @param body
40
+ * @returns
41
+ */
42
+ export async function createInvoice(headers, body) {
43
+ return handlePossibleAxiosErrors(async () => {
44
+ const sendBody = {
45
+ ...body,
46
+ invoice_details_attributes: arrayToObject(body.invoice_details),
47
+ tag_ids: ["", ...(body.tagging_invoices?.map((x) => x.tag_id) ?? [])],
48
+ };
49
+ if (sendBody.deleted_invoice_details)
50
+ delete sendBody.deleted_invoice_details;
51
+ if (sendBody.__rvfInternalFormId)
52
+ delete sendBody.__rvfInternalFormId;
53
+ if (sendBody.invoice_details)
54
+ delete sendBody.invoice_details;
55
+ if (sendBody.tagging_invoices)
56
+ delete sendBody.tagging_invoices;
57
+ console.log("ENVIANDO: ", JSON.stringify(sendBody));
58
+ const response = await httpZauru.post(`/sales/unpaid_invoices.json`, { invoice: sendBody }, { headers });
59
+ return response.data;
60
+ });
61
+ }
36
62
  /**
37
63
  * createInvoiceOrder
38
64
  * @param headers
39
65
  * @param body
40
66
  * @returns
41
67
  */
42
- export async function createInvoiceOrder(headers, body) {
68
+ export async function createInvoiceOrder(headers, body, esFactura = false) {
43
69
  return handlePossibleAxiosErrors(async () => {
44
70
  const sendBody = {
45
71
  ...body,
46
- issued: false, // Esto lo hace una órden y no una factura
72
+ issued: esFactura, //(false) - Esto lo hace una órden y no una factura
47
73
  invoice_details_attributes: arrayToObject(body.invoice_details),
48
- tag_ids: body.tagging_invoices?.map((x) => x.tag_id) ?? [],
74
+ tag_ids: ["", ...(body.tagging_invoices?.map((x) => x.tag_id) ?? [])],
75
+ taxable: esFactura ? 1 : 0,
49
76
  };
50
77
  if (sendBody.deleted_invoice_details)
51
78
  delete sendBody.deleted_invoice_details;
@@ -53,6 +80,8 @@ export async function createInvoiceOrder(headers, body) {
53
80
  delete sendBody.__rvfInternalFormId;
54
81
  if (sendBody.invoice_details)
55
82
  delete sendBody.invoice_details;
83
+ if (sendBody.tagging_invoices)
84
+ delete sendBody.tagging_invoices;
56
85
  const response = await httpZauru.post(`/sales/orders.json`, { invoice: sendBody }, { headers });
57
86
  return response.data;
58
87
  });
@@ -1,6 +1,6 @@
1
1
  import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
2
  import { getVariablesByName } from "../common.js";
3
- import { createWebAppTableRegister, deleteWebAppTableRegister, getWebAppTableRegisters, } from "./zauru-web-app-tables.js";
3
+ import { createWebAppTableRegister, deleteWebAppTableRegister, getWebAppTableRegisters, updateWebAppTableRegister, } from "./zauru-web-app-tables.js";
4
4
  export async function getMotivosRechazo(headers, session) {
5
5
  return handlePossibleAxiosErrors(async () => {
6
6
  const { recepciones_rejection_types_webapp_table_id } = await getVariablesByName(headers, session, [
@@ -31,12 +31,12 @@ export async function createMotivoRechazo(headers, session, body) {
31
31
  return response;
32
32
  });
33
33
  }
34
- export async function updateMotivosRechazo(headers, session, id) {
34
+ export async function updateMotivosRechazo(headers, session, id, Nombre) {
35
35
  return handlePossibleAxiosErrors(async () => {
36
36
  const { recepciones_rejection_types_webapp_table_id } = await getVariablesByName(headers, session, [
37
37
  "recepciones_rejection_types_webapp_table_id",
38
38
  ]);
39
- const response = await deleteWebAppTableRegister(headers, recepciones_rejection_types_webapp_table_id, id);
39
+ const response = await updateWebAppTableRegister(headers, recepciones_rejection_types_webapp_table_id, id, { Nombre });
40
40
  return response;
41
41
  });
42
42
  }
@@ -55,6 +55,21 @@ export async function getPayee(session, id) {
55
55
  return responsePayee?.data?.data?.payees[0];
56
56
  });
57
57
  }
58
+ /**
59
+ * getCreatePayee
60
+ * @param headers
61
+ * @param session
62
+ * @param id
63
+ * @returns
64
+ */
65
+ export async function getCreatePayee(headers, search) {
66
+ return handlePossibleAxiosErrors(async () => {
67
+ const response = await httpZauru.post(`/settings/payees/search_payee.json`, search, {
68
+ headers,
69
+ });
70
+ return response.data;
71
+ });
72
+ }
58
73
  /**
59
74
  * getPayeesByCategoryId
60
75
  * @param session
@@ -325,6 +325,7 @@ export const getGraphQLPurchaseOrderBetweenDates = (session, dates, config = {
325
325
  itemId: config.itemId,
326
326
  payeeCategoryId: config.payeeCategoryId,
327
327
  betweenIssueDate: config.betweenIssueDate,
328
+ payeeId: config.payeeId,
328
329
  id_number: config.id_number,
329
330
  });
330
331
  const variables = {
@@ -4,13 +4,20 @@ import { AxiosUtilsResponse, InvoiceGraphQL } from "@zauru-sdk/types";
4
4
  * getInvoicesByAgencyId
5
5
  */
6
6
  export declare function getInvoicesByAgencyId(session: Session, id: string | null): Promise<AxiosUtilsResponse<InvoiceGraphQL[]>>;
7
+ /**
8
+ * createInvoice
9
+ * @param headers
10
+ * @param body
11
+ * @returns
12
+ */
13
+ export declare function createInvoice(headers: any, body: Partial<InvoiceGraphQL>): Promise<AxiosUtilsResponse<InvoiceGraphQL>>;
7
14
  /**
8
15
  * createInvoiceOrder
9
16
  * @param headers
10
17
  * @param body
11
18
  * @returns
12
19
  */
13
- export declare function createInvoiceOrder(headers: any, body: Partial<InvoiceGraphQL>): Promise<AxiosUtilsResponse<InvoiceGraphQL>>;
20
+ export declare function createInvoiceOrder(headers: any, body: Partial<InvoiceGraphQL>, esFactura?: boolean): Promise<AxiosUtilsResponse<InvoiceGraphQL>>;
14
21
  /**
15
22
  * updateInvoiceOrder
16
23
  * @param headers
@@ -3,7 +3,7 @@ import { AxiosUtilsResponse, MotivoRechazo, RegisterMotivosRechazoBody, WebAppRo
3
3
  export declare function getMotivosRechazo(headers: any, session: Session): Promise<AxiosUtilsResponse<WebAppRowGraphQL<MotivoRechazo>[]>>;
4
4
  export declare function deleteMotivosRechazo(headers: any, session: Session, id: number): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
5
5
  export declare function createMotivoRechazo(headers: any, session: Session, body: MotivoRechazo): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
6
- export declare function updateMotivosRechazo(headers: any, session: Session, id: number): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
6
+ export declare function updateMotivosRechazo(headers: any, session: Session, id: number, Nombre: string): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
7
7
  export declare function saveMotivosDeRechazoByPurchase(headers: any, session: Session, body: RegisterMotivosRechazoBody, extraBody: {
8
8
  temp_purchase_order_id: string;
9
9
  }): Promise<AxiosUtilsResponse<any>>;
@@ -18,6 +18,16 @@ export declare function getProviders(session: Session): Promise<AxiosUtilsRespon
18
18
  * @param id
19
19
  */
20
20
  export declare function getPayee(session: Session, id: number | string): Promise<AxiosUtilsResponse<PayeeGraphQL | undefined>>;
21
+ /**
22
+ * getCreatePayee
23
+ * @param headers
24
+ * @param session
25
+ * @param id
26
+ * @returns
27
+ */
28
+ export declare function getCreatePayee(headers: any, search: {
29
+ tin?: string;
30
+ }): Promise<AxiosUtilsResponse<PayeeGraphQL | undefined>>;
21
31
  /**
22
32
  * getPayeesByCategoryId
23
33
  * @param session
@@ -135,6 +135,7 @@ export declare const getGraphQLPurchaseOrderBetweenDates: (session: Session, dat
135
135
  withLotStocksToMyAgency?: boolean;
136
136
  itemId?: number | string;
137
137
  payeeCategoryId?: number | string;
138
+ payeeId?: number | string;
138
139
  betweenIssueDate?: boolean;
139
140
  }) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
140
141
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/services",
3
- "version": "1.0.77",
3
+ "version": "1.0.79",
4
4
  "description": "Servicios de consulta a Zauru",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -27,10 +27,10 @@
27
27
  "@remix-run/node": "^2.8.1",
28
28
  "@zauru-sdk/common": "^1.0.76",
29
29
  "@zauru-sdk/config": "^1.0.60",
30
- "@zauru-sdk/graphql": "^1.0.77",
30
+ "@zauru-sdk/graphql": "^1.0.79",
31
31
  "@zauru-sdk/types": "^1.0.76",
32
32
  "axios": "^1.6.7",
33
33
  "chalk": "5.3.0"
34
34
  },
35
- "gitHead": "8d3fd81081748d39a8570e865acd27ae6d15ea5c"
35
+ "gitHead": "25cf887cf57d6eabd296bbe06b91170636f1275a"
36
36
  }