btrz-api-client 5.74.0 → 5.76.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.
@@ -142,6 +142,18 @@ function shiftsFactory(_ref) {
142
142
  });
143
143
  }
144
144
  };
145
+ var transactions = {
146
+ get: function get(_ref11) {
147
+ var token = _ref11.token,
148
+ jwtToken = _ref11.jwtToken,
149
+ shiftId = _ref11.shiftId,
150
+ headers = _ref11.headers;
151
+
152
+ return client.get("/shifts/" + shiftId + "/transactions", {
153
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
154
+ });
155
+ }
156
+ };
145
157
 
146
158
  return {
147
159
  all: all,
@@ -149,6 +161,7 @@ function shiftsFactory(_ref) {
149
161
  create: create,
150
162
  update: update,
151
163
  payments: payments,
164
+ transactions: transactions,
152
165
  locationClosures: locationClosures
153
166
  };
154
167
  }
@@ -72,6 +72,10 @@ function pdfDataFactory(_ref) {
72
72
  if (query.type === "invoice") {
73
73
  url = "/pdf-invoices/" + itemId;
74
74
  }
75
+ if (query.type === "locationClosure") {
76
+ url = "/pdf-location-closures/" + itemId;
77
+ }
78
+
75
79
  return client.get(url, {
76
80
  params: query,
77
81
  headers: authorizationHeaders({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "5.74.0",
3
+ "version": "5.76.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -88,6 +88,13 @@ function shiftsFactory({client, internalAuthTokenProvider}) {
88
88
  });
89
89
  }
90
90
  };
91
+ const transactions = {
92
+ get({token, jwtToken, shiftId, headers}) {
93
+ return client.get(`/shifts/${shiftId}/transactions`, {
94
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
95
+ });
96
+ }
97
+ };
91
98
 
92
99
  return {
93
100
  all,
@@ -95,6 +102,7 @@ function shiftsFactory({client, internalAuthTokenProvider}) {
95
102
  create,
96
103
  update,
97
104
  payments,
105
+ transactions,
98
106
  locationClosures
99
107
  };
100
108
  }
@@ -70,6 +70,10 @@ function pdfDataFactory({
70
70
  if (query.type === "invoice") {
71
71
  url = `/pdf-invoices/${itemId}`;
72
72
  }
73
+ if (query.type === "locationClosure") {
74
+ url = `/pdf-location-closures/${itemId}`;
75
+ }
76
+
73
77
  return client.get(url, {
74
78
  params: query,
75
79
  headers: authorizationHeaders({
@@ -90,4 +90,10 @@ describe("accounts/shifts", () => {
90
90
  axiosMock.onGet(`/shifts/${shiftId}/payments`).reply(expectRequest({statusCode: 200, token}));
91
91
  return api.accounts.shifts.payments.get({token, jwtToken, shiftId});
92
92
  });
93
+
94
+ it("should get the shift transactions", () => {
95
+ const shiftId = "shiftId1";
96
+ axiosMock.onGet(`/shifts/${shiftId}/transactions`).reply(expectRequest({statusCode: 200, token}));
97
+ return api.accounts.shifts.transactions.get({token, jwtToken, shiftId});
98
+ });
93
99
  });
@@ -1,14 +1,13 @@
1
1
  const {
2
2
  axiosMock,
3
3
  expectRequest
4
- } = require("./../../test-helpers");
5
- const api = require("./../../../src/client").createApiClient({
4
+ } = require("./../../test-helpers.js");
5
+ const api = require("./../../../src/client.js").createApiClient({
6
6
  baseURL: "http://test.com"
7
7
  });
8
8
 
9
9
  describe("notifications/pdf-data", () => {
10
10
  const token = "my-api-key";
11
- const jwtToken = "my-jwt";
12
11
 
13
12
  afterEach(() => {
14
13
  axiosMock.reset();
@@ -19,13 +18,14 @@ describe("notifications/pdf-data", () => {
19
18
  const query = {
20
19
  type: "product",
21
20
  family: "ticket"
22
- }
21
+ };
23
22
  axiosMock.onGet(`/pdf-tickets/${itemId}`)
24
23
  .reply(expectRequest({
25
24
  statusCode: 200, token
26
25
  }));
27
26
  return api.notifications.pdfData.get({
28
- token, query, itemId});
27
+ token, query, itemId
28
+ });
29
29
  });
30
30
 
31
31
  it("should return the proper data for a reservation", () => {
@@ -33,104 +33,112 @@ describe("notifications/pdf-data", () => {
33
33
  const query = {
34
34
  type: "product",
35
35
  family: "reservation"
36
- }
36
+ };
37
37
  axiosMock.onGet(`/pdf-reservations/${itemId}`)
38
38
  .reply(expectRequest({
39
39
  statusCode: 200, token
40
40
  }));
41
41
  return api.notifications.pdfData.get({
42
- token, query, itemId});
42
+ token, query, itemId
43
+ });
43
44
  });
44
45
 
45
46
  it("should return the proper data for a shift", () => {
46
47
  const itemId = "12345";
47
48
  const query = {
48
49
  type: "shift"
49
- }
50
+ };
50
51
  axiosMock.onGet(`/pdf-shifts/${itemId}`)
51
52
  .reply(expectRequest({
52
53
  statusCode: 200, token
53
54
  }));
54
55
  return api.notifications.pdfData.get({
55
- token, query, itemId});
56
+ token, query, itemId
57
+ });
56
58
  });
57
59
 
58
60
  it("should return the proper data for a manifest", () => {
59
61
  const itemId = "12345";
60
62
  const query = {
61
63
  type: "manifest"
62
- }
64
+ };
63
65
  axiosMock.onGet(`/pdf-manifests/${itemId}`)
64
66
  .reply(expectRequest({
65
67
  statusCode: 200, token
66
68
  }));
67
69
  return api.notifications.pdfData.get({
68
- token, query, itemId});
70
+ token, query, itemId
71
+ });
69
72
  });
