@zauru-sdk/services 1.0.81 → 1.0.83
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 +1 -0
- package/dist/cjs/zauru/zauru-payment-method.js +4 -1
- package/dist/cjs/zauru/zauru-payment-terms.js +4 -2
- package/dist/cjs/zauru/zauru-payments.js +34 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/zauru/zauru-payment-method.js +4 -1
- package/dist/esm/zauru/zauru-payment-terms.js +4 -2
- package/dist/esm/zauru/zauru-payments.js +27 -0
- package/dist/index.d.ts +1 -0
- package/dist/zauru/zauru-payment-method.d.ts +5 -2
- package/dist/zauru/zauru-payment-terms.d.ts +3 -1
- package/dist/zauru/zauru-payments.d.ts +8 -0
- package/package.json +5 -5
package/dist/cjs/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __exportStar(require("./zauru/zauru-lote-record.js"), exports);
|
|
|
37
37
|
__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
|
+
__exportStar(require("./zauru/zauru-payments.js"), exports);
|
|
40
41
|
__exportStar(require("./zauru/zauru-payment-terms.js"), exports);
|
|
41
42
|
__exportStar(require("./zauru/zauru-payment-method.js"), exports);
|
|
42
43
|
__exportStar(require("./zauru/zauru-price-lists.js"), exports);
|
|
@@ -8,6 +8,9 @@ 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"));
|
|
10
10
|
const graphql_1 = require("@zauru-sdk/graphql");
|
|
11
|
+
/**
|
|
12
|
+
* getPaymentTerms
|
|
13
|
+
*/
|
|
11
14
|
/**
|
|
12
15
|
* getPaymentTerms
|
|
13
16
|
*/
|
|
@@ -24,7 +27,7 @@ async function getPaymentMethods(session, config = {
|
|
|
24
27
|
if (response.data.errors) {
|
|
25
28
|
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
26
29
|
}
|
|
27
|
-
const registers = response?.data?.data?.
|
|
30
|
+
const registers = response?.data?.data?.payment_methods;
|
|
28
31
|
return registers;
|
|
29
32
|
});
|
|
30
33
|
}
|
|
@@ -12,11 +12,13 @@ const httpZauru_js_1 = __importDefault(require("./httpZauru.js"));
|
|
|
12
12
|
/**
|
|
13
13
|
* getPaymentTerms
|
|
14
14
|
*/
|
|
15
|
-
async function getPaymentTerms(session) {
|
|
15
|
+
async function getPaymentTerms(session, config = { includeDiscounts: false }) {
|
|
16
16
|
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
17
17
|
const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
|
|
18
18
|
const response = await httpGraphQL_js_1.default.post("", {
|
|
19
|
-
query: graphql_1.getPaymentTermsStringQuery
|
|
19
|
+
query: (0, graphql_1.getPaymentTermsStringQuery)({
|
|
20
|
+
includeDiscounts: config.includeDiscounts,
|
|
21
|
+
}),
|
|
20
22
|
}, { headers });
|
|
21
23
|
if (response.data.errors) {
|
|
22
24
|
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
@@ -0,0 +1,34 @@
|
|
|
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.createPayment = void 0;
|
|
7
|
+
const common_1 = require("@zauru-sdk/common");
|
|
8
|
+
const httpZauru_js_1 = __importDefault(require("./httpZauru.js"));
|
|
9
|
+
/**
|
|
10
|
+
* createInvoice
|
|
11
|
+
* @param headers
|
|
12
|
+
* @param body
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
async function createPayment(headers, body) {
|
|
16
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
17
|
+
const sendBody = {
|
|
18
|
+
...body,
|
|
19
|
+
payment_details_attributes: (0, common_1.arrayToObject)(body.payment_details),
|
|
20
|
+
tag_ids: ["", ...(body.tagging_payments?.map((x) => x.tag_id) ?? [])],
|
|
21
|
+
};
|
|
22
|
+
if (sendBody.deleted_payment_details)
|
|
23
|
+
delete sendBody.deleted_payment_details;
|
|
24
|
+
if (sendBody.__rvfInternalFormId)
|
|
25
|
+
delete sendBody.__rvfInternalFormId;
|
|
26
|
+
if (sendBody.payment_details)
|
|
27
|
+
delete sendBody.payment_details;
|
|
28
|
+
if (sendBody.tagging_payments)
|
|
29
|
+
delete sendBody.tagging_payments;
|
|
30
|
+
const response = await httpZauru_js_1.default.post(`/sales/payments.json`, { payment: sendBody }, { headers });
|
|
31
|
+
return response.data;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.createPayment = createPayment;
|
package/dist/esm/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export * from "./zauru/zauru-lote-record.js";
|
|
|
21
21
|
export * from "./zauru/zauru-lotes.js";
|
|
22
22
|
export * from "./zauru/zauru-motivos-rechazo.js";
|
|
23
23
|
export * from "./zauru/zauru-payees.js";
|
|
24
|
+
export * from "./zauru/zauru-payments.js";
|
|
24
25
|
export * from "./zauru/zauru-payment-terms.js";
|
|
25
26
|
export * from "./zauru/zauru-payment-method.js";
|
|
26
27
|
export * from "./zauru/zauru-price-lists.js";
|
|
@@ -2,6 +2,9 @@ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
|
2
2
|
import { getGraphQLAPIHeaders } from "../common.js";
|
|
3
3
|
import httpGraphQLAPI from "./httpGraphQL.js";
|
|
4
4
|
import { getPaymentMethodsStringQuery } from "@zauru-sdk/graphql";
|
|
5
|
+
/**
|
|
6
|
+
* getPaymentTerms
|
|
7
|
+
*/
|
|
5
8
|
/**
|
|
6
9
|
* getPaymentTerms
|
|
7
10
|
*/
|
|
@@ -18,7 +21,7 @@ export async function getPaymentMethods(session, config = {
|
|
|
18
21
|
if (response.data.errors) {
|
|
19
22
|
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
20
23
|
}
|
|
21
|
-
const registers = response?.data?.data?.
|
|
24
|
+
const registers = response?.data?.data?.payment_methods;
|
|
22
25
|
return registers;
|
|
23
26
|
});
|
|
24
27
|
}
|
|
@@ -6,11 +6,13 @@ import httpZauru from "./httpZauru.js";
|
|
|
6
6
|
/**
|
|
7
7
|
* getPaymentTerms
|
|
8
8
|
*/
|
|
9
|
-
export async function getPaymentTerms(session) {
|
|
9
|
+
export async function getPaymentTerms(session, config = { includeDiscounts: false }) {
|
|
10
10
|
return handlePossibleAxiosErrors(async () => {
|
|
11
11
|
const headers = await getGraphQLAPIHeaders(session);
|
|
12
12
|
const response = await httpGraphQLAPI.post("", {
|
|
13
|
-
query: getPaymentTermsStringQuery
|
|
13
|
+
query: getPaymentTermsStringQuery({
|
|
14
|
+
includeDiscounts: config.includeDiscounts,
|
|
15
|
+
}),
|
|
14
16
|
}, { headers });
|
|
15
17
|
if (response.data.errors) {
|
|
16
18
|
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { arrayToObject, handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
2
|
+
import httpZauru from "./httpZauru.js";
|
|
3
|
+
/**
|
|
4
|
+
* createInvoice
|
|
5
|
+
* @param headers
|
|
6
|
+
* @param body
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export async function createPayment(headers, body) {
|
|
10
|
+
return handlePossibleAxiosErrors(async () => {
|
|
11
|
+
const sendBody = {
|
|
12
|
+
...body,
|
|
13
|
+
payment_details_attributes: arrayToObject(body.payment_details),
|
|
14
|
+
tag_ids: ["", ...(body.tagging_payments?.map((x) => x.tag_id) ?? [])],
|
|
15
|
+
};
|
|
16
|
+
if (sendBody.deleted_payment_details)
|
|
17
|
+
delete sendBody.deleted_payment_details;
|
|
18
|
+
if (sendBody.__rvfInternalFormId)
|
|
19
|
+
delete sendBody.__rvfInternalFormId;
|
|
20
|
+
if (sendBody.payment_details)
|
|
21
|
+
delete sendBody.payment_details;
|
|
22
|
+
if (sendBody.tagging_payments)
|
|
23
|
+
delete sendBody.tagging_payments;
|
|
24
|
+
const response = await httpZauru.post(`/sales/payments.json`, { payment: sendBody }, { headers });
|
|
25
|
+
return response.data;
|
|
26
|
+
});
|
|
27
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export * from "./zauru/zauru-lote-record.js";
|
|
|
21
21
|
export * from "./zauru/zauru-lotes.js";
|
|
22
22
|
export * from "./zauru/zauru-motivos-rechazo.js";
|
|
23
23
|
export * from "./zauru/zauru-payees.js";
|
|
24
|
+
export * from "./zauru/zauru-payments.js";
|
|
24
25
|
export * from "./zauru/zauru-payment-terms.js";
|
|
25
26
|
export * from "./zauru/zauru-payment-method.js";
|
|
26
27
|
export * from "./zauru/zauru-price-lists.js";
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { Session } from "@remix-run/node";
|
|
2
|
-
import { AxiosUtilsResponse,
|
|
2
|
+
import { AxiosUtilsResponse, PaymentMethodGraphQL } from "@zauru-sdk/types";
|
|
3
|
+
/**
|
|
4
|
+
* getPaymentTerms
|
|
5
|
+
*/
|
|
3
6
|
/**
|
|
4
7
|
* getPaymentTerms
|
|
5
8
|
*/
|
|
6
9
|
export declare function getPaymentMethods(session: Session, config?: {
|
|
7
10
|
onlyActives: boolean;
|
|
8
|
-
}): Promise<AxiosUtilsResponse<
|
|
11
|
+
}): Promise<AxiosUtilsResponse<PaymentMethodGraphQL[]>>;
|
|
@@ -3,7 +3,9 @@ import { AxiosUtilsResponse, PaymentTermGraphQL } from "@zauru-sdk/types";
|
|
|
3
3
|
/**
|
|
4
4
|
* getPaymentTerms
|
|
5
5
|
*/
|
|
6
|
-
export declare function getPaymentTerms(session: Session
|
|
6
|
+
export declare function getPaymentTerms(session: Session, config?: {
|
|
7
|
+
includeDiscounts: boolean;
|
|
8
|
+
}): Promise<AxiosUtilsResponse<PaymentTermGraphQL[]>>;
|
|
7
9
|
/**
|
|
8
10
|
* getPaymentTermById
|
|
9
11
|
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AxiosUtilsResponse, PaymentGraphQL } from "@zauru-sdk/types";
|
|
2
|
+
/**
|
|
3
|
+
* createInvoice
|
|
4
|
+
* @param headers
|
|
5
|
+
* @param body
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare function createPayment(headers: any, body: Partial<PaymentGraphQL>): Promise<AxiosUtilsResponse<PaymentGraphQL>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/services",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.83",
|
|
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.
|
|
28
|
+
"@zauru-sdk/common": "^1.0.83",
|
|
29
29
|
"@zauru-sdk/config": "^1.0.60",
|
|
30
|
-
"@zauru-sdk/graphql": "^1.0.
|
|
31
|
-
"@zauru-sdk/types": "^1.0.
|
|
30
|
+
"@zauru-sdk/graphql": "^1.0.83",
|
|
31
|
+
"@zauru-sdk/types": "^1.0.83",
|
|
32
32
|
"axios": "^1.6.7",
|
|
33
33
|
"chalk": "5.3.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "ee7c5a89327913cc2cb8755e215014e236e8799d"
|
|
36
36
|
}
|