turf-common 1.4.1-beta.3 → 1.4.1-beta.5
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/README.md +20 -20
- package/build/src/interface/api/get-pricing-plan-by-date-response.interface.d.ts +24 -0
- package/build/src/interface/billing-cycle.interface.d.ts +6 -0
- package/build/src/interface/entity/pricing-plan-entity.interface.d.ts +16 -0
- package/build/src/interface/entity/subscription-entity.interface.d.ts +4 -0
- package/build/src/interface/entity/subscription-pitch-mapping.interface.d.ts +7 -0
- package/build/src/interface/get-pricing-plan-by-date-response.interface.d.ts +21 -0
- package/build/src/interface/model/pricing-plan-entity-model.interface.d.ts +13 -4
- package/build/src/interface/pitch-slab-dto.interface.d.ts +8 -0
- package/build/src/interface/pitch-slab.interface.d.ts +4 -0
- package/build/src/interface/pricing-plan.interface.d.ts +16 -2
- package/build/src/interface/ui/upgrade-subscription-data.interface.d.ts +5 -0
- package/build/src/models/billing-cycle-model.d.ts +9 -1
- package/build/src/models/billing-cycle-model.js +25 -1
- package/build/src/models/entity/pricing-plan-entity-model.d.ts +47 -7
- package/build/src/models/entity/pricing-plan-entity-model.js +128 -1
- package/build/src/models/entity/subscription-model.d.ts +42 -4
- package/build/src/models/entity/subscription-model.js +138 -1
- package/build/src/models/pitch-slab-model.d.ts +6 -1
- package/build/src/models/pitch-slab-model.js +12 -1
- package/build/src/models/pricing-plan-model.d.ts +28 -3
- package/build/src/models/pricing-plan-model.js +86 -1
- package/build/src/models/subscribed-pricing-plan-model.d.ts +48 -6
- package/build/src/models/subscribed-pricing-plan-model.js +193 -1
- package/build/src/utils/string-util.d.ts +1 -0
- package/build/src/utils/string-util.js +7 -0
- package/package.json +42 -42
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
## 1 npm init -y
|
|
2
|
-
|
|
3
|
-
## 2 npm login
|
|
4
|
-
|
|
5
|
-
## 3 npm version patch
|
|
6
|
-
|
|
7
|
-
# //it increase version
|
|
8
|
-
|
|
9
|
-
## 3 npm publish --access public
|
|
10
|
-
|
|
11
|
-
# //npm publish by default --access public
|
|
12
|
-
|
|
13
|
-
## 4 npm run version:deploy
|
|
14
|
-
|
|
15
|
-
### deploy version
|
|
16
|
-
|
|
17
|
-
## Client side
|
|
18
|
-
|
|
19
|
-
update package command <br />
|
|
20
|
-
npm update turf-comman
|
|
1
|
+
## 1 npm init -y
|
|
2
|
+
|
|
3
|
+
## 2 npm login
|
|
4
|
+
|
|
5
|
+
## 3 npm version patch
|
|
6
|
+
|
|
7
|
+
# //it increase version
|
|
8
|
+
|
|
9
|
+
## 3 npm publish --access public
|
|
10
|
+
|
|
11
|
+
# //npm publish by default --access public
|
|
12
|
+
|
|
13
|
+
## 4 npm run version:deploy
|
|
14
|
+
|
|
15
|
+
### deploy version
|
|
16
|
+
|
|
17
|
+
## Client side
|
|
18
|
+
|
|
19
|
+
update package command <br />
|
|
20
|
+
npm update turf-comman
|
|
@@ -21,3 +21,27 @@ export interface IGetPricingPlanByDateResponse {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
+
export interface IGetPricingPlanByDateResponseV2 {
|
|
25
|
+
id: number;
|
|
26
|
+
effective_from_date: number;
|
|
27
|
+
effective_to_date: number;
|
|
28
|
+
base_price: number;
|
|
29
|
+
unit: string;
|
|
30
|
+
billing_cost_code: string;
|
|
31
|
+
pitch_slab: {
|
|
32
|
+
[key: string]: {
|
|
33
|
+
from: number;
|
|
34
|
+
to: number;
|
|
35
|
+
discount: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
billing_cycle: {
|
|
39
|
+
[key: string]: {
|
|
40
|
+
from: number;
|
|
41
|
+
to: number;
|
|
42
|
+
discount: string;
|
|
43
|
+
name: string;
|
|
44
|
+
key: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -13,4 +13,20 @@ export interface IPricingPlanEntity extends IEntityAuditColumn {
|
|
|
13
13
|
basePrice: number;
|
|
14
14
|
billingCycle: string;
|
|
15
15
|
unit: string;
|
|
16
|
+
billingCostCode: string | null;
|
|
17
|
+
subscriptionCycle: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface IPricingPlanEntityV2 extends IEntityAuditColumn {
|
|
20
|
+
id: number;
|
|
21
|
+
effectiveFrom: Date;
|
|
22
|
+
effectiveTo: Date;
|
|
23
|
+
status: PricingPlanStatus;
|
|
24
|
+
createdBy: number;
|
|
25
|
+
createdOn: Date;
|
|
26
|
+
updatedBy: number;
|
|
27
|
+
updatedOn: Date;
|
|
28
|
+
basePrice: number;
|
|
29
|
+
unit: string;
|
|
30
|
+
subscriptionCycle: string | null;
|
|
31
|
+
billingCostCode: string | null;
|
|
16
32
|
}
|
|
@@ -24,3 +24,7 @@ export type ISubscriptionModel = ISubscriptionEntity & {
|
|
|
24
24
|
details?: ISubscriptionPitchMappingEntity[];
|
|
25
25
|
advanceAmount?: number;
|
|
26
26
|
};
|
|
27
|
+
export type ISubscriptionModelV2 = ISubscriptionEntity & {
|
|
28
|
+
details?: ISubscriptionPitchMappingEntity[];
|
|
29
|
+
advanceAmount?: number;
|
|
30
|
+
};
|
|
@@ -6,3 +6,10 @@ export interface ISubscriptionPitchMappingEntity extends IEntityAuditColumn {
|
|
|
6
6
|
status: string;
|
|
7
7
|
organizationId: number;
|
|
8
8
|
}
|
|
9
|
+
export interface ISubscriptionPitchMappingEntityV2 extends IEntityAuditColumn {
|
|
10
|
+
pitchId: number;
|
|
11
|
+
turfId: number;
|
|
12
|
+
subscriptionId: number;
|
|
13
|
+
status: string;
|
|
14
|
+
organizationId: number;
|
|
15
|
+
}
|
|
@@ -21,3 +21,24 @@ export interface GetPricingPlanByDateResponse {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
+
export interface GetPricingPlanByDateResponseV2 {
|
|
25
|
+
id: number;
|
|
26
|
+
effective_from_date: number;
|
|
27
|
+
effective_to_date: number;
|
|
28
|
+
base_price: number;
|
|
29
|
+
unit: string;
|
|
30
|
+
pitch_slab: {
|
|
31
|
+
[key: string]: {
|
|
32
|
+
from: number;
|
|
33
|
+
to: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
billing_cycle: {
|
|
37
|
+
[key: string]: {
|
|
38
|
+
from: number;
|
|
39
|
+
to: number;
|
|
40
|
+
name: string;
|
|
41
|
+
key: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PricingPlanModel } from "../../models/pricing-plan-model";
|
|
2
|
-
import { IPricingPlanEntity } from "../entity/pricing-plan-entity.interface";
|
|
3
|
-
import { GetPricingPlanByDateResponse } from "../get-pricing-plan-by-date-response.interface";
|
|
4
|
-
import { IPitchSlab } from "../pitch-slab.interface";
|
|
1
|
+
import { PricingPlanModel, PricingPlanModelV2 } from "../../models/pricing-plan-model";
|
|
2
|
+
import { IPricingPlanEntity, IPricingPlanEntityV2 } from "../entity/pricing-plan-entity.interface";
|
|
3
|
+
import { GetPricingPlanByDateResponse, GetPricingPlanByDateResponseV2 } from "../get-pricing-plan-by-date-response.interface";
|
|
4
|
+
import { IPitchSlab, IPitchSlabV2 } from "../pitch-slab.interface";
|
|
5
5
|
export interface IPricingPlanEntityModel extends IPricingPlanEntity {
|
|
6
6
|
getBillingCycleKeys(): string[];
|
|
7
7
|
toModel(): PricingPlanModel;
|
|
@@ -11,3 +11,12 @@ export interface IPricingPlanEntityModel extends IPricingPlanEntity {
|
|
|
11
11
|
toObject(): GetPricingPlanByDateResponse;
|
|
12
12
|
toPitchSlabs(): IPitchSlab[];
|
|
13
13
|
}
|
|
14
|
+
export interface IPricingPlanEntityModelV2 extends IPricingPlanEntityV2 {
|
|
15
|
+
getBillingCycleKeys(): string[];
|
|
16
|
+
toModel(): PricingPlanModelV2;
|
|
17
|
+
arrayToIndexedObject<T>(arr: T[]): {
|
|
18
|
+
[key: string]: T;
|
|
19
|
+
};
|
|
20
|
+
toObject(): GetPricingPlanByDateResponseV2;
|
|
21
|
+
toPitchSlabs(): IPitchSlabV2[];
|
|
22
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IBillingCycleModel } from "./billing-cycle.interface";
|
|
2
|
-
import { IPitchSlab } from "./pitch-slab.interface";
|
|
1
|
+
import { IBillingCycleModel, IBillingCycleModelV2 } from "./billing-cycle.interface";
|
|
2
|
+
import { IPitchSlab, IPitchSlabV2 } from "./pitch-slab.interface";
|
|
3
3
|
export interface IPricingPlanModel {
|
|
4
4
|
id: number;
|
|
5
5
|
effective_from_date: number;
|
|
@@ -13,3 +13,17 @@ export interface IPricingPlanModel {
|
|
|
13
13
|
[key: string]: IBillingCycleModel;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
+
export interface IPricingPlanModelV2 {
|
|
17
|
+
id: number;
|
|
18
|
+
effective_from_date: number;
|
|
19
|
+
effective_to_date: number;
|
|
20
|
+
base_price: number;
|
|
21
|
+
unit: string;
|
|
22
|
+
pitch_slab: {
|
|
23
|
+
[key: string]: IPitchSlabV2;
|
|
24
|
+
};
|
|
25
|
+
billing_cycle: {
|
|
26
|
+
[key: string]: IBillingCycleModelV2;
|
|
27
|
+
};
|
|
28
|
+
billing_cost_code: string;
|
|
29
|
+
}
|
|
@@ -13,3 +13,8 @@ export type RenewSubscriptionData = PickOnly<ISubscriptionEntity, "noOfPitches"
|
|
|
13
13
|
toDate: Date;
|
|
14
14
|
basePrice: number;
|
|
15
15
|
};
|
|
16
|
+
export type RenewSubscriptionDataV2 = PickOnly<ISubscriptionEntity, "noOfPitches" | "netAmount" | "grossAmount" | "organizationId" | "pricingPlanId" | "registrationId" | "type" | "previousSubscriptionIds" | "amountPaid" | "discount"> & {
|
|
17
|
+
fromDate: Date;
|
|
18
|
+
toDate: Date;
|
|
19
|
+
basePrice: number;
|
|
20
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBillingCycleModel } from "../interface/billing-cycle.interface";
|
|
1
|
+
import { IBillingCycleModel, IBillingCycleModelV2 } from "../interface/billing-cycle.interface";
|
|
2
2
|
export declare class BillingCycleModel implements IBillingCycleModel {
|
|
3
3
|
from: number;
|
|
4
4
|
to: number;
|
|
@@ -9,3 +9,11 @@ export declare class BillingCycleModel implements IBillingCycleModel {
|
|
|
9
9
|
getDiscount(): number;
|
|
10
10
|
getBillingCycle(date: Date): [Date, Date];
|
|
11
11
|
}
|
|
12
|
+
export declare class BillingCycleModelV2 implements IBillingCycleModelV2 {
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
name: string;
|
|
16
|
+
key: string;
|
|
17
|
+
constructor(data: IBillingCycleModelV2);
|
|
18
|
+
getBillingCycle(date: Date): [Date, Date];
|
|
19
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BillingCycleModel = void 0;
|
|
3
|
+
exports.BillingCycleModelV2 = exports.BillingCycleModel = void 0;
|
|
4
4
|
var date_util_1 = require("../utils/date-util");
|
|
5
5
|
var BillingCycleModel = /** @class */ (function () {
|
|
6
6
|
function BillingCycleModel(data) {
|
|
@@ -25,3 +25,27 @@ var BillingCycleModel = /** @class */ (function () {
|
|
|
25
25
|
return BillingCycleModel;
|
|
26
26
|
}());
|
|
27
27
|
exports.BillingCycleModel = BillingCycleModel;
|
|
28
|
+
// v2 __________________________________________________________________________________________//
|
|
29
|
+
var BillingCycleModelV2 = /** @class */ (function () {
|
|
30
|
+
function BillingCycleModelV2(data) {
|
|
31
|
+
this.from = data.from;
|
|
32
|
+
this.to = data.to;
|
|
33
|
+
// this.discount = data.discount;
|
|
34
|
+
this.name = data.name;
|
|
35
|
+
this.key = data.key;
|
|
36
|
+
}
|
|
37
|
+
// public getDiscount(): number {
|
|
38
|
+
// if (this.discount.indexOf("P") > -1) {
|
|
39
|
+
// return parseFloat(this.discount.replace("P", ""));
|
|
40
|
+
// }
|
|
41
|
+
// return 0;
|
|
42
|
+
// }
|
|
43
|
+
BillingCycleModelV2.prototype.getBillingCycle = function (date) {
|
|
44
|
+
// const dateUtilService = AppInjector.get(DateUtilService);
|
|
45
|
+
var startDate = date_util_1.dateUtilService.addNDaysToDate(date, 1);
|
|
46
|
+
var endDate = date_util_1.dateUtilService.addNDaysToDate(startDate, this.to * 30);
|
|
47
|
+
return [startDate, endDate];
|
|
48
|
+
};
|
|
49
|
+
return BillingCycleModelV2;
|
|
50
|
+
}());
|
|
51
|
+
exports.BillingCycleModelV2 = BillingCycleModelV2;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PricingPlanStatus } from "../../enums/pricing-plan-status.enum";
|
|
2
|
-
import { IBillingCycleModel } from "../../interface/billing-cycle.interface";
|
|
3
|
-
import { GetPricingPlanByDateResponse } from "../../interface/get-pricing-plan-by-date-response.interface";
|
|
4
|
-
import { IPitchSlab } from "../../interface/pitch-slab.interface";
|
|
5
|
-
import { IPricingPlanEntityModel } from "../../interface/model/pricing-plan-entity-model.interface";
|
|
6
|
-
import { IPricingPlanEntity } from "../../interface/entity/pricing-plan-entity.interface";
|
|
7
|
-
import { BillingCycleModel } from "../billing-cycle-model";
|
|
8
|
-
import { PricingPlanModel } from "../pricing-plan-model";
|
|
2
|
+
import { IBillingCycleModel, IBillingCycleModelV2 } from "../../interface/billing-cycle.interface";
|
|
3
|
+
import { GetPricingPlanByDateResponse, GetPricingPlanByDateResponseV2 } from "../../interface/get-pricing-plan-by-date-response.interface";
|
|
4
|
+
import { IPitchSlab, IPitchSlabV2 } from "../../interface/pitch-slab.interface";
|
|
5
|
+
import { IPricingPlanEntityModel, IPricingPlanEntityModelV2 } from "../../interface/model/pricing-plan-entity-model.interface";
|
|
6
|
+
import { IPricingPlanEntity, IPricingPlanEntityV2 } from "../../interface/entity/pricing-plan-entity.interface";
|
|
7
|
+
import { BillingCycleModel, BillingCycleModelV2 } from "../billing-cycle-model";
|
|
8
|
+
import { PricingPlanModel, PricingPlanModelV2 } from "../pricing-plan-model";
|
|
9
9
|
export declare class PricingPlanEntityModel implements IPricingPlanEntityModel {
|
|
10
10
|
id: number;
|
|
11
11
|
effectiveFrom: Date;
|
|
@@ -19,6 +19,8 @@ export declare class PricingPlanEntityModel implements IPricingPlanEntityModel {
|
|
|
19
19
|
basePrice: number;
|
|
20
20
|
billingCycle: string;
|
|
21
21
|
unit: string;
|
|
22
|
+
billingCostCode: string | null;
|
|
23
|
+
subscriptionCycle: string | null;
|
|
22
24
|
constructor(data: IPricingPlanEntity);
|
|
23
25
|
getBillingCycleKeys(): string[];
|
|
24
26
|
toModel(): PricingPlanModel;
|
|
@@ -34,6 +36,11 @@ export declare class PitchSlabParser {
|
|
|
34
36
|
constructor(code: string);
|
|
35
37
|
parseToModel(): IPitchSlab;
|
|
36
38
|
}
|
|
39
|
+
export declare class PitchSlabParserV2 {
|
|
40
|
+
code: string;
|
|
41
|
+
constructor(code: string);
|
|
42
|
+
parseToModel(): IPitchSlabV2;
|
|
43
|
+
}
|
|
37
44
|
export declare class BillingCycleCodeParser {
|
|
38
45
|
code: string;
|
|
39
46
|
from: number;
|
|
@@ -45,3 +52,36 @@ export declare class BillingCycleCodeParser {
|
|
|
45
52
|
parseToModel(): BillingCycleModel;
|
|
46
53
|
getKey(): string;
|
|
47
54
|
}
|
|
55
|
+
export declare class PricingPlanEntityModelV2 implements IPricingPlanEntityModelV2 {
|
|
56
|
+
id: number;
|
|
57
|
+
effectiveFrom: Date;
|
|
58
|
+
effectiveTo: Date;
|
|
59
|
+
status: PricingPlanStatus;
|
|
60
|
+
createdBy: number;
|
|
61
|
+
createdOn: Date;
|
|
62
|
+
updatedBy: number;
|
|
63
|
+
updatedOn: Date;
|
|
64
|
+
basePrice: number;
|
|
65
|
+
unit: string;
|
|
66
|
+
billingCostCode: string | null;
|
|
67
|
+
subscriptionCycle: string | null;
|
|
68
|
+
constructor(data: IPricingPlanEntityV2);
|
|
69
|
+
getBillingCycleKeys(): string[];
|
|
70
|
+
toModel(): PricingPlanModelV2;
|
|
71
|
+
arrayToIndexedObject<T>(arr: T[]): {
|
|
72
|
+
[key: string]: T;
|
|
73
|
+
};
|
|
74
|
+
toObject(): GetPricingPlanByDateResponseV2;
|
|
75
|
+
toPitchSlabs(): IPitchSlabV2[];
|
|
76
|
+
toBillingCycles(): IBillingCycleModelV2[];
|
|
77
|
+
}
|
|
78
|
+
export declare class BillingCycleCodeParserV2 {
|
|
79
|
+
code: string;
|
|
80
|
+
from: number;
|
|
81
|
+
to: number;
|
|
82
|
+
name: string;
|
|
83
|
+
constructor(code: string);
|
|
84
|
+
parse(): BillingCycleCodeParserV2;
|
|
85
|
+
parseToModel(): BillingCycleModelV2;
|
|
86
|
+
getKey(): string;
|
|
87
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BillingCycleCodeParser = exports.PitchSlabParser = exports.PricingPlanEntityModel = void 0;
|
|
3
|
+
exports.BillingCycleCodeParserV2 = exports.PricingPlanEntityModelV2 = exports.BillingCycleCodeParser = exports.PitchSlabParserV2 = exports.PitchSlabParser = exports.PricingPlanEntityModel = void 0;
|
|
4
4
|
var billing_cycle_model_1 = require("../billing-cycle-model");
|
|
5
5
|
var booking_code_model_1 = require("../booking-code-model");
|
|
6
6
|
var pitch_slab_model_1 = require("../pitch-slab-model");
|
|
@@ -94,6 +94,22 @@ var PitchSlabParser = /** @class */ (function () {
|
|
|
94
94
|
return PitchSlabParser;
|
|
95
95
|
}());
|
|
96
96
|
exports.PitchSlabParser = PitchSlabParser;
|
|
97
|
+
var PitchSlabParserV2 = /** @class */ (function () {
|
|
98
|
+
function PitchSlabParserV2(code) {
|
|
99
|
+
this.code = code;
|
|
100
|
+
}
|
|
101
|
+
PitchSlabParserV2.prototype.parseToModel = function () {
|
|
102
|
+
var costCodeComponents = this.code.split("#");
|
|
103
|
+
costCodeComponents = costCodeComponents[0].split("_");
|
|
104
|
+
return new pitch_slab_model_1.PitchSlabModelV2({
|
|
105
|
+
// discount: costCodeComponents[1],
|
|
106
|
+
from: parseInt(costCodeComponents[0]),
|
|
107
|
+
to: parseInt(costCodeComponents[1]),
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
return PitchSlabParserV2;
|
|
111
|
+
}());
|
|
112
|
+
exports.PitchSlabParserV2 = PitchSlabParserV2;
|
|
97
113
|
var BillingCycleCodeParser = /** @class */ (function () {
|
|
98
114
|
function BillingCycleCodeParser(code) {
|
|
99
115
|
this.code = code;
|
|
@@ -126,3 +142,114 @@ var BillingCycleCodeParser = /** @class */ (function () {
|
|
|
126
142
|
return BillingCycleCodeParser;
|
|
127
143
|
}());
|
|
128
144
|
exports.BillingCycleCodeParser = BillingCycleCodeParser;
|
|
145
|
+
// V2 ___________________________________________________________________________________________//
|
|
146
|
+
// Done
|
|
147
|
+
var PricingPlanEntityModelV2 = /** @class */ (function () {
|
|
148
|
+
function PricingPlanEntityModelV2(data) {
|
|
149
|
+
Object.assign(this, data);
|
|
150
|
+
}
|
|
151
|
+
PricingPlanEntityModelV2.prototype.getBillingCycleKeys = function () {
|
|
152
|
+
return this.toBillingCycles().map(function (billingCycle) { return billingCycle.key; });
|
|
153
|
+
};
|
|
154
|
+
PricingPlanEntityModelV2.prototype.toModel = function () {
|
|
155
|
+
return new pricing_plan_model_1.PricingPlanModelV2({
|
|
156
|
+
id: this.id,
|
|
157
|
+
base_price: this.basePrice,
|
|
158
|
+
effective_from_date: parseInt(booking_code_model_1.BookingCode.getDateCode(this.effectiveFrom)),
|
|
159
|
+
effective_to_date: parseInt(booking_code_model_1.BookingCode.getDateCode(this.effectiveTo)),
|
|
160
|
+
unit: this.unit,
|
|
161
|
+
billing_cycle: this.arrayToIndexedObject(this.toBillingCycles()),
|
|
162
|
+
pitch_slab: this.arrayToIndexedObject(this.toPitchSlabs()),
|
|
163
|
+
billing_cost_code: this.billingCostCode,
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
PricingPlanEntityModelV2.prototype.arrayToIndexedObject = function (arr) {
|
|
167
|
+
return arr.reduce(function (result, item, index) {
|
|
168
|
+
result[index.toString()] = item; //a, b, c
|
|
169
|
+
return result;
|
|
170
|
+
}, {});
|
|
171
|
+
};
|
|
172
|
+
PricingPlanEntityModelV2.prototype.toObject = function () {
|
|
173
|
+
var _a;
|
|
174
|
+
var responseObj = {
|
|
175
|
+
id: this.id,
|
|
176
|
+
effective_from_date: 0,
|
|
177
|
+
effective_to_date: 0,
|
|
178
|
+
base_price: 0,
|
|
179
|
+
unit: "per_hour_per_pitch",
|
|
180
|
+
pitch_slab: {},
|
|
181
|
+
billing_cycle: {},
|
|
182
|
+
};
|
|
183
|
+
var billingCycle = (_a = this.subscriptionCycle) === null || _a === void 0 ? void 0 : _a.split(",");
|
|
184
|
+
billingCycle === null || billingCycle === void 0 ? void 0 : billingCycle.forEach(function (billing, index) {
|
|
185
|
+
var billingArray = billing.split("_");
|
|
186
|
+
responseObj.billing_cycle[index] = {
|
|
187
|
+
from: Number(billingArray[0].slice(0, 3)),
|
|
188
|
+
to: Number(billingArray[0].slice(3, 6)),
|
|
189
|
+
// discount: billingArray[1],
|
|
190
|
+
name: billingArray.slice(2).join("_"),
|
|
191
|
+
key: billingArray.slice(2).join("-").toLowerCase().replace(/ /g, "-"),
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
this.billingCostCode.split(",").forEach(function (code, index) {
|
|
195
|
+
var costCode = code.split("#");
|
|
196
|
+
responseObj.pitch_slab[index] = {
|
|
197
|
+
from: Number(costCode[0]),
|
|
198
|
+
to: Number(costCode[0]),
|
|
199
|
+
// discount: costCode[1],
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
responseObj.effective_from_date = Number(booking_code_model_1.BookingCode.getDateCode(this.effectiveFrom));
|
|
203
|
+
responseObj.effective_to_date = Number(booking_code_model_1.BookingCode.getDateCode(this.effectiveTo));
|
|
204
|
+
responseObj.unit = this.unit;
|
|
205
|
+
responseObj.base_price = this.basePrice;
|
|
206
|
+
return responseObj;
|
|
207
|
+
};
|
|
208
|
+
PricingPlanEntityModelV2.prototype.toPitchSlabs = function () {
|
|
209
|
+
return this.billingCostCode
|
|
210
|
+
.split(",")
|
|
211
|
+
.map(function (cost_code) { return new PitchSlabParserV2(cost_code).parseToModel(); });
|
|
212
|
+
};
|
|
213
|
+
PricingPlanEntityModelV2.prototype.toBillingCycles = function () {
|
|
214
|
+
return this.subscriptionCycle
|
|
215
|
+
.split(",")
|
|
216
|
+
.map(function (billingCode) {
|
|
217
|
+
return new BillingCycleCodeParserV2(billingCode).parseToModel();
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
return PricingPlanEntityModelV2;
|
|
221
|
+
}());
|
|
222
|
+
exports.PricingPlanEntityModelV2 = PricingPlanEntityModelV2;
|
|
223
|
+
// Done
|
|
224
|
+
var BillingCycleCodeParserV2 = /** @class */ (function () {
|
|
225
|
+
function BillingCycleCodeParserV2(code) {
|
|
226
|
+
this.code = code;
|
|
227
|
+
}
|
|
228
|
+
BillingCycleCodeParserV2.prototype.parse = function () {
|
|
229
|
+
var billingCycleComponents = this.code.split("_");
|
|
230
|
+
this.from = parseInt(billingCycleComponents[0].slice(0, 3));
|
|
231
|
+
this.to = parseInt(billingCycleComponents[0].slice(3, 6));
|
|
232
|
+
// this.discount = billingCycleComponents[1];
|
|
233
|
+
this.name = billingCycleComponents[2];
|
|
234
|
+
return this;
|
|
235
|
+
};
|
|
236
|
+
BillingCycleCodeParserV2.prototype.parseToModel = function () {
|
|
237
|
+
var billingCycleComponents = this.code.split("_");
|
|
238
|
+
this.from = parseInt(billingCycleComponents[0].slice(0, 3));
|
|
239
|
+
this.to = parseInt(billingCycleComponents[0].slice(3, 6));
|
|
240
|
+
// this.discount = billingCycleComponents[1];
|
|
241
|
+
this.name = billingCycleComponents[2];
|
|
242
|
+
return new billing_cycle_model_1.BillingCycleModelV2({
|
|
243
|
+
// discount: this.discount,
|
|
244
|
+
from: this.from,
|
|
245
|
+
to: this.to,
|
|
246
|
+
name: this.name,
|
|
247
|
+
key: this.getKey(),
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
BillingCycleCodeParserV2.prototype.getKey = function () {
|
|
251
|
+
return this.name.toLowerCase().replace(" ", "-");
|
|
252
|
+
};
|
|
253
|
+
return BillingCycleCodeParserV2;
|
|
254
|
+
}());
|
|
255
|
+
exports.BillingCycleCodeParserV2 = BillingCycleCodeParserV2;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IGetCurrentSubscriptionResponse, ISubscriptionPitchMappingEntity } from "../../@type";
|
|
2
2
|
import { SubscriptionStatus } from "../../enums/subscription-status.enum";
|
|
3
|
-
import { ISubscriptionEntity, ISubscriptionModel } from "../../interface/entity/subscription-entity.interface";
|
|
4
|
-
import { RenewSubscriptionData, UpgradeSubscriptionData } from "../../interface/ui/upgrade-subscription-data.interface";
|
|
5
|
-
import { PricingPlanModel } from "../pricing-plan-model";
|
|
6
|
-
import { SubscribedPricingPlanModel } from "../subscribed-pricing-plan-model";
|
|
3
|
+
import { ISubscriptionEntity, ISubscriptionModel, ISubscriptionModelV2 } from "../../interface/entity/subscription-entity.interface";
|
|
4
|
+
import { RenewSubscriptionData, RenewSubscriptionDataV2, UpgradeSubscriptionData } from "../../interface/ui/upgrade-subscription-data.interface";
|
|
5
|
+
import { PricingPlanModel, PricingPlanModelV2 } from "../pricing-plan-model";
|
|
6
|
+
import { SubscribedPricingPlanModel, SubscribedPricingPlanModelV2 } from "../subscribed-pricing-plan-model";
|
|
7
7
|
export declare class SubscriptionModel implements ISubscriptionModel {
|
|
8
8
|
id: number;
|
|
9
9
|
organizationId: number;
|
|
@@ -42,3 +42,41 @@ export declare class SubscriptionModel implements ISubscriptionModel {
|
|
|
42
42
|
isAmountPaidGreater(): boolean;
|
|
43
43
|
updateStatusIfPaymentDone(): void;
|
|
44
44
|
}
|
|
45
|
+
export declare class SubscriptionModelV2 implements ISubscriptionModelV2 {
|
|
46
|
+
id: number;
|
|
47
|
+
organizationId: number;
|
|
48
|
+
from: Date;
|
|
49
|
+
to: Date;
|
|
50
|
+
type: string;
|
|
51
|
+
grossAmount: number;
|
|
52
|
+
discount: string;
|
|
53
|
+
netAmount: number;
|
|
54
|
+
amountPaid: number;
|
|
55
|
+
status: SubscriptionStatus;
|
|
56
|
+
noOfPitches: number;
|
|
57
|
+
remarks: string;
|
|
58
|
+
registrationId: number;
|
|
59
|
+
pricingPlanId: number;
|
|
60
|
+
previousSubscriptionIds: string;
|
|
61
|
+
createdOn: Date;
|
|
62
|
+
updatedOn: Date;
|
|
63
|
+
createdBy: number;
|
|
64
|
+
updatedBy: number;
|
|
65
|
+
fromDateCode: string;
|
|
66
|
+
toDateCode: string;
|
|
67
|
+
details?: ISubscriptionPitchMappingEntity[];
|
|
68
|
+
advanceAmount?: number;
|
|
69
|
+
constructor(data: ISubscriptionEntity);
|
|
70
|
+
static getInstanceByResponse(data: IGetCurrentSubscriptionResponse): SubscriptionModelV2;
|
|
71
|
+
getFromDate(): Date;
|
|
72
|
+
getToDate(): Date;
|
|
73
|
+
isRenewalDue(): boolean;
|
|
74
|
+
remainingSubscriptionDays(): number;
|
|
75
|
+
upgradeSubscription(totalPitchCount: number, subscribedPricingModel: SubscribedPricingPlanModelV2): UpgradeSubscriptionData;
|
|
76
|
+
renewSubscription(totalPitchCount: number, billingCycle: string, currentPricingPlanModel: PricingPlanModelV2): RenewSubscriptionDataV2;
|
|
77
|
+
static updateStatus(subscriptionEntities: ISubscriptionEntity[], status: SubscriptionStatus, userId: number): ISubscriptionEntity[];
|
|
78
|
+
remainingAmount(): number;
|
|
79
|
+
isAmountFullyPaid(): boolean;
|
|
80
|
+
isAmountPaidGreater(): boolean;
|
|
81
|
+
updateStatusIfPaymentDone(): void;
|
|
82
|
+
}
|
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.SubscriptionModel = void 0;
|
|
14
|
+
exports.SubscriptionModelV2 = exports.SubscriptionModel = void 0;
|
|
15
15
|
var subscription_status_enum_1 = require("../../enums/subscription-status.enum");
|
|
16
16
|
var constant_1 = require("../../utils/constant");
|
|
17
17
|
var date_util_1 = require("../../utils/date-util");
|
|
@@ -152,3 +152,140 @@ var SubscriptionModel = /** @class */ (function () {
|
|
|
152
152
|
return SubscriptionModel;
|
|
153
153
|
}());
|
|
154
154
|
exports.SubscriptionModel = SubscriptionModel;
|
|
155
|
+
var SubscriptionModelV2 = /** @class */ (function () {
|
|
156
|
+
function SubscriptionModelV2(data) {
|
|
157
|
+
Object.assign(this, data);
|
|
158
|
+
}
|
|
159
|
+
SubscriptionModelV2.getInstanceByResponse = function (data) {
|
|
160
|
+
// this.id = data.id;
|
|
161
|
+
// this.organizationId = data.organizationId;
|
|
162
|
+
// this.from = data.from;
|
|
163
|
+
// this.to = data.to;
|
|
164
|
+
// this.type = data.type;
|
|
165
|
+
// this.grossAmount = data.grossAmount;
|
|
166
|
+
// this.discount = data.discount;
|
|
167
|
+
// this.netAmount = data.netAmount;
|
|
168
|
+
// this.amountPaid = data.amountPaid;
|
|
169
|
+
// this.status = data.status;
|
|
170
|
+
// this.noOfPitches = data.noOfPitches;
|
|
171
|
+
// this.createdBy = data.createdBy;
|
|
172
|
+
// this.createdOn = data.createdOn;
|
|
173
|
+
// this.updatedBy = data.updatedBy;
|
|
174
|
+
// this.updatedOn = data.updatedOn;
|
|
175
|
+
// this.remarks = data.remarks;
|
|
176
|
+
// this.registrationId = data.registrationId;
|
|
177
|
+
// this.pricingPlanId = data.pricingPlanId;
|
|
178
|
+
// this.upgradeSubscriptionId = Number(data.previousSubscriptionIds);
|
|
179
|
+
// this.details = data.details;
|
|
180
|
+
var demo = __assign(__assign({}, data), { from: date_util_1.dateUtilService.getDateFromDatabaseDate(data.from), to: date_util_1.dateUtilService.getDateFromDatabaseDate(data.to), createdOn: date_util_1.dateUtilService.getDateFromDatabaseDate(data.createdOn), updatedOn: date_util_1.dateUtilService.getDateFromDatabaseDate(data.updatedOn) });
|
|
181
|
+
return new SubscriptionModelV2(demo);
|
|
182
|
+
};
|
|
183
|
+
SubscriptionModelV2.prototype.getFromDate = function () {
|
|
184
|
+
return date_util_1.dateUtilService.convertStringToDate(this.fromDateCode, "yyMMdd");
|
|
185
|
+
};
|
|
186
|
+
SubscriptionModelV2.prototype.getToDate = function () {
|
|
187
|
+
return date_util_1.dateUtilService.convertStringToDate(this.toDateCode, "yyMMdd");
|
|
188
|
+
};
|
|
189
|
+
SubscriptionModelV2.prototype.isRenewalDue = function () {
|
|
190
|
+
// Check if difference 'to' date and today's date is less than 7 days
|
|
191
|
+
return (this.getToDate().getTime() - new Date().getTime() <
|
|
192
|
+
constant_1.SUBSCRIPTION_RENEWAL_THRESHOLD_DAYS * 24 * 60 * 60 * 1000);
|
|
193
|
+
};
|
|
194
|
+
SubscriptionModelV2.prototype.remainingSubscriptionDays = function () {
|
|
195
|
+
// const oneDay = 24 * 60 * 60 * 1000;
|
|
196
|
+
// const dayDifference = Math.ceil(
|
|
197
|
+
// (this.to.getTime() - new Date().getTime()) / oneDay
|
|
198
|
+
// );
|
|
199
|
+
// return dayDifference - 1; //minus 1 day
|
|
200
|
+
return date_util_1.dateUtilService.noOfDaysBetweenDates(new Date(), this.getToDate());
|
|
201
|
+
};
|
|
202
|
+
SubscriptionModelV2.prototype.upgradeSubscription = function (totalPitchCount, subscribedPricingModel) {
|
|
203
|
+
var newlyAddedPitchCount = totalPitchCount - this.noOfPitches;
|
|
204
|
+
var basePrice = subscribedPricingModel.getSelectedPitchSlabBasePrice();
|
|
205
|
+
var remainingSubscriptionDays = this.remainingSubscriptionDays();
|
|
206
|
+
var additionalGrossAmount = basePrice * remainingSubscriptionDays * 24 * newlyAddedPitchCount;
|
|
207
|
+
return {
|
|
208
|
+
amountPaid: this.amountPaid,
|
|
209
|
+
discount: this.discount,
|
|
210
|
+
from: this.from,
|
|
211
|
+
to: this.to,
|
|
212
|
+
noOfPitches: totalPitchCount,
|
|
213
|
+
netAmount: Math.round(this.netAmount + additionalGrossAmount),
|
|
214
|
+
grossAmount: Math.round(this.grossAmount + additionalGrossAmount),
|
|
215
|
+
organizationId: this.organizationId,
|
|
216
|
+
pricingPlanId: this.pricingPlanId,
|
|
217
|
+
registrationId: this.registrationId,
|
|
218
|
+
type: this.type,
|
|
219
|
+
previousSubscriptionIds: this.id.toString(),
|
|
220
|
+
newlyAddedPitchCount: newlyAddedPitchCount,
|
|
221
|
+
basePrice: basePrice,
|
|
222
|
+
remainingSubscriptionDays: remainingSubscriptionDays,
|
|
223
|
+
additionalGrossAmount: Math.round(additionalGrossAmount),
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
SubscriptionModelV2.prototype.renewSubscription = function (totalPitchCount, billingCycle, currentPricingPlanModel) {
|
|
227
|
+
// const dateUtilService = new DateUtilService();
|
|
228
|
+
// dateService.convertStringToDate(this.from, "yyyy-MM-dd");
|
|
229
|
+
// const subscribedPitchCount: number = this.noOfPitches;
|
|
230
|
+
var renewalSubscriptionModel = new subscribed_pricing_plan_model_1.SubscribedPricingPlanModelV2(currentPricingPlanModel, totalPitchCount, billingCycle);
|
|
231
|
+
var toDate = this.getToDate();
|
|
232
|
+
var _a = renewalSubscriptionModel.getNextBillingCycleDateRange(toDate), startDate = _a[0], endDate = _a[1];
|
|
233
|
+
// const [startDateCode, endDateCode]: [string, string] = [
|
|
234
|
+
// dateService.getDateCode(startDate),
|
|
235
|
+
// dateService.getDateCode(endDate),
|
|
236
|
+
// ];
|
|
237
|
+
return {
|
|
238
|
+
amountPaid: 0,
|
|
239
|
+
// discount: renewalSubscriptionModel.selectedBillingCycle.discount,
|
|
240
|
+
discount: renewalSubscriptionModel.getDiscount(),
|
|
241
|
+
fromDate: startDate,
|
|
242
|
+
grossAmount: Math.round(renewalSubscriptionModel.getGrossAmount()),
|
|
243
|
+
netAmount: Math.round(renewalSubscriptionModel.getNetAmount()),
|
|
244
|
+
noOfPitches: totalPitchCount,
|
|
245
|
+
pricingPlanId: currentPricingPlanModel.id,
|
|
246
|
+
toDate: endDate,
|
|
247
|
+
type: billingCycle,
|
|
248
|
+
organizationId: this.organizationId,
|
|
249
|
+
registrationId: this.registrationId,
|
|
250
|
+
previousSubscriptionIds: null,
|
|
251
|
+
basePrice: renewalSubscriptionModel.getSelectedPitchSlabBasePrice(),
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
SubscriptionModelV2.updateStatus = function (subscriptionEntities, status, userId) {
|
|
255
|
+
return subscriptionEntities.map(function (subscriptionEntity) {
|
|
256
|
+
subscriptionEntity.status = status;
|
|
257
|
+
subscriptionEntity.updatedBy = userId;
|
|
258
|
+
subscriptionEntity.updatedOn = new Date();
|
|
259
|
+
return subscriptionEntity;
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
SubscriptionModelV2.prototype.remainingAmount = function () {
|
|
263
|
+
return this.netAmount - this.amountPaid;
|
|
264
|
+
};
|
|
265
|
+
SubscriptionModelV2.prototype.isAmountFullyPaid = function () {
|
|
266
|
+
if (this.netAmount === this.amountPaid) {
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
return false;
|
|
270
|
+
};
|
|
271
|
+
SubscriptionModelV2.prototype.isAmountPaidGreater = function () {
|
|
272
|
+
if (this.amountPaid > this.netAmount) {
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
return false;
|
|
276
|
+
};
|
|
277
|
+
SubscriptionModelV2.prototype.updateStatusIfPaymentDone = function () {
|
|
278
|
+
if (this.isAmountFullyPaid()) {
|
|
279
|
+
this.status =
|
|
280
|
+
this.status === subscription_status_enum_1.SubscriptionStatus.UPGRADE_PAYMENT_PENDING
|
|
281
|
+
? subscription_status_enum_1.SubscriptionStatus.UPGRADE_PAYMENT_DONE
|
|
282
|
+
: this.status === subscription_status_enum_1.SubscriptionStatus.UPGRADE_RENEW_PAYMENT_PENDING
|
|
283
|
+
? subscription_status_enum_1.SubscriptionStatus.UPGRADE_RENEW_PAYMENT_DONE
|
|
284
|
+
: this.status === subscription_status_enum_1.SubscriptionStatus.PAYMENT_PENDING
|
|
285
|
+
? subscription_status_enum_1.SubscriptionStatus.PAYMENT_DONE
|
|
286
|
+
: this.status;
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
return SubscriptionModelV2;
|
|
290
|
+
}());
|
|
291
|
+
exports.SubscriptionModelV2 = SubscriptionModelV2;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPitchSlab } from "../interface/pitch-slab.interface";
|
|
1
|
+
import { IPitchSlab, IPitchSlabV2 } from "../interface/pitch-slab.interface";
|
|
2
2
|
export declare class PitchSlabModel implements IPitchSlab {
|
|
3
3
|
from: number;
|
|
4
4
|
to: number;
|
|
@@ -7,3 +7,8 @@ export declare class PitchSlabModel implements IPitchSlab {
|
|
|
7
7
|
getDiscount(): number;
|
|
8
8
|
getBasePrice(basePrice: number): number;
|
|
9
9
|
}
|
|
10
|
+
export declare class PitchSlabModelV2 implements IPitchSlabV2 {
|
|
11
|
+
from: number;
|
|
12
|
+
to: number;
|
|
13
|
+
constructor(data: IPitchSlabV2);
|
|
14
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PitchSlabModel = void 0;
|
|
3
|
+
exports.PitchSlabModelV2 = exports.PitchSlabModel = void 0;
|
|
4
4
|
var PitchSlabModel = /** @class */ (function () {
|
|
5
5
|
function PitchSlabModel(data) {
|
|
6
6
|
this.from = data.from;
|
|
@@ -19,3 +19,14 @@ var PitchSlabModel = /** @class */ (function () {
|
|
|
19
19
|
return PitchSlabModel;
|
|
20
20
|
}());
|
|
21
21
|
exports.PitchSlabModel = PitchSlabModel;
|
|
22
|
+
//v2 __________________________________________________________________________________________//
|
|
23
|
+
var PitchSlabModelV2 = /** @class */ (function () {
|
|
24
|
+
// public discount: string;
|
|
25
|
+
function PitchSlabModelV2(data) {
|
|
26
|
+
this.from = data.from;
|
|
27
|
+
this.to = data.to;
|
|
28
|
+
// this.discount = data.discount;
|
|
29
|
+
}
|
|
30
|
+
return PitchSlabModelV2;
|
|
31
|
+
}());
|
|
32
|
+
exports.PitchSlabModelV2 = PitchSlabModelV2;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IPricingPlanModel } from "../interface/pricing-plan.interface";
|
|
2
|
-
import { PitchSlabModel } from "./pitch-slab-model";
|
|
3
|
-
import { BillingCycleModel } from "./billing-cycle-model";
|
|
1
|
+
import { IPricingPlanModel, IPricingPlanModelV2 } from "../interface/pricing-plan.interface";
|
|
2
|
+
import { PitchSlabModel, PitchSlabModelV2 } from "./pitch-slab-model";
|
|
3
|
+
import { BillingCycleModel, BillingCycleModelV2 } from "./billing-cycle-model";
|
|
4
4
|
export declare class PricingPlanModel implements IPricingPlanModel {
|
|
5
5
|
id: number;
|
|
6
6
|
effective_from_date: number;
|
|
@@ -25,3 +25,28 @@ export declare class PricingPlanModel implements IPricingPlanModel {
|
|
|
25
25
|
formatPitchSlab(index: number): string;
|
|
26
26
|
getBillingCycleIndexByMonths(noOfMonths: number): number;
|
|
27
27
|
}
|
|
28
|
+
export declare class PricingPlanModelV2 implements IPricingPlanModelV2 {
|
|
29
|
+
id: number;
|
|
30
|
+
effective_from_date: number;
|
|
31
|
+
effective_to_date: number;
|
|
32
|
+
base_price: number;
|
|
33
|
+
unit: string;
|
|
34
|
+
pitch_slab: {
|
|
35
|
+
[key: string]: PitchSlabModelV2;
|
|
36
|
+
};
|
|
37
|
+
billing_cycle: {
|
|
38
|
+
[key: string]: BillingCycleModelV2;
|
|
39
|
+
};
|
|
40
|
+
billing_cost_code: string;
|
|
41
|
+
constructor(data: IPricingPlanModelV2);
|
|
42
|
+
getPitchSlab(pitchCount: number): PitchSlabModelV2;
|
|
43
|
+
getBillingCycle(billingCycleKey: string): BillingCycleModelV2;
|
|
44
|
+
getMonth(billingCycleKey: string): number;
|
|
45
|
+
getNoOfSubscriptionDays(billingCycleKey: string): number;
|
|
46
|
+
getBillingCycleKeys(): string[];
|
|
47
|
+
validateBillingCycleKey(billingCycleKey: string): void;
|
|
48
|
+
getBillingCycleByDay(numberOfDay: number): BillingCycleModelV2 | undefined;
|
|
49
|
+
getPitchSlabIndex(pitchCount: number): number;
|
|
50
|
+
formatPitchSlab(index: number): string;
|
|
51
|
+
getBillingCycleIndexByMonths(noOfMonths: number): number;
|
|
52
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PricingPlanModel = void 0;
|
|
3
|
+
exports.PricingPlanModelV2 = exports.PricingPlanModel = void 0;
|
|
4
4
|
var pitch_slab_model_1 = require("./pitch-slab-model");
|
|
5
5
|
var billing_cycle_model_1 = require("./billing-cycle-model");
|
|
6
6
|
var app_badrequest_exception_1 = require("../exceptions/app-badrequest.exception");
|
|
@@ -87,3 +87,88 @@ var PricingPlanModel = /** @class */ (function () {
|
|
|
87
87
|
return PricingPlanModel;
|
|
88
88
|
}());
|
|
89
89
|
exports.PricingPlanModel = PricingPlanModel;
|
|
90
|
+
//v2 __________________________________________________________________________________________//
|
|
91
|
+
// Done
|
|
92
|
+
var PricingPlanModelV2 = /** @class */ (function () {
|
|
93
|
+
function PricingPlanModelV2(data) {
|
|
94
|
+
var _this = this;
|
|
95
|
+
this.id = data.id;
|
|
96
|
+
this.effective_from_date = data.effective_from_date;
|
|
97
|
+
this.effective_to_date = data.effective_to_date;
|
|
98
|
+
this.base_price = data.base_price;
|
|
99
|
+
this.unit = data.unit;
|
|
100
|
+
this.pitch_slab = {};
|
|
101
|
+
this.billing_cycle = {};
|
|
102
|
+
Object.keys(data.pitch_slab).forEach(function (key) {
|
|
103
|
+
_this.pitch_slab[key] = new pitch_slab_model_1.PitchSlabModelV2(data.pitch_slab[key]);
|
|
104
|
+
});
|
|
105
|
+
Object.keys(data.billing_cycle).forEach(function (key) {
|
|
106
|
+
_this.billing_cycle[key] = new billing_cycle_model_1.BillingCycleModelV2(data.billing_cycle[key]);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
PricingPlanModelV2.prototype.getPitchSlab = function (pitchCount) {
|
|
110
|
+
var pitchRangesMap = this.pitch_slab;
|
|
111
|
+
var pitchRanges = Object.values(pitchRangesMap);
|
|
112
|
+
var selectedPitchSlab = pitchRanges.filter(function (pitchRange) {
|
|
113
|
+
return pitchRange.from <= pitchCount && pitchCount <= pitchRange.to;
|
|
114
|
+
})[0];
|
|
115
|
+
return selectedPitchSlab;
|
|
116
|
+
};
|
|
117
|
+
PricingPlanModelV2.prototype.getBillingCycle = function (billingCycleKey) {
|
|
118
|
+
var billingCycleMap = this.billing_cycle;
|
|
119
|
+
var billingCycles = Object.values(billingCycleMap);
|
|
120
|
+
var selectedBillingCycle = billingCycles.filter(function (_a) {
|
|
121
|
+
var key = _a.key;
|
|
122
|
+
return key === billingCycleKey;
|
|
123
|
+
})[0];
|
|
124
|
+
return selectedBillingCycle;
|
|
125
|
+
};
|
|
126
|
+
PricingPlanModelV2.prototype.getMonth = function (billingCycleKey) {
|
|
127
|
+
return this.getBillingCycle(billingCycleKey).to;
|
|
128
|
+
};
|
|
129
|
+
PricingPlanModelV2.prototype.getNoOfSubscriptionDays = function (billingCycleKey) {
|
|
130
|
+
return this.getBillingCycle(billingCycleKey).to * 30 - 1;
|
|
131
|
+
};
|
|
132
|
+
PricingPlanModelV2.prototype.getBillingCycleKeys = function () {
|
|
133
|
+
return Object.values(this.billing_cycle).map(function (obj) { return obj.key; });
|
|
134
|
+
};
|
|
135
|
+
PricingPlanModelV2.prototype.validateBillingCycleKey = function (billingCycleKey) {
|
|
136
|
+
if (!this.getBillingCycleKeys().includes(billingCycleKey)) {
|
|
137
|
+
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
138
|
+
key: "type",
|
|
139
|
+
message: ["pricing plan type:'".concat(billingCycleKey, "' is not found")],
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
PricingPlanModelV2.prototype.getBillingCycleByDay = function (numberOfDay) {
|
|
144
|
+
return Object.values(this.billing_cycle).find(function (obj) {
|
|
145
|
+
if (numberOfDay <= obj.to * 30) {
|
|
146
|
+
return obj;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
PricingPlanModelV2.prototype.getPitchSlabIndex = function (pitchCount) {
|
|
151
|
+
var pitchRangesMap = this.pitch_slab;
|
|
152
|
+
var pitchRanges = Object.values(pitchRangesMap);
|
|
153
|
+
return pitchRanges.findIndex(function (pitchRange) {
|
|
154
|
+
return pitchRange.from <= pitchCount && pitchCount <= pitchRange.to;
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
PricingPlanModelV2.prototype.formatPitchSlab = function (index) {
|
|
158
|
+
var pitchRangesMap = this.pitch_slab;
|
|
159
|
+
var pitchRanges = Object.values(pitchRangesMap);
|
|
160
|
+
var selectedPitchSlab = pitchRanges[index];
|
|
161
|
+
if (index === pitchRanges.length - 1) {
|
|
162
|
+
return "".concat(selectedPitchSlab.from - 1, "+");
|
|
163
|
+
}
|
|
164
|
+
return "".concat(selectedPitchSlab.from, "-").concat(selectedPitchSlab.to);
|
|
165
|
+
};
|
|
166
|
+
PricingPlanModelV2.prototype.getBillingCycleIndexByMonths = function (noOfMonths) {
|
|
167
|
+
return Object.values(this.billing_cycle).findIndex(function (_a) {
|
|
168
|
+
var from = _a.from, to = _a.to;
|
|
169
|
+
return from <= noOfMonths && noOfMonths <= to;
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
return PricingPlanModelV2;
|
|
173
|
+
}());
|
|
174
|
+
exports.PricingPlanModelV2 = PricingPlanModelV2;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IGetPricingPlanByDateResponse } from "../@type";
|
|
2
|
-
import { IPricingPlanModel } from "../interface/pricing-plan.interface";
|
|
3
|
-
import { BillingCycleModel } from "./billing-cycle-model";
|
|
4
|
-
import { SubscriptionModel } from "./entity";
|
|
5
|
-
import { PitchSlabModel } from "./pitch-slab-model";
|
|
6
|
-
import { PricingPlanModel } from "./pricing-plan-model";
|
|
1
|
+
import { IGetPricingPlanByDateResponse, IGetPricingPlanByDateResponseV2 } from "../@type";
|
|
2
|
+
import { IPricingPlanModel, IPricingPlanModelV2 } from "../interface/pricing-plan.interface";
|
|
3
|
+
import { BillingCycleModel, BillingCycleModelV2 } from "./billing-cycle-model";
|
|
4
|
+
import { SubscriptionModel, SubscriptionModelV2 } from "./entity";
|
|
5
|
+
import { PitchSlabModel, PitchSlabModelV2 } from "./pitch-slab-model";
|
|
6
|
+
import { PricingPlanModel, PricingPlanModelV2 } from "./pricing-plan-model";
|
|
7
7
|
export declare class SubscribedPricingPlanModel extends PricingPlanModel {
|
|
8
8
|
pitchCount: number;
|
|
9
9
|
billingCycle: string;
|
|
@@ -35,3 +35,45 @@ export declare class SubscribedPricingPlanModel extends PricingPlanModel {
|
|
|
35
35
|
getBasePriceBySelectedBillingCycleDiscount(): number;
|
|
36
36
|
getTotalHours(): number;
|
|
37
37
|
}
|
|
38
|
+
export declare class SubscribedPricingPlanModelV2 extends PricingPlanModelV2 {
|
|
39
|
+
pitchCount: number;
|
|
40
|
+
billingCycle: string;
|
|
41
|
+
selectedPitchSlab: PitchSlabModelV2;
|
|
42
|
+
selectedBillingCycle: BillingCycleModelV2;
|
|
43
|
+
selectedPitchSlabBasePrice: number;
|
|
44
|
+
hourInMonth: number;
|
|
45
|
+
months: number | undefined;
|
|
46
|
+
constructor(data: IPricingPlanModelV2, pitchCount: number, billingCycle: string);
|
|
47
|
+
getCodeByPitchCountCycle(): string;
|
|
48
|
+
getCodeByCycle(): string[];
|
|
49
|
+
getDiscount(): string;
|
|
50
|
+
getBasePriceByPitchSlab(): number;
|
|
51
|
+
getCodesByPitchSlab(): string[];
|
|
52
|
+
parseCode(code: string): {
|
|
53
|
+
from: number;
|
|
54
|
+
to: number;
|
|
55
|
+
month: number;
|
|
56
|
+
price: number;
|
|
57
|
+
}[];
|
|
58
|
+
getMonths(): number;
|
|
59
|
+
getBasePrice(): number;
|
|
60
|
+
getGrossAmount(config?: {
|
|
61
|
+
roundDown: boolean;
|
|
62
|
+
}): number;
|
|
63
|
+
getNetAmount(config?: {
|
|
64
|
+
roundDown: boolean;
|
|
65
|
+
}): number;
|
|
66
|
+
getBillingDiscount(): number;
|
|
67
|
+
getMonthDifference(that: SubscribedPricingPlanModelV2): number;
|
|
68
|
+
getGrossAmountByMonth(month: number): number;
|
|
69
|
+
getNetAmountByMonth(month: number): number;
|
|
70
|
+
getGrossAmountByPitchDays(pitchCount: number, days: number): number;
|
|
71
|
+
getNetAmountByPitchDays(pitchCount: number, days: number): number;
|
|
72
|
+
getGrossAmountByPitchDaysBasePrice(basePrice: number, pitchCount: number, days: number): number;
|
|
73
|
+
getNetAmountByPitchDaysBasePrice(basePrice: number, pitchCount: number, days: number): number;
|
|
74
|
+
getNextBillingCycleDateRange(date: Date): [Date, Date];
|
|
75
|
+
static getInstanceBySubscriptionData(data: IGetPricingPlanByDateResponseV2, subscriptionDataModel: SubscriptionModelV2): SubscribedPricingPlanModelV2;
|
|
76
|
+
getSelectedPitchSlabBasePrice(): number;
|
|
77
|
+
getBasePriceBySelectedBillingCycleDiscount(): number;
|
|
78
|
+
getTotalHours(): number;
|
|
79
|
+
}
|
|
@@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.SubscribedPricingPlanModel = void 0;
|
|
18
|
+
exports.SubscribedPricingPlanModelV2 = exports.SubscribedPricingPlanModel = void 0;
|
|
19
19
|
var date_util_1 = require("../utils/date-util");
|
|
20
20
|
var math_util_1 = require("../utils/math-util");
|
|
21
21
|
var pricing_plan_model_1 = require("./pricing-plan-model");
|
|
@@ -120,3 +120,195 @@ var SubscribedPricingPlanModel = /** @class */ (function (_super) {
|
|
|
120
120
|
return SubscribedPricingPlanModel;
|
|
121
121
|
}(pricing_plan_model_1.PricingPlanModel));
|
|
122
122
|
exports.SubscribedPricingPlanModel = SubscribedPricingPlanModel;
|
|
123
|
+
//V2 ___________________________________________________________________________________________//
|
|
124
|
+
var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
125
|
+
__extends(SubscribedPricingPlanModelV2, _super);
|
|
126
|
+
function SubscribedPricingPlanModelV2(data, pitchCount, billingCycle) {
|
|
127
|
+
var _this = _super.call(this, data) || this;
|
|
128
|
+
_this.hourInMonth = 24 * 30;
|
|
129
|
+
_this.pitchCount = pitchCount;
|
|
130
|
+
_this.billingCycle = billingCycle;
|
|
131
|
+
_this.selectedPitchSlab = _this.getPitchSlab(_this.pitchCount);
|
|
132
|
+
_this.selectedBillingCycle = _this.getBillingCycle(_this.billingCycle);
|
|
133
|
+
// this.selectedPitchSlabBasePrice = this.selectedPitchSlab.getBasePrice(
|
|
134
|
+
// this.base_price
|
|
135
|
+
// );
|
|
136
|
+
_this.selectedPitchSlabBasePrice = _this.getBasePriceByPitchSlab();
|
|
137
|
+
return _this;
|
|
138
|
+
}
|
|
139
|
+
SubscribedPricingPlanModelV2.prototype.getCodeByPitchCountCycle = function () {
|
|
140
|
+
var _this = this;
|
|
141
|
+
var codes = this.billing_cost_code.split(",");
|
|
142
|
+
// Filter by pitch count
|
|
143
|
+
codes = codes.filter(function (code) {
|
|
144
|
+
var _a = code.split("_"), from = _a[0], to = _a[1];
|
|
145
|
+
return _this.pitchCount >= parseInt(from) && _this.pitchCount <= parseInt(to);
|
|
146
|
+
});
|
|
147
|
+
codes.sort();
|
|
148
|
+
// Filter by billing cycle
|
|
149
|
+
codes = codes.filter(function (code) {
|
|
150
|
+
return _this.selectedBillingCycle.key === _this.billingCycle;
|
|
151
|
+
});
|
|
152
|
+
return codes ? codes[0] : "";
|
|
153
|
+
};
|
|
154
|
+
SubscribedPricingPlanModelV2.prototype.getCodeByCycle = function () {
|
|
155
|
+
var _this = this;
|
|
156
|
+
var codes = this.billing_cost_code.split(",");
|
|
157
|
+
// Filter by pitch count
|
|
158
|
+
// codes = codes.filter((code) => {
|
|
159
|
+
// const [from, to] = code.split("_");
|
|
160
|
+
// return this.pitchCount >= parseInt(from) && this.pitchCount <= parseInt(to);
|
|
161
|
+
// });
|
|
162
|
+
// codes.sort();
|
|
163
|
+
// Filter by billing cycle
|
|
164
|
+
return codes.filter(function (code) {
|
|
165
|
+
return _this.selectedBillingCycle.to === parseInt(code.split("#")[1]);
|
|
166
|
+
});
|
|
167
|
+
// return codes ? codes[0] : "";
|
|
168
|
+
};
|
|
169
|
+
SubscribedPricingPlanModelV2.prototype.getDiscount = function () {
|
|
170
|
+
var codes = this.getCodeByPitchCountCycle();
|
|
171
|
+
return codes === null || codes === void 0 ? void 0 : codes.split("#")[3];
|
|
172
|
+
};
|
|
173
|
+
SubscribedPricingPlanModelV2.prototype.getBasePriceByPitchSlab = function () {
|
|
174
|
+
var _this = this;
|
|
175
|
+
var codes = this.billing_cost_code.split(",");
|
|
176
|
+
var code = codes.filter(function (code) {
|
|
177
|
+
var _a = code.split("_"), from = _a[0], to = _a[1];
|
|
178
|
+
return _this.pitchCount >= parseInt(from) && _this.pitchCount <= parseInt(to);
|
|
179
|
+
});
|
|
180
|
+
code.sort();
|
|
181
|
+
if (code) {
|
|
182
|
+
var _a = code[0].split("#"), from = _a[0], to = _a[1], price = _a[2];
|
|
183
|
+
return parseFloat(price);
|
|
184
|
+
}
|
|
185
|
+
return 0;
|
|
186
|
+
};
|
|
187
|
+
SubscribedPricingPlanModelV2.prototype.getCodesByPitchSlab = function () {
|
|
188
|
+
var _this = this;
|
|
189
|
+
var codes = this.billing_cost_code.split(",");
|
|
190
|
+
return codes.filter(function (code) {
|
|
191
|
+
var _a = code.split("_"), from = _a[0], to = _a[1];
|
|
192
|
+
return _this.pitchCount >= parseInt(from) && _this.pitchCount <= parseInt(to);
|
|
193
|
+
});
|
|
194
|
+
// code.sort();
|
|
195
|
+
// if (code) {
|
|
196
|
+
// const [from, to, price] = code[0].split("#");
|
|
197
|
+
// return parseFloat(price);
|
|
198
|
+
// }
|
|
199
|
+
// return 0;
|
|
200
|
+
};
|
|
201
|
+
SubscribedPricingPlanModelV2.prototype.parseCode = function (code) {
|
|
202
|
+
// 1_5#1#100,1_5#6#98,6_10#1#97,6_10#6#90
|
|
203
|
+
var codes = code.split(",");
|
|
204
|
+
return codes.map(function (code) {
|
|
205
|
+
var _a = code.split("#"), pitch = _a[0], month = _a[1], price = _a[2];
|
|
206
|
+
var _b = pitch.split("_"), from = _b[0], to = _b[1];
|
|
207
|
+
return {
|
|
208
|
+
from: parseInt(from),
|
|
209
|
+
to: parseInt(to),
|
|
210
|
+
month: parseInt(month),
|
|
211
|
+
price: parseFloat(price),
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
SubscribedPricingPlanModelV2.prototype.getMonths = function () {
|
|
216
|
+
return this.selectedBillingCycle.to;
|
|
217
|
+
};
|
|
218
|
+
SubscribedPricingPlanModelV2.prototype.getBasePrice = function () {
|
|
219
|
+
return this.selectedPitchSlabBasePrice;
|
|
220
|
+
};
|
|
221
|
+
SubscribedPricingPlanModelV2.prototype.getGrossAmount = function (config) {
|
|
222
|
+
if (config === void 0) { config = { roundDown: false }; }
|
|
223
|
+
var roundDown = config.roundDown;
|
|
224
|
+
if (roundDown) {
|
|
225
|
+
return Math.floor(this.selectedPitchSlabBasePrice * this.pitchCount * this.getTotalHours());
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
return Math.round(this.selectedPitchSlabBasePrice * this.pitchCount * this.getTotalHours());
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
SubscribedPricingPlanModelV2.prototype.getNetAmount = function (config) {
|
|
232
|
+
if (config === void 0) { config = { roundDown: false }; }
|
|
233
|
+
var roundDown = config.roundDown;
|
|
234
|
+
if (roundDown) {
|
|
235
|
+
return Math.floor(parseFloat(this.getCodeByPitchCountCycle().split("#")[2]) *
|
|
236
|
+
this.pitchCount *
|
|
237
|
+
this.getTotalHours());
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
return Math.round(parseFloat(this.getCodeByPitchCountCycle().split("#")[2]) *
|
|
241
|
+
this.pitchCount *
|
|
242
|
+
this.getTotalHours());
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
SubscribedPricingPlanModelV2.prototype.getBillingDiscount = function () {
|
|
246
|
+
var selectedCode = this.getCodeByPitchCountCycle();
|
|
247
|
+
var selectedCodesByCycle = this.getCodeByCycle();
|
|
248
|
+
selectedCodesByCycle.sort();
|
|
249
|
+
var basePrice = parseFloat(selectedCodesByCycle[0].split("#")[2]);
|
|
250
|
+
var actualPrice = parseFloat(selectedCode.split("#")[2]);
|
|
251
|
+
return (basePrice - actualPrice) / basePrice * 100;
|
|
252
|
+
// 6_10#1#97,6_10#6#90
|
|
253
|
+
// return this.selectedBillingCycle.getDiscount();
|
|
254
|
+
};
|
|
255
|
+
SubscribedPricingPlanModelV2.prototype.getMonthDifference = function (that) {
|
|
256
|
+
return that.getMonths() - this.getMonths();
|
|
257
|
+
};
|
|
258
|
+
SubscribedPricingPlanModelV2.prototype.getGrossAmountByMonth = function (month) {
|
|
259
|
+
return Math.round(this.selectedPitchSlabBasePrice *
|
|
260
|
+
this.pitchCount *
|
|
261
|
+
this.hourInMonth *
|
|
262
|
+
month);
|
|
263
|
+
};
|
|
264
|
+
SubscribedPricingPlanModelV2.prototype.getNetAmountByMonth = function (month) {
|
|
265
|
+
return Math.round(this.selectedPitchSlabBasePrice *
|
|
266
|
+
(1 - this.getBillingDiscount() / 100) *
|
|
267
|
+
this.pitchCount *
|
|
268
|
+
this.hourInMonth *
|
|
269
|
+
month);
|
|
270
|
+
};
|
|
271
|
+
SubscribedPricingPlanModelV2.prototype.getGrossAmountByPitchDays = function (pitchCount, days) {
|
|
272
|
+
return Math.round(this.selectedPitchSlabBasePrice * pitchCount * days * 24);
|
|
273
|
+
};
|
|
274
|
+
SubscribedPricingPlanModelV2.prototype.getNetAmountByPitchDays = function (pitchCount, days) {
|
|
275
|
+
return Math.round(this.selectedPitchSlabBasePrice *
|
|
276
|
+
(1 - this.getBillingDiscount() / 100) *
|
|
277
|
+
pitchCount *
|
|
278
|
+
days *
|
|
279
|
+
24);
|
|
280
|
+
};
|
|
281
|
+
SubscribedPricingPlanModelV2.prototype.getGrossAmountByPitchDaysBasePrice = function (basePrice, pitchCount, days) {
|
|
282
|
+
return Math.round(basePrice * pitchCount * days * 24);
|
|
283
|
+
};
|
|
284
|
+
SubscribedPricingPlanModelV2.prototype.getNetAmountByPitchDaysBasePrice = function (basePrice, pitchCount, days) {
|
|
285
|
+
return Math.round(basePrice * (1 - this.getBillingDiscount() / 100) * pitchCount * days * 24);
|
|
286
|
+
};
|
|
287
|
+
SubscribedPricingPlanModelV2.prototype.getNextBillingCycleDateRange = function (date) {
|
|
288
|
+
// const dateService = new DateUtilService();
|
|
289
|
+
var startDate = date_util_1.dateUtilService.addNDaysToDate(date, 1);
|
|
290
|
+
var endDate = date_util_1.dateUtilService.addNDaysToDate(date, this.selectedBillingCycle.to * 30);
|
|
291
|
+
return [startDate, endDate];
|
|
292
|
+
};
|
|
293
|
+
SubscribedPricingPlanModelV2.getInstanceBySubscriptionData = function (data, subscriptionDataModel) {
|
|
294
|
+
return new SubscribedPricingPlanModelV2(data, subscriptionDataModel.noOfPitches, subscriptionDataModel.type);
|
|
295
|
+
};
|
|
296
|
+
SubscribedPricingPlanModelV2.prototype.getSelectedPitchSlabBasePrice = function () {
|
|
297
|
+
return this.selectedPitchSlabBasePrice;
|
|
298
|
+
};
|
|
299
|
+
SubscribedPricingPlanModelV2.prototype.getBasePriceBySelectedBillingCycleDiscount = function () {
|
|
300
|
+
return this.selectedPitchSlabBasePrice;
|
|
301
|
+
// return (
|
|
302
|
+
// this.selectedPitchSlabBasePrice -
|
|
303
|
+
// mathUtil.getDiscountAmount(
|
|
304
|
+
// this.selectedBillingCycle.discount,
|
|
305
|
+
// this.selectedPitchSlabBasePrice
|
|
306
|
+
// )
|
|
307
|
+
// );
|
|
308
|
+
};
|
|
309
|
+
SubscribedPricingPlanModelV2.prototype.getTotalHours = function () {
|
|
310
|
+
return this.hourInMonth * this.selectedBillingCycle.to;
|
|
311
|
+
};
|
|
312
|
+
return SubscribedPricingPlanModelV2;
|
|
313
|
+
}(pricing_plan_model_1.PricingPlanModelV2));
|
|
314
|
+
exports.SubscribedPricingPlanModelV2 = SubscribedPricingPlanModelV2;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function testRegexArray(regexArray: RegExp[], testString: string): boolean[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testRegexArray = void 0;
|
|
4
|
+
function testRegexArray(regexArray, testString) {
|
|
5
|
+
return regexArray.map(function (regex) { return regex.test(testString); });
|
|
6
|
+
}
|
|
7
|
+
exports.testRegexArray = testRegexArray;
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "turf-common",
|
|
3
|
-
"version": "1.4.1-beta.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "./build/index.js",
|
|
6
|
-
"types": "./build/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"build/**/*"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"clean": "rm -rf build",
|
|
12
|
-
"build": "npm run clean && tsc",
|
|
13
|
-
"version:deploy:
|
|
14
|
-
"version:deploy:
|
|
15
|
-
"version:deploy:
|
|
16
|
-
"test": "jest",
|
|
17
|
-
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" 2>&1| tee eslint.log",
|
|
18
|
-
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
|
|
19
|
-
},
|
|
20
|
-
"repository": {
|
|
21
|
-
"type": "git",
|
|
22
|
-
"url": "github__bellex-dev__turf-common:bellex-dev/turf-common.git"
|
|
23
|
-
},
|
|
24
|
-
"keywords": [],
|
|
25
|
-
"author": "",
|
|
26
|
-
"license": "ISC",
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"@types/jest": "^29.5.11",
|
|
29
|
-
"@types/node": "^20.8.9",
|
|
30
|
-
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
|
31
|
-
"@typescript-eslint/parser": "^6.7.2",
|
|
32
|
-
"del-cli": "^5.1.0",
|
|
33
|
-
"eslint": "^8.50.0",
|
|
34
|
-
"jest": "^29.7.0",
|
|
35
|
-
"ts-jest": "^29.1.1",
|
|
36
|
-
"ts-node": "^10.9.2",
|
|
37
|
-
"typescript": "^5.2.2"
|
|
38
|
-
},
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"date-fns": "^2.30.0"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "turf-common",
|
|
3
|
+
"version": "1.4.1-beta.5",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./build/index.js",
|
|
6
|
+
"types": "./build/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"build/**/*"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"clean": "rm -rf build",
|
|
12
|
+
"build": "npm run clean && tsc",
|
|
13
|
+
"version:deploy:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
|
|
14
|
+
"version:deploy:patch": "npm version patch && git push && npm run build && npm publish",
|
|
15
|
+
"version:deploy:minor": "npm version minor && git push && npm run build && npm publish",
|
|
16
|
+
"test": "jest",
|
|
17
|
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" 2>&1| tee eslint.log",
|
|
18
|
+
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "github__bellex-dev__turf-common:bellex-dev/turf-common.git"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [],
|
|
25
|
+
"author": "",
|
|
26
|
+
"license": "ISC",
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/jest": "^29.5.11",
|
|
29
|
+
"@types/node": "^20.8.9",
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
|
31
|
+
"@typescript-eslint/parser": "^6.7.2",
|
|
32
|
+
"del-cli": "^5.1.0",
|
|
33
|
+
"eslint": "^8.50.0",
|
|
34
|
+
"jest": "^29.7.0",
|
|
35
|
+
"ts-jest": "^29.1.1",
|
|
36
|
+
"ts-node": "^10.9.2",
|
|
37
|
+
"typescript": "^5.2.2"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"date-fns": "^2.30.0"
|
|
41
|
+
}
|
|
42
|
+
}
|