@zauru-sdk/services 1.0.80 → 1.0.81

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/cjs/index.js CHANGED
@@ -38,6 +38,7 @@ __exportStar(require("./zauru/zauru-lotes.js"), exports);
38
38
  __exportStar(require("./zauru/zauru-motivos-rechazo.js"), exports);
39
39
  __exportStar(require("./zauru/zauru-payees.js"), exports);
40
40
  __exportStar(require("./zauru/zauru-payment-terms.js"), exports);
41
+ __exportStar(require("./zauru/zauru-payment-method.js"), exports);
41
42
  __exportStar(require("./zauru/zauru-price-lists.js"), exports);
42
43
  __exportStar(require("./zauru/zauru-print-templates.js"), exports);
43
44
  __exportStar(require("./zauru/zauru-purchase-orders.js"), exports);
@@ -46,12 +46,13 @@ exports.getInvoicesByAgencyId = getInvoicesByAgencyId;
46
46
  * @param body
47
47
  * @returns
48
48
  */
49
- async function createInvoice(headers, body) {
49
+ async function createInvoice(headers, body, sujetaAImpuestos = true) {
50
50
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
51
51
  const sendBody = {
52
52
  ...body,
53
53
  invoice_details_attributes: (0, common_1.arrayToObject)(body.invoice_details),
54
54
  tag_ids: ["", ...(body.tagging_invoices?.map((x) => x.tag_id) ?? [])],
55
+ taxable: sujetaAImpuestos,
55
56
  };
56
57
  if (sendBody.deleted_invoice_details)
57
58
  delete sendBody.deleted_invoice_details;
@@ -61,7 +62,6 @@ async function createInvoice(headers, body) {
61
62
  delete sendBody.invoice_details;
62
63
  if (sendBody.tagging_invoices)
63
64
  delete sendBody.tagging_invoices;
64
- console.log("ENVIANDO: ", JSON.stringify(sendBody));
65
65
  const response = await httpZauru_js_1.default.post(`/sales/unpaid_invoices.json`, { invoice: sendBody }, { headers });
66
66
  return response.data;
67
67
  });
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getPaymentMethods = void 0;
7
+ const common_1 = require("@zauru-sdk/common");
8
+ const common_js_1 = require("../common.js");
9
+ const httpGraphQL_js_1 = __importDefault(require("./httpGraphQL.js"));
10
+ const graphql_1 = require("@zauru-sdk/graphql");
11
+ /**
12
+ * getPaymentTerms
13
+ */
14
+ async function getPaymentMethods(session, config = {
15
+ onlyActives: true,
16
+ }) {
17
+ return (0, common_1.handlePossibleAxiosErrors)(async () => {
18
+ const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
19
+ const response = await httpGraphQL_js_1.default.post("", {
20
+ query: (0, graphql_1.getPaymentMethodsStringQuery)({
21
+ onlyActives: config.onlyActives,
22
+ }),
23
+ }, { headers });
24
+ if (response.data.errors) {
25
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
26
+ }
27
+ const registers = response?.data?.data?.payment_terms;
28
+ return registers;
29
+ });
30
+ }
31
+ exports.getPaymentMethods = getPaymentMethods;
package/dist/esm/index.js CHANGED
@@ -22,6 +22,7 @@ export * from "./zauru/zauru-lotes.js";
22
22
  export * from "./zauru/zauru-motivos-rechazo.js";
23
23
  export * from "./zauru/zauru-payees.js";
24
24
  export * from "./zauru/zauru-payment-terms.js";
25
+ export * from "./zauru/zauru-payment-method.js";
25
26
  export * from "./zauru/zauru-price-lists.js";
26
27
  export * from "./zauru/zauru-print-templates.js";
27
28
  export * from "./zauru/zauru-purchase-orders.js";
@@ -39,12 +39,13 @@ export async function getInvoicesByAgencyId(session, id) {
39
39
  * @param body
40
40
  * @returns
41
41
  */
42
- export async function createInvoice(headers, body) {
42
+ export async function createInvoice(headers, body, sujetaAImpuestos = true) {
43
43
  return handlePossibleAxiosErrors(async () => {
44
44
  const sendBody = {
45
45
  ...body,
46
46
  invoice_details_attributes: arrayToObject(body.invoice_details),
47
47
  tag_ids: ["", ...(body.tagging_invoices?.map((x) => x.tag_id) ?? [])],
48
+ taxable: sujetaAImpuestos,
48
49
  };
49
50
  if (sendBody.deleted_invoice_details)
50
51
  delete sendBody.deleted_invoice_details;
@@ -54,7 +55,6 @@ export async function createInvoice(headers, body) {
54
55
  delete sendBody.invoice_details;
55
56
  if (sendBody.tagging_invoices)
56
57
  delete sendBody.tagging_invoices;
57
- console.log("ENVIANDO: ", JSON.stringify(sendBody));
58
58
  const response = await httpZauru.post(`/sales/unpaid_invoices.json`, { invoice: sendBody }, { headers });
59
59
  return response.data;
60
60
  });
@@ -0,0 +1,24 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import { getGraphQLAPIHeaders } from "../common.js";
3
+ import httpGraphQLAPI from "./httpGraphQL.js";
4
+ import { getPaymentMethodsStringQuery } from "@zauru-sdk/graphql";
5
+ /**
6
+ * getPaymentTerms
7
+ */
8
+ export async function getPaymentMethods(session, config = {
9
+ onlyActives: true,
10
+ }) {
11
+ return handlePossibleAxiosErrors(async () => {
12
+ const headers = await getGraphQLAPIHeaders(session);
13
+ const response = await httpGraphQLAPI.post("", {
14
+ query: getPaymentMethodsStringQuery({
15
+ onlyActives: config.onlyActives,
16
+ }),
17
+ }, { headers });
18
+ if (response.data.errors) {
19
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
20
+ }
21
+ const registers = response?.data?.data?.payment_terms;
22
+ return registers;
23
+ });
24
+ }
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export * from "./zauru/zauru-lotes.js";
22
22
  export * from "./zauru/zauru-motivos-rechazo.js";
23
23
  export * from "./zauru/zauru-payees.js";
24
24
  export * from "./zauru/zauru-payment-terms.js";
25
+ export * from "./zauru/zauru-payment-method.js";
25
26
  export * from "./zauru/zauru-price-lists.js";
26
27
  export * from "./zauru/zauru-print-templates.js";
27
28
  export * from "./zauru/zauru-purchase-orders.js";
@@ -10,7 +10,7 @@ export declare function getInvoicesByAgencyId(session: Session, id: string | nul
10
10
  * @param body
11
11
  * @returns
12
12
  */
13
- export declare function createInvoice(headers: any, body: Partial<InvoiceGraphQL>): Promise<AxiosUtilsResponse<InvoiceGraphQL>>;
13
+ export declare function createInvoice(headers: any, body: Partial<InvoiceGraphQL>, sujetaAImpuestos?: boolean): Promise<AxiosUtilsResponse<InvoiceGraphQL>>;
14
14
  /**
15
15
  * createInvoiceOrder
16
16
  * @param headers
@@ -0,0 +1,8 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { AxiosUtilsResponse, PaymentTermGraphQL } from "@zauru-sdk/types";
3
+ /**
4
+ * getPaymentTerms
5
+ */
6
+ export declare function getPaymentMethods(session: Session, config?: {
7
+ onlyActives: boolean;
8
+ }): Promise<AxiosUtilsResponse<PaymentTermGraphQL[]>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/services",
3
- "version": "1.0.80",
3
+ "version": "1.0.81",
4
4
  "description": "Servicios de consulta a Zauru",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -25,12 +25,12 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@remix-run/node": "^2.8.1",
28
- "@zauru-sdk/common": "^1.0.80",
28
+ "@zauru-sdk/common": "^1.0.81",
29
29
  "@zauru-sdk/config": "^1.0.60",
30
- "@zauru-sdk/graphql": "^1.0.79",
31
- "@zauru-sdk/types": "^1.0.76",
30
+ "@zauru-sdk/graphql": "^1.0.81",
31
+ "@zauru-sdk/types": "^1.0.81",
32
32
  "axios": "^1.6.7",
33
33
  "chalk": "5.3.0"
34
34
  },
35
- "gitHead": "3da2a589e254d04992e8c76924142f4b5f7c54b6"
35
+ "gitHead": "24f4eeb19473bf56b1681e21ca5d7db831429c4a"
36
36
  }