70
73
 
71
74
  it("should return the proper data for an order", () => {
72
75
  const itemId = "12345";
73
76
  const query = {
74
77
  type: "order"
75
- }
78
+ };
76
79
  axiosMock.onGet(`/pdf-orders/${itemId}`)
77
80
  .reply(expectRequest({
78
81
  statusCode: 200, token
79
82
  }));
80
83
  return api.notifications.pdfData.get({
81
- token, query, itemId});
84
+ token, query, itemId
85
+ });
82
86
  });
83
87
 
84
88
  it("should return the proper data for a ssr", () => {
85
89
  const itemId = "12345";
86
90
  const query = {
87
91
  type: "ssr"
88
- }
92
+ };
89
93
  axiosMock.onGet(`/pdf-ssrs/${itemId}`)
90
94
  .reply(expectRequest({
91
95
  statusCode: 200, token
92
96
  }));
93
97
  return api.notifications.pdfData.get({
94
- token, query, itemId});
98
+ token, query, itemId
99
+ });
95
100
  });
96
101
 
97
102
  it("should return the proper data for a exchange", () => {
98
103
  const itemId = "12345";
99
104
  const query = {
100
105
  type: "exchange"
101
- }
106
+ };
102
107
  axiosMock.onGet(`/pdf-exchanges/${itemId}`)
103
108
  .reply(expectRequest({
104
109
  statusCode: 200, token
105
110
  }));
106
111
  return api.notifications.pdfData.get({
107
- token, query, itemId});
112
+ token, query, itemId
113
+ });
108
114
  });
109
115
 
110
116
  it("should return the proper data for a invoice", () => {
111
117
  const itemId = "12345";
112
118
  const query = {
113
119
  type: "invoice"
114
- }
120
+ };
115
121
  axiosMock.onGet(`/pdf-invoices/${itemId}`)
116
122
  .reply(expectRequest({
117
123
  statusCode: 200, token
118
124
  }));
119
125
  return api.notifications.pdfData.get({
120
- token, query, itemId});
126
+ token, query, itemId
127
+ });
121
128
  });
