btrz-api-client 8.66.1 → 8.68.1
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/accounts/agencies.js +34 -7
- package/lib/endpoints/inventory/fare-type-modifiers.js +167 -0
- package/lib/endpoints/notifications/notify.js +55 -19
- package/package.json +1 -1
- package/src/client.js +1 -0
- package/src/endpoints/accounts/agencies.js +23 -1
- package/src/endpoints/inventory/fare-type-modifiers.js +140 -0
- package/src/endpoints/notifications/notify.js +28 -1
- package/test/all.test.js +1 -0
- package/test/endpoints/accounts/agencies.test.js +28 -0
- package/test/endpoints/inventory/fare-type-modifiers.test.js +76 -0
- package/test/endpoints/notifications/notify.test.js +18 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const {
|
|
2
|
+
axiosMock, expectRequest
|
|
3
|
+
} = require("../../test-helpers.js");
|
|
4
|
+
const api = require("../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
5
|
+
|
|
6
|
+
describe("inventory/fare-type-modifiers", () => {
|
|
7
|
+
const token = "I owe you a token";
|
|
8
|
+
const jwtToken = "I owe you a JWT token";
|
|
9
|
+
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
axiosMock.reset();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("should create a fare-type modifier", () => {
|
|
15
|
+
axiosMock.onPost("/fare-type-modifiers").reply(expectRequest({
|
|
16
|
+
statusCode: 200, token, jwtToken
|
|
17
|
+
}));
|
|
18
|
+
return api.inventory.fareTypeModifiers.create({
|
|
19
|
+
jwtToken,
|
|
20
|
+
token,
|
|
21
|
+
fareTypeModifier: {
|
|
22
|
+
name: "My fare-type modifier"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("should get all fare-type modifiers", () => {
|
|
28
|
+
axiosMock.onGet("/fare-type-modifiers").reply(expectRequest({
|
|
29
|
+
statusCode: 200, token, jwtToken
|
|
30
|
+
}));
|
|
31
|
+
return api.inventory.fareTypeModifiers.all({
|
|
32
|
+
jwtToken,
|
|
33
|
+
token,
|
|
34
|
+
query: {}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("should update a fare-type modifier", () => {
|
|
39
|
+
const fareTypeModifierId = "1234";
|
|
40
|
+
axiosMock.onPut(`/fare-type-modifiers/${fareTypeModifierId}`).reply(expectRequest({
|
|
41
|
+
statusCode: 200, token, jwtToken
|
|
42
|
+
}));
|
|
43
|
+
return api.inventory.fareTypeModifiers.update({
|
|
44
|
+
jwtToken,
|
|
45
|
+
token,
|
|
46
|
+
fareTypeModifierId,
|
|
47
|
+
fareTypeModifier: {
|
|
48
|
+
name: "My Updated fare-type modifier it"
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("should get a fare-type modifier", () => {
|
|
54
|
+
const fareTypeModifierId = "1234";
|
|
55
|
+
axiosMock.onGet(`/fare-type-modifiers/${fareTypeModifierId}`).reply(expectRequest({
|
|
56
|
+
statusCode: 200, token, jwtToken
|
|
57
|
+
}));
|
|
58
|
+
return api.inventory.fareTypeModifiers.get({
|
|
59
|
+
jwtToken,
|
|
60
|
+
token,
|
|
61
|
+
fareTypeModifierId
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("should delete a fare-type modifier", () => {
|
|
66
|
+
const fareTypeModifierId = "12345";
|
|
67
|
+
axiosMock.onDelete(`/fare-type-modifiers/${fareTypeModifierId}`).reply(expectRequest({
|
|
68
|
+
statusCode: 200, token, jwtToken
|
|
69
|
+
}));
|
|
70
|
+
return api.inventory.fareTypeModifiers.remove({
|
|
71
|
+
jwtToken,
|
|
72
|
+
token,
|
|
73
|
+
fareTypeModifierId
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -60,6 +60,24 @@ describe("notifications/notify-child-user", () => {
|
|
|
60
60
|
axiosMock.reset();
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
+
it("should post send an email for new seller welcome", () => {
|
|
64
|
+
axiosMock.onPost("/notify-new-seller").reply(({headers}) => {
|
|
65
|
+
if (headers["x-api-key"] === token && headers.authorization === `Bearer ${jwtToken}`) {
|
|
66
|
+
return [200];
|
|
67
|
+
}
|
|
68
|
+
return [403];
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
return api.notifications.notify.newSeller.create({
|
|
72
|
+
token,
|
|
73
|
+
jwtToken,
|
|
74
|
+
sellerEmail: "admin@agency.com",
|
|
75
|
+
sellerDomain: "my-agency",
|
|
76
|
+
providerAdminEmail: "provider@test.com",
|
|
77
|
+
lang: "en-us"
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
63
81
|
it("should post send an email with child user created", () => {
|
|
64
82
|
axiosMock.onPost("/notify-child-user").reply(({headers}) => {
|
|
65
83
|
if (headers["x-api-key"] === token && headers.authorization === `Bearer ${jwtToken}`) {
|