turf-common 1.0.16-beta.14 → 1.0.16-beta.16
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/enums/booking-details-status.enum.d.ts +4 -0
- package/build/enums/booking-details-status.enum.js +8 -0
- package/build/enums/booking-history-operation-type.enum.d.ts +10 -0
- package/build/enums/booking-history-operation-type.enum.js +18 -0
- package/build/enums/payment-mode.enum.d.ts +4 -0
- package/build/enums/payment-mode.enum.js +8 -0
- package/build/enums/pricing-plan-status.enum copy.d.ts +4 -0
- package/build/enums/pricing-plan-status.enum copy.js +8 -0
- package/build/enums/pricing-plan-status.enum.d.ts +4 -0
- package/build/enums/pricing-plan-status.enum.js +8 -0
- package/build/enums/registration-status-enum.d.ts +12 -0
- package/build/enums/registration-status-enum.js +16 -0
- package/build/enums/user-status.enum.d.ts +11 -0
- package/build/enums/user-status.enum.js +15 -0
- package/build/enums/valid-type.enum.d.ts +6 -0
- package/build/enums/valid-type.enum.js +10 -0
- package/build/interface/billing-cycle.interface.d.ts +7 -0
- package/build/interface/billing-cycle.interface.js +2 -0
- package/build/interface/get-pricing-plan-by-date-response.interface copy.d.ts +23 -0
- package/build/interface/get-pricing-plan-by-date-response.interface copy.js +2 -0
- package/build/interface/get-pricing-plan-by-date-response.interface.d.ts +23 -0
- package/build/interface/get-pricing-plan-by-date-response.interface.js +2 -0
- package/build/interface/pitch-slab.interface copy.d.ts +5 -0
- package/build/interface/pitch-slab.interface copy.js +2 -0
- package/build/interface/pitch-slab.interface.d.ts +5 -0
- package/build/interface/pitch-slab.interface.js +2 -0
- package/build/interface/pricing-plan-model.interface.d.ts +15 -0
- package/build/interface/pricing-plan-model.interface.js +2 -0
- package/build/models/pitch-slab-model.d.ts +85 -0
- package/build/models/pitch-slab-model.js +184 -0
- package/build/types/bookingdetails-with-booking.type.d.ts +34 -0
- package/build/types/bookingdetails-with-booking.type.js +2 -0
- package/build/types/entity/booking-cancellation-entity.type.d.ts +32 -0
- package/build/types/entity/booking-cancellation-entity.type.js +2 -0
- package/build/types/entity/booking-customer-entity.type.d.ts +8 -0
- package/build/types/entity/booking-customer-entity.type.js +2 -0
- package/build/types/entity/booking-details-entity.type.d.ts +66 -0
- package/build/types/entity/booking-details-entity.type.js +69 -0
- package/build/types/entity/bookings-entity.type.d.ts +31 -0
- package/build/types/entity/bookings-entity.type.js +47 -0
- package/build/types/entity/cancellation-policy-entity.type.d.ts +27 -0
- package/build/types/entity/cancellation-policy-entity.type.js +32 -0
- package/build/types/entity/price-entity.type.d.ts +16 -0
- package/build/types/entity/price-entity.type.js +15 -0
- package/build/types/entity/pricing-plan-entity.d.ts +66 -0
- package/build/types/entity/pricing-plan-entity.js +126 -0
- package/build/types/entity/registration-entity.type.d.ts +12 -0
- package/build/types/entity/registration-entity.type.js +2 -0
- package/build/types/entity/user-entity.type.d.ts +52 -0
- package/build/types/entity/user-entity.type.js +19 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BookingDetailsStatus = void 0;
|
|
4
|
+
var BookingDetailsStatus;
|
|
5
|
+
(function (BookingDetailsStatus) {
|
|
6
|
+
BookingDetailsStatus["BOOKED"] = "booked";
|
|
7
|
+
BookingDetailsStatus["BLOCKED"] = "blocked";
|
|
8
|
+
})(BookingDetailsStatus || (exports.BookingDetailsStatus = BookingDetailsStatus = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum BookingHistoryOperationType {
|
|
2
|
+
DELETE = "delete",
|
|
3
|
+
UPDATE = "update",
|
|
4
|
+
INSERT = "insert",
|
|
5
|
+
DELETE_INSERT = "delete_insert",
|
|
6
|
+
DELETE_SLOT = "delete_slot",
|
|
7
|
+
REFUND = "refund",
|
|
8
|
+
PAYMENT = "payment"
|
|
9
|
+
}
|
|
10
|
+
export declare const operationTypes: BookingHistoryOperationType[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.operationTypes = exports.BookingHistoryOperationType = void 0;
|
|
4
|
+
var BookingHistoryOperationType;
|
|
5
|
+
(function (BookingHistoryOperationType) {
|
|
6
|
+
BookingHistoryOperationType["DELETE"] = "delete";
|
|
7
|
+
BookingHistoryOperationType["UPDATE"] = "update";
|
|
8
|
+
BookingHistoryOperationType["INSERT"] = "insert";
|
|
9
|
+
BookingHistoryOperationType["DELETE_INSERT"] = "delete_insert";
|
|
10
|
+
BookingHistoryOperationType["DELETE_SLOT"] = "delete_slot";
|
|
11
|
+
BookingHistoryOperationType["REFUND"] = "refund";
|
|
12
|
+
BookingHistoryOperationType["PAYMENT"] = "payment";
|
|
13
|
+
})(BookingHistoryOperationType || (exports.BookingHistoryOperationType = BookingHistoryOperationType = {}));
|
|
14
|
+
exports.operationTypes = [
|
|
15
|
+
BookingHistoryOperationType.DELETE,
|
|
16
|
+
BookingHistoryOperationType.REFUND,
|
|
17
|
+
BookingHistoryOperationType.PAYMENT,
|
|
18
|
+
];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentMode = void 0;
|
|
4
|
+
var PaymentMode;
|
|
5
|
+
(function (PaymentMode) {
|
|
6
|
+
PaymentMode["UPI"] = "upi";
|
|
7
|
+
PaymentMode["CASH"] = "cash";
|
|
8
|
+
})(PaymentMode || (exports.PaymentMode = PaymentMode = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PricingPlanStatus = void 0;
|
|
4
|
+
var PricingPlanStatus;
|
|
5
|
+
(function (PricingPlanStatus) {
|
|
6
|
+
PricingPlanStatus["ACTIVE"] = "active";
|
|
7
|
+
PricingPlanStatus["DEACTIVE"] = "deactive";
|
|
8
|
+
})(PricingPlanStatus || (exports.PricingPlanStatus = PricingPlanStatus = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PricingPlanStatus = void 0;
|
|
4
|
+
var PricingPlanStatus;
|
|
5
|
+
(function (PricingPlanStatus) {
|
|
6
|
+
PricingPlanStatus["ACTIVE"] = "active";
|
|
7
|
+
PricingPlanStatus["DEACTIVE"] = "deactive";
|
|
8
|
+
})(PricingPlanStatus || (exports.PricingPlanStatus = PricingPlanStatus = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum RegistrationStatus {
|
|
2
|
+
REGISTRATION = "registration",
|
|
3
|
+
REGISTRATION_INVALID = "registration_invalid",
|
|
4
|
+
REGISTRATION_APPROVED = "registration_approved",
|
|
5
|
+
SETUP_INVALID = "setup_invalid",
|
|
6
|
+
SETUP_DONE = "setup_done",
|
|
7
|
+
PAYMENT_INVALID = "payment_invalid",
|
|
8
|
+
PAYMENT_DONE = "payment_done",
|
|
9
|
+
ACCOUNT_ACTIVE = "account_active",
|
|
10
|
+
ACCOUNT_SUSPENDED = "account_suspended",
|
|
11
|
+
ACTIVE = "active"
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegistrationStatus = void 0;
|
|
4
|
+
var RegistrationStatus;
|
|
5
|
+
(function (RegistrationStatus) {
|
|
6
|
+
RegistrationStatus["REGISTRATION"] = "registration";
|
|
7
|
+
RegistrationStatus["REGISTRATION_INVALID"] = "registration_invalid";
|
|
8
|
+
RegistrationStatus["REGISTRATION_APPROVED"] = "registration_approved";
|
|
9
|
+
RegistrationStatus["SETUP_INVALID"] = "setup_invalid";
|
|
10
|
+
RegistrationStatus["SETUP_DONE"] = "setup_done";
|
|
11
|
+
RegistrationStatus["PAYMENT_INVALID"] = "payment_invalid";
|
|
12
|
+
RegistrationStatus["PAYMENT_DONE"] = "payment_done";
|
|
13
|
+
RegistrationStatus["ACCOUNT_ACTIVE"] = "account_active";
|
|
14
|
+
RegistrationStatus["ACCOUNT_SUSPENDED"] = "account_suspended";
|
|
15
|
+
RegistrationStatus["ACTIVE"] = "active";
|
|
16
|
+
})(RegistrationStatus || (exports.RegistrationStatus = RegistrationStatus = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum UserStatus {
|
|
2
|
+
ACTIVE = "active",
|
|
3
|
+
DEACTIVE = "deactive",
|
|
4
|
+
SUSPENDED = "suspended",
|
|
5
|
+
REGISTRATION_APPROVED = "registration_approved",
|
|
6
|
+
SETUP_INVALID = "setup_invalid",
|
|
7
|
+
PAYMENT_INVALID = "payment_invalid",
|
|
8
|
+
ACCOUNT_SUSPENDED = "account_suspended",
|
|
9
|
+
SETUP_DONE = "setup_done",
|
|
10
|
+
PAYMENT_DONE = "payment_done"
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserStatus = void 0;
|
|
4
|
+
var UserStatus;
|
|
5
|
+
(function (UserStatus) {
|
|
6
|
+
UserStatus["ACTIVE"] = "active";
|
|
7
|
+
UserStatus["DEACTIVE"] = "deactive";
|
|
8
|
+
UserStatus["SUSPENDED"] = "suspended";
|
|
9
|
+
UserStatus["REGISTRATION_APPROVED"] = "registration_approved";
|
|
10
|
+
UserStatus["SETUP_INVALID"] = "setup_invalid";
|
|
11
|
+
UserStatus["PAYMENT_INVALID"] = "payment_invalid";
|
|
12
|
+
UserStatus["ACCOUNT_SUSPENDED"] = "account_suspended";
|
|
13
|
+
UserStatus["SETUP_DONE"] = "setup_done";
|
|
14
|
+
UserStatus["PAYMENT_DONE"] = "payment_done";
|
|
15
|
+
})(UserStatus || (exports.UserStatus = UserStatus = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserType = void 0;
|
|
4
|
+
var UserType;
|
|
5
|
+
(function (UserType) {
|
|
6
|
+
UserType["STAFF"] = "staff";
|
|
7
|
+
UserType["OWNER"] = "owner";
|
|
8
|
+
UserType["SUPERADMIN"] = "superadmin";
|
|
9
|
+
UserType["BOT_USER"] = "bot_user";
|
|
10
|
+
})(UserType || (exports.UserType = UserType = {}));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface GetPricingPlanByDateResponse {
|
|
2
|
+
id: number;
|
|
3
|
+
effective_from_date: number;
|
|
4
|
+
effective_to_date: number;
|
|
5
|
+
base_price: number;
|
|
6
|
+
unit: string;
|
|
7
|
+
pitch_slab: {
|
|
8
|
+
[key: string]: {
|
|
9
|
+
from: number;
|
|
10
|
+
to: number;
|
|
11
|
+
discount: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
billing_cycle: {
|
|
15
|
+
[key: string]: {
|
|
16
|
+
from: number;
|
|
17
|
+
to: number;
|
|
18
|
+
discount: string;
|
|
19
|
+
name: string;
|
|
20
|
+
key: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface GetPricingPlanByDateResponse {
|
|
2
|
+
id: number;
|
|
3
|
+
effective_from_date: number;
|
|
4
|
+
effective_to_date: number;
|
|
5
|
+
base_price: number;
|
|
6
|
+
unit: string;
|
|
7
|
+
pitch_slab: {
|
|
8
|
+
[key: string]: {
|
|
9
|
+
from: number;
|
|
10
|
+
to: number;
|
|
11
|
+
discount: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
billing_cycle: {
|
|
15
|
+
[key: string]: {
|
|
16
|
+
from: number;
|
|
17
|
+
to: number;
|
|
18
|
+
discount: string;
|
|
19
|
+
name: string;
|
|
20
|
+
key: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IBillingCycle } from "./billing-cycle.interface";
|
|
2
|
+
import { IPitchSlab } from "./pitch-slab.interface";
|
|
3
|
+
export interface IPringPlanModel {
|
|
4
|
+
id: number;
|
|
5
|
+
effective_from_date: number;
|
|
6
|
+
effective_to_date: number;
|
|
7
|
+
base_price: number;
|
|
8
|
+
unit: string;
|
|
9
|
+
pitch_slab: {
|
|
10
|
+
[key: string]: IPitchSlab;
|
|
11
|
+
};
|
|
12
|
+
billing_cycle: {
|
|
13
|
+
[key: string]: IBillingCycle;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export interface PricingPlan {
|
|
2
|
+
id: number;
|
|
3
|
+
effective_from_date: number;
|
|
4
|
+
effective_to_date: number;
|
|
5
|
+
base_price: number;
|
|
6
|
+
unit: string;
|
|
7
|
+
pitch_slab: {
|
|
8
|
+
[key: string]: PitchSlab;
|
|
9
|
+
};
|
|
10
|
+
billing_cycle: {
|
|
11
|
+
[key: string]: BillingCycle;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface BillingCycle {
|
|
15
|
+
from: number;
|
|
16
|
+
to: number;
|
|
17
|
+
discount: string;
|
|
18
|
+
name: string;
|
|
19
|
+
key: string;
|
|
20
|
+
}
|
|
21
|
+
export interface PitchSlab {
|
|
22
|
+
from: number;
|
|
23
|
+
to: number;
|
|
24
|
+
discount: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class PricingPlanModel implements PricingPlan {
|
|
27
|
+
id: number;
|
|
28
|
+
effective_from_date: number;
|
|
29
|
+
effective_to_date: number;
|
|
30
|
+
base_price: number;
|
|
31
|
+
unit: string;
|
|
32
|
+
pitch_slab: {
|
|
33
|
+
[key: string]: PitchSlabModel;
|
|
34
|
+
};
|
|
35
|
+
billing_cycle: {
|
|
36
|
+
[key: string]: BillingCycleModel;
|
|
37
|
+
};
|
|
38
|
+
constructor(data: PricingPlan);
|
|
39
|
+
getPitchSlab(pitchCount: number): PitchSlabModel;
|
|
40
|
+
getBillingCycle(billingCycleKey: string): BillingCycleModel;
|
|
41
|
+
getMonth(billingCycleKey: string): number;
|
|
42
|
+
getNoOfSubscriptionDays(billingCycleKey: string): number;
|
|
43
|
+
getBillingCycleKeys(): string[];
|
|
44
|
+
validateBillingCycleKey(billingCycleKey: string): void;
|
|
45
|
+
getBillingCycleByDay(numberOfDay: number): BillingCycleModel | undefined;
|
|
46
|
+
}
|
|
47
|
+
export declare class SubscribedPricingPlanModel extends PricingPlanModel {
|
|
48
|
+
pitchCount: number;
|
|
49
|
+
billingCycle: string;
|
|
50
|
+
selectedPitchSlab: PitchSlabModel;
|
|
51
|
+
selectedBillingCycle: BillingCycleModel;
|
|
52
|
+
selectedPitchSlabBasePrice: number;
|
|
53
|
+
hourInMonth: number;
|
|
54
|
+
months: number | undefined;
|
|
55
|
+
constructor(data: PricingPlan, pitchCount: number, billingCycle: string);
|
|
56
|
+
getMonths(): number;
|
|
57
|
+
getBasePrice(): number;
|
|
58
|
+
getGrossAmount(): number;
|
|
59
|
+
getNetAmount(): number;
|
|
60
|
+
getBillingDiscount(): number;
|
|
61
|
+
getMonthDifference(that: SubscribedPricingPlanModel): number;
|
|
62
|
+
getGrossAmountByMonth(month: number): number;
|
|
63
|
+
getNetAmountByMonth(month: number): number;
|
|
64
|
+
getGrossAmountByPitchDays(pitchCount: number, days: number): number;
|
|
65
|
+
getNetAmountByPitchDays(pitchCount: number, days: number): number;
|
|
66
|
+
getGrossAmountByPitchDaysBasePrice(basePrice: number, pitchCount: number, days: number): number;
|
|
67
|
+
getNetAmountByPitchDaysBasePrice(basePrice: number, pitchCount: number, days: number): number;
|
|
68
|
+
}
|
|
69
|
+
export declare class BillingCycleModel implements BillingCycle {
|
|
70
|
+
from: number;
|
|
71
|
+
to: number;
|
|
72
|
+
discount: string;
|
|
73
|
+
name: string;
|
|
74
|
+
key: string;
|
|
75
|
+
constructor(data: BillingCycle);
|
|
76
|
+
getDiscount(): number;
|
|
77
|
+
}
|
|
78
|
+
export declare class PitchSlabModel implements PitchSlab {
|
|
79
|
+
from: number;
|
|
80
|
+
to: number;
|
|
81
|
+
discount: string;
|
|
82
|
+
constructor(data: PitchSlab);
|
|
83
|
+
getDiscount(): number;
|
|
84
|
+
getBasePrice(basePrice: number): number;
|
|
85
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.PitchSlabModel = exports.BillingCycleModel = exports.SubscribedPricingPlanModel = exports.PricingPlanModel = void 0;
|
|
19
|
+
var common_1 = require("@nestjs/common");
|
|
20
|
+
var PricingPlanModel = /** @class */ (function () {
|
|
21
|
+
function PricingPlanModel(data) {
|
|
22
|
+
var _this = this;
|
|
23
|
+
this.id = data.id;
|
|
24
|
+
this.effective_from_date = data.effective_from_date;
|
|
25
|
+
this.effective_to_date = data.effective_to_date;
|
|
26
|
+
this.base_price = data.base_price;
|
|
27
|
+
this.unit = data.unit;
|
|
28
|
+
this.pitch_slab = {};
|
|
29
|
+
this.billing_cycle = {};
|
|
30
|
+
Object.keys(data.pitch_slab).forEach(function (key) {
|
|
31
|
+
_this.pitch_slab[key] = new PitchSlabModel(data.pitch_slab[key]);
|
|
32
|
+
});
|
|
33
|
+
Object.keys(data.billing_cycle).forEach(function (key) {
|
|
34
|
+
_this.billing_cycle[key] = new BillingCycleModel(data.billing_cycle[key]);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
PricingPlanModel.prototype.getPitchSlab = function (pitchCount) {
|
|
38
|
+
var pitchRangesMap = this.pitch_slab;
|
|
39
|
+
var pitchRanges = Object.values(pitchRangesMap);
|
|
40
|
+
var selectedPitchSlab = pitchRanges.filter(function (pitchRange) {
|
|
41
|
+
return pitchRange.from <= pitchCount && pitchCount <= pitchRange.to;
|
|
42
|
+
})[0];
|
|
43
|
+
return selectedPitchSlab;
|
|
44
|
+
};
|
|
45
|
+
PricingPlanModel.prototype.getBillingCycle = function (billingCycleKey) {
|
|
46
|
+
var billingCycleMap = this.billing_cycle;
|
|
47
|
+
var billingCycles = Object.values(billingCycleMap);
|
|
48
|
+
var selectedBillingCycle = billingCycles.filter(function (_a) {
|
|
49
|
+
var key = _a.key;
|
|
50
|
+
return key === billingCycleKey;
|
|
51
|
+
})[0];
|
|
52
|
+
return selectedBillingCycle;
|
|
53
|
+
};
|
|
54
|
+
PricingPlanModel.prototype.getMonth = function (billingCycleKey) {
|
|
55
|
+
return this.getBillingCycle(billingCycleKey).to;
|
|
56
|
+
};
|
|
57
|
+
PricingPlanModel.prototype.getNoOfSubscriptionDays = function (billingCycleKey) {
|
|
58
|
+
return this.getBillingCycle(billingCycleKey).to * 30 - 1;
|
|
59
|
+
};
|
|
60
|
+
PricingPlanModel.prototype.getBillingCycleKeys = function () {
|
|
61
|
+
return Object.values(this.billing_cycle).map(function (obj) { return obj.key; });
|
|
62
|
+
};
|
|
63
|
+
PricingPlanModel.prototype.validateBillingCycleKey = function (billingCycleKey) {
|
|
64
|
+
if (!this.getBillingCycleKeys().includes(billingCycleKey)) {
|
|
65
|
+
throw new common_1.BadRequestException({
|
|
66
|
+
key: "type",
|
|
67
|
+
message: ["pricing plan type:'".concat(billingCycleKey, "' is not found")],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
PricingPlanModel.prototype.getBillingCycleByDay = function (numberOfDay) {
|
|
72
|
+
return Object.values(this.billing_cycle).find(function (obj) {
|
|
73
|
+
if (numberOfDay <= obj.to * 30) {
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
return PricingPlanModel;
|
|
79
|
+
}());
|
|
80
|
+
exports.PricingPlanModel = PricingPlanModel;
|
|
81
|
+
var SubscribedPricingPlanModel = /** @class */ (function (_super) {
|
|
82
|
+
__extends(SubscribedPricingPlanModel, _super);
|
|
83
|
+
function SubscribedPricingPlanModel(data, pitchCount, billingCycle) {
|
|
84
|
+
var _this = _super.call(this, data) || this;
|
|
85
|
+
_this.hourInMonth = 24 * 30;
|
|
86
|
+
_this.pitchCount = pitchCount;
|
|
87
|
+
_this.billingCycle = billingCycle;
|
|
88
|
+
_this.selectedPitchSlab = _this.getPitchSlab(_this.pitchCount);
|
|
89
|
+
_this.selectedBillingCycle = _this.getBillingCycle(_this.billingCycle);
|
|
90
|
+
_this.selectedPitchSlabBasePrice = _this.selectedPitchSlab.getBasePrice(_this.base_price);
|
|
91
|
+
return _this;
|
|
92
|
+
}
|
|
93
|
+
SubscribedPricingPlanModel.prototype.getMonths = function () {
|
|
94
|
+
return this.selectedBillingCycle.to;
|
|
95
|
+
};
|
|
96
|
+
SubscribedPricingPlanModel.prototype.getBasePrice = function () {
|
|
97
|
+
return this.selectedPitchSlabBasePrice;
|
|
98
|
+
};
|
|
99
|
+
SubscribedPricingPlanModel.prototype.getGrossAmount = function () {
|
|
100
|
+
return Math.round(this.selectedPitchSlabBasePrice *
|
|
101
|
+
this.pitchCount *
|
|
102
|
+
this.hourInMonth *
|
|
103
|
+
this.selectedBillingCycle.to);
|
|
104
|
+
};
|
|
105
|
+
SubscribedPricingPlanModel.prototype.getNetAmount = function () {
|
|
106
|
+
return Math.round(this.selectedPitchSlabBasePrice *
|
|
107
|
+
(1 - this.getBillingDiscount() / 100) *
|
|
108
|
+
this.pitchCount *
|
|
109
|
+
this.hourInMonth *
|
|
110
|
+
this.selectedBillingCycle.to);
|
|
111
|
+
};
|
|
112
|
+
SubscribedPricingPlanModel.prototype.getBillingDiscount = function () {
|
|
113
|
+
return this.selectedBillingCycle.getDiscount();
|
|
114
|
+
};
|
|
115
|
+
SubscribedPricingPlanModel.prototype.getMonthDifference = function (that) {
|
|
116
|
+
return that.getMonths() - this.getMonths();
|
|
117
|
+
};
|
|
118
|
+
SubscribedPricingPlanModel.prototype.getGrossAmountByMonth = function (month) {
|
|
119
|
+
return Math.round(this.selectedPitchSlabBasePrice *
|
|
120
|
+
this.pitchCount *
|
|
121
|
+
this.hourInMonth *
|
|
122
|
+
month);
|
|
123
|
+
};
|
|
124
|
+
SubscribedPricingPlanModel.prototype.getNetAmountByMonth = function (month) {
|
|
125
|
+
return Math.round(this.selectedPitchSlabBasePrice *
|
|
126
|
+
(1 - this.getBillingDiscount() / 100) *
|
|
127
|
+
this.pitchCount *
|
|
128
|
+
this.hourInMonth *
|
|
129
|
+
month);
|
|
130
|
+
};
|
|
131
|
+
SubscribedPricingPlanModel.prototype.getGrossAmountByPitchDays = function (pitchCount, days) {
|
|
132
|
+
return Math.round(this.selectedPitchSlabBasePrice * pitchCount * days * 24);
|
|
133
|
+
};
|
|
134
|
+
SubscribedPricingPlanModel.prototype.getNetAmountByPitchDays = function (pitchCount, days) {
|
|
135
|
+
return Math.round(this.selectedPitchSlabBasePrice *
|
|
136
|
+
(1 - this.getBillingDiscount() / 100) *
|
|
137
|
+
pitchCount *
|
|
138
|
+
days *
|
|
139
|
+
24);
|
|
140
|
+
};
|
|
141
|
+
SubscribedPricingPlanModel.prototype.getGrossAmountByPitchDaysBasePrice = function (basePrice, pitchCount, days) {
|
|
142
|
+
return Math.round(basePrice * pitchCount * days * 24);
|
|
143
|
+
};
|
|
144
|
+
SubscribedPricingPlanModel.prototype.getNetAmountByPitchDaysBasePrice = function (basePrice, pitchCount, days) {
|
|
145
|
+
return Math.round(basePrice * (1 - this.getBillingDiscount() / 100) * pitchCount * days * 24);
|
|
146
|
+
};
|
|
147
|
+
return SubscribedPricingPlanModel;
|
|
148
|
+
}(PricingPlanModel));
|
|
149
|
+
exports.SubscribedPricingPlanModel = SubscribedPricingPlanModel;
|
|
150
|
+
var BillingCycleModel = /** @class */ (function () {
|
|
151
|
+
function BillingCycleModel(data) {
|
|
152
|
+
this.from = data.from;
|
|
153
|
+
this.to = data.to;
|
|
154
|
+
this.discount = data.discount;
|
|
155
|
+
this.name = data.name;
|
|
156
|
+
this.key = data.key;
|
|
157
|
+
}
|
|
158
|
+
BillingCycleModel.prototype.getDiscount = function () {
|
|
159
|
+
if (this.discount.indexOf("P") > -1) {
|
|
160
|
+
return parseFloat(this.discount.replace("P", ""));
|
|
161
|
+
}
|
|
162
|
+
return 0;
|
|
163
|
+
};
|
|
164
|
+
return BillingCycleModel;
|
|
165
|
+
}());
|
|
166
|
+
exports.BillingCycleModel = BillingCycleModel;
|
|
167
|
+
var PitchSlabModel = /** @class */ (function () {
|
|
168
|
+
function PitchSlabModel(data) {
|
|
169
|
+
this.from = data.from;
|
|
170
|
+
this.to = data.to;
|
|
171
|
+
this.discount = data.discount;
|
|
172
|
+
}
|
|
173
|
+
PitchSlabModel.prototype.getDiscount = function () {
|
|
174
|
+
if (this.discount.indexOf("P") > -1) {
|
|
175
|
+
return parseFloat(this.discount.replace("P", ""));
|
|
176
|
+
}
|
|
177
|
+
return 0;
|
|
178
|
+
};
|
|
179
|
+
PitchSlabModel.prototype.getBasePrice = function (basePrice) {
|
|
180
|
+
return basePrice * (1 - this.getDiscount() / 100);
|
|
181
|
+
};
|
|
182
|
+
return PitchSlabModel;
|
|
183
|
+
}());
|
|
184
|
+
exports.PitchSlabModel = PitchSlabModel;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BookingDetailsStatus } from '../enums/booking-details-status.enum';
|
|
2
|
+
export type IBookingDetailsWithBooking = {
|
|
3
|
+
[bookingDetailsId: string]: {
|
|
4
|
+
createdOn: Date;
|
|
5
|
+
updatedOn: Date;
|
|
6
|
+
createdBy: number;
|
|
7
|
+
updatedBy: number;
|
|
8
|
+
id: number;
|
|
9
|
+
turfId: number;
|
|
10
|
+
pitchId: number;
|
|
11
|
+
customerName: string;
|
|
12
|
+
contact: string;
|
|
13
|
+
paymentMode: string;
|
|
14
|
+
couponCode: string;
|
|
15
|
+
totalCost: number;
|
|
16
|
+
discountedCost: number;
|
|
17
|
+
amountPaid: number;
|
|
18
|
+
email: string;
|
|
19
|
+
status: BookingDetailsStatus;
|
|
20
|
+
sport: string;
|
|
21
|
+
remarks: string;
|
|
22
|
+
initialBookingGrossAmount: number;
|
|
23
|
+
additionalBookingGrossAmount: number;
|
|
24
|
+
discountAmount: number;
|
|
25
|
+
cancelledBookingGrossAmount: number;
|
|
26
|
+
totalCancellationCharges: number;
|
|
27
|
+
netTotal: number;
|
|
28
|
+
amountPayable: number;
|
|
29
|
+
refundPayable: number;
|
|
30
|
+
bookings: {
|
|
31
|
+
[code: string]: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
2
|
+
import { BookingHistoryOperationType } from "../../enums/booking-history-operation-type.enum";
|
|
3
|
+
import { PaymentMode } from "../../enums/payment-mode.enum";
|
|
4
|
+
export interface IBookingCancellationEntity extends IEntityAuditColumn {
|
|
5
|
+
id: number;
|
|
6
|
+
bookingDetailsId: number;
|
|
7
|
+
turfId: number;
|
|
8
|
+
pitchId: number;
|
|
9
|
+
customerName: string;
|
|
10
|
+
contact: string;
|
|
11
|
+
paymentMode: string;
|
|
12
|
+
couponCode: string;
|
|
13
|
+
totalCost: number;
|
|
14
|
+
discountedCost: number;
|
|
15
|
+
amountPaid: number;
|
|
16
|
+
operationType: BookingHistoryOperationType;
|
|
17
|
+
email: string;
|
|
18
|
+
bookingCodes: string;
|
|
19
|
+
cancellationAmount: number;
|
|
20
|
+
refundAmount: number;
|
|
21
|
+
refundMode: PaymentMode | null;
|
|
22
|
+
startDateCode: number;
|
|
23
|
+
endDateCode: number;
|
|
24
|
+
initialBookingGrossAmount: number;
|
|
25
|
+
additionalBookingGrossAmount: number;
|
|
26
|
+
discountAmount: number;
|
|
27
|
+
cancelledBookingGrossAmount: number;
|
|
28
|
+
totalCancellationCharges: number;
|
|
29
|
+
netTotal: number;
|
|
30
|
+
amountPayable: number;
|
|
31
|
+
refundPayable: number;
|
|
32
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ChargesModel } from "../../models/charge-model";
|
|
2
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
3
|
+
import { BookingDetailsStatus } from "../../enums/booking-details-status.enum";
|
|
4
|
+
import { IBookingsEntity } from "./bookings-entity.type";
|
|
5
|
+
import { IBookingDetailsWithBooking } from "../bookingdetails-with-booking.type";
|
|
6
|
+
export interface IBookingDetailsEntity extends IEntityAuditColumn {
|
|
7
|
+
id: number;
|
|
8
|
+
turfId: number;
|
|
9
|
+
pitchId: number;
|
|
10
|
+
customerName: string;
|
|
11
|
+
contact: string;
|
|
12
|
+
paymentMode: string;
|
|
13
|
+
couponCode: string;
|
|
14
|
+
totalCost: number;
|
|
15
|
+
discountedCost: number;
|
|
16
|
+
amountPaid: number;
|
|
17
|
+
email: string;
|
|
18
|
+
status: BookingDetailsStatus;
|
|
19
|
+
sport: string;
|
|
20
|
+
remarks: string;
|
|
21
|
+
initialBookingGrossAmount: number;
|
|
22
|
+
additionalBookingGrossAmount: number;
|
|
23
|
+
discountAmount: number;
|
|
24
|
+
cancelledBookingGrossAmount: number;
|
|
25
|
+
totalCancellationCharges: number;
|
|
26
|
+
netTotal: number;
|
|
27
|
+
amountPayable: number;
|
|
28
|
+
refundPayable: number;
|
|
29
|
+
totalRefundedAmount: number;
|
|
30
|
+
}
|
|
31
|
+
export interface IBookingDetailsModel extends IBookingDetailsEntity {
|
|
32
|
+
assignCharges(chargeModel: ChargesModel): void;
|
|
33
|
+
}
|
|
34
|
+
export declare class BookingDetailsModel implements IBookingDetailsModel {
|
|
35
|
+
id: number;
|
|
36
|
+
turfId: number;
|
|
37
|
+
pitchId: number;
|
|
38
|
+
customerName: string;
|
|
39
|
+
contact: string;
|
|
40
|
+
paymentMode: string;
|
|
41
|
+
couponCode: string;
|
|
42
|
+
totalCost: number;
|
|
43
|
+
discountedCost: number;
|
|
44
|
+
amountPaid: number;
|
|
45
|
+
email: string;
|
|
46
|
+
status: BookingDetailsStatus;
|
|
47
|
+
sport: string;
|
|
48
|
+
remarks: string;
|
|
49
|
+
initialBookingGrossAmount: number;
|
|
50
|
+
additionalBookingGrossAmount: number;
|
|
51
|
+
discountAmount: number;
|
|
52
|
+
cancelledBookingGrossAmount: number;
|
|
53
|
+
totalCancellationCharges: number;
|
|
54
|
+
netTotal: number;
|
|
55
|
+
amountPayable: number;
|
|
56
|
+
refundPayable: number;
|
|
57
|
+
totalRefundedAmount: number;
|
|
58
|
+
createdOn: Date;
|
|
59
|
+
updatedOn: Date;
|
|
60
|
+
createdBy: number;
|
|
61
|
+
updatedBy: number;
|
|
62
|
+
constructor(data: IBookingDetailsEntity);
|
|
63
|
+
static getIdAndCreatedBy(bookingDetailsEntities: IBookingDetailsEntity[]): number[][];
|
|
64
|
+
assignCharges(chargeModel: ChargesModel): void;
|
|
65
|
+
static toMap(bookingDetailsEntities: IBookingDetailsEntity[], bookingsEntities: IBookingsEntity[]): IBookingDetailsWithBooking;
|
|
66
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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.BookingDetailsModel = void 0;
|
|
15
|
+
var bookings_entity_type_1 = require("./bookings-entity.type");
|
|
16
|
+
var BookingDetailsModel = /** @class */ (function () {
|
|
17
|
+
function BookingDetailsModel(data) {
|
|
18
|
+
Object.assign(this, data);
|
|
19
|
+
}
|
|
20
|
+
BookingDetailsModel.getIdAndCreatedBy = function (bookingDetailsEntities) {
|
|
21
|
+
var bookingDetailsIds = [];
|
|
22
|
+
var userIds = [];
|
|
23
|
+
bookingDetailsEntities.forEach(function (_a) {
|
|
24
|
+
var bookingDetailId = _a.id, createdBy = _a.createdBy;
|
|
25
|
+
bookingDetailsIds.push(bookingDetailId), userIds.push(createdBy);
|
|
26
|
+
});
|
|
27
|
+
return [bookingDetailsIds, userIds];
|
|
28
|
+
};
|
|
29
|
+
// static toMap(
|
|
30
|
+
// bookingDetailsEntities: IBookingDetailsEntity[],
|
|
31
|
+
// bookingsEntities: BookingsEntity[],
|
|
32
|
+
// ): IBookingDetailsWithBooking {
|
|
33
|
+
// const response: IBookingDetailsWithBooking = {};
|
|
34
|
+
// bookingDetailsEntities.forEach((bookingsDetailsEntity) => {
|
|
35
|
+
// const bookingDetailsId = bookingsDetailsEntity.id;
|
|
36
|
+
// if (!response[bookingDetailsId]) {
|
|
37
|
+
// response[bookingDetailsId] = {
|
|
38
|
+
// ...bookingsDetailsEntity,
|
|
39
|
+
// bookings: {},
|
|
40
|
+
// };
|
|
41
|
+
// }
|
|
42
|
+
// const filterBookingEntities = bookingsEntities.filter(
|
|
43
|
+
// (bookingEntity) => bookingEntity.bookingDetailsId === bookingDetailsId,
|
|
44
|
+
// );
|
|
45
|
+
// response[bookingDetailsId].bookings = BookingsEntity.toMap(
|
|
46
|
+
// filterBookingEntities,
|
|
47
|
+
// );
|
|
48
|
+
// });
|
|
49
|
+
// return response;
|
|
50
|
+
// }
|
|
51
|
+
BookingDetailsModel.prototype.assignCharges = function (chargeModel) {
|
|
52
|
+
this.discountAmount = chargeModel.getDiscountAmount();
|
|
53
|
+
Object.assign(this, chargeModel);
|
|
54
|
+
};
|
|
55
|
+
BookingDetailsModel.toMap = function (bookingDetailsEntities, bookingsEntities) {
|
|
56
|
+
var response = {};
|
|
57
|
+
bookingDetailsEntities.forEach(function (bookingsDetailsEntity) {
|
|
58
|
+
var bookingDetailsId = bookingsDetailsEntity.id;
|
|
59
|
+
if (!response[bookingDetailsId]) {
|
|
60
|
+
response[bookingDetailsId] = __assign(__assign({}, bookingsDetailsEntity), { bookings: {} });
|
|
61
|
+
}
|
|
62
|
+
var filterBookingEntities = bookingsEntities.filter(function (bookingEntity) { return bookingEntity.bookingDetailsId === bookingDetailsId; });
|
|
63
|
+
response[bookingDetailsId].bookings = bookings_entity_type_1.BookingEntityModel.toMap(filterBookingEntities);
|
|
64
|
+
});
|
|
65
|
+
return response;
|
|
66
|
+
};
|
|
67
|
+
return BookingDetailsModel;
|
|
68
|
+
}());
|
|
69
|
+
exports.BookingDetailsModel = BookingDetailsModel;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BookingCode } from "../../models/booking-code-model";
|
|
2
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
3
|
+
export interface IBookingsEntity extends IEntityAuditColumn {
|
|
4
|
+
bookingDetailsId: number;
|
|
5
|
+
code: string;
|
|
6
|
+
cost: string;
|
|
7
|
+
}
|
|
8
|
+
export interface IBookingsEntityModel extends IBookingsEntity {
|
|
9
|
+
getTotalCost(): number;
|
|
10
|
+
getBookingTimeInMinutes(): number;
|
|
11
|
+
isTimeExtended(newBookingEntities: IBookingsEntity[]): boolean;
|
|
12
|
+
getBookingCode(): BookingCode;
|
|
13
|
+
}
|
|
14
|
+
export declare class BookingEntityModel implements IBookingsEntityModel {
|
|
15
|
+
bookingDetailsId: number;
|
|
16
|
+
code: string;
|
|
17
|
+
cost: string;
|
|
18
|
+
createdOn: Date;
|
|
19
|
+
updatedOn: Date;
|
|
20
|
+
createdBy: number;
|
|
21
|
+
updatedBy: number;
|
|
22
|
+
constructor(data: IBookingsEntity);
|
|
23
|
+
getTotalCost(): number;
|
|
24
|
+
getBookingTimeInMinutes(): number;
|
|
25
|
+
isTimeExtended(newBookingEntities: IBookingsEntity[]): boolean;
|
|
26
|
+
getBookingCode(): BookingCode;
|
|
27
|
+
static toMap(bookingEntities: IBookingsEntity[]): {
|
|
28
|
+
[key: string]: string;
|
|
29
|
+
};
|
|
30
|
+
static findByCodeAndTurfId(bookingEntities: IBookingsEntity[], turfId: number, bookingCode: string): IBookingsEntity | undefined;
|
|
31
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BookingEntityModel = void 0;
|
|
4
|
+
var booking_code_model_1 = require("../../models/booking-code-model");
|
|
5
|
+
var BookingEntityModel = /** @class */ (function () {
|
|
6
|
+
function BookingEntityModel(data) {
|
|
7
|
+
Object.assign(this, data);
|
|
8
|
+
}
|
|
9
|
+
BookingEntityModel.prototype.getTotalCost = function () {
|
|
10
|
+
return this.cost
|
|
11
|
+
.split(",")
|
|
12
|
+
.map(Number)
|
|
13
|
+
.reduce(function (accumulator, currentValue) { return accumulator + currentValue; }, 0);
|
|
14
|
+
};
|
|
15
|
+
BookingEntityModel.prototype.getBookingTimeInMinutes = function () {
|
|
16
|
+
var bookingCode = new booking_code_model_1.BookingCode(this.code);
|
|
17
|
+
return bookingCode.getBookingTimeInMinutes();
|
|
18
|
+
};
|
|
19
|
+
BookingEntityModel.prototype.isTimeExtended = function (newBookingEntities) {
|
|
20
|
+
var newTimeInMinutes = newBookingEntities
|
|
21
|
+
.map(function (bookingEntity) {
|
|
22
|
+
return new BookingEntityModel(bookingEntity).getBookingTimeInMinutes();
|
|
23
|
+
})
|
|
24
|
+
.reduce(function (accumulator, currentValue) { return accumulator + currentValue; }, 0);
|
|
25
|
+
return (newTimeInMinutes > new BookingEntityModel(this).getBookingTimeInMinutes());
|
|
26
|
+
};
|
|
27
|
+
BookingEntityModel.prototype.getBookingCode = function () {
|
|
28
|
+
return new booking_code_model_1.BookingCode(this.code, this.cost);
|
|
29
|
+
};
|
|
30
|
+
BookingEntityModel.toMap = function (bookingEntities) {
|
|
31
|
+
var response = {};
|
|
32
|
+
bookingEntities.forEach(function (bookingEntity) {
|
|
33
|
+
response[bookingEntity.code] =
|
|
34
|
+
response[bookingEntity.code] === undefined
|
|
35
|
+
? bookingEntity.cost
|
|
36
|
+
: response[bookingEntity.code];
|
|
37
|
+
});
|
|
38
|
+
return response;
|
|
39
|
+
};
|
|
40
|
+
BookingEntityModel.findByCodeAndTurfId = function (bookingEntities, turfId, bookingCode) {
|
|
41
|
+
return bookingEntities.find(function (bookingEntity) {
|
|
42
|
+
return bookingEntity.code === booking_code_model_1.BookingCode.getInstance(turfId, bookingCode).code;
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
return BookingEntityModel;
|
|
46
|
+
}());
|
|
47
|
+
exports.BookingEntityModel = BookingEntityModel;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
2
|
+
export interface ICancellationPolicyEntity extends IEntityAuditColumn {
|
|
3
|
+
id: number;
|
|
4
|
+
turfId: number;
|
|
5
|
+
from: number;
|
|
6
|
+
to: number;
|
|
7
|
+
charges: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ICancellationPolicyModel extends ICancellationPolicyEntity {
|
|
10
|
+
unitOfCharges(): string;
|
|
11
|
+
}
|
|
12
|
+
export declare class CancellationPolicyModel implements ICancellationPolicyModel {
|
|
13
|
+
id: number;
|
|
14
|
+
turfId: number;
|
|
15
|
+
from: number;
|
|
16
|
+
to: number;
|
|
17
|
+
charges: string;
|
|
18
|
+
createdOn: Date;
|
|
19
|
+
updatedOn: Date;
|
|
20
|
+
createdBy: number;
|
|
21
|
+
updatedBy: number;
|
|
22
|
+
constructor(data: ICancellationPolicyEntity);
|
|
23
|
+
unitOfCharges(): string;
|
|
24
|
+
chargesWithoutUnit(): string;
|
|
25
|
+
isInEffect(hours: number): boolean;
|
|
26
|
+
getCancellationCharges(cost: number): number;
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CancellationPolicyModel = void 0;
|
|
4
|
+
var CancellationPolicyModel = /** @class */ (function () {
|
|
5
|
+
function CancellationPolicyModel(data) {
|
|
6
|
+
Object.assign(this, data);
|
|
7
|
+
}
|
|
8
|
+
CancellationPolicyModel.prototype.unitOfCharges = function () {
|
|
9
|
+
return this.charges.slice(-1);
|
|
10
|
+
};
|
|
11
|
+
CancellationPolicyModel.prototype.chargesWithoutUnit = function () {
|
|
12
|
+
return this.charges.slice(0, -1);
|
|
13
|
+
};
|
|
14
|
+
CancellationPolicyModel.prototype.isInEffect = function (hours) {
|
|
15
|
+
return this.from <= hours && hours <= this.to;
|
|
16
|
+
};
|
|
17
|
+
CancellationPolicyModel.prototype.getCancellationCharges = function (cost) {
|
|
18
|
+
var cancellationCharges = 0;
|
|
19
|
+
var cancellationChargesModel = new CancellationPolicyModel(this);
|
|
20
|
+
if (cancellationChargesModel.unitOfCharges() === "P") {
|
|
21
|
+
var percentageValue = cancellationChargesModel.chargesWithoutUnit();
|
|
22
|
+
cancellationCharges = (cost * Number(percentageValue)) / 100;
|
|
23
|
+
}
|
|
24
|
+
else if (cancellationChargesModel.unitOfCharges() === "U") {
|
|
25
|
+
var unit = cancellationChargesModel.chargesWithoutUnit();
|
|
26
|
+
cancellationCharges = Number(unit);
|
|
27
|
+
}
|
|
28
|
+
return cancellationCharges;
|
|
29
|
+
};
|
|
30
|
+
return CancellationPolicyModel;
|
|
31
|
+
}());
|
|
32
|
+
exports.CancellationPolicyModel = CancellationPolicyModel;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
2
|
+
export interface IPriceEntity extends IEntityAuditColumn {
|
|
3
|
+
id: string;
|
|
4
|
+
price: number;
|
|
5
|
+
}
|
|
6
|
+
export interface IPriceModel extends IPriceEntity {
|
|
7
|
+
}
|
|
8
|
+
export declare class PriceModel implements IPriceModel {
|
|
9
|
+
id: string;
|
|
10
|
+
price: number;
|
|
11
|
+
createdOn: Date;
|
|
12
|
+
updatedOn: Date;
|
|
13
|
+
createdBy: number;
|
|
14
|
+
updatedBy: number;
|
|
15
|
+
static sortByCode(priceEntities: IPriceEntity[]): IPriceEntity[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PriceModel = void 0;
|
|
4
|
+
var PriceModel = /** @class */ (function () {
|
|
5
|
+
function PriceModel() {
|
|
6
|
+
}
|
|
7
|
+
PriceModel.sortByCode = function (priceEntities) {
|
|
8
|
+
priceEntities = priceEntities.sort(function (a, b) {
|
|
9
|
+
return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
|
10
|
+
});
|
|
11
|
+
return priceEntities;
|
|
12
|
+
};
|
|
13
|
+
return PriceModel;
|
|
14
|
+
}());
|
|
15
|
+
exports.PriceModel = PriceModel;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
2
|
+
import { PricingPlanStatus } from "../../enums/pricing-plan-status.enum";
|
|
3
|
+
import { PitchSlab, PricingPlanModel, BillingCycle, BillingCycleModel } from "../../models/pitch-slab-model";
|
|
4
|
+
import { GetPricingPlanByDateResponse } from "../../interface/get-pricing-plan-by-date-response.interface";
|
|
5
|
+
export interface IPricingPlanEntity extends IEntityAuditColumn {
|
|
6
|
+
id: number;
|
|
7
|
+
effectiveFrom: Date;
|
|
8
|
+
effectiveTo: Date;
|
|
9
|
+
costCode: string;
|
|
10
|
+
status: PricingPlanStatus;
|
|
11
|
+
createdBy: number;
|
|
12
|
+
createdOn: Date;
|
|
13
|
+
updatedBy: number;
|
|
14
|
+
updatedOn: Date;
|
|
15
|
+
basePrice: number;
|
|
16
|
+
billingCycle: string;
|
|
17
|
+
unit: string;
|
|
18
|
+
}
|
|
19
|
+
export interface IPricingPlanEntityModel extends IPricingPlanEntity {
|
|
20
|
+
getBillingCycleKeys(): string[];
|
|
21
|
+
toModel(): PricingPlanModel;
|
|
22
|
+
arrayToIndexedObject<T>(arr: T[]): {
|
|
23
|
+
[key: string]: T;
|
|
24
|
+
};
|
|
25
|
+
toObject(): GetPricingPlanByDateResponse;
|
|
26
|
+
toPitchSlabs(): PitchSlab[];
|
|
27
|
+
}
|
|
28
|
+
export declare class PricingPlanEntityModel implements IPricingPlanEntityModel {
|
|
29
|
+
id: number;
|
|
30
|
+
effectiveFrom: Date;
|
|
31
|
+
effectiveTo: Date;
|
|
32
|
+
costCode: string;
|
|
33
|
+
status: PricingPlanStatus;
|
|
34
|
+
createdBy: number;
|
|
35
|
+
createdOn: Date;
|
|
36
|
+
updatedBy: number;
|
|
37
|
+
updatedOn: Date;
|
|
38
|
+
basePrice: number;
|
|
39
|
+
billingCycle: string;
|
|
40
|
+
unit: string;
|
|
41
|
+
constructor(data: IPricingPlanEntity);
|
|
42
|
+
getBillingCycleKeys(): string[];
|
|
43
|
+
toModel(): PricingPlanModel;
|
|
44
|
+
arrayToIndexedObject<T>(arr: T[]): {
|
|
45
|
+
[key: string]: T;
|
|
46
|
+
};
|
|
47
|
+
toObject(): GetPricingPlanByDateResponse;
|
|
48
|
+
toPitchSlabs(): PitchSlab[];
|
|
49
|
+
toBillingCycles(): BillingCycle[];
|
|
50
|
+
}
|
|
51
|
+
export declare class PitchSlabParser {
|
|
52
|
+
code: string;
|
|
53
|
+
constructor(code: string);
|
|
54
|
+
parseToModel(): PitchSlab;
|
|
55
|
+
}
|
|
56
|
+
export declare class BillingCycleCodeParser {
|
|
57
|
+
code: string;
|
|
58
|
+
from: number;
|
|
59
|
+
to: number;
|
|
60
|
+
discount: string;
|
|
61
|
+
name: string;
|
|
62
|
+
constructor(code: string);
|
|
63
|
+
parse(): BillingCycleCodeParser;
|
|
64
|
+
parseToModel(): BillingCycleModel;
|
|
65
|
+
getKey(): string;
|
|
66
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BillingCycleCodeParser = exports.PitchSlabParser = exports.PricingPlanEntityModel = void 0;
|
|
4
|
+
var booking_code_model_1 = require("../../models/booking-code-model");
|
|
5
|
+
var pitch_slab_model_1 = require("../../models/pitch-slab-model");
|
|
6
|
+
var PricingPlanEntityModel = /** @class */ (function () {
|
|
7
|
+
function PricingPlanEntityModel(data) {
|
|
8
|
+
Object.assign(this, data);
|
|
9
|
+
}
|
|
10
|
+
PricingPlanEntityModel.prototype.getBillingCycleKeys = function () {
|
|
11
|
+
return this.toBillingCycles().map(function (billingCycle) { return billingCycle.key; });
|
|
12
|
+
};
|
|
13
|
+
PricingPlanEntityModel.prototype.toModel = function () {
|
|
14
|
+
return new pitch_slab_model_1.PricingPlanModel({
|
|
15
|
+
id: this.id,
|
|
16
|
+
base_price: this.basePrice,
|
|
17
|
+
effective_from_date: parseInt(booking_code_model_1.BookingCode.getDateCode(this.effectiveFrom)),
|
|
18
|
+
effective_to_date: parseInt(booking_code_model_1.BookingCode.getDateCode(this.effectiveTo)),
|
|
19
|
+
unit: this.unit,
|
|
20
|
+
billing_cycle: this.arrayToIndexedObject(this.toBillingCycles()),
|
|
21
|
+
pitch_slab: this.arrayToIndexedObject(this.toPitchSlabs()),
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
PricingPlanEntityModel.prototype.arrayToIndexedObject = function (arr) {
|
|
25
|
+
return arr.reduce(function (result, item, index) {
|
|
26
|
+
result[index.toString()] = item; //a, b, c
|
|
27
|
+
return result;
|
|
28
|
+
}, {});
|
|
29
|
+
};
|
|
30
|
+
PricingPlanEntityModel.prototype.toObject = function () {
|
|
31
|
+
var responseObj = {
|
|
32
|
+
id: this.id,
|
|
33
|
+
effective_from_date: 0,
|
|
34
|
+
effective_to_date: 0,
|
|
35
|
+
base_price: 0,
|
|
36
|
+
unit: "per_hour_per_pitch",
|
|
37
|
+
pitch_slab: {},
|
|
38
|
+
billing_cycle: {},
|
|
39
|
+
};
|
|
40
|
+
var billingCycle = this.billingCycle.split(",");
|
|
41
|
+
billingCycle.forEach(function (billing, index) {
|
|
42
|
+
var billingArray = billing.split("_");
|
|
43
|
+
responseObj.billing_cycle[index] = {
|
|
44
|
+
from: Number(billingArray[0].slice(0, 3)),
|
|
45
|
+
to: Number(billingArray[0].slice(3, 6)),
|
|
46
|
+
discount: billingArray[1],
|
|
47
|
+
name: billingArray.slice(2).join("_"),
|
|
48
|
+
key: billingArray.slice(2).join("-").toLowerCase().replace(/ /g, "-"),
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
this.costCode.split(",").forEach(function (code, index) {
|
|
52
|
+
var costCode = code.split("_");
|
|
53
|
+
responseObj.pitch_slab[index] = {
|
|
54
|
+
from: Number(costCode[0].slice(0, 3)),
|
|
55
|
+
to: Number(costCode[0].slice(3, 6)),
|
|
56
|
+
discount: costCode[1],
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
responseObj.effective_from_date = Number(booking_code_model_1.BookingCode.getDateCode(this.effectiveFrom));
|
|
60
|
+
responseObj.effective_to_date = Number(booking_code_model_1.BookingCode.getDateCode(this.effectiveTo));
|
|
61
|
+
responseObj.unit = this.unit;
|
|
62
|
+
responseObj.base_price = this.basePrice;
|
|
63
|
+
return responseObj;
|
|
64
|
+
};
|
|
65
|
+
PricingPlanEntityModel.prototype.toPitchSlabs = function () {
|
|
66
|
+
return this.costCode
|
|
67
|
+
.split(",")
|
|
68
|
+
.map(function (cost_code) { return new PitchSlabParser(cost_code).parseToModel(); });
|
|
69
|
+
};
|
|
70
|
+
PricingPlanEntityModel.prototype.toBillingCycles = function () {
|
|
71
|
+
return this.billingCycle
|
|
72
|
+
.split(",")
|
|
73
|
+
.map(function (billingCode) {
|
|
74
|
+
return new BillingCycleCodeParser(billingCode).parseToModel();
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
return PricingPlanEntityModel;
|
|
78
|
+
}());
|
|
79
|
+
exports.PricingPlanEntityModel = PricingPlanEntityModel;
|
|
80
|
+
var PitchSlabParser = /** @class */ (function () {
|
|
81
|
+
function PitchSlabParser(code) {
|
|
82
|
+
this.code = code;
|
|
83
|
+
}
|
|
84
|
+
PitchSlabParser.prototype.parseToModel = function () {
|
|
85
|
+
var costCodeComponents = this.code.split("_");
|
|
86
|
+
return new pitch_slab_model_1.PitchSlabModel({
|
|
87
|
+
discount: costCodeComponents[1],
|
|
88
|
+
from: parseInt(costCodeComponents[0].slice(0, 3)),
|
|
89
|
+
to: parseInt(costCodeComponents[0].slice(3)),
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
return PitchSlabParser;
|
|
93
|
+
}());
|
|
94
|
+
exports.PitchSlabParser = PitchSlabParser;
|
|
95
|
+
var BillingCycleCodeParser = /** @class */ (function () {
|
|
96
|
+
function BillingCycleCodeParser(code) {
|
|
97
|
+
this.code = code;
|
|
98
|
+
}
|
|
99
|
+
BillingCycleCodeParser.prototype.parse = function () {
|
|
100
|
+
var billingCycleComponents = this.code.split("_");
|
|
101
|
+
this.from = parseInt(billingCycleComponents[0].slice(0, 3));
|
|
102
|
+
this.to = parseInt(billingCycleComponents[0].slice(3, 6));
|
|
103
|
+
this.discount = billingCycleComponents[1];
|
|
104
|
+
this.name = billingCycleComponents[2];
|
|
105
|
+
return this;
|
|
106
|
+
};
|
|
107
|
+
BillingCycleCodeParser.prototype.parseToModel = function () {
|
|
108
|
+
var billingCycleComponents = this.code.split("_");
|
|
109
|
+
this.from = parseInt(billingCycleComponents[0].slice(0, 3));
|
|
110
|
+
this.to = parseInt(billingCycleComponents[0].slice(3, 6));
|
|
111
|
+
this.discount = billingCycleComponents[1];
|
|
112
|
+
this.name = billingCycleComponents[2];
|
|
113
|
+
return new pitch_slab_model_1.BillingCycleModel({
|
|
114
|
+
discount: this.discount,
|
|
115
|
+
from: this.from,
|
|
116
|
+
to: this.to,
|
|
117
|
+
name: this.name,
|
|
118
|
+
key: this.getKey(),
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
BillingCycleCodeParser.prototype.getKey = function () {
|
|
122
|
+
return this.name.toLowerCase().replace(" ", "-");
|
|
123
|
+
};
|
|
124
|
+
return BillingCycleCodeParser;
|
|
125
|
+
}());
|
|
126
|
+
exports.BillingCycleCodeParser = BillingCycleCodeParser;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RegistrationStatus } from "../../enums/registration-status-enum";
|
|
2
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
3
|
+
export interface IRegistrationEntity extends IEntityAuditColumn {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
contact: string;
|
|
7
|
+
email: string;
|
|
8
|
+
pitchPlan: string;
|
|
9
|
+
status: RegistrationStatus;
|
|
10
|
+
comments: string;
|
|
11
|
+
token: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
2
|
+
import { UserStatus } from "../../enums/user-status.enum";
|
|
3
|
+
import { UserType } from "../../enums/valid-type.enum";
|
|
4
|
+
import { ITurfEntity } from "./turf-entity.type";
|
|
5
|
+
export interface IUserEntity extends IEntityAuditColumn {
|
|
6
|
+
id: number;
|
|
7
|
+
firstname: string;
|
|
8
|
+
lastname: string;
|
|
9
|
+
phone: string;
|
|
10
|
+
password: string;
|
|
11
|
+
email: string;
|
|
12
|
+
status: UserStatus;
|
|
13
|
+
is_email_verified: boolean;
|
|
14
|
+
is_mobile_verified: boolean;
|
|
15
|
+
is_account_verified: boolean;
|
|
16
|
+
require_new_password: boolean;
|
|
17
|
+
organization_id: number;
|
|
18
|
+
type: UserType;
|
|
19
|
+
registrationId: number;
|
|
20
|
+
comments: string;
|
|
21
|
+
}
|
|
22
|
+
export interface IUserEntityRel {
|
|
23
|
+
turf: ITurfEntity[];
|
|
24
|
+
}
|
|
25
|
+
export interface IUserModel extends IUserEntity, IUserEntityRel {
|
|
26
|
+
}
|
|
27
|
+
export declare class UserModel implements IUserModel {
|
|
28
|
+
id: number;
|
|
29
|
+
firstname: string;
|
|
30
|
+
lastname: string;
|
|
31
|
+
phone: string;
|
|
32
|
+
password: string;
|
|
33
|
+
email: string;
|
|
34
|
+
status: UserStatus;
|
|
35
|
+
is_email_verified: boolean;
|
|
36
|
+
is_mobile_verified: boolean;
|
|
37
|
+
is_account_verified: boolean;
|
|
38
|
+
require_new_password: boolean;
|
|
39
|
+
organization_id: number;
|
|
40
|
+
type: UserType;
|
|
41
|
+
createdOn: Date;
|
|
42
|
+
updatedOn: Date;
|
|
43
|
+
createdBy: number;
|
|
44
|
+
updatedBy: number;
|
|
45
|
+
registrationId: number;
|
|
46
|
+
comments: string;
|
|
47
|
+
turf: ITurfEntity[];
|
|
48
|
+
constructor(data: IUserModel);
|
|
49
|
+
static toMap(userEntities: IUserEntity[]): {
|
|
50
|
+
[key: number]: IUserEntity;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserModel = void 0;
|
|
4
|
+
var UserModel = /** @class */ (function () {
|
|
5
|
+
function UserModel(data) {
|
|
6
|
+
Object.assign(this, data);
|
|
7
|
+
}
|
|
8
|
+
UserModel.toMap = function (userEntities) {
|
|
9
|
+
var response = {};
|
|
10
|
+
userEntities.forEach(function (userEntity) {
|
|
11
|
+
if (!response[userEntity.id]) {
|
|
12
|
+
response[userEntity.id] = userEntity;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return response;
|
|
16
|
+
};
|
|
17
|
+
return UserModel;
|
|
18
|
+
}());
|
|
19
|
+
exports.UserModel = UserModel;
|