btrz-api-client 5.113.0 → 5.115.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 +1 -1
- package/lib/client.js +1 -0
- package/lib/endpoints/accounts/exchange-receipts.js +30 -0
- package/lib/endpoints/accounts/shifts.js +37 -24
- package/package.json +2 -2
- package/src/client.js +1 -0
- package/src/endpoints/accounts/exchange-receipts.js +19 -0
- package/src/endpoints/accounts/shifts.js +8 -0
- package/test/endpoints/accounts/exchange-receipts.test.js +30 -0
- package/test/endpoints/accounts/shifts.test.js +6 -0
- package/types/client.d.ts +16 -0
- package/types/endpoints/accounts/exchange-receipts.d.ts +12 -0
- package/types/endpoints/accounts/shifts.d.ts +8 -0
- package/types/initializedClient.d.ts +16 -0
package/lib/client.js
CHANGED
|
@@ -176,6 +176,7 @@ function createAccounts(_ref4) {
|
|
|
176
176
|
domains: require("./endpoints/accounts/domains.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
177
177
|
emailSettings: require("./endpoints/accounts/email-settings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
178
178
|
exchangeRates: require("./endpoints/accounts/exchange-rates.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
179
|
+
exchangeReceipts: require("./endpoints/accounts/exchange-receipts.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
179
180
|
images: require("./endpoints/accounts/images.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
180
181
|
interline: require("./endpoints/accounts/interline.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
181
182
|
lexicons: require("./endpoints/accounts/lexicons.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable import/extensions */
|
|
4
|
+
var _require = require("../endpoints_helpers"),
|
|
5
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
6
|
+
|
|
7
|
+
function exchangeReceiptsFactory(_ref) {
|
|
8
|
+
var client = _ref.client,
|
|
9
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
10
|
+
|
|
11
|
+
function update(_ref2) {
|
|
12
|
+
var data = _ref2.data,
|
|
13
|
+
token = _ref2.token,
|
|
14
|
+
jwtToken = _ref2.jwtToken,
|
|
15
|
+
headers = _ref2.headers;
|
|
16
|
+
|
|
17
|
+
return client({
|
|
18
|
+
url: "/exchange-receipt-settings",
|
|
19
|
+
method: "put",
|
|
20
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
21
|
+
data: data
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
update: update
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = exchangeReceiptsFactory;
|
|
@@ -250,24 +250,36 @@ function shiftsFactory(_ref) {
|
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
252
|
};
|
|
253
|
-
var
|
|
253
|
+
var invoices = {
|
|
254
254
|
get: function get(_ref20) {
|
|
255
255
|
var token = _ref20.token,
|
|
256
256
|
jwtToken = _ref20.jwtToken,
|
|
257
257
|
shiftId = _ref20.shiftId,
|
|
258
258
|
headers = _ref20.headers;
|
|
259
259
|
|
|
260
|
-
return client.get("/shifts/" + shiftId + "/
|
|
260
|
+
return client.get("/shifts/" + shiftId + "/invoices", {
|
|
261
261
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
262
262
|
});
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
var deposits = {
|
|
266
|
+
get: function get(_ref21) {
|
|
267
|
+
var token = _ref21.token,
|
|
268
|
+
jwtToken = _ref21.jwtToken,
|
|
267
269
|
shiftId = _ref21.shiftId,
|
|
268
|
-
deposit = _ref21.deposit,
|
|
269
270
|
headers = _ref21.headers;
|
|
270
271
|
|
|
272
|
+
return client.get("/shifts/" + shiftId + "/deposits", {
|
|
273
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
274
|
+
});
|
|
275
|
+
},
|
|
276
|
+
create: function create(_ref22) {
|
|
277
|
+
var jwtToken = _ref22.jwtToken,
|
|
278
|
+
token = _ref22.token,
|
|
279
|
+
shiftId = _ref22.shiftId,
|
|
280
|
+
deposit = _ref22.deposit,
|
|
281
|
+
headers = _ref22.headers;
|
|
282
|
+
|
|
271
283
|
return client({
|
|
272
284
|
url: "/shifts/" + shiftId + "/deposits",
|
|
273
285
|
method: "post",
|
|
@@ -277,22 +289,22 @@ function shiftsFactory(_ref) {
|
|
|
277
289
|
}
|
|
278
290
|
};
|
|
279
291
|
var manualTickets = {
|
|
280
|
-
get: function get(
|
|
281
|
-
var token =
|
|
282
|
-
jwtToken =
|
|
283
|
-
shiftId =
|
|
284
|
-
headers =
|
|
292
|
+
get: function get(_ref23) {
|
|
293
|
+
var token = _ref23.token,
|
|
294
|
+
jwtToken = _ref23.jwtToken,
|
|
295
|
+
shiftId = _ref23.shiftId,
|
|
296
|
+
headers = _ref23.headers;
|
|
285
297
|
|
|
286
298
|
return client.get("/shifts/" + shiftId + "/manual-tickets", {
|
|
287
299
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
288
300
|
});
|
|
289
301
|
},
|
|
290
|
-
create: function create(
|
|
291
|
-
var jwtToken =
|
|
292
|
-
token =
|
|
293
|
-
shiftId =
|
|
294
|
-
manualTicket =
|
|
295
|
-
headers =
|
|
302
|
+
create: function create(_ref24) {
|
|
303
|
+
var jwtToken = _ref24.jwtToken,
|
|
304
|
+
token = _ref24.token,
|
|
305
|
+
shiftId = _ref24.shiftId,
|
|
306
|
+
manualTicket = _ref24.manualTicket,
|
|
307
|
+
headers = _ref24.headers;
|
|
296
308
|
|
|
297
309
|
return client({
|
|
298
310
|
url: "/shifts/" + shiftId + "/manual-tickets",
|
|
@@ -303,12 +315,12 @@ function shiftsFactory(_ref) {
|
|
|
303
315
|
}
|
|
304
316
|
};
|
|
305
317
|
var startingBalances = {
|
|
306
|
-
create: function create(
|
|
307
|
-
var jwtToken =
|
|
308
|
-
token =
|
|
309
|
-
shiftId =
|
|
310
|
-
startingBalance =
|
|
311
|
-
headers =
|
|
318
|
+
create: function create(_ref25) {
|
|
319
|
+
var jwtToken = _ref25.jwtToken,
|
|
320
|
+
token = _ref25.token,
|
|
321
|
+
shiftId = _ref25.shiftId,
|
|
322
|
+
startingBalance = _ref25.startingBalance,
|
|
323
|
+
headers = _ref25.headers;
|
|
312
324
|
|
|
313
325
|
return client({
|
|
314
326
|
url: "/shifts/" + shiftId + "/starting-balance",
|
|
@@ -334,6 +346,7 @@ function shiftsFactory(_ref) {
|
|
|
334
346
|
giftCertificates: giftCertificates,
|
|
335
347
|
parcels: parcels,
|
|
336
348
|
insurances: insurances,
|
|
349
|
+
invoices: invoices,
|
|
337
350
|
deposits: deposits,
|
|
338
351
|
manualTickets: manualTickets,
|
|
339
352
|
locationClosures: locationClosures,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "btrz-api-client",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.115.0",
|
|
4
4
|
"description": "Api client for Betterez endpoints",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
|
34
34
|
"babel-preset-es2015": "^6.24.1",
|
|
35
35
|
"browserify": "^17.0.0",
|
|
36
|
-
"chai": "^4.3.
|
|
36
|
+
"chai": "^4.3.8",
|
|
37
37
|
"confusing-browser-globals": "^1.0.11",
|
|
38
38
|
"eslint": "7.32.0",
|
|
39
39
|
"eslint-config-btrz-base": "^1.0.0",
|
package/src/client.js
CHANGED
|
@@ -142,6 +142,7 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
|
|
|
142
142
|
domains: require("./endpoints/accounts/domains.js")({client, internalAuthTokenProvider}),
|
|
143
143
|
emailSettings: require("./endpoints/accounts/email-settings.js")({client, internalAuthTokenProvider}),
|
|
144
144
|
exchangeRates: require("./endpoints/accounts/exchange-rates.js")({client, internalAuthTokenProvider}),
|
|
145
|
+
exchangeReceipts: require("./endpoints/accounts/exchange-receipts.js")({client, internalAuthTokenProvider}),
|
|
145
146
|
images: require("./endpoints/accounts/images.js")({client, internalAuthTokenProvider}),
|
|
146
147
|
interline: require("./endpoints/accounts/interline.js")({client, internalAuthTokenProvider}),
|
|
147
148
|
lexicons: require("./endpoints/accounts/lexicons.js")({client, internalAuthTokenProvider}),
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* eslint-disable import/extensions */
|
|
2
|
+
const {authorizationHeaders} = require("../endpoints_helpers");
|
|
3
|
+
|
|
4
|
+
function exchangeReceiptsFactory({client, internalAuthTokenProvider}) {
|
|
5
|
+
function update({data, token, jwtToken, headers}) {
|
|
6
|
+
return client({
|
|
7
|
+
url: "/exchange-receipt-settings",
|
|
8
|
+
method: "put",
|
|
9
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
10
|
+
data
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
update
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = exchangeReceiptsFactory;
|
|
@@ -151,6 +151,13 @@ function shiftsFactory({client, internalAuthTokenProvider}) {
|
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
|
+
const invoices = {
|
|
155
|
+
get({token, jwtToken, shiftId, headers}) {
|
|
156
|
+
return client.get(`/shifts/${shiftId}/invoices`, {
|
|
157
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
};
|
|
154
161
|
const deposits = {
|
|
155
162
|
get({token, jwtToken, shiftId, headers}) {
|
|
156
163
|
return client.get(`/shifts/${shiftId}/deposits`, {
|
|
@@ -208,6 +215,7 @@ function shiftsFactory({client, internalAuthTokenProvider}) {
|
|
|
208
215
|
giftCertificates,
|
|
209
216
|
parcels,
|
|
210
217
|
insurances,
|
|
218
|
+
invoices,
|
|
211
219
|
deposits,
|
|
212
220
|
manualTickets,
|
|
213
221
|
locationClosures,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const {expect} = require("chai");
|
|
2
|
+
const {axiosMock, expectRequest} = require("../../test-helpers.js");
|
|
3
|
+
const api = require("../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
4
|
+
|
|
5
|
+
describe("accounts/exchange-receipt-settings", () => {
|
|
6
|
+
const token = "I owe you a token";
|
|
7
|
+
const jwtToken = "I owe you a JWT token";
|
|
8
|
+
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
axiosMock.reset();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("should PUT to ExchangeReceipts", () => {
|
|
14
|
+
const data = {
|
|
15
|
+
accountId: "123456789"
|
|
16
|
+
};
|
|
17
|
+
axiosMock.onPut("/exchange-receipt-settings").reply(expectRequest({
|
|
18
|
+
statusCode: 200,
|
|
19
|
+
token,
|
|
20
|
+
jwtToken
|
|
21
|
+
}));
|
|
22
|
+
return api.accounts.exchangeReceipts.update({
|
|
23
|
+
token,
|
|
24
|
+
jwtToken,
|
|
25
|
+
data
|
|
26
|
+
}).then((httpResponse) => {
|
|
27
|
+
expect(httpResponse.status).eql(200);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -145,6 +145,12 @@ describe("accounts/shifts", () => {
|
|
|
145
145
|
return api.accounts.shifts.insurances.get({token, jwtToken, shiftId});
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
+
it("should get the shift invoices", () => {
|
|
149
|
+
const shiftId = "shiftId1";
|
|
150
|
+
axiosMock.onGet(`/shifts/${shiftId}/invoices`).reply(expectRequest({statusCode: 200, token}));
|
|
151
|
+
return api.accounts.shifts.invoices.get({token, jwtToken, shiftId});
|
|
152
|
+
});
|
|
153
|
+
|
|
148
154
|
it("should get the shift deposits", () => {
|
|
149
155
|
const shiftId = "shiftId1";
|
|
150
156
|
axiosMock.onGet(`/shifts/${shiftId}/deposits`).reply(expectRequest({statusCode: 200, token}));
|
package/types/client.d.ts
CHANGED
|
@@ -1618,6 +1618,14 @@ export function createApiClient(options: {
|
|
|
1618
1618
|
headers: any;
|
|
1619
1619
|
}) => any;
|
|
1620
1620
|
};
|
|
1621
|
+
exchangeReceipts: {
|
|
1622
|
+
update: ({ data, token, jwtToken, headers }: {
|
|
1623
|
+
data: any;
|
|
1624
|
+
token: any;
|
|
1625
|
+
jwtToken: any;
|
|
1626
|
+
headers: any;
|
|
1627
|
+
}) => any;
|
|
1628
|
+
};
|
|
1621
1629
|
images: {
|
|
1622
1630
|
all: ({ token, jwtToken, query, headers }: {
|
|
1623
1631
|
token: any;
|
|
@@ -1994,6 +2002,14 @@ export function createApiClient(options: {
|
|
|
1994
2002
|
headers: any;
|
|
1995
2003
|
}): any;
|
|
1996
2004
|
};
|
|
2005
|
+
invoices: {
|
|
2006
|
+
get({ token, jwtToken, shiftId, headers }: {
|
|
2007
|
+
token: any;
|
|
2008
|
+
jwtToken: any;
|
|
2009
|
+
shiftId: any;
|
|
2010
|
+
headers: any;
|
|
2011
|
+
}): any;
|
|
2012
|
+
};
|
|
1997
2013
|
deposits: {
|
|
1998
2014
|
get({ token, jwtToken, shiftId, headers }: {
|
|
1999
2015
|
token: any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export = exchangeReceiptsFactory;
|
|
2
|
+
declare function exchangeReceiptsFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
update: ({ data, token, jwtToken, headers }: {
|
|
7
|
+
data: any;
|
|
8
|
+
token: any;
|
|
9
|
+
jwtToken: any;
|
|
10
|
+
headers: any;
|
|
11
|
+
}) => any;
|
|
12
|
+
};
|
|
@@ -108,6 +108,14 @@ declare function shiftsFactory({ client, internalAuthTokenProvider }: {
|
|
|
108
108
|
headers: any;
|
|
109
109
|
}): any;
|
|
110
110
|
};
|
|
111
|
+
invoices: {
|
|
112
|
+
get({ token, jwtToken, shiftId, headers }: {
|
|
113
|
+
token: any;
|
|
114
|
+
jwtToken: any;
|
|
115
|
+
shiftId: any;
|
|
116
|
+
headers: any;
|
|
117
|
+
}): any;
|
|
118
|
+
};
|
|
111
119
|
deposits: {
|
|
112
120
|
get({ token, jwtToken, shiftId, headers }: {
|
|
113
121
|
token: any;
|
|
@@ -1572,6 +1572,14 @@ declare const _exports: {
|
|
|
1572
1572
|
headers: any;
|
|
1573
1573
|
}) => any;
|
|
1574
1574
|
};
|
|
1575
|
+
exchangeReceipts: {
|
|
1576
|
+
update: ({ data, token, jwtToken, headers }: {
|
|
1577
|
+
data: any;
|
|
1578
|
+
token: any;
|
|
1579
|
+
jwtToken: any;
|
|
1580
|
+
headers: any;
|
|
1581
|
+
}) => any;
|
|
1582
|
+
};
|
|
1575
1583
|
images: {
|
|
1576
1584
|
all: ({ token, jwtToken, query, headers }: {
|
|
1577
1585
|
token: any;
|
|
@@ -1948,6 +1956,14 @@ declare const _exports: {
|
|
|
1948
1956
|
headers: any;
|
|
1949
1957
|
}): any;
|
|
1950
1958
|
};
|
|
1959
|
+
invoices: {
|
|
1960
|
+
get({ token, jwtToken, shiftId, headers }: {
|
|
1961
|
+
token: any;
|
|
1962
|
+
jwtToken: any;
|
|
1963
|
+
shiftId: any;
|
|
1964
|
+
headers: any;
|
|
1965
|
+
}): any;
|
|
1966
|
+
};
|
|
1951
1967
|
deposits: {
|
|
1952
1968
|
get({ token, jwtToken, shiftId, headers }: {
|
|
1953
1969
|
token: any;
|