122
129
 
123
130
  it("should return the proper data for a transaction", () => {
124
131
  const itemId = "12345";
125
132
  const query = {
126
133
  type: "transaction"
127
- }
134
+ };
128
135
  axiosMock.onGet(`/pdf-transactions/${itemId}`)
129
136
  .reply(expectRequest({
130
137
  statusCode: 200, token
131
138
  }));
132
139
  return api.notifications.pdfData.get({
133
- token, query, itemId});
140
+ token, query, itemId
141
+ });
134
142
  });
135
143
 
136
144
  it("should return the proper data for a paid in", () => {
@@ -138,13 +146,14 @@ describe("notifications/pdf-data", () => {
138
146
  const query = {
139
147
  type: "product",
140
148
  family: "paid in"
141
- }
149
+ };
142
150
  axiosMock.onGet(`/pdf-paid-ins/${itemId}`)
143
151
  .reply(expectRequest({
144
152
  statusCode: 200, token
145
153
  }));
146
154
  return api.notifications.pdfData.get({
147
- token, query, itemId});
155
+ token, query, itemId
156
+ });
148
157
  });
149
158
 
150
159
  it("should return the proper data for a paid out", () => {
@@ -152,13 +161,14 @@ describe("notifications/pdf-data", () => {
152
161
  const query = {
153
162
  type: "product",
154
163
  family: "paid out"
155
- }
164
+ };
156
165
  axiosMock.onGet(`/pdf-paid-outs/${itemId}`)
157
166
  .reply(expectRequest({
158
167
  statusCode: 200, token
159
168
  }));
160
169
  return api.notifications.pdfData.get({
161
- token, query, itemId});
170
+ token, query, itemId
171
+ });
162
172
  });
163
173
 
164
174
  it("should return the proper data for a parcel", () => {
@@ -166,13 +176,14 @@ describe("notifications/pdf-data", () => {
166
176
  const query = {
167
177
  type: "product",
168
178
  family: "parcel"
169
- }
179
+ };
170
180
  axiosMock.onGet(`/pdf-parcels/${itemId}`)
171
181
  .reply(expectRequest({
172
182
  statusCode: 200, token
173
183
  }));
174
184
  return api.notifications.pdfData.get({
175
- token, query, itemId});
185
+ token, query, itemId
186
+ });
176
187
  });
177
188
 
178
189
  it("should return the proper data for a flexpass", () => {
@@ -180,13 +191,14 @@ describe("notifications/pdf-data", () => {
180
191
  const query = {
181
192
  type: "product",
182
193
  family: "flexpass"
183
- }
194
+ };
184
195
  axiosMock.onGet(`/pdf-flexpasses/${itemId}`)
185
196
  .reply(expectRequest({
186
197
  statusCode: 200, token
187
198
  }));
188
199
  return api.notifications.pdfData.get({
189
- token, query, itemId});
200
+ token, query, itemId
201
+ });
190
202
  });
191
203
 
192
204
 
@@ -195,38 +207,83 @@ describe("notifications/pdf-data", () => {
195
207
  const query = {
196
208
  type: "product",
197
209
  family: "bundle"
198
- }
210
+ };
199
211
  axiosMock.onGet(`/pdf-redeemable-items/${itemId}`)
200
212
  .reply(expectRequest({
201
213
  statusCode: 200, token
202
214
  }));
203
215
  return api.notifications.pdfData.get({
204
- token, query, itemId});
216
+ token, query, itemId
217
+ });
205
218
  });
206
219
 
207
220
  it("should return the proper data for a gift-certificates", () => {
208
221
  const itemId = "12345";
209
222
  const query = {
210
- type: "giftCertificate",
211
- }
223
+ type: "giftCertificate"
224
+ };
212
225
  axiosMock.onGet(`/pdf-gift-certificates/${itemId}`)
213
226
  .reply(expectRequest({
214
227
  statusCode: 200, token
215
228
  }));
216
229
  return api.notifications.pdfData.get({
217
- token, query, itemId});
230
+ token, query, itemId
231
+ });
218
232
  });
