mts-booking-library 3.0.1 → 3.0.4
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/booking/tplBooking.d.ts +2 -2
- package/lib/booking/tplBooking.js +4 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +15 -0
- package/lib/types/tpl/TplCart.d.ts +8 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import { AddReductionRequest } from "../types/common/Reduction";
|
|
|
6
6
|
import { TariffType, TermsType } from "../types/common/Tariffs";
|
|
7
7
|
import { GetTariffsResponse } from "../types/tpl/GetTariffsResponse";
|
|
8
8
|
import { GetSuperAreasRequest, SuperArea } from "../types/tpl/SuperArea";
|
|
9
|
-
import { TplCart } from "../types/tpl/TplCart";
|
|
9
|
+
import { BookingSkip, TplCart } from "../types/tpl/TplCart";
|
|
10
10
|
import { ApiCallOptions } from "../utils/apiCall";
|
|
11
11
|
import { Booking } from "./booking";
|
|
12
12
|
export declare class TplBooking extends Booking {
|
|
@@ -149,7 +149,7 @@ export declare class TplBooking extends Booking {
|
|
|
149
149
|
* This method creates a tpl cart for the given parameters.
|
|
150
150
|
* @returns The created cart
|
|
151
151
|
*/
|
|
152
|
-
createCart(request: CreateUpdateCartRequest, options?: ApiCallOptions): Promise<ErrorResponse | TplCart>;
|
|
152
|
+
createCart(request: CreateUpdateCartRequest, options?: ApiCallOptions): Promise<ErrorResponse | TplCart | BookingSkip>;
|
|
153
153
|
/**
|
|
154
154
|
* @description This method shall be called when the user wants to retrieve information about the buyer and the passengers.
|
|
155
155
|
* @returns An object of type {@link GetBuyerPassengersDetailsResponse} containing the buyer and the passengers information,
|
|
@@ -333,6 +333,10 @@ var TplBooking = /** @class */ (function (_super) {
|
|
|
333
333
|
this.resetBooking();
|
|
334
334
|
return [2 /*return*/, response];
|
|
335
335
|
}
|
|
336
|
+
// Handle bookings skips (e.g. Cialone with >1000 tickets: tickets issued asynchronously without cart creation)
|
|
337
|
+
if (response.cartGuid === null && response.message) {
|
|
338
|
+
return [2 /*return*/, { message: response.message }];
|
|
339
|
+
}
|
|
336
340
|
// Fetch the newly created cart & update local properties
|
|
337
341
|
return [4 /*yield*/, this.fetchAndSetCart(response.cartGuid)];
|
|
338
342
|
case 1:
|
package/lib/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { Gateway, GetSellerGatewaysResponse, GetPaymentInformationFromGatewayRes
|
|
|
14
14
|
export { ErrorResponse, objectIsMTSErrorResponse } from "./types/ErrorResponse";
|
|
15
15
|
export { City } from "./types/common/City";
|
|
16
16
|
export { Extra, GetExtrasResponse, GetExtrasForBookingResponse } from "./types/common/Extra";
|
|
17
|
+
export * from "./types/common/dates";
|
|
17
18
|
export { BusLayoutCell, BusMatrix, BusCellTypes, SeatStatus } from "./types/journeys/BusMatrix";
|
|
18
19
|
export { JourneyCart, JourneyBookingType, TripBookingInfo } from "./types/journeys/JourneyCart";
|
|
19
20
|
export { JourneyInfo } from "./types/journeys/JourneyInfo";
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.DEFAULT_JOURNEY_SEARCH = exports.SeatStatus = exports.BusCellTypes = exports.objectIsMTSErrorResponse = exports.PaymentMethods = exports.GatewayTypes = exports.ReductionType = exports.initializePerson = exports.DEFAULT_PERSON = exports.isNullOrWhiteSpace = exports.isNullOrUndefined = exports.useMtsBookingState = exports.TplBooking = exports.SubscriptionBooking = exports.ServiceBooking = exports.JourneyBooking = exports.Booking = void 0;
|
|
4
18
|
//#region Export Booking classes
|
|
@@ -31,6 +45,7 @@ Object.defineProperty(exports, "GatewayTypes", { enumerable: true, get: function
|
|
|
31
45
|
Object.defineProperty(exports, "PaymentMethods", { enumerable: true, get: function () { return Payment_1.PaymentMethods; } });
|
|
32
46
|
var ErrorResponse_1 = require("./types/ErrorResponse");
|
|
33
47
|
Object.defineProperty(exports, "objectIsMTSErrorResponse", { enumerable: true, get: function () { return ErrorResponse_1.objectIsMTSErrorResponse; } });
|
|
48
|
+
__exportStar(require("./types/common/dates"), exports);
|
|
34
49
|
//#endregion
|
|
35
50
|
//#region Export JourneyBooking types
|
|
36
51
|
var BusMatrix_1 = require("./types/journeys/BusMatrix");
|
|
@@ -41,3 +41,11 @@ export type TplBookingInfo = {
|
|
|
41
41
|
/** The end date of the ticket (or of the subscription). Format: "DD/MM/YYYY HH:MM" */
|
|
42
42
|
endDate: string;
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* This can happen when tickets are issued directly, skipping cart creation.
|
|
46
|
+
* @example Booking on Cialone with >1000 tickets: tickets issued asynchronously without cart creation
|
|
47
|
+
*/
|
|
48
|
+
export type BookingSkip = {
|
|
49
|
+
/** A custom message to show the user, as sent by the backend */
|
|
50
|
+
message: string;
|
|
51
|
+
};
|