btrz-api-client 5.140.0 → 5.142.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/operations/vehicle_assignments.js +64 -0
- package/lib/endpoints/sales/cart.js +18 -3
- package/package.json +1 -1
- package/src/client.js +1 -0
- package/src/endpoints/operations/vehicle_assignments.js +38 -0
- package/src/endpoints/sales/cart.js +24 -14
- package/test/endpoints/operations/vehicle-assignments.test.js +84 -0
- package/test/endpoints/sales/cart.test.js +39 -33
- package/types/client.d.ts +35 -0
- package/types/endpoints/operations/vehicle_assignments.d.ts +31 -0
- package/types/endpoints/sales/cart.d.ts +8 -0
- package/types/initializedClient.d.ts +35 -0
package/lib/client.js
CHANGED
|
@@ -275,6 +275,7 @@ function createOperations(_ref6) {
|
|
|
275
275
|
outlookTrips: require("./endpoints/operations/outlook-trips.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
276
276
|
manifestLegForTickets: require("./endpoints/operations/manifest_leg_for_tickets.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
277
277
|
passengerCheckInInfo: require("./endpoints/operations/passenger_check_in_info.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
278
|
+
vehicleAssignments: require("./endpoints/operations/vehicle_assignments.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
278
279
|
vouchers: require("./endpoints/operations/vouchers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
279
280
|
parcelManifests: require("./endpoints/operations/parcels_manifests.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
280
281
|
__test: {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("../endpoints_helpers.js"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
function vehicleAssignmentFactory(_ref) {
|
|
7
|
+
var client = _ref.client,
|
|
8
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
all: function all(_ref2) {
|
|
12
|
+
var token = _ref2.token,
|
|
13
|
+
jwtToken = _ref2.jwtToken,
|
|
14
|
+
_ref2$query = _ref2.query,
|
|
15
|
+
query = _ref2$query === undefined ? {} : _ref2$query,
|
|
16
|
+
headers = _ref2.headers;
|
|
17
|
+
|
|
18
|
+
return client({
|
|
19
|
+
url: "/vehicle-assignments",
|
|
20
|
+
params: query,
|
|
21
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
get: function get(_ref3) {
|
|
25
|
+
var token = _ref3.token,
|
|
26
|
+
jwtToken = _ref3.jwtToken,
|
|
27
|
+
vehicleAssignmentId = _ref3.vehicleAssignmentId,
|
|
28
|
+
headers = _ref3.headers;
|
|
29
|
+
|
|
30
|
+
return client.get("/vehicle-assignments/" + vehicleAssignmentId, {
|
|
31
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
create: function create(_ref4) {
|
|
35
|
+
var data = _ref4.data,
|
|
36
|
+
token = _ref4.token,
|
|
37
|
+
jwtToken = _ref4.jwtToken,
|
|
38
|
+
headers = _ref4.headers;
|
|
39
|
+
|
|
40
|
+
return client({
|
|
41
|
+
url: "/vehicle-assignments",
|
|
42
|
+
method: "post",
|
|
43
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
44
|
+
data: data
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
update: function update(_ref5) {
|
|
48
|
+
var vehicleAssignmentId = _ref5.vehicleAssignmentId,
|
|
49
|
+
data = _ref5.data,
|
|
50
|
+
token = _ref5.token,
|
|
51
|
+
jwtToken = _ref5.jwtToken,
|
|
52
|
+
headers = _ref5.headers;
|
|
53
|
+
|
|
54
|
+
return client({
|
|
55
|
+
url: "/vehicle-assignments/" + vehicleAssignmentId,
|
|
56
|
+
method: "put",
|
|
57
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
58
|
+
data: data
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = vehicleAssignmentFactory;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _require = require("./../endpoints_helpers"),
|
|
3
|
+
var _require = require("./../endpoints_helpers.js"),
|
|
4
4
|
authorizationHeaders = _require.authorizationHeaders;
|
|
5
5
|
|
|
6
6
|
function cartFactory(_ref) {
|
|
7
7
|
var client = _ref.client,
|
|
8
8
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
function get(_ref2) {
|
|
12
11
|
var token = _ref2.token,
|
|
13
12
|
id = _ref2.id,
|
|
@@ -115,6 +114,21 @@ function cartFactory(_ref) {
|
|
|
115
114
|
}
|
|
116
115
|
};
|
|
117
116
|
|
|
117
|
+
var payments = {
|
|
118
|
+
delete: function _delete(_ref9) {
|
|
119
|
+
var token = _ref9.token,
|
|
120
|
+
cartId = _ref9.cartId,
|
|
121
|
+
jwtToken = _ref9.jwtToken,
|
|
122
|
+
headers = _ref9.headers;
|
|
123
|
+
|
|
124
|
+
return client({
|
|
125
|
+
url: "/cart/" + cartId + "/payments",
|
|
126
|
+
method: "delete",
|
|
127
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
118
132
|
return {
|
|
119
133
|
get: get,
|
|
120
134
|
create: create,
|
|
@@ -122,7 +136,8 @@ function cartFactory(_ref) {
|
|
|
122
136
|
deleteItems: deleteItems,
|
|
123
137
|
loyaltyPointsAmount: loyaltyPointsAmount,
|
|
124
138
|
patch: patch,
|
|
125
|
-
partialDepositStatus: partialDepositStatus
|
|
139
|
+
partialDepositStatus: partialDepositStatus,
|
|
140
|
+
payments: payments
|
|
126
141
|
};
|
|
127
142
|
}
|
|
128
143
|
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -227,6 +227,7 @@ function createOperations({baseURL, headers, timeout, overrideFn, internalAuthTo
|
|
|
227
227
|
outlookTrips: require("./endpoints/operations/outlook-trips.js")({client, internalAuthTokenProvider}),
|
|
228
228
|
manifestLegForTickets: require("./endpoints/operations/manifest_leg_for_tickets.js")({client, internalAuthTokenProvider}),
|
|
229
229
|
passengerCheckInInfo: require("./endpoints/operations/passenger_check_in_info.js")({client, internalAuthTokenProvider}),
|
|
230
|
+
vehicleAssignments: require("./endpoints/operations/vehicle_assignments.js")({client, internalAuthTokenProvider}),
|
|
230
231
|
vouchers: require("./endpoints/operations/vouchers.js")({client, internalAuthTokenProvider}),
|
|
231
232
|
parcelManifests: require("./endpoints/operations/parcels_manifests.js")({client, internalAuthTokenProvider}),
|
|
232
233
|
__test: {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("../endpoints_helpers.js");
|
|
4
|
+
|
|
5
|
+
function vehicleAssignmentFactory({client, internalAuthTokenProvider}) {
|
|
6
|
+
return {
|
|
7
|
+
all({token, jwtToken, query = {}, headers}) {
|
|
8
|
+
return client({
|
|
9
|
+
url: "/vehicle-assignments",
|
|
10
|
+
params: query,
|
|
11
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
get({token, jwtToken, vehicleAssignmentId, headers}) {
|
|
15
|
+
return client.get(`/vehicle-assignments/${vehicleAssignmentId}`, {
|
|
16
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
create({data, token, jwtToken, headers}) {
|
|
20
|
+
return client({
|
|
21
|
+
url: "/vehicle-assignments",
|
|
22
|
+
method: "post",
|
|
23
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
24
|
+
data
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
update({vehicleAssignmentId, data, token, jwtToken, headers}) {
|
|
28
|
+
return client({
|
|
29
|
+
url: `/vehicle-assignments/${vehicleAssignmentId}`,
|
|
30
|
+
method: "put",
|
|
31
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
32
|
+
data
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = vehicleAssignmentFactory;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
2
2
|
|
|
3
|
-
function cartFactory({
|
|
4
|
-
|
|
5
|
-
function get({ token, id, providerId, headers }) {
|
|
3
|
+
function cartFactory({client, internalAuthTokenProvider}) {
|
|
4
|
+
function get({token, id, providerId, headers}) {
|
|
6
5
|
let url = `/cart/${id}`;
|
|
7
6
|
|
|
8
|
-
if(providerId) {
|
|
7
|
+
if (providerId) {
|
|
9
8
|
url = `${url}?providerId=${providerId}`;
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -15,8 +14,8 @@ function cartFactory({ client, internalAuthTokenProvider }) {
|
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
function create({
|
|
19
|
-
return client({
|
|
17
|
+
function create({token, cart, jwtToken, headers}) {
|
|
18
|
+
return client({
|
|
20
19
|
url: "/cart",
|
|
21
20
|
method: "post",
|
|
22
21
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
@@ -24,8 +23,8 @@ function cartFactory({ client, internalAuthTokenProvider }) {
|
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
function add({
|
|
28
|
-
return client({
|
|
26
|
+
function add({token, cartId, cart, jwtToken, headers}) {
|
|
27
|
+
return client({
|
|
29
28
|
url: `/cart/${cartId}/items`,
|
|
30
29
|
method: "post",
|
|
31
30
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
@@ -33,8 +32,8 @@ function cartFactory({ client, internalAuthTokenProvider }) {
|
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
function deleteItems({
|
|
37
|
-
return client({
|
|
35
|
+
function deleteItems({token, cartId, params, jwtToken, headers}) {
|
|
36
|
+
return client({
|
|
38
37
|
url: `/cart/${cartId}/items`,
|
|
39
38
|
method: "delete",
|
|
40
39
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
@@ -43,7 +42,7 @@ function cartFactory({ client, internalAuthTokenProvider }) {
|
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
const loyaltyPointsAmount = {
|
|
46
|
-
get({
|
|
45
|
+
get({token, jwtToken, cartId, query = {}, headers}) {
|
|
47
46
|
return client({
|
|
48
47
|
url: `/carts/${cartId}/loyalty-points-amount`,
|
|
49
48
|
params: query,
|
|
@@ -53,7 +52,7 @@ function cartFactory({ client, internalAuthTokenProvider }) {
|
|
|
53
52
|
};
|
|
54
53
|
|
|
55
54
|
|
|
56
|
-
function patch({
|
|
55
|
+
function patch({token, jwtToken, cartId, data, headers}) {
|
|
57
56
|
return client({
|
|
58
57
|
url: `/cart/${cartId}`,
|
|
59
58
|
method: "patch",
|
|
@@ -70,6 +69,16 @@ function cartFactory({ client, internalAuthTokenProvider }) {
|
|
|
70
69
|
}
|
|
71
70
|
};
|
|
72
71
|
|
|
72
|
+
const payments = {
|
|
73
|
+
delete({token, cartId, jwtToken, headers}) {
|
|
74
|
+
return client({
|
|
75
|
+
url: `/cart/${cartId}/payments`,
|
|
76
|
+
method: "delete",
|
|
77
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
73
82
|
return {
|
|
74
83
|
get,
|
|
75
84
|
create,
|
|
@@ -77,7 +86,8 @@ function cartFactory({ client, internalAuthTokenProvider }) {
|
|
|
77
86
|
deleteItems,
|
|
78
87
|
loyaltyPointsAmount,
|
|
79
88
|
patch,
|
|
80
|
-
partialDepositStatus
|
|
89
|
+
partialDepositStatus,
|
|
90
|
+
payments
|
|
81
91
|
};
|
|
82
92
|
}
|
|
83
93
|
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const {
|
|
2
|
+
expect
|
|
3
|
+
} = require("chai");
|
|
4
|
+
const {
|
|
5
|
+
axiosMock,
|
|
6
|
+
expectRequest
|
|
7
|
+
} = require("../../test-helpers.js");
|
|
8
|
+
const api = require("../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
9
|
+
|
|
10
|
+
describe("operations/vehicle-assignments", () => {
|
|
11
|
+
const token = "I owe you a token";
|
|
12
|
+
const jwtToken = "I owe you a JWT token";
|
|
13
|
+
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
axiosMock.reset();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should GET a list of vehicle assignments", () => {
|
|
19
|
+
axiosMock.onGet("/vehicle-assignments").reply(expectRequest({
|
|
20
|
+
statusCode: 200,
|
|
21
|
+
token
|
|
22
|
+
}));
|
|
23
|
+
return api.operations.vehicleAssignments.all({
|
|
24
|
+
token
|
|
25
|
+
}).then((httpResponse) => {
|
|
26
|
+
expect(httpResponse.status).eql(200);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("should GET a vehicle assignment", () => {
|
|
31
|
+
const vehicleAssignmentId = "assignment999";
|
|
32
|
+
|
|
33
|
+
axiosMock.onGet(`/vehicle-assignments/${vehicleAssignmentId}`).reply(expectRequest({
|
|
34
|
+
statusCode: 200,
|
|
35
|
+
token
|
|
36
|
+
}));
|
|
37
|
+
return api.operations.vehicleAssignments.get({
|
|
38
|
+
vehicleAssignmentId,
|
|
39
|
+
token
|
|
40
|
+
}).then((httpResponse) => {
|
|
41
|
+
expect(httpResponse.status).eql(200);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("should POST a new vehicle assignment", () => {
|
|
46
|
+
const data = {
|
|
47
|
+
name: "test assignment",
|
|
48
|
+
groups: []
|
|
49
|
+
};
|
|
50
|
+
axiosMock.onPost("/vehicle-assignments").reply(expectRequest({
|
|
51
|
+
statusCode: 200,
|
|
52
|
+
token,
|
|
53
|
+
jwtToken
|
|
54
|
+
}));
|
|
55
|
+
return api.operations.vehicleAssignments.create({
|
|
56
|
+
token,
|
|
57
|
+
jwtToken,
|
|
58
|
+
data
|
|
59
|
+
}).then((httpResponse) => {
|
|
60
|
+
expect(httpResponse.status).eql(200);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("should PUT and update the vehicle assignment", () => {
|
|
65
|
+
const vehicleAssignmentId = "assignment999";
|
|
66
|
+
const data = {
|
|
67
|
+
groups: [{"test": 1}],
|
|
68
|
+
status: "published"
|
|
69
|
+
};
|
|
70
|
+
axiosMock.onPut(`/vehicle-assignments/${vehicleAssignmentId}`).reply(expectRequest({
|
|
71
|
+
statusCode: 200,
|
|
72
|
+
token,
|
|
73
|
+
jwtToken
|
|
74
|
+
}));
|
|
75
|
+
return api.operations.vehicleAssignments.update({
|
|
76
|
+
vehicleAssignmentId,
|
|
77
|
+
token,
|
|
78
|
+
jwtToken,
|
|
79
|
+
data
|
|
80
|
+
}).then((httpResponse) => {
|
|
81
|
+
expect(httpResponse.status).eql(200);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -1,66 +1,72 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const api = require("./../../../src/client").createApiClient({
|
|
1
|
+
const {axiosMock, expectRequest} = require("./../../test-helpers.js");
|
|
2
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: ""});
|
|
3
3
|
const expect = require("chai").expect;
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
const token =
|
|
7
|
-
const jwtToken =
|
|
8
|
-
|
|
9
|
-
afterEach(
|
|
5
|
+
describe("sales/cart", () => {
|
|
6
|
+
const token = "I owe you a token";
|
|
7
|
+
const jwtToken = "I owe you a JWT token";
|
|
8
|
+
|
|
9
|
+
afterEach(() => {
|
|
10
10
|
axiosMock.reset();
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
it("should get a cart by id",
|
|
13
|
+
it("should get a cart by id", () => {
|
|
14
14
|
const cartId = "cartId1";
|
|
15
|
-
axiosMock.onGet(`/cart/${cartId}`).reply(expectRequest({
|
|
16
|
-
return api.sales.cart.get({
|
|
15
|
+
axiosMock.onGet(`/cart/${cartId}`).reply(expectRequest({statusCode: 200, token}));
|
|
16
|
+
return api.sales.cart.get({token, id: cartId});
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
it("should create a cart",
|
|
20
|
-
axiosMock.onPost(
|
|
21
|
-
return api.sales.cart.create({
|
|
19
|
+
it("should create a cart", () => {
|
|
20
|
+
axiosMock.onPost("/cart").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
21
|
+
return api.sales.cart.create({jwtToken, token, cart: {operationId: 1234}});
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
it("should add to existing cart",
|
|
24
|
+
it("should add to existing cart", () => {
|
|
25
25
|
const cartId = "someCartId";
|
|
26
|
-
axiosMock.onPost(`/cart/${cartId}/items`).reply(expectRequest({
|
|
27
|
-
return api.sales.cart.add({
|
|
26
|
+
axiosMock.onPost(`/cart/${cartId}/items`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
27
|
+
return api.sales.cart.add({jwtToken, token, cartId, cart: {operationId: 1234}});
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
it("should delete item from existing cart",
|
|
30
|
+
it("should delete item from existing cart", () => {
|
|
31
31
|
const cartId = "someCartId";
|
|
32
|
-
axiosMock.onDelete(`/cart/${cartId}/items`).reply(
|
|
32
|
+
axiosMock.onDelete(`/cart/${cartId}/items`).reply((request) => {
|
|
33
33
|
expect(request.params).to.eql({operationId: 1234, providerId: 123});
|
|
34
|
-
expect(request.headers).to.eql({
|
|
35
|
-
Accept:
|
|
36
|
-
|
|
37
|
-
authorization:
|
|
34
|
+
expect(request.headers).to.eql({
|
|
35
|
+
"Accept": "application/json",
|
|
36
|
+
"x-api-key": "I owe you a token",
|
|
37
|
+
"authorization": "Bearer I owe you a JWT token"
|
|
38
38
|
});
|
|
39
39
|
expect(request.method).to.eql("delete");
|
|
40
40
|
expect(request.url).to.eql(`/cart/${cartId}/items`);
|
|
41
41
|
return [200];
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
return api.sales.cart.deleteItems({
|
|
44
|
+
return api.sales.cart.deleteItems({jwtToken, token, cartId, params: {operationId: 1234, providerId: 123}});
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
it("should get loyalty points amount of a cart",
|
|
47
|
+
it("should get loyalty points amount of a cart", () => {
|
|
48
48
|
const cartId = "cartId1";
|
|
49
|
-
axiosMock.onGet(`/carts/${cartId}/loyalty-points-amount`).reply(expectRequest({
|
|
50
|
-
return api.sales.cart.loyaltyPointsAmount.get({
|
|
49
|
+
axiosMock.onGet(`/carts/${cartId}/loyalty-points-amount`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
50
|
+
return api.sales.cart.loyaltyPointsAmount.get({token, jwtToken, cartId});
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
it("should update a cart",
|
|
54
|
-
const cartId = "someCartId"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
axiosMock.onPatch(`/cart/${cartId}`).reply(expectRequest({
|
|
58
|
-
return api.sales.cart.patch({
|
|
53
|
+
it("should update a cart", () => {
|
|
54
|
+
const cartId = "someCartId";
|
|
55
|
+
const providerId = "someProviderId";
|
|
56
|
+
const op = "overrideFees";
|
|
57
|
+
axiosMock.onPatch(`/cart/${cartId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
58
|
+
return api.sales.cart.patch({jwtToken, token, cartId, data: {providerId, operations: [{op}]}});
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
it("should get the shift partial deposit status",
|
|
61
|
+
it("should get the shift partial deposit status", () => {
|
|
62
62
|
const shiftId = "shiftId1";
|
|
63
63
|
axiosMock.onGet(`/cart/${shiftId}/partial-deposit-status`).reply(expectRequest({statusCode: 200, token}));
|
|
64
64
|
return api.sales.cart.partialDepositStatus.get({token, jwtToken, shiftId});
|
|
65
65
|
});
|
|
66
|
+
|
|
67
|
+
it("should delete payments from a cart", () => {
|
|
68
|
+
const cartId = "someCartId";
|
|
69
|
+
axiosMock.onDelete(`/cart/${cartId}/payments`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
70
|
+
return api.sales.cart.payments.delete({jwtToken, token, cartId});
|
|
71
|
+
});
|
|
66
72
|
});
|
package/types/client.d.ts
CHANGED
|
@@ -2371,6 +2371,14 @@ export function createApiClient(options: {
|
|
|
2371
2371
|
headers: any;
|
|
2372
2372
|
}): any;
|
|
2373
2373
|
};
|
|
2374
|
+
payments: {
|
|
2375
|
+
delete({ token, cartId, jwtToken, headers }: {
|
|
2376
|
+
token: any;
|
|
2377
|
+
cartId: any;
|
|
2378
|
+
jwtToken: any;
|
|
2379
|
+
headers: any;
|
|
2380
|
+
}): any;
|
|
2381
|
+
};
|
|
2374
2382
|
};
|
|
2375
2383
|
giftCertificates: {
|
|
2376
2384
|
get: ({ token, GCNumber, query, headers }: {
|
|
@@ -3019,6 +3027,33 @@ export function createApiClient(options: {
|
|
|
3019
3027
|
headers: any;
|
|
3020
3028
|
}) => any;
|
|
3021
3029
|
};
|
|
3030
|
+
vehicleAssignments: {
|
|
3031
|
+
all({ token, jwtToken, query, headers }: {
|
|
3032
|
+
token: any;
|
|
3033
|
+
jwtToken: any;
|
|
3034
|
+
query?: {};
|
|
3035
|
+
headers: any;
|
|
3036
|
+
}): any;
|
|
3037
|
+
get({ token, jwtToken, vehicleAssignmentId, headers }: {
|
|
3038
|
+
token: any;
|
|
3039
|
+
jwtToken: any;
|
|
3040
|
+
vehicleAssignmentId: any;
|
|
3041
|
+
headers: any;
|
|
3042
|
+
}): any;
|
|
3043
|
+
create({ data, token, jwtToken, headers }: {
|
|
3044
|
+
data: any;
|
|
3045
|
+
token: any;
|
|
3046
|
+
jwtToken: any;
|
|
3047
|
+
headers: any;
|
|
3048
|
+
}): any;
|
|
3049
|
+
update({ vehicleAssignmentId, data, token, jwtToken, headers }: {
|
|
3050
|
+
vehicleAssignmentId: any;
|
|
3051
|
+
data: any;
|
|
3052
|
+
token: any;
|
|
3053
|
+
jwtToken: any;
|
|
3054
|
+
headers: any;
|
|
3055
|
+
}): any;
|
|
3056
|
+
};
|
|
3022
3057
|
vouchers: {
|
|
3023
3058
|
create: ({ jwtToken, token, headers, query, voucher }: {
|
|
3024
3059
|
jwtToken: any;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export = vehicleAssignmentFactory;
|
|
2
|
+
declare function vehicleAssignmentFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
all({ token, jwtToken, query, headers }: {
|
|
7
|
+
token: any;
|
|
8
|
+
jwtToken: any;
|
|
9
|
+
query?: {};
|
|
10
|
+
headers: any;
|
|
11
|
+
}): any;
|
|
12
|
+
get({ token, jwtToken, vehicleAssignmentId, headers }: {
|
|
13
|
+
token: any;
|
|
14
|
+
jwtToken: any;
|
|
15
|
+
vehicleAssignmentId: any;
|
|
16
|
+
headers: any;
|
|
17
|
+
}): any;
|
|
18
|
+
create({ data, token, jwtToken, headers }: {
|
|
19
|
+
data: any;
|
|
20
|
+
token: any;
|
|
21
|
+
jwtToken: any;
|
|
22
|
+
headers: any;
|
|
23
|
+
}): any;
|
|
24
|
+
update({ vehicleAssignmentId, data, token, jwtToken, headers }: {
|
|
25
|
+
vehicleAssignmentId: any;
|
|
26
|
+
data: any;
|
|
27
|
+
token: any;
|
|
28
|
+
jwtToken: any;
|
|
29
|
+
headers: any;
|
|
30
|
+
}): any;
|
|
31
|
+
};
|
|
@@ -53,4 +53,12 @@ declare function cartFactory({ client, internalAuthTokenProvider }: {
|
|
|
53
53
|
headers: any;
|
|
54
54
|
}): any;
|
|
55
55
|
};
|
|
56
|
+
payments: {
|
|
57
|
+
delete({ token, cartId, jwtToken, headers }: {
|
|
58
|
+
token: any;
|
|
59
|
+
cartId: any;
|
|
60
|
+
jwtToken: any;
|
|
61
|
+
headers: any;
|
|
62
|
+
}): any;
|
|
63
|
+
};
|
|
56
64
|
};
|
|
@@ -2325,6 +2325,14 @@ declare const _exports: {
|
|
|
2325
2325
|
headers: any;
|
|
2326
2326
|
}): any;
|
|
2327
2327
|
};
|
|
2328
|
+
payments: {
|
|
2329
|
+
delete({ token, cartId, jwtToken, headers }: {
|
|
2330
|
+
token: any;
|
|
2331
|
+
cartId: any;
|
|
2332
|
+
jwtToken: any;
|
|
2333
|
+
headers: any;
|
|
2334
|
+
}): any;
|
|
2335
|
+
};
|
|
2328
2336
|
};
|
|
2329
2337
|
giftCertificates: {
|
|
2330
2338
|
get: ({ token, GCNumber, query, headers }: {
|
|
@@ -2973,6 +2981,33 @@ declare const _exports: {
|
|
|
2973
2981
|
headers: any;
|
|
2974
2982
|
}) => any;
|
|
2975
2983
|
};
|
|
2984
|
+
vehicleAssignments: {
|
|
2985
|
+
all({ token, jwtToken, query, headers }: {
|
|
2986
|
+
token: any;
|
|
2987
|
+
jwtToken: any;
|
|
2988
|
+
query?: {};
|
|
2989
|
+
headers: any;
|
|
2990
|
+
}): any;
|
|
2991
|
+
get({ token, jwtToken, vehicleAssignmentId, headers }: {
|
|
2992
|
+
token: any;
|
|
2993
|
+
jwtToken: any;
|
|
2994
|
+
vehicleAssignmentId: any;
|
|
2995
|
+
headers: any;
|
|
2996
|
+
}): any;
|
|
2997
|
+
create({ data, token, jwtToken, headers }: {
|
|
2998
|
+
data: any;
|
|
2999
|
+
token: any;
|
|
3000
|
+
jwtToken: any;
|
|
3001
|
+
headers: any;
|
|
3002
|
+
}): any;
|
|
3003
|
+
update({ vehicleAssignmentId, data, token, jwtToken, headers }: {
|
|
3004
|
+
vehicleAssignmentId: any;
|
|
3005
|
+
data: any;
|
|
3006
|
+
token: any;
|
|
3007
|
+
jwtToken: any;
|
|
3008
|
+
headers: any;
|
|
3009
|
+
}): any;
|
|
3010
|
+
};
|
|
2976
3011
|
vouchers: {
|
|
2977
3012
|
create: ({ jwtToken, token, headers, query, voucher }: {
|
|
2978
3013
|
jwtToken: any;
|