btrz-api-client 5.133.0 → 5.135.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/oxxo.js +45 -0
- package/lib/endpoints/inventory/operating-companies.js +28 -0
- package/package.json +1 -1
- package/src/client.js +1 -0
- package/src/endpoints/btrzpay/oxxo.js +31 -0
- package/src/endpoints/inventory/operating-companies.js +15 -0
- package/test/endpoints/btrzpay/oxxoPayments.tests.js +37 -0
- package/test/endpoints/btrzpay/oxxoToken.tests.js +32 -0
- package/test/endpoints/inventory/operating-companies.test.js +32 -0
- package/types/client.d.ts +33 -0
- package/types/endpoints/btrzpay/oxxo.d.ts +22 -0
- package/types/endpoints/inventory/operating-companies.d.ts +15 -0
- package/types/initializedClient.d.ts +33 -0
package/lib/client.js
CHANGED
|
@@ -427,6 +427,7 @@ function createBtrzPay(_ref13) {
|
|
|
427
427
|
customerCards: require("./endpoints/btrzpay/customerCards.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
428
428
|
squareTerminals: require("./endpoints/btrzpay/square.js").squareTerminalsFactory({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
429
429
|
squareWebhooks: require("./endpoints/btrzpay/square.js").squareWebhooksFactory({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
430
|
+
oxxo: require("./endpoints/btrzpay/oxxo.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
430
431
|
__test: {
|
|
431
432
|
client: client
|
|
432
433
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("./../endpoints_helpers"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
function oxxoFactory(_ref) {
|
|
7
|
+
var client = _ref.client,
|
|
8
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
|
+
|
|
10
|
+
var token = {
|
|
11
|
+
get: function get(_ref2) {
|
|
12
|
+
var jwtToken = _ref2.jwtToken,
|
|
13
|
+
headers = _ref2.headers,
|
|
14
|
+
internalAuthTokenProvider = _ref2.internalAuthTokenProvider;
|
|
15
|
+
|
|
16
|
+
return client({
|
|
17
|
+
url: "/oxxo/token",
|
|
18
|
+
headers: authorizationHeaders({ jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var payments = {
|
|
24
|
+
all: function all(_ref3) {
|
|
25
|
+
var jwtToken = _ref3.jwtToken,
|
|
26
|
+
headers = _ref3.headers,
|
|
27
|
+
oxxoToken = _ref3.oxxoToken,
|
|
28
|
+
query = _ref3.query,
|
|
29
|
+
internalAuthTokenProvider = _ref3.internalAuthTokenProvider;
|
|
30
|
+
|
|
31
|
+
return client({
|
|
32
|
+
url: "/oxxo/" + oxxoToken + "/payments",
|
|
33
|
+
params: query,
|
|
34
|
+
headers: authorizationHeaders({ jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
token: token,
|
|
41
|
+
payments: payments
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = oxxoFactory;
|
|
@@ -90,6 +90,34 @@ function operatingCompaniesFactory(_ref) {
|
|
|
90
90
|
method: "get",
|
|
91
91
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
92
92
|
});
|
|
93
|
+
},
|
|
94
|
+
get: function get(_ref8) {
|
|
95
|
+
var jwtToken = _ref8.jwtToken,
|
|
96
|
+
token = _ref8.token,
|
|
97
|
+
operatingCompanyId = _ref8.operatingCompanyId,
|
|
98
|
+
sequenceId = _ref8.sequenceId,
|
|
99
|
+
headers = _ref8.headers;
|
|
100
|
+
|
|
101
|
+
return client({
|
|
102
|
+
url: "/operating-companies/" + operatingCompanyId + "/sequences/" + sequenceId,
|
|
103
|
+
method: "get",
|
|
104
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
update: function update(_ref9) {
|
|
108
|
+
var jwtToken = _ref9.jwtToken,
|
|
109
|
+
token = _ref9.token,
|
|
110
|
+
operatingCompanyId = _ref9.operatingCompanyId,
|
|
111
|
+
sequenceId = _ref9.sequenceId,
|
|
112
|
+
sequence = _ref9.sequence,
|
|
113
|
+
headers = _ref9.headers;
|
|
114
|
+
|
|
115
|
+
return client({
|
|
116
|
+
url: "/operating-companies/" + operatingCompanyId + "/sequences/" + sequenceId,
|
|
117
|
+
method: "put",
|
|
118
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
119
|
+
data: sequence
|
|
120
|
+
});
|
|
93
121
|
}
|
|
94
122
|
};
|
|
95
123
|
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -330,6 +330,7 @@ function createBtrzPay({baseURL, headers, timeout, overrideFn, internalAuthToken
|
|
|
330
330
|
customerCards: require("./endpoints/btrzpay/customerCards.js")({client, internalAuthTokenProvider}),
|
|
331
331
|
squareTerminals: require("./endpoints/btrzpay/square.js").squareTerminalsFactory({client, internalAuthTokenProvider}),
|
|
332
332
|
squareWebhooks: require("./endpoints/btrzpay/square.js").squareWebhooksFactory({client, internalAuthTokenProvider}),
|
|
333
|
+
oxxo: require("./endpoints/btrzpay/oxxo.js")({client, internalAuthTokenProvider}),
|
|
333
334
|
__test: {
|
|
334
335
|
client
|
|
335
336
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("./../endpoints_helpers");
|
|
4
|
+
|
|
5
|
+
function oxxoFactory({client, internalAuthTokenProvider}) {
|
|
6
|
+
const token = {
|
|
7
|
+
get({jwtToken, headers, internalAuthTokenProvider}) {
|
|
8
|
+
return client({
|
|
9
|
+
url: "/oxxo/token",
|
|
10
|
+
headers: authorizationHeaders({jwtToken, internalAuthTokenProvider, headers})
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const payments = {
|
|
16
|
+
all({jwtToken, headers, oxxoToken, query, internalAuthTokenProvider}) {
|
|
17
|
+
return client({
|
|
18
|
+
url: `/oxxo/${oxxoToken}/payments`,
|
|
19
|
+
params: query,
|
|
20
|
+
headers: authorizationHeaders({jwtToken, internalAuthTokenProvider, headers})
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
token,
|
|
27
|
+
payments
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = oxxoFactory;
|
|
@@ -51,6 +51,21 @@ function operatingCompaniesFactory({ client, internalAuthTokenProvider }) {
|
|
|
51
51
|
method: "get",
|
|
52
52
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
53
53
|
});
|
|
54
|
+
},
|
|
55
|
+
get({jwtToken, token, operatingCompanyId, sequenceId, headers}) {
|
|
56
|
+
return client({
|
|
57
|
+
url: `/operating-companies/${operatingCompanyId}/sequences/${sequenceId}`,
|
|
58
|
+
method: "get",
|
|
59
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
update({jwtToken, token, operatingCompanyId, sequenceId, sequence, headers}) {
|
|
63
|
+
return client({
|
|
64
|
+
url: `/operating-companies/${operatingCompanyId}/sequences/${sequenceId}`,
|
|
65
|
+
method: "put",
|
|
66
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
67
|
+
data: sequence
|
|
68
|
+
});
|
|
54
69
|
}
|
|
55
70
|
};
|
|
56
71
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const {
|
|
2
|
+
axiosMock, expectRequest
|
|
3
|
+
} = require("../../test-helpers");
|
|
4
|
+
const api = require("../../../src/client").createApiClient({
|
|
5
|
+
baseURL: "http://test.com"
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
describe("btrz-pay/oxxo/payments", () => {
|
|
9
|
+
const oxxoToken = "OXXO_1234567890";
|
|
10
|
+
const referenceNumber = "1234-1234-1234-1234";
|
|
11
|
+
const internalAuthTokenProvider = {
|
|
12
|
+
getToken: () => {
|
|
13
|
+
return "internalToken";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
axiosMock.reset();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("should get a list of payments", () => {
|
|
22
|
+
axiosMock.onGet(`/oxxo/${oxxoToken}/payments`).reply(expectRequest({
|
|
23
|
+
statusCode: 200,
|
|
24
|
+
internalAuthTokenProvider,
|
|
25
|
+
withoutApiKey: true,
|
|
26
|
+
jwtToken: "internal_auth_token",
|
|
27
|
+
query: {referenceNumber}
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
return api.btrzpay.oxxo.payments.all({
|
|
31
|
+
internalAuthTokenProvider,
|
|
32
|
+
jwtToken: "internal_auth_token",
|
|
33
|
+
oxxoToken,
|
|
34
|
+
query: {referenceNumber}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const {
|
|
2
|
+
axiosMock, expectRequest
|
|
3
|
+
} = require("../../test-helpers");
|
|
4
|
+
const api = require("../../../src/client").createApiClient({
|
|
5
|
+
baseURL: "http://test.com"
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
describe("btrz-pay/oxxo/token", () => {
|
|
9
|
+
const internalAuthTokenProvider = {
|
|
10
|
+
getToken: () => {
|
|
11
|
+
return "internalToken";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
axiosMock.reset();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should get a new token", () => {
|
|
20
|
+
axiosMock.onGet("/oxxo/token").reply(expectRequest({
|
|
21
|
+
statusCode: 200,
|
|
22
|
+
internalAuthTokenProvider,
|
|
23
|
+
withoutApiKey: true,
|
|
24
|
+
jwtToken: "internal_auth_token"
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
return api.btrzpay.oxxo.token.get({
|
|
28
|
+
internalAuthTokenProvider,
|
|
29
|
+
jwtToken: "internal_auth_token"
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -83,4 +83,36 @@ describe('inventory/operating-companies', () => {
|
|
|
83
83
|
expect(httpResponse.status).eql(200);
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
|
+
|
|
87
|
+
it("should get operating company sequence by id", () => {
|
|
88
|
+
const operatingCompanyId = "1234";
|
|
89
|
+
const sequenceId = "5678";
|
|
90
|
+
// eslint-disable-next-line max-len
|
|
91
|
+
axiosMock.onGet(`/operating-companies/${operatingCompanyId}/sequences/${sequenceId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
92
|
+
return api.inventory.operatingCompanies.sequences.get({
|
|
93
|
+
jwtToken,
|
|
94
|
+
token,
|
|
95
|
+
operatingCompanyId,
|
|
96
|
+
sequenceId
|
|
97
|
+
}).then((httpResponse) => {
|
|
98
|
+
expect(httpResponse.status).eql(200);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("should update operating company sequence", () => {
|
|
103
|
+
const operatingCompanyId = "1234";
|
|
104
|
+
const sequenceId = "5678";
|
|
105
|
+
const operatingCompanySequenceData = {};
|
|
106
|
+
// eslint-disable-next-line max-len
|
|
107
|
+
axiosMock.onPut(`/operating-companies/${operatingCompanyId}/sequences/${sequenceId}`).reply(expectRequest({statusCode: 200, token, jwtToken, body: operatingCompanySequenceData}));
|
|
108
|
+
return api.inventory.operatingCompanies.sequences.update({
|
|
109
|
+
jwtToken,
|
|
110
|
+
token,
|
|
111
|
+
operatingCompanyId,
|
|
112
|
+
sequenceId,
|
|
113
|
+
sequence: operatingCompanySequenceData
|
|
114
|
+
}).then((httpResponse) => {
|
|
115
|
+
expect(httpResponse.status).eql(200);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
86
118
|
});
|
package/types/client.d.ts
CHANGED
|
@@ -654,6 +654,21 @@ export function createApiClient(options: {
|
|
|
654
654
|
operatingCompanyId: any;
|
|
655
655
|
headers: any;
|
|
656
656
|
}): any;
|
|
657
|
+
get({ jwtToken, token, operatingCompanyId, sequenceId, headers }: {
|
|
658
|
+
jwtToken: any;
|
|
659
|
+
token: any;
|
|
660
|
+
operatingCompanyId: any;
|
|
661
|
+
sequenceId: any;
|
|
662
|
+
headers: any;
|
|
663
|
+
}): any;
|
|
664
|
+
update({ jwtToken, token, operatingCompanyId, sequenceId, sequence, headers }: {
|
|
665
|
+
jwtToken: any;
|
|
666
|
+
token: any;
|
|
667
|
+
operatingCompanyId: any;
|
|
668
|
+
sequenceId: any;
|
|
669
|
+
sequence: any;
|
|
670
|
+
headers: any;
|
|
671
|
+
}): any;
|
|
657
672
|
};
|
|
658
673
|
};
|
|
659
674
|
operationMessages: {
|
|
@@ -3570,6 +3585,24 @@ export function createApiClient(options: {
|
|
|
3570
3585
|
headers: any;
|
|
3571
3586
|
}) => any;
|
|
3572
3587
|
};
|
|
3588
|
+
oxxo: {
|
|
3589
|
+
token: {
|
|
3590
|
+
get({ jwtToken, headers, internalAuthTokenProvider }: {
|
|
3591
|
+
jwtToken: any;
|
|
3592
|
+
headers: any;
|
|
3593
|
+
internalAuthTokenProvider: any;
|
|
3594
|
+
}): any;
|
|
3595
|
+
};
|
|
3596
|
+
payments: {
|
|
3597
|
+
all({ jwtToken, headers, oxxoToken, query, internalAuthTokenProvider }: {
|
|
3598
|
+
jwtToken: any;
|
|
3599
|
+
headers: any;
|
|
3600
|
+
oxxoToken: any;
|
|
3601
|
+
query: any;
|
|
3602
|
+
internalAuthTokenProvider: any;
|
|
3603
|
+
}): any;
|
|
3604
|
+
};
|
|
3605
|
+
};
|
|
3573
3606
|
__test: {
|
|
3574
3607
|
client: axios.AxiosInstance;
|
|
3575
3608
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export = oxxoFactory;
|
|
2
|
+
declare function oxxoFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
token: {
|
|
7
|
+
get({ jwtToken, headers, internalAuthTokenProvider }: {
|
|
8
|
+
jwtToken: any;
|
|
9
|
+
headers: any;
|
|
10
|
+
internalAuthTokenProvider: any;
|
|
11
|
+
}): any;
|
|
12
|
+
};
|
|
13
|
+
payments: {
|
|
14
|
+
all({ jwtToken, headers, oxxoToken, query, internalAuthTokenProvider }: {
|
|
15
|
+
jwtToken: any;
|
|
16
|
+
headers: any;
|
|
17
|
+
oxxoToken: any;
|
|
18
|
+
query: any;
|
|
19
|
+
internalAuthTokenProvider: any;
|
|
20
|
+
}): any;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -42,5 +42,20 @@ declare function operatingCompaniesFactory({ client, internalAuthTokenProvider }
|
|
|
42
42
|
operatingCompanyId: any;
|
|
43
43
|
headers: any;
|
|
44
44
|
}): any;
|
|
45
|
+
get({ jwtToken, token, operatingCompanyId, sequenceId, headers }: {
|
|
46
|
+
jwtToken: any;
|
|
47
|
+
token: any;
|
|
48
|
+
operatingCompanyId: any;
|
|
49
|
+
sequenceId: any;
|
|
50
|
+
headers: any;
|
|
51
|
+
}): any;
|
|
52
|
+
update({ jwtToken, token, operatingCompanyId, sequenceId, sequence, headers }: {
|
|
53
|
+
jwtToken: any;
|
|
54
|
+
token: any;
|
|
55
|
+
operatingCompanyId: any;
|
|
56
|
+
sequenceId: any;
|
|
57
|
+
sequence: any;
|
|
58
|
+
headers: any;
|
|
59
|
+
}): any;
|
|
45
60
|
};
|
|
46
61
|
};
|
|
@@ -608,6 +608,21 @@ declare const _exports: {
|
|
|
608
608
|
operatingCompanyId: any;
|
|
609
609
|
headers: any;
|
|
610
610
|
}): any;
|
|
611
|
+
get({ jwtToken, token, operatingCompanyId, sequenceId, headers }: {
|
|
612
|
+
jwtToken: any;
|
|
613
|
+
token: any;
|
|
614
|
+
operatingCompanyId: any;
|
|
615
|
+
sequenceId: any;
|
|
616
|
+
headers: any;
|
|
617
|
+
}): any;
|
|
618
|
+
update({ jwtToken, token, operatingCompanyId, sequenceId, sequence, headers }: {
|
|
619
|
+
jwtToken: any;
|
|
620
|
+
token: any;
|
|
621
|
+
operatingCompanyId: any;
|
|
622
|
+
sequenceId: any;
|
|
623
|
+
sequence: any;
|
|
624
|
+
headers: any;
|
|
625
|
+
}): any;
|
|
611
626
|
};
|
|
612
627
|
};
|
|
613
628
|
operationMessages: {
|
|
@@ -3524,6 +3539,24 @@ declare const _exports: {
|
|
|
3524
3539
|
headers: any;
|
|
3525
3540
|
}) => any;
|
|
3526
3541
|
};
|
|
3542
|
+
oxxo: {
|
|
3543
|
+
token: {
|
|
3544
|
+
get({ jwtToken, headers, internalAuthTokenProvider }: {
|
|
3545
|
+
jwtToken: any;
|
|
3546
|
+
headers: any;
|
|
3547
|
+
internalAuthTokenProvider: any;
|
|
3548
|
+
}): any;
|
|
3549
|
+
};
|
|
3550
|
+
payments: {
|
|
3551
|
+
all({ jwtToken, headers, oxxoToken, query, internalAuthTokenProvider }: {
|
|
3552
|
+
jwtToken: any;
|
|
3553
|
+
headers: any;
|
|
3554
|
+
oxxoToken: any;
|
|
3555
|
+
query: any;
|
|
3556
|
+
internalAuthTokenProvider: any;
|
|
3557
|
+
}): any;
|
|
3558
|
+
};
|
|
3559
|
+
};
|
|
3527
3560
|
__test: {
|
|
3528
3561
|
client: import("axios").AxiosInstance;
|
|
3529
3562
|
};
|