btrz-api-client 9.6.0 → 9.8.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.
@@ -2,6 +2,78 @@ const {
2
2
  authorizationHeaders
3
3
  } = require("./../endpoints_helpers.js");
4
4
 
5
+ /**
6
+ * @typedef {Object} AmenityGroupTransition
7
+ * @property {string} from - Original ticket amenity group id.
8
+ * @property {string} to - Destination amenity group id.
9
+ */
10
+
11
+ /**
12
+ * @typedef {Object} AmenityGroupTransitionsSettings
13
+ * @property {boolean} allowAny - When true, any transition is allowed.
14
+ * @property {AmenityGroupTransition[] | null} allowedTransitions - Allowed transition pairs when allowAny is false.
15
+ */
16
+
17
+ /**
18
+ * @typedef {Object} OriginalTripRestrictions
19
+ * @property {number} cutoffMinutes - Minutes before/after the selected reference point.
20
+ * @property {"original_passenger_departure_time" | "original_schedule_departure_time"} referencePoint - Restriction reference point.
21
+ */
22
+
23
+ /**
24
+ * @typedef {Object} NewTripRestrictions
25
+ * @property {number} lowerBoundCutoffMinutes - Lower bound for move eligibility in minutes.
26
+ * @property {"original_passenger_departure_time"} lowerBoundReferencePoint - Lower bound reference point.
27
+ * @property {number} upperBoundCutoffMinutes - Upper bound for move eligibility in minutes.
28
+ * @property {"original_passenger_departure_time"} upperBoundReferencePoint - Upper bound reference point.
29
+ */
30
+
31
+ /**
32
+ * @typedef {Object} TimeRestrictionsSettings
33
+ * @property {OriginalTripRestrictions} originalTripRestrictions - Restrictions applied to the original trip.
34
+ * @property {NewTripRestrictions} newTripRestrictions - Restrictions applied to the destination trip.
35
+ */
36
+
37
+ /**
38
+ * Ticket movement settings payload used by the accounts API.
39
+ * @typedef {Object} TicketMovementSettings
40
+ * @property {boolean} preventMovementsAfterManifestHasBeenPrinted - Prevent moves after printing manifests.
41
+ * @property {boolean} preventSeatmapOptimizationMovementsWithDifferentSeatClassOrFees - Block optimization moves changing class/fees.
42
+ * @property {boolean} preventMovementsWhenOriginalManifestIsBoarding - Prevent moves when original manifest is boarding.
43
+ * @property {null | "passengers_board_at_any_station" | "passengers_board_at_ticket_departure_station"} originalManifestIsBoardingWhen - Rule to determine original manifest boarding state.
44
+ * @property {boolean} preventMovementsWhenDestinationManifestIsBoarding - Prevent moves when destination manifest is boarding.
45
+ * @property {null | "passengers_board_at_any_station" | "passengers_board_at_ticket_departure_station"} destinationManifestIsBoardingWhen - Rule to determine destination manifest boarding state.
46
+ * @property {boolean} preventMovedTicketsFromBeingChanged - Block changing tickets after movement.
47
+ * @property {boolean} preventMovedTicketsFromBeingCancelled - Block cancelling tickets after movement.
48
+ * @property {boolean} preventMovementsWhenFareSpecificCapacityLimitsAreExceeded - Prevent moves when fare capacity is exceeded.
49
+ * @property {boolean} sendSMSNotifications - Enable SMS notifications for ticket movements.
50
+ * @property {boolean} [allowSendingEmailNotification] - Enable email notifications for ticket movements.
51
+ * @property {boolean} [useConfirmationRecipientForNotifications] - Send notifications to the confirmation recipient.
52
+ * @property {number} maxMovementsPerTicket - Maximum ticket movements without authorization.
53
+ * @property {number} [maxMovementsPerTicketWithAuthorization] - Maximum ticket movements with authorization.
54
+ * @property {AmenityGroupTransitionsSettings} amenityGroupTransitions - Allowed amenity group transitions.
55
+ * @property {TimeRestrictionsSettings} timeRestrictions - Time restriction rules.
56
+ * @property {string[]} [allowMovementToManifestsWithStatus] - Allowed destination manifest statuses.
57
+ * @property {string} [singleTicketMoveUIVersion] - Single ticket move UI version preference.
58
+ * @property {boolean} [displayExpiredSchedulesInUIToMove] - Show expired schedules in move UI when true.
59
+ * @property {boolean} [followingSeatBehaviorEnabled] - Enables following-seat behavior for automatic seat movement resolution.
60
+ */
61
+
62
+ /**
63
+ * @typedef {Object} GetTicketMovementSettingsOptions
64
+ * @property {string} [token] - API key.
65
+ * @property {string} [jwtToken] - JWT or internal auth symbol.
66
+ * @property {Object} [headers] - Optional headers.
67
+ */
68
+
69
+ /**
70
+ * @typedef {Object} UpdateTicketMovementSettingsOptions
71
+ * @property {string} [token] - API key.
72
+ * @property {string} [jwtToken] - JWT or internal auth symbol.
73
+ * @property {TicketMovementSettings} ticketMovementSettings - Full settings payload to persist.
74
+ * @property {Object} [headers] - Optional headers.
75
+ */
76
+
5
77
  /**
6
78
  * Factory for ticket-movement-settings API (btrz-api-accounts).
7
79
  * @param {Object} deps
@@ -16,11 +88,8 @@ function ticketMovementSettingsFactory({
16
88
  /**
17
89
  * GET /ticket-movement-settings - get ticket movement settings for the account.
18
90
  * No query or path parameters. See get-handler getSpec() in btrz-api-accounts for response schema.
19
- * @param {Object} opts
20
- * @param {string} [opts.token] - API key
21
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
22
- * @param {Object} [opts.headers] - Optional headers
23
- * @returns {Promise<import("axios").AxiosResponse<Object>>} Response body: ticket movement settings object. Errors: 401, 500
91
+ * @param {GetTicketMovementSettingsOptions} opts
92
+ * @returns {Promise<import("axios").AxiosResponse<TicketMovementSettings>>} Response body: ticket movement settings object. Errors: 401, 500
24
93
  */
