turf-common 1.0.1 → 1.0.2

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 (38) hide show
  1. package/README.md +11 -0
  2. package/build/enums/modification-discount-policy.enum.d.ts +5 -0
  3. package/build/enums/modification-discount-policy.enum.js +9 -0
  4. package/build/exceptions/app-badrequest.exception.d.ts +5 -0
  5. package/build/exceptions/app-badrequest.exception.js +28 -0
  6. package/build/index.d.ts +8 -1
  7. package/build/index.js +22 -5
  8. package/build/interface/get-booking-codes-per-thirty-min.interface.d.ts +4 -0
  9. package/build/interface/get-booking-codes-per-thirty-min.interface.js +2 -0
  10. package/build/models/booking-code-model.d.ts +72 -0
  11. package/build/models/booking-code-model.js +414 -0
  12. package/build/models/charge-model.d.ts +44 -0
  13. package/build/models/charge-model.js +227 -0
  14. package/build/models/time-slot-model.d.ts +18 -0
  15. package/build/models/time-slot-model.js +95 -0
  16. package/build/modules/app-badrequest-exception-module/app-badrequest-exception-model.d.ts +5 -0
  17. package/build/modules/app-badrequest-exception-module/app-badrequest-exception-model.js +28 -0
  18. package/build/modules/app-badrequest-exception-module/types/app-badrequest-exception.type.d.ts +4 -0
  19. package/build/modules/app-badrequest-exception-module/types/app-badrequest-exception.type.js +2 -0
  20. package/build/modules/booking-module/booking-code-model.d.ts +71 -0
  21. package/build/modules/booking-module/booking-code-model.js +407 -0
  22. package/build/modules/booking-module/interfaces/get-booking-codes-per-thirty-min.interface.d.ts +4 -0
  23. package/build/modules/booking-module/interfaces/get-booking-codes-per-thirty-min.interface.js +2 -0
  24. package/build/modules/charge-module/charge-model.d.ts +44 -0
  25. package/build/modules/charge-module/charge-model.js +227 -0
  26. package/build/modules/charge-module/enums/modification-discount-policy.enum.d.ts +5 -0
  27. package/build/modules/charge-module/enums/modification-discount-policy.enum.js +9 -0
  28. package/build/modules/charge-module/types/booking-modification.type.d.ts +6 -0
  29. package/build/modules/charge-module/types/booking-modification.type.js +2 -0
  30. package/build/modules/date-module/date-code-model.d.ts +8 -0
  31. package/build/modules/date-module/date-code-model.js +38 -0
  32. package/build/modules/time-slot-module/time-slot-model.d.ts +18 -0
  33. package/build/modules/time-slot-module/time-slot-model.js +95 -0
  34. package/build/types/app-badrequest-exception.type.d.ts +4 -0
  35. package/build/types/app-badrequest-exception.type.js +2 -0
  36. package/build/types/booking-modification.type.d.ts +6 -0
  37. package/build/types/booking-modification.type.js +2 -0
  38. package/package.json +3 -3
