mts-booking-library 3.0.8 → 3.0.9

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.
@@ -10,6 +10,11 @@ import { BookingSkip, TplCart } from "../types/tpl/TplCart";
10
10
  import { GetTripsResponse } from "../types/tpl/Trips";
11
11
  import { ApiCallOptions } from "../utils/apiCall";
12
12
  import { Booking } from "./booking";
13
+ export declare enum TplTariffClassificationType {
14
+ TPL = "TARIFF_TYPE_TPL",
15
+ TPL_TOUR = "TARIFF_TYPE_TPL_TOUR",
16
+ TPL_SUBSCRIPTION = "TARIFF_TYPE_TPL_SUBSCRIPTION"
17
+ }
13
18
  export declare class TplBooking extends Booking {
14
19
  private cart?;
15
20
  /**
@@ -141,11 +146,16 @@ export declare class TplBooking extends Booking {
141
146
  * @param superAreaId The id of the super area (as returned by the {@link getSuperAreas} method).
142
147
  * @param termsTypeId The id of the terms type (as returned by the {@link getTermsTypes} method).
143
148
  * If null, tariffs from all terms types will be considered.
144
- * @param onlyTickets If true, only only return the tariffs that are for single tickets.
145
- * @param onlySubscriptions If true, only return the tariffs that are for subscriptions.
149
+ * @param type Filters returned tariffs by their classification (case-insensitive).
150
+ * Accepted values:
151
+ * - "TARIFF_TYPE_TPL": regular TPL tickets (not a tour, not a subscription)
152
+ * - "TARIFF_TYPE_TPL_TOUR": tour tariffs
153
+ * - "TARIFF_TYPE_TPL_SUBSCRIPTION": subscription tariffs
154
+ * If omitted or null, all tariff types are returned.
155
+ * When `termsTypeId` is also provided, the type filter is applied after tariffs are fetched.
146
156
  * @returns A {@link GetTariffsResponse} if the call is successful, an {@link ErrorResponse} object otherwise.
147
157
  */
148
- getTariffs(superAreaId: number, termsTypeId: number | null, onlyTickets: boolean, onlySubscriptions: boolean, options?: ApiCallOptions): Promise<ErrorResponse | GetTariffsResponse>;
158
+ getTariffs(superAreaId: number, termsTypeId: number | null, type?: TplTariffClassificationType | null, options?: ApiCallOptions): Promise<ErrorResponse | GetTariffsResponse>;
149
159
  /**
150
160
  * This method returns the tours available for the given date. This method can be used if the seller wants the user to book a specific date
151
161
  * and/or a specific hour for the tour.
@@ -71,7 +71,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
71
71
  return to.concat(ar || Array.prototype.slice.call(from));
72
72
  };
73
73
  Object.defineProperty(exports, "__esModule", { value: true });
74
- exports.TplBooking = void 0;
74
+ exports.TplBooking = exports.TplTariffClassificationType = void 0;
75
75
  var config_1 = require("../config");
76
76
  var mtsStorage_1 = require("../mtsStorage");
77
77
  var ErrorResponse_1 = require("../types/ErrorResponse");
@@ -79,6 +79,12 @@ var Reduction_1 = require("../types/common/Reduction");
79
79
  var processBookingSteps_1 = require("../utils/processBookingSteps");
80
80
  var utils_1 = require("../utils/utils");
81
81
  var booking_1 = require("./booking");
82
+ var TplTariffClassificationType;
83
+ (function (TplTariffClassificationType) {
84
+ TplTariffClassificationType["TPL"] = "TARIFF_TYPE_TPL";
85
+ TplTariffClassificationType["TPL_TOUR"] = "TARIFF_TYPE_TPL_TOUR";
86
+ TplTariffClassificationType["TPL_SUBSCRIPTION"] = "TARIFF_TYPE_TPL_SUBSCRIPTION";
87
+ })(TplTariffClassificationType || (exports.TplTariffClassificationType = TplTariffClassificationType = {}));
82
88
  var TplBooking = /** @class */ (function (_super) {
83
89
  __extends(TplBooking, _super);
84
90
  /**
@@ -282,15 +288,20 @@ var TplBooking = /** @class */ (function (_super) {
282
288
  * @param superAreaId The id of the super area (as returned by the {@link getSuperAreas} method).
283
289
  * @param termsTypeId The id of the terms type (as returned by the {@link getTermsTypes} method).
284
290
  * If null, tariffs from all terms types will be considered.
285
- * @param onlyTickets If true, only only return the tariffs that are for single tickets.
286
- * @param onlySubscriptions If true, only return the tariffs that are for subscriptions.
291
+ * @param type Filters returned tariffs by their classification (case-insensitive).
292
+ * Accepted values:
293
+ * - "TARIFF_TYPE_TPL": regular TPL tickets (not a tour, not a subscription)
294
+ * - "TARIFF_TYPE_TPL_TOUR": tour tariffs
295
+ * - "TARIFF_TYPE_TPL_SUBSCRIPTION": subscription tariffs
296
+ * If omitted or null, all tariff types are returned.
297
+ * When `termsTypeId` is also provided, the type filter is applied after tariffs are fetched.
287
298
  * @returns A {@link GetTariffsResponse} if the call is successful, an {@link ErrorResponse} object otherwise.
288
299
  */
289
- TplBooking.prototype.getTariffs = function (superAreaId, termsTypeId, onlyTickets, onlySubscriptions, options) {
300
+ TplBooking.prototype.getTariffs = function (superAreaId, termsTypeId, type, options) {
290
301
  return __awaiter(this, void 0, void 0, function () {
291
302
  var searchParams, url;
292
303
  return __generator(this, function (_a) {
293
- searchParams = new URLSearchParams(__assign(__assign({ superAreaId: superAreaId.toString() }, (termsTypeId && { termsTypeId: termsTypeId.toString() })), { onlyTickets: onlyTickets.toString(), onlySubscriptions: onlySubscriptions.toString() }));
304
+ searchParams = new URLSearchParams(__assign(__assign({ superAreaId: superAreaId.toString() }, (termsTypeId && { termsTypeId: termsTypeId.toString() })), (type && { type: type.toUpperCase() })));
294
305
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/tpl/tariffs?").concat(searchParams);
295
306
  // Call the API
296
307
  return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "description": "Library for using MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",