25
94
  function get({
26
95
  token,
@@ -42,12 +111,8 @@ function ticketMovementSettingsFactory({
42
111
  * PUT /ticket-movement-settings - update ticket movement settings for the account.
43
112
  * Body must include all required fields (see put-handler getSpec() in btrz-api-accounts).
44
113
  * Side effect: persists to account.preferences.ticketMovements.
45
- * @param {Object} opts
46
- * @param {string} [opts.token] - API key
47
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
48
- * @param {Object} opts.ticketMovementSettings - Full settings payload (see put-handler getSpec())
49
- * @param {Object} [opts.headers] - Optional headers
50
- * @returns {Promise<import("axios").AxiosResponse<Object>>} Updated settings. Errors: 400, 401, 500
114
+ * @param {UpdateTicketMovementSettingsOptions} opts
115
+ * @returns {Promise<import("axios").AxiosResponse<TicketMovementSettings>>} Updated settings. Errors: 400, 401, 500
51
116
  */
52
117
  function update({
53
118
  token,
@@ -1028,6 +1028,108 @@ function manifestFactory({
1028
1028
  });
1029
1029
  }
1030
1030
  };
1031
+
1032
+ /**
1033
+ * POST manifests/:manifestId/boarding/:stationId - board passengers at station.
1034
+ * @param {Object} opts
1035
+ * @param {string} [opts.token] - API key
1036
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
1037
+ * @param {Object} [opts.headers] - Optional headers
1038
+ * @param {string} opts.manifestId - Manifest id
1039
+ * @param {string} opts.stationId - Station id
1040
+ * @param {Object} opts.data - Request body
1041
+ * @returns {Promise<import("axios").AxiosResponse>}
1042
+ */
1043
+ function stationBoarding({
1044
+ token,
1045
+ jwtToken,
1046
+ headers,
1047
+ manifestId,
1048
+ stationId,
1049
+ data,
1050
+ query
1051
+ }) {
1052
+ return client({
1053
+ url: `/manifests/${manifestId}/boarding/${stationId}`,
1054
+ method: "post",
1055
+ headers: authorizationHeaders({
1056
+ token,
1057
+ jwtToken,
1058
+ internalAuthTokenProvider,
1059
+ headers
1060
+ }),
1061
+ data,
1062
+ params: query
1063
+ });
1064
+ }
1065
+
1066
+ /**
1067
+ * POST manifests/:manifestId/dispatch/:stationId - dispatch manifest at station.
1068
+ * @param {Object} opts
1069
+ * @param {string} [opts.token] - API key
1070
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
1071
+ * @param {Object} [opts.headers] - Optional headers
1072
+ * @param {string} opts.manifestId - Manifest id
1073
+ * @param {string} opts.stationId - Station id
1074
+ * @param {Object} opts.data - Request body
1075
+ * @returns {Promise<import("axios").AxiosResponse>}
1076
+ */
1077
+ function stationDispatch({
1078
+ token,
1079
+ jwtToken,
1080
+ headers,
1081
+ manifestId,
1082
+ stationId,
1083
+ data,
1084
+ query
1085
+ }) {
1086
+ return client({
1087
+ url: `/manifests/${manifestId}/dispatch/${stationId}`,
1088
+ method: "post",
1089
+ headers: authorizationHeaders({
1090
+ token,
1091
+ jwtToken,
1092
+ internalAuthTokenProvider,
1093
+ headers
1094
+ }),
1095
+ data,
1096
+ params: query
1097
+ });
1098
+ }
1099
+
1100
+ /**
1101
+ * POST manifests/:manifestId/sales-closure/:stationId - close sales at station.
1102
+ * @param {Object} opts
1103
+ * @param {string} [opts.token] - API key
1104
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
1105
+ * @param {Object} [opts.headers] - Optional headers
1106
+ * @param {string} opts.manifestId - Manifest id
1107
+ * @param {string} opts.stationId - Station id
1108
+ * @param {Object} opts.data - Request body
1109
+ * @returns {Promise<import("axios").AxiosResponse>}
1110
+ */
1111
+ function stationSalesClosure({
1112
+ token,
1113
+ jwtToken,
1114
+ headers,
1115
+ manifestId,
1116
+ stationId,
1117
+ data,
1118
+ query
1119
+ }) {
1120
+ return client({
1121
+ url: `/manifests/${manifestId}/sales-closure/${stationId}`,
1122
+ method: "post",
1123
+ headers: authorizationHeaders({
1124
+ token,
1125
+ jwtToken,
1126
+ internalAuthTokenProvider,
1127
+ headers
1128
+ }),
1129
+ data,
1130
+ params: query
1131
+ });
1132
+ }
1031
1133
  return {
1032
1134
  get,
1033
1135
  getAll,
@@ -1052,7 +1154,10 @@ function manifestFactory({
1052
1154
  reports,
1053
1155
  labels,
1054
1156
  driverRelays,
1055
- tripClose
1157
+ tripClose,
1158
+ stationBoarding,
1159
+ stationDispatch,
1160
+ stationSalesClosure
1056
1161
  };
1057
1162
  }
1058
1163
  module.exports = manifestFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "9.6.0",
3
+ "version": "9.8.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -2,6 +2,78 @@ const {
2
2
  authorizationHeaders
3
3
  } = require("./../endpoints_helpers.js");
4
4
 
5
+ /**
6
+ * @typedef {Object} AmenityGroupTransition
7
+ * @property {string} from - Original ticket amenity group id.
8
+ * @property {string} to - Destination amenity group id.
9
+ */
10
+
11
+ /**
12
+ * @typedef {Object} AmenityGroupTransitionsSettings
13
+ * @property {boolean} allowAny - When true, any transition is allowed.
14
+ * @property {AmenityGroupTransition[] | null} allowedTransitions - Allowed transition pairs when allowAny is false.
15
+ */
16
+
17
+ /**
18
+ * @typedef {Object} OriginalTripRestrictions
19
+ * @property {number} cutoffMinutes - Minutes before/after the selected reference point.
20
+ * @property {"original_passenger_departure_time" | "original_schedule_departure_time"} referencePoint - Restriction reference point.
21
+ */
22
+
23
+ /**
24
+ * @typedef {Object} NewTripRestrictions
25
+ * @property {number} lowerBoundCutoffMinutes - Lower bound for move eligibility in minutes.
26
+ * @property {"original_passenger_departure_time"} lowerBoundReferencePoint - Lower bound reference point.
27
+ * @property {number} upperBoundCutoffMinutes - Upper bound for move eligibility in minutes.
28
+ * @property {"original_passenger_departure_time"} upperBoundReferencePoint - Upper bound reference point.
29
+ */
30
+
31
+ /**
32
+ * @typedef {Object} TimeRestrictionsSettings
33
+ * @property {OriginalTripRestrictions} originalTripRestrictions - Restrictions applied to the original trip.
34
+ * @property {NewTripRestrictions} newTripRestrictions - Restrictions applied to the destination trip.
35
+ */
36
+
37
+ /**
38
+ * Ticket movement settings payload used by the accounts API.
39
+ * @typedef {Object} TicketMovementSettings
40
+ * @property {boolean} preventMovementsAfterManifestHasBeenPrinted - Prevent moves after printing manifests.
41
+ * @property {boolean} preventSeatmapOptimizationMovementsWithDifferentSeatClassOrFees - Block optimization moves changing class/fees.
42
+ * @property {boolean} preventMovementsWhenOriginalManifestIsBoarding - Prevent moves when original manifest is boarding.
43
+ * @property {null | "passengers_board_at_any_station" | "passengers_board_at_ticket_departure_station"} originalManifestIsBoardingWhen - Rule to determine original manifest boarding state.
44
+ * @property {boolean} preventMovementsWhenDestinationManifestIsBoarding - Prevent moves when destination manifest is boarding.
45
+ * @property {null | "passengers_board_at_any_station" | "passengers_board_at_ticket_departure_station"} destinationManifestIsBoardingWhen - Rule to determine destination manifest boarding state.
46
+ * @property {boolean} preventMovedTicketsFromBeingChanged - Block changing tickets after movement.
47
+ * @property {boolean} preventMovedTicketsFromBeingCancelled - Block cancelling tickets after movement.
48
+ * @property {boolean} preventMovementsWhenFareSpecificCapacityLimitsAreExceeded - Prevent moves when fare capacity is exceeded.
49
+ * @property {boolean} sendSMSNotifications - Enable SMS notifications for ticket movements.
50
+ * @property {boolean} [allowSendingEmailNotification] - Enable email notifications for ticket movements.
51
+ * @property {boolean} [useConfirmationRecipientForNotifications] - Send notifications to the confirmation recipient.
52
+ * @property {number} maxMovementsPerTicket - Maximum ticket movements without authorization.
53
+ * @property {number} [maxMovementsPerTicketWithAuthorization] - Maximum ticket movements with authorization.
54
+ * @property {AmenityGroupTransitionsSettings} amenityGroupTransitions - Allowed amenity group transitions.
55
+ * @property {TimeRestrictionsSettings} timeRestrictions - Time restriction rules.
56
+ * @property {string[]} [allowMovementToManifestsWithStatus] - Allowed destination manifest statuses.
57
+ * @property {string} [singleTicketMoveUIVersion] - Single ticket move UI version preference.
58
+ * @property {boolean} [displayExpiredSchedulesInUIToMove] - Show expired schedules in move UI when true.
59
+ * @property {boolean} [followingSeatBehaviorEnabled] - Enables following-seat behavior for automatic seat movement resolution.
60
+ */
61
+
62
+ /**
63
+ * @typedef {Object} GetTicketMovementSettingsOptions
64
+ * @property {string} [token] - API key.
65
+ * @property {string} [jwtToken] - JWT or internal auth symbol.
66
+ * @property {Object} [headers] - Optional headers.
67
+ */
68
+
69
+ /**
70
+ * @typedef {Object} UpdateTicketMovementSettingsOptions
71
+ * @property {string} [token] - API key.
72
+ * @property {string} [jwtToken] - JWT or internal auth symbol.
73
+ * @property {TicketMovementSettings} ticketMovementSettings - Full settings payload to persist.
74
+ * @property {Object} [headers] - Optional headers.
75
+ */
76
+
5
77
  /**
6
78
  * Factory for ticket-movement-settings API (btrz-api-accounts).
7
79
  * @param {Object} deps
@@ -13,11 +85,8 @@ function ticketMovementSettingsFactory({client, internalAuthTokenProvider}) {
13
85
  /**
14
86
  * GET /ticket-movement-settings - get ticket movement settings for the account.
15
87
  * No query or path parameters. See get-handler getSpec() in btrz-api-accounts for response schema.
16
- * @param {Object} opts
17
- * @param {string} [opts.token] - API key
18
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
19
- * @param {Object} [opts.headers] - Optional headers
20
- * @returns {Promise<import("axios").AxiosResponse<Object>>} Response body: ticket movement settings object. Errors: 401, 500
88
+ * @param {GetTicketMovementSettingsOptions} opts
89
+ * @returns {Promise<import("axios").AxiosResponse<TicketMovementSettings>>} Response body: ticket movement settings object. Errors: 401, 500
21
90
  */
22
91
  function get({token, jwtToken, headers}) {
23
92
  return client({
@@ -30,12 +99,8 @@ function ticketMovementSettingsFactory({client, internalAuthTokenProvider}) {
30
99
  * PUT /ticket-movement-settings - update ticket movement settings for the account.
31
100
  * Body must include all required fields (see put-handler getSpec() in btrz-api-accounts).
32
101
  * Side effect: persists to account.preferences.ticketMovements.
33
- * @param {Object} opts
34
- * @param {string} [opts.token] - API key
35
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
36
- * @param {Object} opts.ticketMovementSettings - Full settings payload (see put-handler getSpec())
37
- * @param {Object} [opts.headers] - Optional headers
38
- * @returns {Promise<import("axios").AxiosResponse<Object>>} Updated settings. Errors: 400, 401, 500
102
+ * @param {UpdateTicketMovementSettingsOptions} opts
103
+ * @returns {Promise<import("axios").AxiosResponse<TicketMovementSettings>>} Updated settings. Errors: 400, 401, 500
39
104
  */
40
105
  function update({token, jwtToken, ticketMovementSettings, headers}) {
41
106
  return client({
@@ -730,6 +730,69 @@ function manifestFactory({
730
730
  }
731
731
  };
732
732
 
733
+ /**
734
+ * POST manifests/:manifestId/boarding/:stationId - board passengers at station.
735
+ * @param {Object} opts
736
+ * @param {string} [opts.token] - API key
737
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
738
+ * @param {Object} [opts.headers] - Optional headers
739
+ * @param {string} opts.manifestId - Manifest id
740
+ * @param {string} opts.stationId - Station id
741
+ * @param {Object} opts.data - Request body
742
+ * @returns {Promise<import("axios").AxiosResponse>}
743
+ */
744
+ function stationBoarding({token, jwtToken, headers, manifestId, stationId, data, query}) {
745
+ return client({
746
+ url: `/manifests/${manifestId}/boarding/${stationId}`,
747
+ method: "post",
748
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
749
+ data,
750
+ params: query
751
+ });
752
+ }
753
+
754
+ /**
755
+ * POST manifests/:manifestId/dispatch/:stationId - dispatch manifest at station.
756
+ * @param {Object} opts
757
+ * @param {string} [opts.token] - API key
758
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
759
+ * @param {Object} [opts.headers] - Optional headers
760
+ * @param {string} opts.manifestId - Manifest id
761
+ * @param {string} opts.stationId - Station id
762
+ * @param {Object} opts.data - Request body
763
+ * @returns {Promise<import("axios").AxiosResponse>}
764
+ */
765
+ function stationDispatch({token, jwtToken, headers, manifestId, stationId, data, query}) {
766
+ return client({
767
+ url: `/manifests/${manifestId}/dispatch/${stationId}`,
768
+ method: "post",
769
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
770
+ data,
771
+ params: query
772
+ });
773
+ }
774
+
775
+ /**
776
+ * POST manifests/:manifestId/sales-closure/:stationId - close sales at station.
777
+ * @param {Object} opts
778
+ * @param {string} [opts.token] - API key
779
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
780
+ * @param {Object} [opts.headers] - Optional headers
781
+ * @param {string} opts.manifestId - Manifest id
782
+ * @param {string} opts.stationId - Station id
783
+ * @param {Object} opts.data - Request body
784
+ * @returns {Promise<import("axios").AxiosResponse>}
785
+ */
786
+ function stationSalesClosure({token, jwtToken, headers, manifestId, stationId, data, query}) {
787
+ return client({
788
+ url: `/manifests/${manifestId}/sales-closure/${stationId}`,
789
+ method: "post",
790
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
791
+ data,
792
+ params: query
793
+ });
794
+ }
795
+
733
796
  return {
734
797
  get,
735
798
  getAll,
@@ -754,7 +817,10 @@ function manifestFactory({
754
817
  reports,
755
818
  labels,
756
819
  driverRelays,
757
- tripClose
820
+ tripClose,
821
+ stationBoarding,
822
+ stationDispatch,
823
+ stationSalesClosure
758
824
  };
759
825
  }
760
826
 
@@ -17,7 +17,37 @@ describe("accounts/ticket-movement-settings", () => {
17
17
 
18
18
  it("should update ticket movement settings", () => {
19
19
  const ticketMovementSettings = {
20
- enabled: true
20
+ preventMovementsAfterManifestHasBeenPrinted: true,
21
+ preventSeatmapOptimizationMovementsWithDifferentSeatClassOrFees: false,
22
+ preventMovementsWhenOriginalManifestIsBoarding: false,
23
+ originalManifestIsBoardingWhen: null,
24
+ preventMovementsWhenDestinationManifestIsBoarding: false,
25
+ destinationManifestIsBoardingWhen: null,
26
+ preventMovedTicketsFromBeingChanged: true,
27
+ preventMovedTicketsFromBeingCancelled: false,
28
+ preventMovementsWhenFareSpecificCapacityLimitsAreExceeded: true,
29
+ sendSMSNotifications: true,
30
+ allowSendingEmailNotification: true,
31
+ useConfirmationRecipientForNotifications: false,
32
+ maxMovementsPerTicket: 1,
33
+ maxMovementsPerTicketWithAuthorization: 2,
34
+ amenityGroupTransitions: {
35
+ allowAny: true,
36
+ allowedTransitions: null
37
+ },
38
+ timeRestrictions: {
39
+ originalTripRestrictions: {
40
+ cutoffMinutes: 0,
41
+ referencePoint: "original_passenger_departure_time"
42
+ },
43
+ newTripRestrictions: {
44
+ lowerBoundCutoffMinutes: 0,
45
+ lowerBoundReferencePoint: "original_passenger_departure_time",
46
+ upperBoundCutoffMinutes: 15,
47
+ upperBoundReferencePoint: "original_passenger_departure_time"
48
+ }
49
+ },
50
+ followingSeatBehaviorEnabled: true
21
51
  };
22
52
 
23
53
  axiosMock.onPut("/ticket-movement-settings")
@@ -406,3 +406,83 @@ describe("operations/manifests/:manifestKey/manifests-exceptions", () => {
406
406
  return api.operations.manifest.manifestsExceptions.update({token, jwtToken, manifestKey, manifestException});
407
407
  });
408
408
  });
409
+
410
+ describe("operations/manifests/:manifestId/station operations", () => {
411
+ const token = "I owe you a token";
412
+ const jwtToken = "I owe you a JWT token";
413
+
414
+ afterEach(() => {
415
+ axiosMock.reset();
416
+ });
417
+
418
+ it("should board passengers at station", async () => {
419
+ const manifestId = "manifestId";
420
+ const stationId = "stationId";
421
+ const data = {
422
+ user: {
423
+ firstName: "Test",
424
+ lastName: "Testing",
425
+ email: "test@betterez.com"
426
+ }
427
+ };
428
+ const query = {bypassValidations: false};
429
+
430
+ axiosMock.onPost(`/manifests/${manifestId}/boarding/${stationId}`).reply(expectRequest({
431
+ statusCode: 200, token, jwtToken
432
+ }));
433
+ const call = await api.operations.manifest.stationBoarding({
434
+ token, jwtToken, manifestId, stationId, data, query
435
+ });
436
+ assert.deepStrictEqual(JSON.parse(call.config.data), data);
437
+ assert.deepStrictEqual(call.config.params, query);
438
+ return call;
439
+ });
440
+
441
+ it("should dispatch manifest at station", async () => {
442
+ const manifestId = "manifestId";
443
+ const stationId = "stationId";
444
+ const data = {
445
+ user: {
446
+ firstName: "Test",
447
+ lastName: "Testing",
448
+ email: "Test@betterez.com",
449
+ shiftId: "649f20a95679910784326e81",
450
+ shiftNumber: "S-WTN6LDX"
451
+ }
452
+ };
453
+ const query = {bypassValidations: false};
454
+
455
+ axiosMock.onPost(`/manifests/${manifestId}/dispatch/${stationId}`).reply(expectRequest({
456
+ statusCode: 200, token, jwtToken
457
+ }));
458
+ const call = await api.operations.manifest.stationDispatch({
459
+ token, jwtToken, manifestId, stationId, data, query
460
+ });
461
+ assert.deepStrictEqual(JSON.parse(call.config.data), data);
462
+ assert.deepStrictEqual(call.config.params, query);
463
+ return call;
464
+ });
465
+
466
+ it("should close sales at station", async () => {
467
+ const manifestId = "manifestId";
468
+ const stationId = "stationId";
469
+ const data = {
470
+ user: {
471
+ firstName: "Test",
472
+ lastName: "Testing",
473
+ email: "Test@betterez.com"
474
+ }
475
+ };
476
+ const query = {bypassValidations: false};
477
+
478
+ axiosMock.onPost(`/manifests/${manifestId}/sales-closure/${stationId}`).reply(expectRequest({
479
+ statusCode: 200, token, jwtToken
480
+ }));
481
+ const call = await api.operations.manifest.stationSalesClosure({
482
+ token, jwtToken, manifestId, stationId, data, query
483
+ });
484
+ assert.deepStrictEqual(JSON.parse(call.config.data), data);
485
+ assert.deepStrictEqual(call.config.params, query);
486
+ return call;
487
+ });
488
+ });