turf-common 1.2.1-beta.7 → 1.2.1-beta.71

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.
Files changed (49) hide show
  1. package/build/@enum.d.ts +2 -0
  2. package/build/@enum.js +2 -0
  3. package/build/@model.d.ts +1 -0
  4. package/build/@model.js +1 -0
  5. package/build/@type.d.ts +2 -0
  6. package/build/@type.js +2 -0
  7. package/build/@utils.d.ts +1 -0
  8. package/build/@utils.js +1 -0
  9. package/build/enums/availability-view.enum.d.ts +4 -0
  10. package/build/enums/availability-view.enum.js +8 -0
  11. package/build/enums/booking-history-operation-type.enum.d.ts +4 -2
  12. package/build/enums/booking-history-operation-type.enum.js +4 -2
  13. package/build/enums/environment.enum.d.ts +5 -0
  14. package/build/enums/environment.enum.js +9 -0
  15. package/build/enums/valid-coupon-type.enum.d.ts +3 -1
  16. package/build/enums/valid-coupon-type.enum.js +2 -0
  17. package/build/interface/api/create-recurring-slot-booking.interface.d.ts +4 -1
  18. package/build/interface/api/get-availability-by-turf.interface.d.ts +29 -0
  19. package/build/interface/api/get-availability-by-turf.interface.js +2 -0
  20. package/build/interface/api/get-tournament.interface.d.ts +4 -0
  21. package/build/interface/api/get-tournament.interface.js +2 -0
  22. package/build/interface/api/index.d.ts +2 -0
  23. package/build/interface/api/index.js +2 -0
  24. package/build/interface/api/list-of-coupons.interface.d.ts +6 -0
  25. package/build/interface/convert-to-midnight-time.interface.d.ts +5 -0
  26. package/build/interface/convert-to-midnight-time.interface.js +2 -0
  27. package/build/interface/entity/booking-details-entity.interface.d.ts +2 -0
  28. package/build/interface/entity/booking-history-entity.interface.d.ts +4 -0
  29. package/build/interface/get-booking-by-id.interface.d.ts +2 -3
  30. package/build/interface/model/charge-model.interface.d.ts +1 -0
  31. package/build/interface/ng-date-structure.interface.d.ts +5 -0
  32. package/build/interface/ng-date-structure.interface.js +2 -0
  33. package/build/models/booking-code-model.d.ts +28 -1
  34. package/build/models/booking-code-model.js +66 -3
  35. package/build/models/charge-model.d.ts +3 -3
  36. package/build/models/charge-model.js +74 -28
  37. package/build/models/entity/booking-details-model.d.ts +2 -0
  38. package/build/models/entity/subscription-model.js +3 -3
  39. package/build/models/turf-availability-model.d.ts +57 -0
  40. package/build/models/turf-availability-model.js +239 -0
  41. package/build/utils/constant.d.ts +2 -0
  42. package/build/utils/constant.js +3 -1
  43. package/build/utils/date-util.d.ts +32 -0
  44. package/build/utils/date-util.js +76 -1
  45. package/build/utils/string-utils.d.ts +12 -0
  46. package/build/utils/string-utils.js +53 -0
  47. package/package.json +1 -1
  48. package/build/utils/format-string-with-hyphens.d.ts +0 -1
  49. package/build/utils/format-string-with-hyphens.js +0 -7
package/build/@enum.d.ts CHANGED
@@ -22,3 +22,5 @@ export * from "./enums/booking-fetch-filter.enum";
22
22
  export * from "./enums/timezone.enum";
23
23
  export * from "./enums/bookings-status.enum";
24
24
  export * from "./enums/organization-type.enum";
25
+ export * from "./enums/environment.enum";
26
+ export * from "./enums/availability-view.enum";
package/build/@enum.js CHANGED
@@ -38,3 +38,5 @@ __exportStar(require("./enums/booking-fetch-filter.enum"), exports);
38
38
  __exportStar(require("./enums/timezone.enum"), exports);
39
39
  __exportStar(require("./enums/bookings-status.enum"), exports);
40
40
  __exportStar(require("./enums/organization-type.enum"), exports);
41
+ __exportStar(require("./enums/environment.enum"), exports);
42
+ __exportStar(require("./enums/availability-view.enum"), exports);
package/build/@model.d.ts CHANGED
@@ -6,3 +6,4 @@ export * from "./models/pitch-slab-model";
6
6
  export * from "./models/pricing-plan-model";
7
7
  export * from "./models/subscribed-pricing-plan-model";
