btrz-api-client 5.222.0 → 5.224.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/inventory/pay-on-accounts.js +30 -0
- package/lib/endpoints/inventory/products.js +41 -10
- package/package.json +1 -1
- package/src/client.js +1 -0
- package/src/endpoints/inventory/pay-on-accounts.js +17 -0
- package/src/endpoints/inventory/products.js +20 -0
- package/test/endpoints/inventory/pay-on-accounts.test.js +21 -0
- package/test/endpoints/inventory/products.test.js +16 -3
- package/types/client.d.ts +21 -0
- package/types/endpoints/inventory/pay-on-accounts.d.ts +12 -0
- package/types/endpoints/inventory/products.d.ts +13 -0
- package/types/initializedClient.d.ts +21 -0
package/lib/client.js
CHANGED
|
@@ -84,6 +84,7 @@ function createInventory(_ref) {
|
|
|
84
84
|
operatingCompanies: require("./endpoints/inventory/operating-companies.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
85
85
|
operationMessages: require("./endpoints/inventory/operation-messages.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
86
86
|
paymentTerminals: require("./endpoints/inventory/payment-terminals.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
87
|
+
payOnAccounts: require("./endpoints/inventory/pay-on-accounts.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
87
88
|
mitTerminals: require("./endpoints/inventory/mit-terminals.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
88
89
|
serviceTypes: require("./endpoints/inventory/service-types.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
89
90
|
customContent: require("./endpoints/inventory/custom-content.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("../endpoints_helpers.js"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
function payOnAccountsFactory(_ref) {
|
|
7
|
+
var client = _ref.client,
|
|
8
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
|
+
|
|
10
|
+
function all(_ref2) {
|
|
11
|
+
var token = _ref2.token,
|
|
12
|
+
_ref2$query = _ref2.query,
|
|
13
|
+
query = _ref2$query === undefined ? {} : _ref2$query,
|
|
14
|
+
_ref2$responseType = _ref2.responseType,
|
|
15
|
+
responseType = _ref2$responseType === undefined ? "json" : _ref2$responseType,
|
|
16
|
+
headers = _ref2.headers;
|
|
17
|
+
|
|
18
|
+
return client.get("/pay-on-accounts", {
|
|
19
|
+
params: query,
|
|
20
|
+
responseType: responseType,
|
|
21
|
+
headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
all: all
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = payOnAccountsFactory;
|
|
@@ -35,12 +35,41 @@ function productsFactory(_ref) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
function create(_ref4) {
|
|
39
|
+
var data = _ref4.data,
|
|
40
|
+
token = _ref4.token,
|
|
41
|
+
jwtToken = _ref4.jwtToken,
|
|
42
|
+
headers = _ref4.headers;
|
|
43
|
+
|
|
44
|
+
return client({
|
|
45
|
+
url: "/products",
|
|
46
|
+
method: "post",
|
|
47
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
48
|
+
data: data
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function update(_ref5) {
|
|
53
|
+
var productId = _ref5.productId,
|
|
54
|
+
data = _ref5.data,
|
|
55
|
+
token = _ref5.token,
|
|
56
|
+
jwtToken = _ref5.jwtToken,
|
|
57
|
+
headers = _ref5.headers;
|
|
58
|
+
|
|
59
|
+
return client({
|
|
60
|
+
url: "/products/" + productId,
|
|
61
|
+
method: "put",
|
|
62
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
63
|
+
data: data
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
38
67
|
var domains = {
|
|
39
|
-
remove: function remove(
|
|
40
|
-
var token =
|
|
41
|
-
jwtToken =
|
|
42
|
-
domain =
|
|
43
|
-
headers =
|
|
68
|
+
remove: function remove(_ref6) {
|
|
69
|
+
var token = _ref6.token,
|
|
70
|
+
jwtToken = _ref6.jwtToken,
|
|
71
|
+
domain = _ref6.domain,
|
|
72
|
+
headers = _ref6.headers;
|
|
44
73
|
|
|
45
74
|
return client({
|
|
46
75
|
url: "/products/domains/" + domain,
|
|
@@ -51,11 +80,11 @@ function productsFactory(_ref) {
|
|
|
51
80
|
};
|
|
52
81
|
|
|
53
82
|
var families = {
|
|
54
|
-
all: function all(
|
|
55
|
-
var token =
|
|
56
|
-
|
|
57
|
-
query =
|
|
58
|
-
headers =
|
|
83
|
+
all: function all(_ref7) {
|
|
84
|
+
var token = _ref7.token,
|
|
85
|
+
_ref7$query = _ref7.query,
|
|
86
|
+
query = _ref7$query === undefined ? {} : _ref7$query,
|
|
87
|
+
headers = _ref7.headers;
|
|
59
88
|
|
|
60
89
|
return client({
|
|
61
90
|
url: "/products/families",
|
|
@@ -68,6 +97,8 @@ function productsFactory(_ref) {
|
|
|
68
97
|
return {
|
|
69
98
|
all: all,
|
|
70
99
|
get: get,
|
|
100
|
+
create: create,
|
|
101
|
+
update: update,
|
|
71
102
|
families: families,
|
|
72
103
|
domains: domains
|
|
73
104
|
};
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -71,6 +71,7 @@ function createInventory({baseURL, headers, timeout, overrideFn, internalAuthTok
|
|
|
71
71
|
operatingCompanies: require("./endpoints/inventory/operating-companies.js")({client, internalAuthTokenProvider}),
|
|
72
72
|
operationMessages: require("./endpoints/inventory/operation-messages.js")({client, internalAuthTokenProvider}),
|
|
73
73
|
paymentTerminals: require("./endpoints/inventory/payment-terminals.js")({client, internalAuthTokenProvider}),
|
|
74
|
+
payOnAccounts: require("./endpoints/inventory/pay-on-accounts.js")({client, internalAuthTokenProvider}),
|
|
74
75
|
mitTerminals: require("./endpoints/inventory/mit-terminals.js")({client, internalAuthTokenProvider}),
|
|
75
76
|
serviceTypes: require("./endpoints/inventory/service-types.js")({client, internalAuthTokenProvider}),
|
|
76
77
|
customContent: require("./endpoints/inventory/custom-content.js")({client, internalAuthTokenProvider}),
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const {authorizationHeaders} = require("../endpoints_helpers.js");
|
|
2
|
+
|
|
3
|
+
function payOnAccountsFactory({client, internalAuthTokenProvider}) {
|
|
4
|
+
function all({token, query = {}, responseType = "json", headers}) {
|
|
5
|
+
return client.get("/pay-on-accounts", {
|
|
6
|
+
params: query,
|
|
7
|
+
responseType,
|
|
8
|
+
headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
all
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = payOnAccountsFactory;
|
|
@@ -17,6 +17,24 @@ function productsFactory({client, internalAuthTokenProvider}) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
function create({data, token, jwtToken, headers}) {
|
|
21
|
+
return client({
|
|
22
|
+
url: "/products",
|
|
23
|
+
method: "post",
|
|
24
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
25
|
+
data
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function update({productId, data, token, jwtToken, headers}) {
|
|
30
|
+
return client({
|
|
31
|
+
url: `/products/${productId}`,
|
|
32
|
+
method: "put",
|
|
33
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
34
|
+
data
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
20
38
|
const domains = {
|
|
21
39
|
remove: ({token, jwtToken, domain, headers}) =>{
|
|
22
40
|
return client({
|
|
@@ -40,6 +58,8 @@ function productsFactory({client, internalAuthTokenProvider}) {
|
|
|
40
58
|
return {
|
|
41
59
|
all,
|
|
42
60
|
get,
|
|
61
|
+
create,
|
|
62
|
+
update,
|
|
43
63
|
families,
|
|
44
64
|
domains
|
|
45
65
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const {axiosMock, expectRequest} = require("../../test-helpers.js");
|
|
2
|
+
const api = require("../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
3
|
+
|
|
4
|
+
describe("inventory/pay-on-accounts", () => {
|
|
5
|
+
const token = "I owe you a token";
|
|
6
|
+
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
axiosMock.reset();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("should list pay-on-accounts", () => {
|
|
12
|
+
axiosMock.onGet("/pay-on-accounts").reply(expectRequest({statusCode: 200, token}));
|
|
13
|
+
return api.inventory.payOnAccounts.all({token});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should list pay-on-accounts with responseType blob", () => {
|
|
17
|
+
const responseType = "blob";
|
|
18
|
+
axiosMock.onGet("/pay-on-accounts").reply(expectRequest({statusCode: 200, token}));
|
|
19
|
+
return api.inventory.payOnAccounts.all({token, responseType});
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -4,10 +4,10 @@ const api = require("./../../../src/client").createApiClient({ baseURL: "http://
|
|
|
4
4
|
describe('inventory/products', function() {
|
|
5
5
|
const token = 'I owe you a token';
|
|
6
6
|
const jwtToken = 'I owe you a JWT token';
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
afterEach(function() {
|
|
9
9
|
axiosMock.reset();
|
|
10
|
-
})
|
|
10
|
+
});
|
|
11
11
|
|
|
12
12
|
it("should list products", function() {
|
|
13
13
|
axiosMock.onGet(`/products`).reply(expectRequest({ statusCode: 200, token }));
|
|
@@ -29,6 +29,19 @@ describe('inventory/products', function() {
|
|
|
29
29
|
return api.inventory.products.families.all({ token });
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
it("should create a product", function() {
|
|
33
|
+
const data = {name: "Test Product"};
|
|
34
|
+
axiosMock.onPost("/products").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
35
|
+
return api.inventory.products.create({token, jwtToken, data});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("should update a product", function() {
|
|
39
|
+
const data = {name: "Test Product"};
|
|
40
|
+
const productId = 1;
|
|
41
|
+
axiosMock.onPut(`/products/${productId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
42
|
+
return api.inventory.products.update({token, jwtToken, productId, data});
|
|
43
|
+
});
|
|
44
|
+
|
|
32
45
|
it("should delete domain for all products from account", () => {
|
|
33
46
|
const domain = "domain1";
|
|
34
47
|
axiosMock.onDelete(`/products/domains/${domain}`).reply(expectRequest({
|
|
@@ -44,4 +57,4 @@ describe('inventory/products', function() {
|
|
|
44
57
|
});
|
|
45
58
|
});
|
|
46
59
|
|
|
47
|
-
});
|
|
60
|
+
});
|
package/types/client.d.ts
CHANGED
|
@@ -124,6 +124,19 @@ export function createApiClient(options: {
|
|
|
124
124
|
query?: {};
|
|
125
125
|
headers: any;
|
|
126
126
|
}) => any;
|
|
127
|
+
create: ({ data, token, jwtToken, headers }: {
|
|
128
|
+
data: any;
|
|
129
|
+
token: any;
|
|
130
|
+
jwtToken: any;
|
|
131
|
+
headers: any;
|
|
132
|
+
}) => any;
|
|
133
|
+
update: ({ productId, data, token, jwtToken, headers }: {
|
|
134
|
+
productId: any;
|
|
135
|
+
data: any;
|
|
136
|
+
token: any;
|
|
137
|
+
jwtToken: any;
|
|
138
|
+
headers: any;
|
|
139
|
+
}) => any;
|
|
127
140
|
families: {
|
|
128
141
|
all: ({ token, query, headers }: {
|
|
129
142
|
token: any;
|
|
@@ -814,6 +827,14 @@ export function createApiClient(options: {
|
|
|
814
827
|
headers: any;
|
|
815
828
|
}) => any;
|
|
816
829
|
};
|
|
830
|
+
payOnAccounts: {
|
|
831
|
+
all: ({ token, query, responseType, headers }: {
|
|
832
|
+
token: any;
|
|
833
|
+
query?: {};
|
|
834
|
+
responseType?: string;
|
|
835
|
+
headers: any;
|
|
836
|
+
}) => any;
|
|
837
|
+
};
|
|
817
838
|
mitTerminals: {
|
|
818
839
|
all: ({ token, query, headers }: {
|
|
819
840
|
token: any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export = payOnAccountsFactory;
|
|
2
|
+
declare function payOnAccountsFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
all: ({ token, query, responseType, headers }: {
|
|
7
|
+
token: any;
|
|
8
|
+
query?: {};
|
|
9
|
+
responseType?: string;
|
|
10
|
+
headers: any;
|
|
11
|
+
}) => any;
|
|
12
|
+
};
|
|
@@ -15,6 +15,19 @@ declare function productsFactory({ client, internalAuthTokenProvider }: {
|
|
|
15
15
|
query?: {};
|
|
16
16
|
headers: any;
|
|
17
17
|
}) => any;
|
|
18
|
+
create: ({ data, token, jwtToken, headers }: {
|
|
19
|
+
data: any;
|
|
20
|
+
token: any;
|
|
21
|
+
jwtToken: any;
|
|
22
|
+
headers: any;
|
|
23
|
+
}) => any;
|
|
24
|
+
update: ({ productId, data, token, jwtToken, headers }: {
|
|
25
|
+
productId: any;
|
|
26
|
+
data: any;
|
|
27
|
+
token: any;
|
|
28
|
+
jwtToken: any;
|
|
29
|
+
headers: any;
|
|
30
|
+
}) => any;
|
|
18
31
|
families: {
|
|
19
32
|
all: ({ token, query, headers }: {
|
|
20
33
|
token: any;
|
|
@@ -78,6 +78,19 @@ declare const _exports: {
|
|
|
78
78
|
query?: {};
|
|
79
79
|
headers: any;
|
|
80
80
|
}) => any;
|
|
81
|
+
create: ({ data, token, jwtToken, headers }: {
|
|
82
|
+
data: any;
|
|
83
|
+
token: any;
|
|
84
|
+
jwtToken: any;
|
|
85
|
+
headers: any;
|
|
86
|
+
}) => any;
|
|
87
|
+
update: ({ productId, data, token, jwtToken, headers }: {
|
|
88
|
+
productId: any;
|
|
89
|
+
data: any;
|
|
90
|
+
token: any;
|
|
91
|
+
jwtToken: any;
|
|
92
|
+
headers: any;
|
|
93
|
+
}) => any;
|
|
81
94
|
families: {
|
|
82
95
|
all: ({ token, query, headers }: {
|
|
83
96
|
token: any;
|
|
@@ -768,6 +781,14 @@ declare const _exports: {
|
|
|
768
781
|
headers: any;
|
|
769
782
|
}) => any;
|
|
770
783
|
};
|
|
784
|
+
payOnAccounts: {
|
|
785
|
+
all: ({ token, query, responseType, headers }: {
|
|
786
|
+
token: any;
|
|
787
|
+
query?: {};
|
|
788
|
+
responseType?: string;
|
|
789
|
+
headers: any;
|
|
790
|
+
}) => any;
|
|
791
|
+
};
|
|
771
792
|
mitTerminals: {
|
|
772
793
|
all: ({ token, query, headers }: {
|
|
773
794
|
token: any;
|