btrz-api-client 9.6.0 → 9.7.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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "9.6.0",
3
+ "version": "9.7.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({
@@ -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")