8
8
  export * from "./models/entity";
9
+ export * from "./models/turf-availability-model";
package/build/@model.js CHANGED
@@ -22,3 +22,4 @@ __exportStar(require("./models/pitch-slab-model"), exports);
22
22
  __exportStar(require("./models/pricing-plan-model"), exports);
23
23
  __exportStar(require("./models/subscribed-pricing-plan-model"), exports);
24
24
  __exportStar(require("./models/entity"), exports);
25
+ __exportStar(require("./models/turf-availability-model"), exports);
package/build/@type.d.ts CHANGED
@@ -29,3 +29,5 @@ export * from "./interface/modify-entity.interface";
29
29
  export * from "./interface/key-value.interface";
30
30
  export * from "./interface/ui/upgrade-subscription-data.interface";
31
31
  export * from "./interface/ui/booking-data.interface";
32
+ export * from "./interface/ng-date-structure.interface";
33
+ export * from "./interface/convert-to-midnight-time.interface";
package/build/@type.js CHANGED
@@ -46,3 +46,5 @@ __exportStar(require("./interface/key-value.interface"), exports);
46
46
  // changes for the ui
47
47
  __exportStar(require("./interface/ui/upgrade-subscription-data.interface"), exports);
48
48
  __exportStar(require("./interface/ui/booking-data.interface"), exports);
49
+ __exportStar(require("./interface/ng-date-structure.interface"), exports);
50
+ __exportStar(require("./interface/convert-to-midnight-time.interface"), exports);
package/build/@utils.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from "./interface/api/utils";
2
2
  export * from "./utils/string-utils";
3
3
  export * from "./utils/date-util";
4
4
  export * from "./utils/math-util";
5
+ export * from "./utils/constant";
package/build/@utils.js CHANGED
@@ -18,3 +18,4 @@ __exportStar(require("./interface/api/utils"), exports);
18
18
  __exportStar(require("./utils/string-utils"), exports);
19
19
  __exportStar(require("./utils/date-util"), exports);
20
20
  __exportStar(require("./utils/math-util"), exports);
