turf-common 1.2.1-beta.1 → 1.2.1-beta.10

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/build/@enum.d.ts CHANGED
@@ -22,3 +22,4 @@ 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";
package/build/@enum.js CHANGED
@@ -38,3 +38,4 @@ __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);
@@ -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,4 +1,6 @@
1
- import { IBookingDetailsWithBookingCodes } from "../../@type";
1
+ import { IBookingDetailsWithBookingCodes, IChargeModel } from "../../@type";
2
2
  import { IModifyEntity } from "../modify-entity.interface";
3
- export interface BookingDetailsData extends IModifyEntity<IBookingDetailsWithBookingCodes> {
3
+ export interface IBookingDetailsData extends IModifyEntity<IBookingDetailsWithBookingCodes>, IChargeModel {
4
+ code?: string;
5
+ slot_cost?: string;
4
6
  }
@@ -1,7 +1,6 @@
1
1
  import { IBookingModification } from "../types/booking-modification.type";
2
2
  import { ModificationDiscountPolicy } from "../enums/modification-discount-policy.enum";
3
3
  import { IChargeModel } from "../interface/model/charge-model.interface";
4
- import { BookingDetailsData, IGetBookingDetailsByIdResponse } from "../@type";
5
4
  export declare class ChargesModel implements IChargeModel {
6
5
  initialBookingGrossAmount: number;
7
6
  additionalBookingGrossAmount: number;
@@ -27,14 +26,8 @@ export declare class ChargesModel implements IChargeModel {
27
26
  private modifyMove;
28
27
  clone(): ChargesModel;
29
28
  private modifyDelete;
30
- static getInstanceByInterface(bookingDetailsEntity: IChargeModel, discountPolicy?: ModificationDiscountPolicy): ChargesModel;
31
- static assignByInterface(bookingDetailsEntity: IChargeModel, discountPolicy?: ModificationDiscountPolicy): ChargesModel;
29
+ static getInstance(chargeData: IChargeModel, discountPolicy?: ModificationDiscountPolicy): ChargesModel;
32
30
  getTotalAmount(): number;
33
31
  getPaymentStatus(): "Refund" | "Paid" | "Pending";
34
- static getInstance(data: Partial<ChargesModel>, discountPolicy?: ModificationDiscountPolicy): ChargesModel;
35
- static getInstanceByBookingDetailsData(bookingDetailsData: BookingDetailsData, discountPolicy?: ModificationDiscountPolicy): ChargesModel;
36
- static getInstanceByBookingDetailData(bookingDetailData: IGetBookingDetailsByIdResponse, discountPolicy?: ModificationDiscountPolicy): ChargesModel;
37
- static assignBookingDetailsData(existingData: Partial<ChargesModel>, bookingDetailsData: BookingDetailsData): Partial<ChargesModel>;
38
- static assignBookingDetailData(existingData: Partial<ChargesModel>, bookingDetailData: IGetBookingDetailsByIdResponse): Partial<ChargesModel>;
39
32
  getTotalNetAmount(): number;
40
33
  }
@@ -185,32 +185,38 @@ var ChargesModel = /** @class */ (function () {
185
185
  }
186
186
  return newChargeModel;
187
187
  };
188
- ChargesModel.getInstanceByInterface = function (bookingDetailsEntity, discountPolicy) {
188
+ ChargesModel.getInstance = function (chargeData, discountPolicy) {
189
189
  if (discountPolicy === void 0) { discountPolicy = modification_discount_policy_enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL; }
190
- var chargesModel = new ChargesModel(bookingDetailsEntity.initialBookingGrossAmount, bookingDetailsEntity.amountPaid, bookingDetailsEntity.couponCode, discountPolicy);
191
- Object.assign(chargesModel, bookingDetailsEntity);
190
+ var chargesModel = new ChargesModel(chargeData.initialBookingGrossAmount, chargeData.amountPaid, chargeData.couponCode, discountPolicy);
191
+ Object.assign(chargesModel, chargeData);
192
192
  return chargesModel;
193
193
  };
194
- ChargesModel.assignByInterface = function (bookingDetailsEntity, discountPolicy) {
195
- if (discountPolicy === void 0) { discountPolicy = modification_discount_policy_enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL; }
196
- var newChargeModel = new ChargesModel(bookingDetailsEntity.initialBookingGrossAmount, bookingDetailsEntity.amountPaid, bookingDetailsEntity.couponCode, discountPolicy);
197
- newChargeModel.additionalBookingGrossAmount =
198
- bookingDetailsEntity.additionalBookingGrossAmount;
199
- newChargeModel.initialBookingGrossAmount =
200
- bookingDetailsEntity.initialBookingGrossAmount;
201
- newChargeModel.cancelledBookingGrossAmount =
202
- bookingDetailsEntity.cancelledBookingGrossAmount;
203
- newChargeModel.refundPayable = bookingDetailsEntity.refundPayable;
204
- newChargeModel.totalRefundedAmount =
205
- bookingDetailsEntity.totalRefundedAmount;
206
- newChargeModel.amountPaid = bookingDetailsEntity.amountPaid;
207
- newChargeModel.totalCancellationCharges =
208
- bookingDetailsEntity.totalCancellationCharges;
209
- newChargeModel.netTotal = bookingDetailsEntity.netTotal;
210
- newChargeModel.couponCode = bookingDetailsEntity.couponCode;
211
- newChargeModel.amountPayable = bookingDetailsEntity.amountPayable;
212
- return newChargeModel;
213
- };
194
+ // static assignByInterface(
195
+ // chargeData: IChargeModel,
196
+ // discountPolicy: ModificationDiscountPolicy = ModificationDiscountPolicy.DISCOUNT_CONDITIONAL
197
+ // ): ChargesModel {
198
+ // const newChargeModel = new ChargesModel(
199
+ // chargeData.initialBookingGrossAmount,
200
+ // chargeData.amountPaid,
201
+ // chargeData.couponCode,
202
+ // discountPolicy
203
+ // );
204
+ // newChargeModel.additionalBookingGrossAmount =
205
+ // chargeData.additionalBookingGrossAmount;
206
+ // newChargeModel.initialBookingGrossAmount =
207
+ // chargeData.initialBookingGrossAmount;
208
+ // newChargeModel.cancelledBookingGrossAmount =
209
+ // chargeData.cancelledBookingGrossAmount;
210
+ // newChargeModel.refundPayable = chargeData.refundPayable;
211
+ // newChargeModel.totalRefundedAmount = chargeData.totalRefundedAmount;
212
+ // newChargeModel.amountPaid = chargeData.amountPaid;
213
+ // newChargeModel.totalCancellationCharges =
214
+ // chargeData.totalCancellationCharges;
215
+ // newChargeModel.netTotal = chargeData.netTotal;
216
+ // newChargeModel.couponCode = chargeData.couponCode;
217
+ // newChargeModel.amountPayable = chargeData.amountPayable;
218
+ // return newChargeModel;
219
+ // }
214
220
  ChargesModel.prototype.getTotalAmount = function () {
215
221
  return this.getNetAmount() + this.totalCancellationCharges;
216
222
  };
@@ -222,50 +228,6 @@ var ChargesModel = /** @class */ (function () {
222
228
  ? "Paid"
223
229
  : "Pending";
224
230
  };
225
- ChargesModel.getInstance = function (data, discountPolicy) {
226
- if (discountPolicy === void 0) { discountPolicy = modification_discount_policy_enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL; }
227
- var chargesModel = new ChargesModel(data.initialBookingGrossAmount, data.amountPaid, data.couponCode, discountPolicy);
228
- // set values
229
- Object.assign(chargesModel, data);
230
- return chargesModel;
231
- };
232
- ChargesModel.getInstanceByBookingDetailsData = function (bookingDetailsData, discountPolicy) {
233
- if (discountPolicy === void 0) { discountPolicy = modification_discount_policy_enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL; }
234
- var data = ChargesModel.assignBookingDetailsData({}, bookingDetailsData);
235
- var chargesModel = new ChargesModel(data.initialBookingGrossAmount, data.amountPaid, data.couponCode, discountPolicy);
236
- // set values
237
- Object.assign(chargesModel, data);
238
- return chargesModel;
239
- };
240
- ChargesModel.getInstanceByBookingDetailData = function (bookingDetailData, discountPolicy) {
241
- if (discountPolicy === void 0) { discountPolicy = modification_discount_policy_enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL; }
242
- var data = ChargesModel.assignBookingDetailData({}, bookingDetailData);
243
- var chargesModel = new ChargesModel(data.initialBookingGrossAmount, data.amountPaid, data.couponCode, discountPolicy);
244
- // set values
245
- Object.assign(chargesModel, data);
246
- return chargesModel;
247
- };
248
- ChargesModel.assignBookingDetailsData = function (existingData, bookingDetailsData) {
249
- Object.assign(existingData, bookingDetailsData);
250
- return existingData;
251
- };
252
- ChargesModel.assignBookingDetailData = function (existingData, bookingDetailData) {
253
- existingData.additionalBookingGrossAmount =
254
- bookingDetailData.additionalBookingGrossAmount;
255
- existingData.initialBookingGrossAmount =
256
- bookingDetailData.initialBookingGrossAmount;
257
- existingData.cancelledBookingGrossAmount =
258
- bookingDetailData.cancelledBookingGrossAmount;
259
- existingData.refundPayable = bookingDetailData.refundPayable;
260
- existingData.totalRefundedAmount = bookingDetailData.totalRefundedAmount;
261
- existingData.amountPaid = bookingDetailData.amountPaid;
262
- existingData.totalCancellationCharges =
263
- bookingDetailData.totalCancellationCharges;
264
- existingData.netTotal = bookingDetailData.netTotal;
265
- existingData.couponCode = bookingDetailData.couponCode;
266
- existingData.amountPayable = bookingDetailData.amountPayable;
267
- return existingData;
268
- };
269
231
  ChargesModel.prototype.getTotalNetAmount = function () {
270
232
  return this.getNetAmount() + this.totalCancellationCharges;
271
233
  };
@@ -14,6 +14,7 @@ declare class StringUtil {
14
14
  * @returns {string} - The formatted string with hyphens.
15
15
  */
16
16
  formatStringWithHyphens(inputString: string): string;
17
+ generateRandomPassword(): string;
17
18
  }
18
19
  export declare const stringUtil: StringUtil;
19
20
  export {};
@@ -24,6 +24,37 @@ var StringUtil = /** @class */ (function () {
24
24
  // Convert the input string to lowercase and replace spaces with hyphens
25
25
  return inputString.toLowerCase().replace(/\s+/g, "-");
26
26
  };
27
+ StringUtil.prototype.generateRandomPassword = function () {
28
+ var _a;
29
+ var alphabets = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
30
+ var numbers = "0123456789";
31
+ var specialChars = "!@#$%^&*?+";
32
+ function getRandomCharacter(characters) {
33
+ return characters[Math.floor(Math.random() * characters.length)];
34
+ }
35
+ var randomAlphabet = getRandomCharacter(alphabets);
36
+ var randomNumber = getRandomCharacter(numbers);
37
+ var randomSpecialChar = getRandomCharacter(specialChars);
38
+ var remainingCharacters = alphabets + alphabets.toLowerCase();
39
+ var randomRemainingChars = Array.from({ length: 3 }, function () {
40
+ return getRandomCharacter(remainingCharacters);
41
+ }).join("");
42
+ var passwordArray = [
43
+ randomAlphabet,
44
+ randomNumber,
45
+ randomSpecialChar,
46
+ randomRemainingChars,
47
+ ];
48
+ // Shuffle the password array
49
+ for (var i = passwordArray.length - 1; i > 0; i--) {
50
+ var j = Math.floor(Math.random() * (i + 1));
51
+ _a = [
52
+ passwordArray[j],
53
+ passwordArray[i],
54
+ ], passwordArray[i] = _a[0], passwordArray[j] = _a[1];
55
+ }
56
+ return passwordArray.join("");
57
+ };
27
58
  return StringUtil;
28
59
  }());
29
60
  exports.stringUtil = new StringUtil();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.2.1-beta.1",
3
+ "version": "1.2.1-beta.10",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -1 +0,0 @@
1
- export declare function FormatStringWithHyphens(inputString: string): string;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormatStringWithHyphens = void 0;
4
- function FormatStringWithHyphens(inputString) {
5
- return inputString.toLowerCase().replace(/\s+/g, "-");
6
- }
7
- exports.FormatStringWithHyphens = FormatStringWithHyphens;