mts-booking-library 1.1.4 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/booking/booking.d.ts +6 -2
- package/lib/booking/booking.js +8 -2
- package/lib/booking/journeyBooking.js +2 -1
- package/lib/booking/serviceBooking.js +2 -1
- package/lib/booking/subscriptionBooking.d.ts +3 -3
- package/lib/booking/subscriptionBooking.js +10 -3
- package/lib/index.d.ts +2 -1
- package/lib/index.js +8 -1
- package/lib/types/ErrorResponse.d.ts +6 -0
- package/lib/types/common/Cart.d.ts +3 -2
- package/lib/types/journeys/JourneyCart.d.ts +11 -7
- package/lib/types/journeys/JourneyCart.js +8 -0
- package/lib/types/services/ServiceCart.d.ts +2 -2
- package/lib/types/subscriptions/SubscriptionCart.d.ts +23 -0
- package/lib/types/subscriptions/SubscriptionInfo.d.ts +39 -0
- package/lib/types/subscriptions/SubscriptionInfo.js +2 -0
- package/package.json +1 -1
package/lib/booking/booking.d.ts
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
import { MTSConfig, MTSEnvs } from "../config";
|
2
2
|
export declare abstract class Booking {
|
3
3
|
readonly sellerId?: number | undefined;
|
4
|
+
readonly bookingType: Booking.BookingTypes;
|
4
5
|
readonly config: MTSConfig;
|
6
|
+
selectedCurrency: Booking.Currencies;
|
5
7
|
cartStatus: Booking.CartStatus;
|
6
8
|
bookingDueDate: Date | undefined;
|
7
9
|
onCartExpiration: () => void;
|
@@ -10,16 +12,18 @@ export declare abstract class Booking {
|
|
10
12
|
* @param {string} env The environment in which the app is running. Can be "dev", "stag" or "prod"
|
11
13
|
* @param {string} sub_key The subscription key for using the APIs
|
12
14
|
* @param {() => void} onCartExpiration A callback function that will be called when the cart expires
|
15
|
+
* @param {Booking.BookingTypes} bookingType The type of booking. Can be "MLP", "SERVICE" or "MLP_SUBSCRIPTION"
|
13
16
|
* @param {string} [access_token=undefined] The access token for calling MTS APIs
|
14
17
|
* @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
|
15
18
|
*/
|
16
|
-
constructor(env: MTSEnvs, sub_key: string, onCartExpiration: () => void, debug?: boolean, access_token?: string, sellerId?: number);
|
19
|
+
constructor(env: MTSEnvs, sub_key: string, onCartExpiration: () => void, bookingType: Booking.BookingTypes, debug?: boolean, access_token?: string, sellerId?: number);
|
17
20
|
/**
|
18
21
|
* This method allows to renew the access token for calling MTS APIs
|
19
22
|
* @param {string} access_token The new access token
|
20
23
|
*/
|
21
24
|
renewAccessToken(access_token: string): void;
|
22
25
|
getCartStatus(): Booking.CartStatus;
|
26
|
+
changeCurrency(currency: Booking.Currencies): void;
|
23
27
|
getCartExpirationTimeInMs(): Promise<number>;
|
24
28
|
}
|
25
29
|
export declare namespace Booking {
|
@@ -39,6 +43,6 @@ export declare namespace Booking {
|
|
39
43
|
enum BookingTypes {
|
40
44
|
MLP = "MLP",
|
41
45
|
SERVICE = "SERVICE",
|
42
|
-
|
46
|
+
MLP_SUBSCRIPTION = "MLP_SUBSCRIPTION"
|
43
47
|
}
|
44
48
|
}
|
package/lib/booking/booking.js
CHANGED
@@ -44,14 +44,17 @@ var Booking = /** @class */ (function () {
|
|
44
44
|
* @param {string} env The environment in which the app is running. Can be "dev", "stag" or "prod"
|
45
45
|
* @param {string} sub_key The subscription key for using the APIs
|
46
46
|
* @param {() => void} onCartExpiration A callback function that will be called when the cart expires
|
47
|
+
* @param {Booking.BookingTypes} bookingType The type of booking. Can be "MLP", "SERVICE" or "MLP_SUBSCRIPTION"
|
47
48
|
* @param {string} [access_token=undefined] The access token for calling MTS APIs
|
48
49
|
* @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
|
49
50
|
*/
|
50
|
-
function Booking(env, sub_key, onCartExpiration, debug, access_token, sellerId) {
|
51
|
+
function Booking(env, sub_key, onCartExpiration, bookingType, debug, access_token, sellerId) {
|
51
52
|
if (debug === void 0) { debug = false; }
|
53
|
+
this.selectedCurrency = Booking.Currencies.EUR;
|
52
54
|
this.cartStatus = Booking.CartStatus.EMPTY;
|
53
55
|
this.sellerId = sellerId || undefined;
|
54
56
|
this.config = (0, config_1.setConfig)(env, sub_key, debug, access_token);
|
57
|
+
this.bookingType = bookingType;
|
55
58
|
this.onCartExpiration = onCartExpiration;
|
56
59
|
}
|
57
60
|
/**
|
@@ -64,6 +67,9 @@ var Booking = /** @class */ (function () {
|
|
64
67
|
Booking.prototype.getCartStatus = function () {
|
65
68
|
return this.cartStatus;
|
66
69
|
};
|
70
|
+
Booking.prototype.changeCurrency = function (currency) {
|
71
|
+
this.selectedCurrency = currency;
|
72
|
+
};
|
67
73
|
Booking.prototype.getCartExpirationTimeInMs = function () {
|
68
74
|
return __awaiter(this, void 0, void 0, function () {
|
69
75
|
return __generator(this, function (_a) {
|
@@ -100,6 +106,6 @@ exports.Booking = Booking;
|
|
100
106
|
(function (BookingTypes) {
|
101
107
|
BookingTypes["MLP"] = "MLP";
|
102
108
|
BookingTypes["SERVICE"] = "SERVICE";
|
103
|
-
BookingTypes["
|
109
|
+
BookingTypes["MLP_SUBSCRIPTION"] = "MLP_SUBSCRIPTION";
|
104
110
|
})(BookingTypes = Booking.BookingTypes || (Booking.BookingTypes = {}));
|
105
111
|
})(Booking || (exports.Booking = Booking = {}));
|
@@ -71,7 +71,7 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
71
71
|
if (debug === void 0) { debug = false; }
|
72
72
|
var _this =
|
73
73
|
// Call Booking constructor
|
74
|
-
_super.call(this, env, sub_key, onCartExpiration, debug, access_token, sellerId) || this;
|
74
|
+
_super.call(this, env, sub_key, onCartExpiration, booking_1.Booking.BookingTypes.MLP, debug, access_token, sellerId) || this;
|
75
75
|
var cartId = localStorage.getItem("cartId");
|
76
76
|
if (cartId) {
|
77
77
|
_this.fetchAndSetCart(parseInt(cartId));
|
@@ -178,6 +178,7 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
178
178
|
return [2 /*return*/, (0, apiCall_1.makePost)(url, tripCart).then(function (cart) {
|
179
179
|
_this.cart = cart.cart;
|
180
180
|
_this.cartStatus = cart.cart.status;
|
181
|
+
_this.bookingDueDate = new Date(cart.cart.bookingDueDate);
|
181
182
|
_this.createCartTimer(new Date(cart.cart.bookingDueDate));
|
182
183
|
return cart.cart;
|
183
184
|
})];
|
@@ -71,7 +71,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
71
71
|
if (debug === void 0) { debug = false; }
|
72
72
|
var _this =
|
73
73
|
// Call Booking constructor
|
74
|
-
_super.call(this, env, sub_key, onCartExpiration, debug, access_token, sellerId) || this;
|
74
|
+
_super.call(this, env, sub_key, onCartExpiration, booking_1.Booking.BookingTypes.SERVICE, debug, access_token, sellerId) || this;
|
75
75
|
var cartId = localStorage.getItem("cartId");
|
76
76
|
if (cartId) {
|
77
77
|
_this.fetchAndSetCart(parseInt(cartId));
|
@@ -179,6 +179,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
179
179
|
return [2 /*return*/, (0, apiCall_1.makePost)(url, serviceCart).then(function (cart) {
|
180
180
|
_this.cart = cart.cart;
|
181
181
|
_this.cartStatus = cart.cart.status;
|
182
|
+
_this.bookingDueDate = new Date(cart.cart.bookingDueDate);
|
182
183
|
_this.createCartTimer(new Date(cart.cart.bookingDueDate));
|
183
184
|
return cart.cart;
|
184
185
|
})];
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { MTSEnvs } from "../config";
|
2
2
|
import { Cart } from "../types/common/Cart";
|
3
3
|
import { GetSubscriptionAvailabilityRequest, GetSubscriptionAvailabilityResponse } from "../types/subscriptions/SubscriptionAvailabilities";
|
4
|
-
import { CreateSubscriptionCartRequest } from "../types/subscriptions/SubscriptionCart";
|
4
|
+
import { CreateSubscriptionCartRequest, SubscriptionCart } from "../types/subscriptions/SubscriptionCart";
|
5
5
|
import { Subscription } from "../types/subscriptions/Subscriptions";
|
6
6
|
import { Booking } from "./booking";
|
7
7
|
export declare class SubscriptionBooking extends Booking {
|
@@ -21,7 +21,7 @@ export declare class SubscriptionBooking extends Booking {
|
|
21
21
|
* @param {string} departureStopName The departure stop name (as returned by {@link getSubscriptionsDepartures})
|
22
22
|
* @returns {string[]} The list of possible destinations
|
23
23
|
*/
|
24
|
-
|
24
|
+
getSubscriptionsDestinations(departureStopName: string): Promise<string[]>;
|
25
25
|
/**
|
26
26
|
* This method returns the possible validity types for the subscriptions sold by this seller between the selected departure and destination.
|
27
27
|
* The validity type is the duration of the subscription (1 week, 1 month, etc.). See {@link ValidityTypes} for more details.
|
@@ -47,7 +47,7 @@ export declare class SubscriptionBooking extends Booking {
|
|
47
47
|
* @returns {GetSubscriptionAvailabilityResponse} The availability of the subscription for the given parameters
|
48
48
|
*/
|
49
49
|
getSubscriptionAvailabilities(request: GetSubscriptionAvailabilityRequest): Promise<GetSubscriptionAvailabilityResponse>;
|
50
|
-
createSubscriptionCart(request: CreateSubscriptionCartRequest): Promise<
|
50
|
+
createSubscriptionCart(request: CreateSubscriptionCartRequest): Promise<SubscriptionCart>;
|
51
51
|
}
|
52
52
|
export declare namespace SubscriptionBooking {
|
53
53
|
enum ValidityTypes {
|
@@ -71,7 +71,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
71
71
|
if (debug === void 0) { debug = false; }
|
72
72
|
var _this =
|
73
73
|
// Call Booking constructor
|
74
|
-
_super.call(this, env, sub_key, onCartExpiration, debug, access_token, sellerId) || this;
|
74
|
+
_super.call(this, env, sub_key, onCartExpiration, booking_1.Booking.BookingTypes.MLP_SUBSCRIPTION, debug, access_token, sellerId) || this;
|
75
75
|
var cartId = localStorage.getItem("cartId");
|
76
76
|
if (cartId) {
|
77
77
|
_this.fetchAndSetCart(parseInt(cartId));
|
@@ -141,7 +141,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
141
141
|
* @param {string} departureStopName The departure stop name (as returned by {@link getSubscriptionsDepartures})
|
142
142
|
* @returns {string[]} The list of possible destinations
|
143
143
|
*/
|
144
|
-
SubscriptionBooking.prototype.
|
144
|
+
SubscriptionBooking.prototype.getSubscriptionsDestinations = function (departureStopName) {
|
145
145
|
return __awaiter(this, void 0, void 0, function () {
|
146
146
|
var url;
|
147
147
|
return __generator(this, function (_a) {
|
@@ -202,9 +202,16 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
202
202
|
SubscriptionBooking.prototype.createSubscriptionCart = function (request) {
|
203
203
|
return __awaiter(this, void 0, void 0, function () {
|
204
204
|
var url;
|
205
|
+
var _this = this;
|
205
206
|
return __generator(this, function (_a) {
|
206
207
|
url = "".concat(this.config.API_ENDPOINT, "/booking/subscriptions");
|
207
|
-
return [2 /*return*/, (0, apiCall_1.makePost)(url, request)
|
208
|
+
return [2 /*return*/, (0, apiCall_1.makePost)(url, request).then(function (cart) {
|
209
|
+
_this.cart = cart.cart;
|
210
|
+
_this.cartStatus = cart.cart.status;
|
211
|
+
_this.bookingDueDate = new Date(cart.cart.bookingDueDate);
|
212
|
+
_this.createCartTimer(new Date(cart.cart.bookingDueDate));
|
213
|
+
return cart.cart;
|
214
|
+
})];
|
208
215
|
});
|
209
216
|
});
|
210
217
|
};
|
package/lib/index.d.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
export { Booking } from "./booking/booking";
|
1
2
|
export { JourneyBooking } from "./booking/journeyBooking";
|
2
3
|
export { ServiceBooking } from "./booking/serviceBooking";
|
3
4
|
export { SubscriptionBooking } from "./booking/subscriptionBooking";
|
4
5
|
export { Person, PassengersDetails, DEFAULT_PERSON } from "./types/common/Person";
|
5
6
|
export { TariffMatrix, TariffSummary, TariffType, TermsType } from "./types/common/Tariffs";
|
6
|
-
export { JourneyCart, JourneyBookingType, CreateJourneyCartRequest,
|
7
|
+
export { JourneyCart, JourneyBookingType, CreateJourneyCartRequest, TripBookingInfo, DEFAULT_CREATE_JOURNEY_CART } from "./types/journeys/JourneyCart";
|
7
8
|
export { JourneyInfo } from "./types/journeys/JourneyInfo";
|
8
9
|
export { JourneySearchRequest, JourneySearchResult, DEFAULT_JOURNEY_SEARCH } from "./types/journeys/JourneySearch";
|
9
10
|
export { Stop } from "./types/journeys/Stop";
|
package/lib/index.js
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DEFAULT_JOURNEY_SEARCH = exports.DEFAULT_PERSON = exports.SubscriptionBooking = exports.ServiceBooking = exports.JourneyBooking = void 0;
|
3
|
+
exports.DEFAULT_JOURNEY_SEARCH = exports.DEFAULT_CREATE_JOURNEY_CART = exports.DEFAULT_PERSON = exports.SubscriptionBooking = exports.ServiceBooking = exports.JourneyBooking = exports.Booking = void 0;
|
4
4
|
//#region Export Booking classes
|
5
|
+
var booking_1 = require("./booking/booking");
|
6
|
+
Object.defineProperty(exports, "Booking", { enumerable: true, get: function () { return booking_1.Booking; } });
|
5
7
|
var journeyBooking_1 = require("./booking/journeyBooking");
|
6
8
|
Object.defineProperty(exports, "JourneyBooking", { enumerable: true, get: function () { return journeyBooking_1.JourneyBooking; } });
|
7
9
|
var serviceBooking_1 = require("./booking/serviceBooking");
|
@@ -13,6 +15,11 @@ Object.defineProperty(exports, "SubscriptionBooking", { enumerable: true, get: f
|
|
13
15
|
// @note: Cart is not exported because it is extended by other types
|
14
16
|
var Person_1 = require("./types/common/Person");
|
15
17
|
Object.defineProperty(exports, "DEFAULT_PERSON", { enumerable: true, get: function () { return Person_1.DEFAULT_PERSON; } });
|
18
|
+
//#endregion
|
19
|
+
//#region Export JourneyBooking types
|
20
|
+
// TODO: BusMatrix.ts
|
21
|
+
var JourneyCart_1 = require("./types/journeys/JourneyCart");
|
22
|
+
Object.defineProperty(exports, "DEFAULT_CREATE_JOURNEY_CART", { enumerable: true, get: function () { return JourneyCart_1.DEFAULT_CREATE_JOURNEY_CART; } });
|
16
23
|
var JourneySearch_1 = require("./types/journeys/JourneySearch");
|
17
24
|
Object.defineProperty(exports, "DEFAULT_JOURNEY_SEARCH", { enumerable: true, get: function () { return JourneySearch_1.DEFAULT_JOURNEY_SEARCH; } });
|
18
25
|
//#endregion
|
@@ -1,3 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* @description Error response type as returned by the BackEnd
|
3
|
+
*
|
4
|
+
* @property {number} statusCode - The status code of the error (e.g. 400)
|
5
|
+
* @property {string} message - The message of the error (e.g. "Invalid parameters")
|
6
|
+
*/
|
1
7
|
export type ErrorResponse = {
|
2
8
|
statusCode: number;
|
3
9
|
message: string;
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { Booking } from "../../booking/booking";
|
2
|
-
import { Person } from "./Person";
|
3
2
|
/**
|
4
3
|
* @description Cart is the object returned by the API when a cart is created.
|
5
4
|
* Note that depending on the type of booking, this type will be extended with different fields:
|
@@ -11,6 +10,8 @@ import { Person } from "./Person";
|
|
11
10
|
* @property {Booking.CartStatus} status The status of the cart. See {@link Booking.CartStatus}
|
12
11
|
* @property {Booking.CartStatus} nextStatus The next status of the cart. See {@link Booking.CartStatus}
|
13
12
|
* @property {Booking.Currencies} currency The currency of the cart. See {@link Booking.Currencies}
|
13
|
+
* @property {string} bookingDueDate The date and time when the cart expires
|
14
|
+
* @property {number} buyerId The id of the buyer
|
14
15
|
*/
|
15
16
|
export type Cart = {
|
16
17
|
id: number;
|
@@ -19,7 +20,7 @@ export type Cart = {
|
|
19
20
|
nextStatus: Booking.CartStatus;
|
20
21
|
currency: Booking.Currencies;
|
21
22
|
bookingDueDate: string;
|
22
|
-
|
23
|
+
buyerId: number;
|
23
24
|
reductions: {
|
24
25
|
tripId: number;
|
25
26
|
tripName: string;
|
@@ -3,14 +3,15 @@ import { Cart } from "../common/Cart";
|
|
3
3
|
import { TariffMatrix, TariffSummary } from "../common/Tariffs";
|
4
4
|
import { Stop } from "./Stop";
|
5
5
|
/**
|
6
|
-
* @description Object containing information about
|
6
|
+
* @description Object containing information about a trip of a selected journey. This object is part of the {@link CreateJourneyCartRequest} object
|
7
|
+
* and describes a single trip of the journey (either outbound or return).
|
7
8
|
*
|
8
9
|
* @property {number} tripId - The unique identifier for the trip.
|
9
10
|
* @property {number} departureStopId - The unique identifier for the departure stop.
|
10
11
|
* @property {number} destinationStopId - The unique identifier for the destination stop.
|
11
12
|
* @property {TariffMatrix} tariffsMatrix - The tariff matrix for pricing the outbound journey.
|
12
13
|
*/
|
13
|
-
export type
|
14
|
+
export type TripBookingInfo = {
|
14
15
|
tripId: number;
|
15
16
|
departureStopId: number;
|
16
17
|
destinationStopId: number;
|
@@ -21,15 +22,18 @@ export type JourneyBookingInfo = {
|
|
21
22
|
*
|
22
23
|
* @property {number|undefined} [cartId=0] - The unique identifier for the cart (optional).
|
23
24
|
* @property {Booking.Currencies} currency - The currency in which the journey is priced.
|
24
|
-
* @property {
|
25
|
-
*
|
25
|
+
* @property {TripBookingInfo[]} outboundJourney - Information about outbound journeys. This is an array of {@link TripBookingInfo} objects.
|
26
|
+
* Note that when searching for journeys, the `trips` property of the {@link JourneySearchResult} object contains an array of {@link Trip} objects.
|
27
|
+
* Each trip should be mapped into a {@link TripBookingInfo} object.
|
28
|
+
* @property {TripBookingInfo[] | null} returnJourney - Information about return journeys (optional, can be null). See outboundJourney.
|
26
29
|
*/
|
27
30
|
export type CreateJourneyCartRequest = {
|
28
31
|
cartId?: number;
|
29
32
|
currency: Booking.Currencies;
|
30
|
-
outboundJourney:
|
31
|
-
returnJourney:
|
33
|
+
outboundJourney: TripBookingInfo[];
|
34
|
+
returnJourney: TripBookingInfo[] | null;
|
32
35
|
};
|
36
|
+
export declare const DEFAULT_CREATE_JOURNEY_CART: CreateJourneyCartRequest;
|
33
37
|
/**
|
34
38
|
* @description Represents a `JourneyCart`, which extends the {@link Cart} type by including additional
|
35
39
|
* information about the bookings
|
@@ -43,7 +47,7 @@ export type JourneyCart = Cart & {
|
|
43
47
|
/**
|
44
48
|
* @description Represents a `JourneyBooking`, which contains information about a journey booking.
|
45
49
|
*
|
46
|
-
* @property {Booking.BookingTypes} type - The type of booking.
|
50
|
+
* @property {Booking.BookingTypes} type - The type of booking. For journeys, this is always `Booking.BookingTypes.MLP`.
|
47
51
|
* @property {TariffSummary[]} summary - An array of {@link TariffSummary} objects representing the tariff summary
|
48
52
|
* associated with this journey booking.
|
49
53
|
* @property {Stop[]} info - An array of {@link Stop} objects representing the stops associated with this journey booking.
|
@@ -1,2 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.DEFAULT_CREATE_JOURNEY_CART = void 0;
|
4
|
+
var booking_1 = require("../../booking/booking");
|
5
|
+
exports.DEFAULT_CREATE_JOURNEY_CART = {
|
6
|
+
cartId: 0,
|
7
|
+
currency: booking_1.Booking.Currencies.EUR,
|
8
|
+
outboundJourney: [],
|
9
|
+
returnJourney: null,
|
10
|
+
};
|
@@ -32,9 +32,9 @@ export type ServiceCart = Cart & {
|
|
32
32
|
bookings: ServiceBookingType[];
|
33
33
|
};
|
34
34
|
/**
|
35
|
-
* @description Represents a `
|
35
|
+
* @description Represents a `ServiceBooking`, which contains information about a service booking.
|
36
36
|
*
|
37
|
-
* @property {Booking.BookingTypes} type - The type of booking.
|
37
|
+
* @property {Booking.BookingTypes} type - The type of booking. For services, this is always `Booking.BookingTypes.SERVICE`.
|
38
38
|
* @property {TariffSummary[]} summary - An array of {@link TariffSummary} objects representing the tariff summary
|
39
39
|
* associated with this journey booking.
|
40
40
|
* @property {ServiceTrip} info - An array of {@link ServiceTrip} objects representing the stops associated with this journey booking.
|
@@ -1,3 +1,6 @@
|
|
1
|
+
import { Booking } from "../../booking/booking";
|
2
|
+
import { Cart } from "../common/Cart";
|
3
|
+
import { SubscriptionInfo } from "./SubscriptionInfo";
|
1
4
|
/**
|
2
5
|
* @description This is the object to be passed to `SubscriptionBooking.createSubscriptionCart`,
|
3
6
|
* containing information about the selected subscription.
|
@@ -37,3 +40,23 @@ export type SubscriptionPeriod = {
|
|
37
40
|
dateFrom: string;
|
38
41
|
dateTo: string;
|
39
42
|
};
|
43
|
+
/**
|
44
|
+
* @description Represents a `SubscriptionCart`, which extends the {@link Cart} type by including additional information about the bookings.
|
45
|
+
*
|
46
|
+
* @property {SubscriptionBookingType[]} bookings - An array of {@link SubscriptionBookingType} objects representing the created subscriptions.
|
47
|
+
*/
|
48
|
+
export type SubscriptionCart = Cart & {
|
49
|
+
bookings: SubscriptionBookingType[];
|
50
|
+
};
|
51
|
+
/**
|
52
|
+
* @description Represents a `SubscriptionBooking`, which contains information about a subscription booking.
|
53
|
+
*
|
54
|
+
* @property {Booking.BookingTypes} type - The type of booking. For subscriptions, this is always `Booking.BookingTypes.SUBSCRIPTION`.
|
55
|
+
* @property {TariffSummary[]} summary - An array of {@link TariffSummary} objects representing the tariff summary
|
56
|
+
* associated with this journey booking.
|
57
|
+
* @property {ServiceTrip} info - An array of {@link ServiceTrip} objects representing the stops associated with this journey booking.
|
58
|
+
*/
|
59
|
+
export type SubscriptionBookingType = {
|
60
|
+
type: Booking.BookingTypes;
|
61
|
+
info: SubscriptionInfo;
|
62
|
+
};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { SubscriptionBooking } from "../../booking/subscriptionBooking";
|
2
|
+
/**
|
3
|
+
* @description This object contains information about the created subscription.
|
4
|
+
*
|
5
|
+
* @property {string} periodsNames - The names of the periods for which the subscription was booked (e.g. "July 2023")
|
6
|
+
* @property {boolean} isRoundTrip - Whether the subscription is for a round trip or not.
|
7
|
+
* @property {SubscriptionBooking.ValidityTypes} validity - The validity of the subscription.
|
8
|
+
* @property {number} totalPrice - The total price of the subscription.
|
9
|
+
* @property {string} outboundLineName - The name of the line for the outbound trip.
|
10
|
+
* @property {string} outboundRouteName - The name of the route for the outbound trip.
|
11
|
+
* @property {string} outboundDepartureStopName - The name of the departure stop for the outbound trip.
|
12
|
+
* @property {string} outboundDestinationStopName - The name of the destination stop for the outbound trip.
|
13
|
+
* @property {string} outboundDepartureStopTime - The departure time (only time, not date) for the outbound trip.
|
14
|
+
* @property {string} outboundDestinationStopTime - The destination time (only time, not date) for the outbound trip.
|
15
|
+
* @property {string} returnLineName - The name of the line for the return trip.
|
16
|
+
* @property {string} returnRouteName - The name of the route for the return trip.
|
17
|
+
* @property {string} returnDepartureStopName - The name of the departure stop for the return trip.
|
18
|
+
* @property {string} returnDestinationStopName - The name of the destination stop for the return trip.
|
19
|
+
* @property {string} returnDepartureStopTime - The departure time (only time, not date) for the return trip.
|
20
|
+
* @property {string} returnDestinationStopTime - The destination time (only time, not date) for the return trip.
|
21
|
+
*/
|
22
|
+
export type SubscriptionInfo = {
|
23
|
+
periodsNames: string;
|
24
|
+
isRoundTrip: boolean;
|
25
|
+
validity: SubscriptionBooking.ValidityTypes;
|
26
|
+
totalPrice: number;
|
27
|
+
outboundLineName: string;
|
28
|
+
outboundRouteName: string;
|
29
|
+
outboundDepartureStopName: string;
|
30
|
+
outboundDestinationStopName: string;
|
31
|
+
outboundDepartureStopTime: string;
|
32
|
+
outboundDestinationStopTime: string;
|
33
|
+
returnLineName: string;
|
34
|
+
returnRouteName: string;
|
35
|
+
returnDepartureStopName: string;
|
36
|
+
returnDestinationStopName: string;
|
37
|
+
returnDepartureStopTime: string;
|
38
|
+
returnDestinationStopTime: string;
|
39
|
+
};
|