btrz-api-client 9.9.1 → 9.10.1
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.
|
@@ -14,7 +14,7 @@ const {
|
|
|
14
14
|
* @param {Object} deps
|
|
15
15
|
* @param {import("axios").AxiosInstance} deps.client
|
|
16
16
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
17
|
-
* @returns {{ create: function, validateCreate: function }}
|
|
17
|
+
* @returns {{ create: function, validateCreate: function, validateVoid: function }}
|
|
18
18
|
*/
|
|
19
19
|
function infileJsonFactory({
|
|
20
20
|
client,
|
|
@@ -83,9 +83,38 @@ function infileJsonFactory({
|
|
|
83
83
|
data
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* GET /infile-json/validate-void - validate void for an original sale transaction.
|
|
89
|
+
* @param {Object} opts
|
|
90
|
+
* @param {string} [opts.token] - API key
|
|
91
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
92
|
+
* @param {{ originalTransactionId: string, invoiceProviderId?: string }} opts.query
|
|
93
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
94
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
95
|
+
*/
|
|
96
|
+
function validateVoid({
|
|
97
|
+
token,
|
|
98
|
+
jwtToken,
|
|
99
|
+
query,
|
|
100
|
+
headers
|
|
101
|
+
}) {
|
|
102
|
+
return client({
|
|
103
|
+
url: "/infile-json/validate-void",
|
|
104
|
+
method: "get",
|
|
105
|
+
headers: authorizationHeaders({
|
|
106
|
+
token,
|
|
107
|
+
jwtToken,
|
|
108
|
+
internalAuthTokenProvider,
|
|
109
|
+
headers
|
|
110
|
+
}),
|
|
111
|
+
params: query
|
|
112
|
+
});
|
|
113
|
+
}
|
|
86
114
|
return {
|
|
87
115
|
create,
|
|
88
|
-
validateCreate
|
|
116
|
+
validateCreate,
|
|
117
|
+
validateVoid
|
|
89
118
|
};
|
|
90
119
|
}
|
|
91
120
|
module.exports = infileJsonFactory;
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
12
12
|
* @param {Object} deps
|
|
13
13
|
* @param {import("axios").AxiosInstance} deps.client
|
|
14
14
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
15
|
-
* @returns {{ create: function, validateCreate: function }}
|
|
15
|
+
* @returns {{ create: function, validateCreate: function, validateVoid: function }}
|
|
16
16
|
*/
|
|
17
17
|
function infileJsonFactory({client, internalAuthTokenProvider}) {
|
|
18
18
|
/**
|
|
@@ -57,9 +57,28 @@ function infileJsonFactory({client, internalAuthTokenProvider}) {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* GET /infile-json/validate-void - validate void for an original sale transaction.
|
|
62
|
+
* @param {Object} opts
|
|
63
|
+
* @param {string} [opts.token] - API key
|
|
64
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
65
|
+
* @param {{ originalTransactionId: string, invoiceProviderId?: string }} opts.query
|
|
66
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
67
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
68
|
+
*/
|
|
69
|
+
function validateVoid({token, jwtToken, query, headers}) {
|
|
70
|
+
return client({
|
|
71
|
+
url: "/infile-json/validate-void",
|
|
72
|
+
method: "get",
|
|
73
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
74
|
+
params: query
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
60
78
|
return {
|
|
61
79
|
create,
|
|
62
|
-
validateCreate
|
|
80
|
+
validateCreate,
|
|
81
|
+
validateVoid
|
|
63
82
|
};
|
|
64
83
|
}
|
|
65
84
|
|
|
@@ -30,4 +30,15 @@ describe("invoices/infileJson", () => {
|
|
|
30
30
|
data: {}
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
|
+
|
|
34
|
+
it("should validate void for an original sale transaction", () => {
|
|
35
|
+
axiosMock.onGet("/infile-json/validate-void").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
36
|
+
return api.invoices.infileJson.validateVoid({
|
|
37
|
+
jwtToken,
|
|
38
|
+
token,
|
|
39
|
+
query: {
|
|
40
|
+
originalTransactionId: "original-trx-id"
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
33
44
|
});
|
|
@@ -9,7 +9,7 @@ export = infileJsonFactory;
|
|
|
9
9
|
* @param {Object} deps
|
|
10
10
|
* @param {import("axios").AxiosInstance} deps.client
|
|
11
11
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
12
|
-
* @returns {{ create: function, validateCreate: function }}
|
|
12
|
+
* @returns {{ create: function, validateCreate: function, validateVoid: function }}
|
|
13
13
|
*/
|
|
14
14
|
declare function infileJsonFactory({ client, internalAuthTokenProvider }: {
|
|
15
15
|
client: import("axios").AxiosInstance;
|
|
@@ -19,10 +19,20 @@ declare function infileJsonFactory({ client, internalAuthTokenProvider }: {
|
|
|
19
19
|
}): {
|
|
20
20
|
create: Function;
|
|
21
21
|
validateCreate: Function;
|
|
22
|
+
validateVoid: Function;
|
|
22
23
|
};
|
|
23
24
|
declare namespace infileJsonFactory {
|
|
24
|
-
export { InvoiceInfileJsonPostQuery };
|
|
25
|
+
export { InvoiceInfileJsonPostQuery, InvoiceInfileJsonValidateVoidQuery };
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Query params for GET /infile-json/validate-void (btrz-api-invoices).
|
|
29
|
+
*/
|
|
30
|
+
type InvoiceInfileJsonValidateVoidQuery = {
|
|
31
|
+
/**
|
|
32
|
+
* - Original sale transaction `_id` (24-character hex ObjectId)
|
|
33
|
+
*/
|
|
34
|
+
originalTransactionId: string;
|
|
35
|
+
};
|
|
26
36
|
/**
|
|
27
37
|
* Query params for POST /infile-json (btrz-api-invoices). onlyValidateRequest optional.
|
|
28
38
|
*/
|