@@ -0,0 +1,407 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.BookingCode = void 0;
15
+ var time_slot_model_1 = require("../time-slot-module/time-slot-model");
16
+ var charge_model_1 = require("../charge-module/charge-model");
17
+ var date_code_model_1 = require("../date-module/date-code-model");
18
+ var app_badrequest_exception_model_1 = require("../app-badrequest-exception-module/app-badrequest-exception-model");
19
+ var BookingCode = /** @class */ (function () {
20
+ function BookingCode(code, cost) {
21
+ if (cost === void 0) { cost = "-1"; }
22
+ // this.id = turfid;
23
+ if (code.length === 18)
24
+ this.code = code + "00";
25
+ else
26
+ this.code = code;
27
+ this.cost = cost;
28
+ this.parse();
29
+ }
30
+ BookingCode.prototype.parse = function () {
31
+ var regexp = /(\d{4})(\d{6})(\d{8})(\d{2})/g;
32
+ var matches = regexp.exec(this.code);
33
+ if (!matches) {
34
+ throw new Error("Booking slot ".concat(this.code, " is invalid"));
35
+ }
36
+ this.turfid = matches[1];
37
+ this.date = matches[2];
38
+ this.slot = matches[3];
39
+ this.fromTime = matches[3].slice(0, 4);
40
+ this.toTime = matches[3].slice(4, 8);
41
+ this.pitchCode = matches[4];
42
+ return this;
43
+ };
44
+ BookingCode.prototype.getBookingTimeInMinutes = function () {
45
+ //from HHMM to HHMM
46
+ var fromHours = parseInt(this.fromTime.slice(0, 2));
47
+ var fromMinutes = parseInt(this.fromTime.slice(2, 4));
48
+ var toHours = parseInt(this.toTime.slice(0, 2));
49
+ var toMinutes = parseInt(this.toTime.slice(2, 4));
50
+ return toHours * 60 + toMinutes - (fromHours * 60 + fromMinutes);
51
+ };
52
+ BookingCode.prototype.getPitchNo = function () {
53
+ return parseInt(this.pitchCode);
54
+ };
55
+ BookingCode.prototype.getHalfHourTimeCodes = function () {
56
+ return new time_slot_model_1.TimeSlot(this.fromTime, this.toTime).getHalfHourTimeCodes();
57
+ };
58
+ /**
59
+ *
60
+ * @returns {Array<string>} - List of half hour time slot codes between start time & end time inclusive
61
+ * @example fromTime: 0000; toTime: 0130
62
+ * // returns ['00000030','00300100','01000130']
63
+ */
64
+ BookingCode.prototype.getHalfHourTimeRangeCodes = function () {
65
+ var halfHourCodes = this.getHalfHourTimeCodes();
66
+ var halfHourRangeCodes = [];
67
+ for (var index = 0; index < halfHourCodes.length - 1; index++) {
68
+ halfHourRangeCodes.push(halfHourCodes[index] + halfHourCodes[index + 1]);
69
+ }
70
+ return halfHourRangeCodes;
71
+ };
72
+ BookingCode.prototype.getValidDate = function () {
73
+ // Date format: YYMMDD
74
+ function getDate(dateString) {
75
+ var separators = ["\\.", "\\-", "\\/"];
76
+ var stringBits = dateString.split(new RegExp(separators.join("|"), "g"));
77
+ var intBits = stringBits.map(function (bit) { return parseInt(bit); });
78
+ return new Date(intBits[0], intBits[1] - 1, intBits[2]);
79
+ }
80
+ return getDate("20".concat(this.date.slice(0, 2), ".").concat(this.date.slice(2, 4), ".").concat(this.date.slice(4, 6)));
81
+ };
82
+ BookingCode.prototype.getDateCode = function () {
83
+ var date = this.getValidDate();
84
+ return "".concat(date.getFullYear() % 2000).concat((date.getMonth() + 1)
85
+ .toString()
86
+ .padStart(2, "0")).concat(date.getDate().toString().padStart(2, "0"));
87
+ };
88
+ BookingCode.prototype.getWeekday = function () {
89
+ var dateObj = new Date(2000 + parseInt(this.date.slice(0, 2)), // Year
90
+ parseInt(this.date.toString().slice(2, 4)) - 1, // Month (0-indexed)
91
+ parseInt(this.date.toString().slice(4, 6)) // Day
92
+ );
93
+ return dateObj.getDay() === 0 ? 7 : dateObj.getDay();
94
+ // return weekday;
95
+ };
96
+ BookingCode.prototype.getMonthCode = function () {
97
+ return this.date.slice(0, 4);
98
+ };
99
+ BookingCode.prototype.getDateWithFromTimeCode = function () {
100
+ return "".concat(this.date).concat(this.fromTime);
101
+ };
102
+ BookingCode.prototype.getCodeWithoutTurfCode = function () {
103
+ return "".concat(this.date).concat(this.slot).concat(this.pitchCode);
104
+ };
105
+ BookingCode.sortByCode = function (bookingCodes) {
106
+ bookingCodes.sort(function (_a, _b) {
107
+ var code1 = _a.code;
108
+ var code2 = _b.code;
109
+ return code1 < code2 ? -1 : code1 > code2 ? 1 : 0;
110
+ });
111
+ };
112
+ // code: TTTTYYMMDDFHFMTHTMPP;
113
+ BookingCode.getOneSlotBookingCode = function (turfId, bookingDate, fhfm, thtm, pitchCode) {
114
+ var code = turfId + bookingDate + fhfm + thtm + pitchCode;
115
+ return code;
116
+ };
117
+ BookingCode.getDiscountedCost = function (couponCode, totalCost, validationApply) {
118
+ if (validationApply === void 0) { validationApply = true; }
119
+ var discount = 0;
120
+ var discountedCost = 0;
121
+ if (couponCode) {
122
+ if (couponCode.endsWith("P")) {
123
+ var percentDiscount = parseFloat(couponCode);
124
+ if (validationApply) {
125
+ if (percentDiscount > 90) {
126
+ throw new app_badrequest_exception_model_1.AppBadRequestException({
127
+ key: "couponCode",
128
+ message: ["Discount should not be more than 90P"],
129
+ });
130
+ }
131
+ }
132
+ discount = totalCost * (percentDiscount / 100);
133
+ }
134
+ else if (couponCode.endsWith("U")) {
135
+ discount = parseFloat(couponCode);
136
+ }
137
+ }
138
+ discountedCost = totalCost - discount;
139
+ return Math.round(discountedCost);
140
+ };
141
+ BookingCode.getDiscountAmount = function (couponCode, totalCost) {
142
+ return charge_model_1.ChargesModel.getDiscountAmount(couponCode, totalCost, true);
143
+ };
144
+ //-----------------
145
+ BookingCode.isValidDate = function (date) {
146
+ // Date format: YYMMDD
147
+ function isDate(dateString) {
148
+ var separators = ["\\.", "\\-", "\\/"];
149
+ var stringBits = dateString.split(new RegExp(separators.join("|"), "g"));
150
+ var intBits = stringBits.map(function (bit) { return parseInt(bit); });
151
+ var parsedDate = new Date(intBits[0], intBits[1] - 1, intBits[2]);
152
+ return (parsedDate.getFullYear() === intBits[0] &&
153
+ parsedDate.getMonth() + 1 === intBits[1] &&
154
+ parsedDate.getDate() === intBits[2]);
155
+ }
156
+ return isDate("20".concat(date.slice(0, 2), ".").concat(date.slice(2, 4), ".").concat(date.slice(4, 6)));
157
+ };
158
+ BookingCode.parseDateCode = function (dateCode) {
159
+ // Date format: YYMMDD
160
+ function getDate(dateString) {
161
+ var separators = ["\\.", "\\-", "\\/"];
162
+ var stringBits = dateString.split(new RegExp(separators.join("|"), "g"));
163
+ var intBits = stringBits.map(function (bit) { return parseInt(bit); });
164
+ return new Date(intBits[0], intBits[1] - 1, intBits[2]);
165
+ }
166
+ return getDate("20".concat(dateCode.slice(0, 2), ".").concat(dateCode.slice(2, 4), ".").concat(dateCode.slice(4, 6)));
167
+ };
168
+ //------------------
169
+ BookingCode.getWeekday = function (dateCode) {
170
+ var dateObj = new Date(2000 + parseInt(dateCode.toString().slice(0, 2)), // Year
171
+ parseInt(dateCode.toString().slice(2, 4)) - 1, // Month (0-indexed)
172
+ parseInt(dateCode.toString().slice(4, 6)) // Day
173
+ );
174
+ var weekday = dateObj.getDay();
175
+ return weekday === 0 ? 7 : weekday;
176
+ };
177
+ //---------------------
178
+ BookingCode.convertToDate = function (str) {
179
+ var year = parseInt(20 + str.slice(0, 2));
180
+ var month = parseInt(str.slice(2, 4)) - 1;
181
+ var day = parseInt(str.slice(4, 6));
182
+ var date = new Date(Date.UTC(year, month, day, 0, 0, 0));
183
+ return date;
184
+ };
185
+ //---------------------
186
+ BookingCode.previousDateChecker = function (fromDate, index, errorKey) {
187
+ var slotDate = this.convertToDate(fromDate.toString());
188
+ var currentDateObj = new Date();
189
+ var parsedDate = this.dateFormat([slotDate]);
190
+ var currentDate = this.dateFormat([currentDateObj]);
191
+ if (parsedDate < currentDate) {
192
+ throw new app_badrequest_exception_model_1.AppBadRequestException({
193
+ key: errorKey !== null && errorKey !== void 0 ? errorKey : "slot.".concat(index),
194
+ message: ["date must be present Date or future Date"],
195
+ });
196
+ }
197
+ else if (parsedDate === currentDate) {
198
+ return;
199
+ }
200
+ };
201
+ //---------------------
202
+ BookingCode.previousTimeChecker = function (fromTime, fromDate, index) {
203
+ var now = new Date();
204
+ this.convertToDate(fromDate.toString());
205
+ var delayInBooking = 15;
206
+ if (this.convertToDate(fromDate.toString()) > now) {
207
+ return; //do nothing if fromDate is in future
208
+ }
209
+ else if (this.convertToDate(fromDate.toString()) <= now) {
210
+ now.setMinutes(now.getMinutes() - delayInBooking); // 15minutes buffer for late bookings
211
+ var options = {
212
+ timeZone: "Asia/Kolkata",
213
+ };
214
+ var timeFormat = new Intl.DateTimeFormat("en-US", __assign(__assign({}, options), { hour: "2-digit", minute: "2-digit", hour12: false }));
215
+ var currentTimeObj = timeFormat.format(now).replace(/:/g, "");
216
+ if (fromTime < currentTimeObj) {
217
+ throw new app_badrequest_exception_model_1.AppBadRequestException({
218
+ key: "slot.".concat(index),
219
+ message: ["Booking time should be in future"],
220
+ });
221
+ }
222
+ }
223
+ };
224
+ //---------------------
225
+ BookingCode.getDateCodesByWeek = function (fromDate, toDate, selectedWeekday) {
226
+ return BookingCode.dateFormat(BookingCode.getDatesByWeek(fromDate, toDate, selectedWeekday));
227
+ };
228
+ BookingCode.getDatesByWeek = function (fromDate, toDate, selectedWeekday) {
229
+ if (!BookingCode.isValidDate(fromDate.toString()) ||
230
+ !BookingCode.isValidDate(toDate.toString())) {
231
+ throw new app_badrequest_exception_model_1.AppBadRequestException({
232
+ key: "Date",
233
+ message: ["Invalid Date"],
234
+ });
235
+ }
236
+ if (selectedWeekday < 0 || selectedWeekday > 7) {
237
+ throw new app_badrequest_exception_model_1.AppBadRequestException({
238
+ key: "weekday",
239
+ message: ["weekday should be between 1-7"],
240
+ });
241
+ }
242
+ var startDate = BookingCode.convertToDate(fromDate.toString());
243
+ var endDate = BookingCode.convertToDate(toDate.toString());
244
+ var currentDate = startDate;
245
+ var dates = [];
246
+ while (currentDate <= endDate) {
247
+ var weekday = currentDate.getDay();
248
+ if (weekday === selectedWeekday % 7) {
249
+ dates.push(new Date(currentDate.getTime()));
250
+ currentDate.setDate(currentDate.getDate() + 7);
251
+ }
252
+ else {
253
+ currentDate.setDate(currentDate.getDate() + 1);
254
+ }
255
+ }
256
+ return dates;
257
+ };
258
+ //--------------------
259
+ BookingCode.isValidTimeRange = function (timeSlot) {
260
+ var timeformat = /^(([01]\d|2[0-3])([0-5]\d|60)|2400|0000)$/;
261
+ var isValidTime = timeformat.test(timeSlot) && parseInt(timeSlot, 10) <= 2400;
262
+ return isValidTime;
263
+ };
264
+ //---------------------
265
+ BookingCode.dateFormat = function (dates) {
266
+ var codes = [];
267
+ for (var _i = 0, dates_1 = dates; _i < dates_1.length; _i++) {
268
+ var date = dates_1[_i];
269
+ var dateYear = date.getFullYear() % 2000;
270
+ var dateMonth = date.getMonth() + 1;
271
+ var dateDay = date.getDate();
272
+ var dateFormat = dateYear.toString() +
273
+ dateMonth.toString().padStart(2, "0") +
274
+ dateDay.toString().padStart(2, "0");
275
+ codes.push(dateFormat);
276
+ }
277
+ return codes;
278
+ };
279
+ BookingCode.getDateCode = function (date) {
280
+ return "".concat(date.getFullYear() % 2000).concat((date.getMonth() + 1)
281
+ .toString()
282
+ .padStart(2, "0")).concat(date.getDate().toString().padStart(2, "0"));
283
+ };
284
+ /**
285
+ * Returns list of month codes (YYMM) in the Date range inclusive
286
+ * @param {Date} from - Start Date
287
+ * @param {Date} to - End Date
288
+ * @return {Array<Number>} - The array of month codes (YYMM)
289
+ */
290
+ BookingCode.getMonthCodesRange = function (from, to) {
291
+ from = new Date(from.getTime());
292
+ to = new Date(to.getTime());
293
+ var monthCodes = [];
294
+ while (from < to) {
295
+ var fromDateCode = BookingCode.getDateCode(from);
296
+ monthCodes.push(parseInt("".concat(fromDateCode.slice(0, 4))));
297
+ from.setMonth(from.getMonth() + 1);
298
+ }
299
+ var toDateCode = BookingCode.getDateCode(to);
300
+ if (!monthCodes.includes(parseInt("".concat(toDateCode.slice(0, 4))))) {
301
+ monthCodes.push(parseInt("".concat(toDateCode.slice(0, 4))));
302
+ }
303
+ return monthCodes;
304
+ };
305
+ BookingCode.getNMonthCodes = function (n) {
306
+ var now = new Date();
307
+ var future = new Date(now.getTime());
308
+ future.setMonth(now.getMonth() + n);
309
+ return BookingCode.getMonthCodesRange(now, future);
310
+ };
311
+ BookingCode.getCodes = function (fromDate, toDate, weekday, turfId, from, to) {
312
+ // const {fromDate, toDate, weekday, turfId, from, to} = bookingSlot
313
+ var dates = this.getDateCodesByWeek(fromDate, toDate, weekday);
314
+ // TTTTYYMMDDFFFFTTTT
315
+ var codes = [];
316
+ for (var _i = 0, dates_2 = dates; _i < dates_2.length; _i++) {
317
+ var date = dates_2[_i];
318
+ codes.push("".concat(turfId.toString().padStart(4, "0")).concat(date).concat(from).concat(to));
319
+ }
320
+ return codes;
321
+ };
322
+ //To check fromDate and toDate present in weekDays and return dateCode
323
+ BookingCode.getNextDayDateCode = function (dateCode) {
324
+ var nextDate = BookingCode.parseDateCode(dateCode.toString());
325
+ nextDate.setDate(nextDate.getDate() + 1);
326
+ return parseInt(BookingCode.getDateCode(nextDate));
327
+ };
328
+ BookingCode.prototype.getUtcDateWithTime = function (dateCodeWithTime) {
329
+ // const dateCodeWithTime = '2305131200';
330
+ var year = parseInt(dateCodeWithTime.slice(0, 2)) + 2000;
331
+ var month = parseInt(dateCodeWithTime.slice(2, 4)) - 1;
332
+ var day = parseInt(dateCodeWithTime.slice(4, 6));
333
+ var hours = parseInt(dateCodeWithTime.slice(6, 8));
334
+ var minutes = parseInt(dateCodeWithTime.slice(8, 10));
335
+ return new Date(Date.UTC(year, month, day, hours, minutes));
336
+ };
337
+ BookingCode.getUtcDateWithTime = function (dateCodeWithTime) {
338
+ // const dateCodeWithTime = '2305131200';
339
+ var year = parseInt(dateCodeWithTime.slice(0, 2)) + 2000;
340
+ var month = parseInt(dateCodeWithTime.slice(2, 4)) - 1;
341
+ var day = parseInt(dateCodeWithTime.slice(4, 6));
342
+ var hours = parseInt(dateCodeWithTime.slice(6, 8));
343
+ var minutes = parseInt(dateCodeWithTime.slice(8, 10));
344
+ return new Date(Date.UTC(year, month, day, hours, minutes));
345
+ };
346
+ BookingCode.prototype.getNoOfHoursDifference = function () {
347
+ var bookingDate = BookingCode.getUtcDateWithTime(this.getDateWithFromTimeCode());
348
+ var date = date_code_model_1.DateCode.getIndianTimeZoneDate();
349
+ var timeDifferenceMs = bookingDate.getTime() - date.getTime();
350
+ return timeDifferenceMs / (1000 * 60 * 60);
351
+ };
352
+ BookingCode.getBookingCodesPerThirtyMinutes = function (from, to, bookingDate) {
353
+ var bookingCodePerThirtyMinutes = [];
354
+ while (from < to) {
355
+ var lastDigit = from.slice(2, 4);
356
+ if (lastDigit == "00") {
357
+ var code = "".concat(from).concat((Number(from) + 30)
358
+ .toString()
359
+ .padStart(4, "0"));
360
+ bookingCodePerThirtyMinutes.push({
361
+ slotCodePerThirtyMinute: code,
362
+ bookingDate: bookingDate,
363
+ });
364
+ from = (Number(from) + 30).toString().padStart(4, "0");
365
+ }
366
+ else {
367
+ var code = "".concat(from).concat((Number(from) + 70)
368
+ .toString()
369
+ .padStart(4, "0"));
370
+ bookingCodePerThirtyMinutes.push({
371
+ slotCodePerThirtyMinute: code,
372
+ bookingDate: bookingDate,
373
+ });
374
+ from = (Number(from) + 70).toString().padStart(4, "0");
375
+ }
376
+ }
377
+ return bookingCodePerThirtyMinutes;
378
+ };
379
+ BookingCode.getCostPerThirtyMinutes = function (bookingCodePerThirtyMinutesPerSlot, pricePerThirtyMinutesData) {
380
+ var cost = [];
381
+ bookingCodePerThirtyMinutesPerSlot.forEach(function (slot) {
382
+ var weekDay = BookingCode.getWeekday(Number(slot.bookingDate));
383
+ var month = slot.bookingDate.slice(0, 4);
384
+ var monthWeekday = "".concat(month).concat(weekDay);
385
+ var price = pricePerThirtyMinutesData[monthWeekday][slot.slotCodePerThirtyMinute];
386
+ cost.push(price.toString());
387
+ });
388
+ return cost.join(",");
389
+ };
390
+ BookingCode.padBookingCode = function (bookingCodeWithoutTurfCode) {
391
+ return bookingCodeWithoutTurfCode.padStart(20, "0");
392
+ };
393
+ BookingCode.getInstance = function (turfId, bookingCodeWithoutTurfCode) {
394
+ return new BookingCode("".concat(turfId.toString().padStart(4, "0")).concat(bookingCodeWithoutTurfCode));
395
+ };
396
+ BookingCode.prototype.getCost = function () {
397
+ return this.cost
398
+ .split(",")
399
+ .map(function (a) { return parseInt(a); })
400
+ .reduce(function (a, b) { return a + b; }, 0);
401
+ };
402
+ BookingCode.prototype.getTimeslot = function () {
403
+ return new time_slot_model_1.TimeSlot(this.fromTime, this.toTime);
404
+ };
405
+ return BookingCode;
406
+ }());
407
+ exports.BookingCode = BookingCode;
@@ -0,0 +1,4 @@
1
+ export interface IGetBookingCodesPerThirtyMinutes {
2
+ slotCodePerThirtyMinute: string;
3
+ bookingDate: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,44 @@
1
+ import { BookingModification } from "./types/booking-modification.type";
2
+ import { ModificationDiscountPolicy } from "./enums/modification-discount-policy.enum";
3
+ export interface IChargeModel {
4
+ initialBookingGrossAmount: number;
5
+ additionalBookingGrossAmount: number;
6
+ cancelledBookingGrossAmount: number;
7
+ totalCancellationCharges: number;
8
+ refundPayable: number;
9
+ netTotal: number;
10
+ amountPaid: number;
11
+ amountPayable: number;
12
+ totalRefundedAmount: number;
13
+ couponCode: string;
14
+ }
15
+ export declare class ChargesModel implements IChargeModel {
16
+ initialBookingGrossAmount: number;
17
+ additionalBookingGrossAmount: number;
18
+ cancelledBookingGrossAmount: number;
19
+ totalCancellationCharges: number;
20
+ refundPayable: number;
21
+ netTotal: number;
22
+ amountPaid: number;
23
+ amountPayable: number;
24
+ totalRefundedAmount: number;
25
+ couponCode: string;
26
+ discountPolicy: ModificationDiscountPolicy;
27
+ constructor(initialGrossAmount: number, paidAmount: number, couponCode: string, discountPolicy: ModificationDiscountPolicy);
28
+ getGrossAmount(): number;
29
+ getNetAmount(): number;
30
+ getDiscountAmount(): number;
31
+ getPayableRefundAmount(): number;
32
+ static getDiscountAmount(couponCode: string, totalCost: number, validationApply?: boolean): number;
33
+ setValues(values?: Partial<ChargesModel>): ChargesModel;
34
+ modify(bookingModification: BookingModification): ChargesModel | null;
35
+ private modifyExtend;
36
+ private modifyReduce;
37
+ private modifyMove;
38
+ clone(): ChargesModel;
39
+ private modifyDelete;
40
+ static getInstanceByInterface(bookingDetailsEntity: IChargeModel, discountPolicy?: ModificationDiscountPolicy): ChargesModel;
41
+ static assignByInterface(bookingDetailsEntity: IChargeModel, discountPolicy?: ModificationDiscountPolicy): ChargesModel;
42
+ getTotalAmount(): number;
43
+ getPaymentStatus(): "Refund" | "Paid" | "Pending";
44
+ }