btrz-api-client 5.233.0 → 5.235.0
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/lib/client-standalone-min.js +3 -3
- package/lib/client.js +1 -0
- package/lib/endpoints/btrzpay/terminalPayments.js +35 -0
- package/lib/endpoints/inventory/countries.js +2 -1
- package/package.json +1 -1
- package/src/client.js +1 -0
- package/src/endpoints/btrzpay/terminalPayments.js +23 -0
- package/src/endpoints/inventory/countries.js +2 -2
- package/test/endpoints/btrzpay/terminalPayments.tests.js +35 -0
- package/test/endpoints/inventory/countries.test.js +5 -4
- package/types/client.d.ts +14 -1
- package/types/endpoints/btrzpay/terminalPayments.d.ts +16 -0
- package/types/endpoints/inventory/countries.d.ts +2 -1
- package/types/initializedClient.d.ts +14 -1
package/lib/client.js
CHANGED
|
@@ -461,6 +461,7 @@ function createBtrzPay(_ref13) {
|
|
|
461
461
|
oxxo: require("./endpoints/btrzpay/oxxo.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
462
462
|
datalogic: require("./endpoints/btrzpay/datalogic.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
463
463
|
prismaTerminals: require("./endpoints/btrzpay/prismaTerminals.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
464
|
+
terminalPayments: require("./endpoints/btrzpay/terminalPayments.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
464
465
|
__test: {
|
|
465
466
|
client: client
|
|
466
467
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("../endpoints_helpers.js"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
function terminalPaymentsFactory(_ref) {
|
|
7
|
+
var client = _ref.client,
|
|
8
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
|
+
|
|
10
|
+
var mit = {
|
|
11
|
+
update: function update(_ref2) {
|
|
12
|
+
var token = _ref2.token,
|
|
13
|
+
jwtToken = _ref2.jwtToken,
|
|
14
|
+
id = _ref2.id,
|
|
15
|
+
payment = _ref2.payment,
|
|
16
|
+
_ref2$query = _ref2.query,
|
|
17
|
+
query = _ref2$query === undefined ? {} : _ref2$query,
|
|
18
|
+
headers = _ref2.headers;
|
|
19
|
+
|
|
20
|
+
return client({
|
|
21
|
+
url: "/terminal-payments/mit/" + id,
|
|
22
|
+
method: "put",
|
|
23
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
24
|
+
params: query,
|
|
25
|
+
data: { payment: payment }
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
mit: mit
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = terminalPaymentsFactory;
|
|
@@ -22,6 +22,7 @@ function countriesFactory(_ref) {
|
|
|
22
22
|
|
|
23
23
|
function get(_ref3) {
|
|
24
24
|
var token = _ref3.token,
|
|
25
|
+
jwtToken = _ref3.jwtToken,
|
|
25
26
|
id = _ref3.id,
|
|
26
27
|
_ref3$query = _ref3.query,
|
|
27
28
|
query = _ref3$query === undefined ? {} : _ref3$query,
|
|
@@ -30,7 +31,7 @@ function countriesFactory(_ref) {
|
|
|
30
31
|
return client({
|
|
31
32
|
url: "/countries/" + id,
|
|
32
33
|
params: query,
|
|
33
|
-
headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
34
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -364,6 +364,7 @@ function createBtrzPay({baseURL, headers, timeout, overrideFn, internalAuthToken
|
|
|
364
364
|
oxxo: require("./endpoints/btrzpay/oxxo.js")({client, internalAuthTokenProvider}),
|
|
365
365
|
datalogic: require("./endpoints/btrzpay/datalogic.js")({client, internalAuthTokenProvider}),
|
|
366
366
|
prismaTerminals: require("./endpoints/btrzpay/prismaTerminals.js")({client, internalAuthTokenProvider}),
|
|
367
|
+
terminalPayments: require("./endpoints/btrzpay/terminalPayments.js")({ client, internalAuthTokenProvider}),
|
|
367
368
|
__test: {
|
|
368
369
|
client
|
|
369
370
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("../endpoints_helpers.js");
|
|
4
|
+
|
|
5
|
+
function terminalPaymentsFactory({client, internalAuthTokenProvider}) {
|
|
6
|
+
const mit = {
|
|
7
|
+
update({token, jwtToken, id, payment, query = {}, headers}) {
|
|
8
|
+
return client({
|
|
9
|
+
url: `/terminal-payments/mit/${id}`,
|
|
10
|
+
method: "put",
|
|
11
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
12
|
+
params: query,
|
|
13
|
+
data: {payment}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
mit
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = terminalPaymentsFactory;
|
|
@@ -9,11 +9,11 @@ function countriesFactory({client, internalAuthTokenProvider}) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
function get({token, id, query = {}, headers}) {
|
|
12
|
+
function get({token, jwtToken, id, query = {}, headers}) {
|
|
13
13
|
return client({
|
|
14
14
|
url: `/countries/${id}`,
|
|
15
15
|
params: query,
|
|
16
|
-
headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
|
|
16
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const {
|
|
2
|
+
axiosMock, expectRequest
|
|
3
|
+
} = require("../../test-helpers.js");
|
|
4
|
+
const api = require("../../../src/client.js").createApiClient({
|
|
5
|
+
baseURL: "http://test.com"
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
describe("btrzpay/terminal-payments", () => {
|
|
9
|
+
const token = "token";
|
|
10
|
+
const jwtToken = "I owe you a JWT token";
|
|
11
|
+
const query = {providerId: "123"};
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
axiosMock.reset();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should update a MIT terminal payment", () => {
|
|
18
|
+
axiosMock.onPut("/terminal-payments/mit/1").reply(expectRequest({
|
|
19
|
+
statusCode: 200, token, jwtToken, query
|
|
20
|
+
}));
|
|
21
|
+
return api.btrzpay.terminalPayments.mit.update({
|
|
22
|
+
token,
|
|
23
|
+
jwtToken,
|
|
24
|
+
query,
|
|
25
|
+
id: 1,
|
|
26
|
+
payment: {
|
|
27
|
+
referenceNumber: "1",
|
|
28
|
+
result: {
|
|
29
|
+
id: "1",
|
|
30
|
+
paymentStatus: "CONFIRMED"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -3,6 +3,7 @@ const api = require("./../../../src/client.js").createApiClient({baseURL: "http:
|
|
|
3
3
|
|
|
4
4
|
describe("inventory/countries", () => {
|
|
5
5
|
const token = "I owe you a token";
|
|
6
|
+
const jwtToken = "I owe you a JWT token";
|
|
6
7
|
|
|
7
8
|
afterEach(() => {
|
|
8
9
|
axiosMock.restore();
|
|
@@ -15,15 +16,15 @@ describe("inventory/countries", () => {
|
|
|
15
16
|
|
|
16
17
|
it("should get a country by id", () => {
|
|
17
18
|
const countryId = "countryId";
|
|
18
|
-
axiosMock.onGet(`/countries/${countryId}`).reply(expectRequest({statusCode: 200, token}));
|
|
19
|
-
return api.inventory.countries.get({id: countryId, token});
|
|
19
|
+
axiosMock.onGet(`/countries/${countryId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
20
|
+
return api.inventory.countries.get({id: countryId, token, jwtToken});
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
it("should get a country by id and support query parameters", () => {
|
|
23
24
|
const countryId = "countryId";
|
|
24
25
|
const query = {param1: "value1"};
|
|
25
26
|
|
|
26
|
-
axiosMock.onGet(`/countries/${countryId}?param1=value1`).reply(expectRequest({statusCode: 200, token}));
|
|
27
|
-
return api.inventory.countries.get({id: countryId, query, token});
|
|
27
|
+
axiosMock.onGet(`/countries/${countryId}?param1=value1`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
28
|
+
return api.inventory.countries.get({id: countryId, query, token, jwtToken});
|
|
28
29
|
});
|
|
29
30
|
});
|
package/types/client.d.ts
CHANGED
|
@@ -265,8 +265,9 @@ export function createApiClient(options: {
|
|
|
265
265
|
query?: {};
|
|
266
266
|
headers: any;
|
|
267
267
|
}) => any;
|
|
268
|
-
get: ({ token, id, query, headers }: {
|
|
268
|
+
get: ({ token, jwtToken, id, query, headers }: {
|
|
269
269
|
token: any;
|
|
270
|
+
jwtToken: any;
|
|
270
271
|
id: any;
|
|
271
272
|
query?: {};
|
|
272
273
|
headers: any;
|
|
@@ -4627,6 +4628,18 @@ export function createApiClient(options: {
|
|
|
4627
4628
|
}): any;
|
|
4628
4629
|
};
|
|
4629
4630
|
};
|
|
4631
|
+
terminalPayments: {
|
|
4632
|
+
mit: {
|
|
4633
|
+
update({ token, jwtToken, id, payment, query, headers }: {
|
|
4634
|
+
token: any;
|
|
4635
|
+
jwtToken: any;
|
|
4636
|
+
id: any;
|
|
4637
|
+
payment: any;
|
|
4638
|
+
query?: {};
|
|
4639
|
+
headers: any;
|
|
4640
|
+
}): any;
|
|
4641
|
+
};
|
|
4642
|
+
};
|
|
4630
4643
|
__test: {
|
|
4631
4644
|
client: axios.AxiosInstance;
|
|
4632
4645
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export = terminalPaymentsFactory;
|
|
2
|
+
declare function terminalPaymentsFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
mit: {
|
|
7
|
+
update({ token, jwtToken, id, payment, query, headers }: {
|
|
8
|
+
token: any;
|
|
9
|
+
jwtToken: any;
|
|
10
|
+
id: any;
|
|
11
|
+
payment: any;
|
|
12
|
+
query?: {};
|
|
13
|
+
headers: any;
|
|
14
|
+
}): any;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -8,8 +8,9 @@ declare function countriesFactory({ client, internalAuthTokenProvider }: {
|
|
|
8
8
|
query?: {};
|
|
9
9
|
headers: any;
|
|
10
10
|
}) => any;
|
|
11
|
-
get: ({ token, id, query, headers }: {
|
|
11
|
+
get: ({ token, jwtToken, id, query, headers }: {
|
|
12
12
|
token: any;
|
|
13
|
+
jwtToken: any;
|
|
13
14
|
id: any;
|
|
14
15
|
query?: {};
|
|
15
16
|
headers: any;
|
|
@@ -219,8 +219,9 @@ declare const _exports: {
|
|
|
219
219
|
query?: {};
|
|
220
220
|
headers: any;
|
|
221
221
|
}) => any;
|
|
222
|
-
get: ({ token, id, query, headers }: {
|
|
222
|
+
get: ({ token, jwtToken, id, query, headers }: {
|
|
223
223
|
token: any;
|
|
224
|
+
jwtToken: any;
|
|
224
225
|
id: any;
|
|
225
226
|
query?: {};
|
|
226
227
|
headers: any;
|
|
@@ -4581,6 +4582,18 @@ declare const _exports: {
|
|
|
4581
4582
|
}): any;
|
|
4582
4583
|
};
|
|
4583
4584
|
};
|
|
4585
|
+
terminalPayments: {
|
|
4586
|
+
mit: {
|
|
4587
|
+
update({ token, jwtToken, id, payment, query, headers }: {
|
|
4588
|
+
token: any;
|
|
4589
|
+
jwtToken: any;
|
|
4590
|
+
id: any;
|
|
4591
|
+
payment: any;
|
|
4592
|
+
query?: {};
|
|
4593
|
+
headers: any;
|
|
4594
|
+
}): any;
|
|
4595
|
+
};
|
|
4596
|
+
};
|
|
4584
4597
|
__test: {
|
|
4585
4598
|
client: import("axios").AxiosInstance;
|
|
4586
4599
|
};
|