21
+ __exportStar(require("./utils/constant"), exports);
@@ -0,0 +1,4 @@
1
+ export declare enum AvailabilityView {
2
+ NORMAL = "normal",
3
+ MERGED = "merged"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AvailabilityView = void 0;
4
+ var AvailabilityView;
5
+ (function (AvailabilityView) {
6
+ AvailabilityView["NORMAL"] = "normal";
7
+ AvailabilityView["MERGED"] = "merged";
8
+ })(AvailabilityView || (exports.AvailabilityView = AvailabilityView = {}));
@@ -5,6 +5,8 @@ export declare enum BookingHistoryOperationType {
5
5
  DELETE_INSERT = "delete_insert",
6
6
  DELETE_SLOT = "delete_slot",
7
7
  REFUND = "refund",
8
- PAYMENT = "payment"
8
+ PAYMENT = "payment",
9
+ MERGED = "merged",
10
+ DELETE_SLOT_EVENT = "delete_slot_event"
9
11
  }
10
- export declare const operationTypes: BookingHistoryOperationType[];
12
+ export declare const OPERATION_TYPES: BookingHistoryOperationType[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.operationTypes = exports.BookingHistoryOperationType = void 0;
3
+ exports.OPERATION_TYPES = exports.BookingHistoryOperationType = void 0;
4
4
  var BookingHistoryOperationType;
5
5
  (function (BookingHistoryOperationType) {
6
6
  BookingHistoryOperationType["DELETE"] = "delete";
@@ -10,8 +10,10 @@ var BookingHistoryOperationType;
10
10
  BookingHistoryOperationType["DELETE_SLOT"] = "delete_slot";
11
11
  BookingHistoryOperationType["REFUND"] = "refund";
12
12
  BookingHistoryOperationType["PAYMENT"] = "payment";
13
+ BookingHistoryOperationType["MERGED"] = "merged";
14
+ BookingHistoryOperationType["DELETE_SLOT_EVENT"] = "delete_slot_event";
13
15
  })(BookingHistoryOperationType || (exports.BookingHistoryOperationType = BookingHistoryOperationType = {}));
14
- exports.operationTypes = [
16
+ exports.OPERATION_TYPES = [
15
17
  BookingHistoryOperationType.DELETE,
16
18
  BookingHistoryOperationType.REFUND,
17
19
  BookingHistoryOperationType.PAYMENT,
@@ -0,0 +1,5 @@
1
+ export declare enum Environment {
2
+ DEVELOPMENT = "development",
3
+ PRODUCTION = "production",
4
+ TEST = "test"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Environment = void 0;
4
+ var Environment;
5
+ (function (Environment) {
6
+ Environment["DEVELOPMENT"] = "development";
7
+ Environment["PRODUCTION"] = "production";
8
+ Environment["TEST"] = "test";
9
+ })(Environment || (exports.Environment = Environment = {}));
@@ -1,4 +1,6 @@
1
1
  export declare enum ValidCouponType {
2
2
  PERCENTAGE = "percentage",
3
- UNIT = "unit"
3
+ UNIT = "unit",
4
+ PER_HOUR_UNIT = "per hour unit",
5
+ PER_HOUR_PERCENTAGE = "per hour percentage"
4
6
  }
@@ -5,4 +5,6 @@ var ValidCouponType;
5
5
  (function (ValidCouponType) {
6
6
  ValidCouponType["PERCENTAGE"] = "percentage";
7
7
  ValidCouponType["UNIT"] = "unit";
8
+ ValidCouponType["PER_HOUR_UNIT"] = "per hour unit";
9
+ ValidCouponType["PER_HOUR_PERCENTAGE"] = "per hour percentage";
8
10
  })(ValidCouponType || (exports.ValidCouponType = ValidCouponType = {}));
@@ -1,5 +1,5 @@
1
1
  import { PaymentMode, BookingDetailsStatus } from "../../@enum";
2
- import { IBookingDetailsEntity, IModifyEntity } from "../../@type";
2
+ import { IBookingDetailsEntity, IGetAvailabilityByTurf, IModifyEntity } from "../../@type";
3
3
  export interface ICreateRecurringSlotBookingResponse extends IModifyEntity<IBookingDetailsEntity> {
4
4
  }
5
5
  export interface ICreateRecurringSlotsBookingDetailsRequest {
@@ -16,6 +16,9 @@ export interface ICreateRecurringSlotsBookingDetailsRequest {
16
16
  sport: string;
17
17
  remarks?: string | null;
18
18
  slot: IRecurringSlot[];
19
+ turf_slot?: {
20
+ availability_details: IGetAvailabilityByTurf;
21
+ };
19
22
  }
20
23
  export declare class IRecurringSlot {
21
24
  fromDate: number;
@@ -0,0 +1,29 @@
1
+ import { BookingDetailsStatus } from "../../@enum";
2
+ import { AvailabilityView } from "../../enums/availability-view.enum";
3
+ export interface IGetAvailabilityByTurfRequest {
4
+ dateRange: string;
5
+ timeRange?: string;
6
+ pitch: string;
7
+ view: AvailabilityView;
8
+ weekDays: number[];
9
+ }
10
+ export interface IGetAvailabilityByTurf {
11
+ [dateCode: string]: IAvailabilityData;
12
+ }
13
+ export interface ITurfAvailabilityDetails {
14
+ [pitchId: string]: ITurfAvailabilityDetail;
15
+ }
16
+ export interface ITurfAvailabilityDetail {
17
+ price: number;
18
+ bookingId?: number;
19
+ status?: BookingDetailsStatus;
20
+ priceSlot?: string;
21
+ }
22
+ export interface IAvailabilityData {
23
+ [timeSlot: string]: ITurfAvailabilityBooking;
24
+ }
25
+ export interface ITurfAvailabilityBooking {
26
+ available: number[];
27
+ notavailable: number[];
28
+ details: ITurfAvailabilityDetails;
29
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { IBookingDetailsEntity } from "../entity";
2
+ import { IModifyEntity } from "../modify-entity.interface";
3
+ export interface IGetTournamentResponse extends IModifyEntity<IBookingDetailsEntity> {
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -73,3 +73,5 @@ export * from "./get-cancelled-booking.interface";
73
73
  export * from "./get-sports.interface";
74
74
  export * from "../entity/sports-entity.interface";
75
75
  export * from "../api/update-sports-interface";
76
+ export * from "./get-availability-by-turf.interface";
77
+ export * from "./get-tournament.interface";
@@ -91,3 +91,5 @@ __exportStar(require("./get-cancelled-booking.interface"), exports);
91
91
  __exportStar(require("./get-sports.interface"), exports);
92
92
  __exportStar(require("../entity/sports-entity.interface"), exports);
93
93
  __exportStar(require("../api/update-sports-interface"), exports);
94
+ __exportStar(require("./get-availability-by-turf.interface"), exports);
95
+ __exportStar(require("./get-tournament.interface"), exports);
@@ -5,4 +5,10 @@ export interface IListOfCouponsResponse {
5
5
  unit: {
6
6
  values: number[];
7
7
  };
8
+ perHourUnit: {
9
+ values: number[];
10
+ };
11
+ perHourPercentage: {
12
+ values: number[];
13
+ };
8
14
  }
@@ -0,0 +1,5 @@
1
+ export interface IConvertToMidNightTime {
2
+ hour: number;
3
+ minute: number;
4
+ second?: number;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -24,4 +24,6 @@ export interface IBookingDetailsEntity extends IEntityAuditColumn {
24
24
  amountPayable: number;
25
25
  refundPayable: number;
26
26
  totalRefundedAmount: number;
27
+ totalBookingHours: number;
28
+ type: string | null;
27
29
  }
@@ -1,3 +1,4 @@
1
+ import { BookingDetailsStatus } from "../../@enum";
1
2
  import { BookingHistoryOperationType } from "../../enums/booking-history-operation-type.enum";
2
3
  import { PaymentMode } from "../../enums/payment-mode.enum";
3
4
  import { IEntityAuditColumn } from "./entity-audit-column.interface";
@@ -28,4 +29,7 @@ export interface IBookingHistoryEntity extends IEntityAuditColumn {
28
29
  amountPayable: number;
29
30
  refundPayable: number;
30
31
  totalRefundedAmount: number;
32
+ type: string | null;
33
+ totalBookingHours: number;
34
+ status: BookingDetailsStatus;
31
35
  }
@@ -1,5 +1,6 @@
1
1
  import { BookingDetailsStatus, PaymentMode, UserType } from "../@enum";
2
- export interface IGetBookingById {
2
+ import { IBookingDetailsEntity } from "./entity";
3
+ export interface IGetBookingById extends Omit<IBookingDetailsEntity, "createdBy" | "updatedBy"> {
3
4
  id: number;
4
5
  customerName: string;
5
6
  contact: string;
@@ -8,8 +9,6 @@ export interface IGetBookingById {
8
9
  totalCost: number;
9
10
  discountedCost: number;
10
11
  amountPaid: number;
11
- createdOn: Date;
12
- updatedOn: Date;
13
12
  createdBy: {
14
13
  firstname: string;
15
14
  type: UserType;
@@ -9,4 +9,5 @@ export interface IChargeModel {
9
9
  amountPayable: number;
10
10
  totalRefundedAmount: number;
11
11
  couponCode: string;
12
+ totalBookingHours: number;
12
13
  }
@@ -0,0 +1,5 @@
1
+ export interface INgbDateStruct {
2
+ year: number;
3
+ month: number;
4
+ day: number;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -33,7 +33,7 @@ export declare class BookingCode {
33
33
  getCodeWithoutTurfCode(): string;
34
34
  static sortByCode(bookingCodes: BookingCode[]): void;
35
35
  static getOneSlotBookingCode(turfId: string, bookingDate: string, fhfm: string, thtm: string, pitchCode: string): string;
36
- static getDiscountedCost(couponCode: string, totalCost: number, validationApply?: boolean): number;
36
+ static getDiscountedCost(couponCode: string, totalCost: number, validationApply?: boolean, totalBookingHours?: number): number;
37
37
  static getDiscountAmount(couponCode: string, totalCost: number): number;
38
38
  static isValidDate(date: string): boolean;
39
39
  static parseDateCode(dateCode: string): Date;
@@ -70,6 +70,13 @@ export declare class BookingCode {
70
70
  }): string;
71
71
  static padBookingCode(bookingCodeWithoutTurfCode: string): string;
72
72
  static getInstance(turfId: number, bookingCodeWithoutTurfCode: string): BookingCode;
73
+ /**
74
+ * Extracts the numeric part of a bookingCode, excluding a predefined deleted slot separator.
75
+ *
76
+ * @param {string} bookingCode - The input bookingCode to extract from.
77
+ * @returns {string} The numeric part of the bookingCode.
78
+ */
79
+ static extractBookingCodeByDeletedSlotSeparator: (bookingCode: string) => string;
73
80
  getCost(): number;
74
81
  getTimeslot(): TimeSlot;
75
82
  static getIndianTimeZoneDate(bookingBufferOffsetHour?: number): Date;
@@ -86,4 +93,24 @@ export declare class BookingCode {
86
93
  formatDateAndTime(formateDateAndTime: IFormateDateAndTime): string;
87
94
  static timeFormatter(timeFormatter: ITimeFormatter): string;
88
95
  static dateFormatter(dateFormatter: IDateFormatter): string;
96
+ /**
97
+ * Calculates the total time difference between two date codes.
98
+ * @param unit - Optional. Specifies the unit of time for the result. Valid values are "minute" or "hr". Defaults to "minute" if not provided.
99
+ * @returns The total time difference in the specified unit (minutes or hours) between the "from" and "to" date codes.
100
+ */
101
+ getTotalTime(unit?: "minute" | "hr"): number;
102
+ /**
103
+ * Gets the date codes across a time range.
104
+ *
105
+ * @returns An object containing the date codes for the from and to time.
106
+ * @description
107
+ * The `fromDateCode` is generated by combining the current instance's `dateCode` and `fromTimeCode`.
108
+ * The `toDateCode` is generated based on the `fromTimeCode` and `toTimeCode`. If `fromTimeCode` is greater
109
+ * than `toTimeCode`, it adds one day to the current instance's `dateCode`.
110
+ */
111
+ getAcrossDateCodes(): {
112
+ fromDateCode: string;
113
+ toDateCode: string;
114
+ };
115
+ static getTotalTimeByBookingCodes(bookingCodes: BookingCode[]): number;
89
116
  }
@@ -17,6 +17,7 @@ var charge_model_1 = require("./charge-model");
17
17
  var app_badrequest_exception_1 = require("../exceptions/app-badrequest.exception");
18
18
  var date_util_1 = require("../utils/date-util");
19
19
  var date_fns_1 = require("date-fns");
20
+ var _utils_1 = require("../@utils");
20
21
  var BookingCode = /** @class */ (function () {
21
22
  function BookingCode(code, cost) {
22
23
  if (cost === void 0) { cost = "-1"; }
@@ -116,12 +117,20 @@ var BookingCode = /** @class */ (function () {
116
117
  var code = turfId + bookingDate + fhfm + thtm + pitchCode;
117
118
  return code;
118
119
  };
119
- BookingCode.getDiscountedCost = function (couponCode, totalCost, validationApply) {
120
+ BookingCode.getDiscountedCost = function (couponCode, totalCost, validationApply, totalBookingHours) {
120
121
  if (validationApply === void 0) { validationApply = true; }
121
122
  var discount = 0;
122
123
  var discountedCost = 0;
123
124
  if (couponCode) {
124
- if (couponCode.endsWith("P")) {
125
+ var code = _utils_1.stringUtil.getCouponDetails(couponCode).code;
126
+ var value = _utils_1.stringUtil.getCouponDetails(couponCode).value;
127
+ if (validationApply && !code && !value) {
128
+ throw new app_badrequest_exception_1.AppBadRequestException({
129
+ key: "couponCode",
130
+ message: ["Coupon with code ".concat(couponCode, " is wrong ")],
131
+ });
132
+ }
133
+ if (code === "P" || code === "PHP") {
125
134
  var percentDiscount = parseFloat(couponCode);
126
135
  if (validationApply) {
127
136
  if (percentDiscount > 90) {
@@ -133,9 +142,20 @@ var BookingCode = /** @class */ (function () {
133
142
  }
134
143
  discount = totalCost * (percentDiscount / 100);
135
144
  }
136
- else if (couponCode.endsWith("U")) {
145
+ else if (code === "U") {
137
146
  discount = parseFloat(couponCode);
138
147
  }
148
+ else if (code === "PHU") {
149
+ if (totalBookingHours === undefined) {
150
+ throw new app_badrequest_exception_1.AppBadRequestException({
151
+ key: "totalBookingHours",
152
+ message: [
153
+ "Total Booking Hours is mandatory to calculate per hour unit",
154
+ ],
155
+ });
156
+ }
157
+ discount = parseFloat(couponCode) * totalBookingHours;
158
+ }
139
159
  }
140
160
  discountedCost = totalCost - discount;
141
161
  return Math.round(discountedCost);
@@ -504,6 +524,49 @@ var BookingCode = /** @class */ (function () {
504
524
  var dateFormat = dateFormatter.dateFormat, dateCode = dateFormatter.dateCode;
505
525
  return (0, date_fns_1.format)(BookingCode.convertToDate(dateCode), dateFormat);
506
526
  };
527
+ /**
528
+ * Calculates the total time difference between two date codes.
529
+ * @param unit - Optional. Specifies the unit of time for the result. Valid values are "minute" or "hr". Defaults to "minute" if not provided.
530
+ * @returns The total time difference in the specified unit (minutes or hours) between the "from" and "to" date codes.
531
+ */
532
+ BookingCode.prototype.getTotalTime = function (unit) {
533
+ if (unit === void 0) { unit = "minute"; }
534
+ return date_util_1.dateUtilService.calculateDateDifference(this.getAcrossDateCodes().fromDateCode, this.getAcrossDateCodes().toDateCode, unit);
535
+ };
536
+ /**
537
+ * Gets the date codes across a time range.
538
+ *
539
+ * @returns An object containing the date codes for the from and to time.
540
+ * @description
541
+ * The `fromDateCode` is generated by combining the current instance's `dateCode` and `fromTimeCode`.
542
+ * The `toDateCode` is generated based on the `fromTimeCode` and `toTimeCode`. If `fromTimeCode` is greater
543
+ * than `toTimeCode`, it adds one day to the current instance's `dateCode`.
544
+ */
545
+ BookingCode.prototype.getAcrossDateCodes = function () {
546
+ var fromDateCode = "".concat(this.dateCode).concat(this.fromTimeCode);
547
+ var toDateCode = "".concat(this.fromTimeCode > this.toTimeCode
548
+ ? date_util_1.dateUtilService.addNDaysToDateCode(this.dateCode, 1)
549
+ : this.dateCode).concat(this.toTimeCode);
550
+ return { fromDateCode: fromDateCode, toDateCode: toDateCode };
551
+ };
552
+ BookingCode.getTotalTimeByBookingCodes = function (bookingCodes) {
553
+ var totalBookingHours = 0;
554
+ bookingCodes.forEach(function (bookingCode) {
555
+ totalBookingHours += new BookingCode(bookingCode.code).getTotalTime("hr");
556
+ });
557
+ return totalBookingHours;
558
+ };
559
+ /**
560
+ * Extracts the numeric part of a bookingCode, excluding a predefined deleted slot separator.
561
+ *
562
+ * @param {string} bookingCode - The input bookingCode to extract from.
563
+ * @returns {string} The numeric part of the bookingCode.
564
+ */
565
+ BookingCode.extractBookingCodeByDeletedSlotSeparator = function (bookingCode) {
566
+ return bookingCode.startsWith(_utils_1.DELETED_SLOT_SEPARATOR)
567
+ ? bookingCode.slice(_utils_1.DELETED_SLOT_SEPARATOR.length)
568
+ : bookingCode;
569
+ };
507
570
  return BookingCode;
508
571
  }());
509
572
  exports.BookingCode = BookingCode;
@@ -11,14 +11,15 @@ export declare class ChargesModel implements IChargeModel {
11
11
  amountPaid: number;
12
12
  amountPayable: number;
13
13
  totalRefundedAmount: number;
14
+ totalBookingHours: number;
14
15
  couponCode: string;
15
16
  discountPolicy: ModificationDiscountPolicy;
16
- constructor(initialGrossAmount: number, paidAmount: number, couponCode: string, discountPolicy: ModificationDiscountPolicy);
17
+ constructor(initialGrossAmount: number, paidAmount: number, couponCode: string, totalBookingHours: number, discountPolicy: ModificationDiscountPolicy);
17
18
  getGrossAmount(): number;
18
19
  getNetAmount(): number;
19
20
  getDiscountAmount(): number;
20
21
  getPayableRefundAmount(): number;
21
- static getDiscountAmount(couponCode: string, totalCost: number, validationApply?: boolean): number;
22
+ static getDiscountAmount(couponCode: string, totalCost: number, validationApply?: boolean, totalBookingHours?: number): number;
22
23
  setValues(values?: Partial<ChargesModel>): ChargesModel;
23
24
  modify(bookingModification: IBookingModification): ChargesModel | null;
24
25
  private modifyExtend;
@@ -27,7 +28,6 @@ export declare class ChargesModel implements IChargeModel {
27
28
  clone(): ChargesModel;
28
29
  private modifyDelete;
29
30
  static getInstance(chargeData: IChargeModel, discountPolicy?: ModificationDiscountPolicy): ChargesModel;
30
- static assignByInterface(chargeData: IChargeModel, discountPolicy?: ModificationDiscountPolicy): ChargesModel;
31
31
  getTotalAmount(): number;
32
32
  getPaymentStatus(): "Refund" | "Paid" | "Pending";
33
33
  getTotalNetAmount(): number;