219
233
 
220
234
  it("should return the proper data for a voucher", () => {
221
235
  const itemId = "12345";
222
236
  const query = {
223
- type: "voucher",
224
- }
237
+ type: "voucher"
238
+ };
225
239
  axiosMock.onGet(`/pdf-vouchers/${itemId}`)
226
240
  .reply(expectRequest({
227
241
  statusCode: 200, token
228
242
  }));
229
243
  return api.notifications.pdfData.get({
230
- token, query, itemId});
244
+ token, query, itemId
245
+ });
246
+ });
247
+
248
+ it("should return the proper data for a voucher", () => {
249
+ const itemId = "12345";
250
+ const query = {
251
+ type: "voucher"
252
+ };
253
+ axiosMock.onGet(`/pdf-vouchers/${itemId}`)
254
+ .reply(expectRequest({
255
+ statusCode: 200, token
256
+ }));
257
+ return api.notifications.pdfData.get({
258
+ token, query, itemId
259
+ });
260
+ });
261
+
262
+ it("should return the proper data for a passengersManifest", () => {
263
+ const itemId = "12345";
264
+ const query = {
265
+ type: "passengersManifest"
266
+ };
267
+ axiosMock.onGet(`/pdf-passengers-manifests/${itemId}`)
268
+ .reply(expectRequest({
269
+ statusCode: 200, token
270
+ }));
271
+ return api.notifications.pdfData.get({
272
+ token, query, itemId
273
+ });
274
+ });
275
+
276
+ it("should return the proper data for a locationClosure", () => {
277
+ const itemId = "12345";
278
+ const query = {
279
+ type: "locationClosure"
280
+ };
281
+ axiosMock.onGet(`/pdf-location-closures/${itemId}`)
282
+ .reply(expectRequest({
283
+ statusCode: 200, token
284
+ }));
285
+ return api.notifications.pdfData.get({
286
+ token, query, itemId
287
+ });
231
288
  });
232
289
  });
package/types/client.d.ts CHANGED
@@ -1774,6 +1774,14 @@ export function createApiClient(options: {
1774
1774
  headers: any;
1775
1775
  }): any;
1776
1776
  };
1777
+ transactions: {
1778
+ get({ token, jwtToken, shiftId, headers }: {
1779
+ token: any;
1780
+ jwtToken: any;
1781
+ shiftId: any;
1782
+ headers: any;
1783
+ }): any;
1784
+ };
1777
1785
  locationClosures: {
1778
1786
  create({ jwtToken, token, locationClosure, headers }: {
1779
1787
  jwtToken: any;
@@ -36,6 +36,14 @@ declare function shiftsFactory({ client, internalAuthTokenProvider }: {
36
36
  headers: any;
37
37
  }): any;
38
38
  };
39
+ transactions: {
40
+ get({ token, jwtToken, shiftId, headers }: {
41
+ token: any;
42
+ jwtToken: any;
43
+ shiftId: any;
44
+ headers: any;
45
+ }): any;
46
+ };
39
47
  locationClosures: {
40
48
  create({ jwtToken, token, locationClosure, headers }: {
41
49
  jwtToken: any;
@@ -1728,6 +1728,14 @@ declare const _exports: {
1728
1728
  headers: any;
1729
1729
  }): any;
1730
1730
  };
1731
+ transactions: {
1732
+ get({ token, jwtToken, shiftId, headers }: {
1733
+ token: any;
1734
+ jwtToken: any;
1735
+ shiftId: any;
1736
+ headers: any;
1737
+ }): any;
1738
+ };
1731
1739
  locationClosures: {
1732
1740
  create({ jwtToken, token, locationClosure, headers }: {
1733
1741
  jwtToken: any;