mts-booking-library 1.3.9 → 1.3.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ import { ErrorResponse } from "../types/ErrorResponse";
3
3
  import { City } from "../types/common/City";
4
4
  import { GetBuyerPassengersDetailsResponse, Person } from "../types/common/Person";
5
5
  import { AddReductionRequest } from "../types/common/Reduction";
6
- import { TermsType } from "../types/common/Tariffs";
6
+ import { TariffType, TermsType } from "../types/common/Tariffs";
7
7
  import { GetTariffsResponse } from "../types/tpl/GetTariffsResponse";
8
8
  import { SuperArea } from "../types/tpl/SuperArea";
9
9
  import { TplCart } from "../types/tpl/TplCart";
@@ -95,6 +95,11 @@ export declare class TplBooking extends Booking {
95
95
  * @returns An array of {@link TermsType} objects representing the available terms types if the call is successful, an {@link ErrorResponse} object otherwise.
96
96
  */
97
97
  getTermsTypes(superAreaId: number): Promise<ErrorResponse | TermsType[]>;
98
+ /**
99
+ * This method fetches the list of tariff types in a given super area.
100
+ * @returns An array of {@link TariffType} objects representing the available tariff types if the call is successful, an {@link ErrorResponse} object otherwise.
101
+ */
102
+ getTariffTypes(superAreaId: number): Promise<ErrorResponse | TariffType[]>;
98
103
  /**
99
104
  * This method fetches the list of available tariffs for the selected terms type in a given super area.
100
105
  * @param {number} superAreaId The id of the super area (as returned by the {@link getSuperAreas} method).
@@ -249,10 +249,26 @@ var TplBooking = /** @class */ (function (_super) {
249
249
  return __generator(this, function (_a) {
250
250
  searchParams = new URLSearchParams({ superAreaId: superAreaId.toString() });
251
251
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/tpl/termsTypesBySuperArea?").concat(searchParams);
252
+ return [2 /*return*/, this.callGetApi(url).then(function (response) {
253
+ return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response.termsTypes;
254
+ })];
255
+ });
256
+ });
257
+ };
258
+ /**
259
+ * This method fetches the list of tariff types in a given super area.
260
+ * @returns An array of {@link TariffType} objects representing the available tariff types if the call is successful, an {@link ErrorResponse} object otherwise.
261
+ */
262
+ TplBooking.prototype.getTariffTypes = function (superAreaId) {
263
+ return __awaiter(this, void 0, void 0, function () {
264
+ var searchParams, url;
265
+ return __generator(this, function (_a) {
266
+ searchParams = new URLSearchParams({ superAreaId: superAreaId.toString() });
267
+ url = "".concat(this.config.API_ENDPOINT, "/v3_booking/tpl/tariffTypesBySuperArea?").concat(searchParams);
252
268
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
253
269
  return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
254
270
  ? response
255
- : response.termsTypes;
271
+ : response.tariffTypes;
256
272
  })];
257
273
  });
258
274
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mts-booking-library",
3
- "version": "1.3.9",
3
+ "version": "1.3.10",
4
4
  "description": "Library for using MyTicketSolution Booking API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",