turf-common 1.4.1-beta.1 → 1.4.1-beta.11
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/@exception.d.ts +1 -0
- package/build/@exception.js +17 -0
- package/build/src/@enum.d.ts +3 -0
- package/build/src/@enum.js +3 -0
- package/build/src/@type.d.ts +2 -0
- package/build/src/@type.js +2 -0
- package/build/src/interface/api/get-pricing-plan-by-date-response.interface.d.ts +22 -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 +22 -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/interface/user-entity-essential-info.interface.d.ts +3 -0
- package/build/src/interface/user-entity-essential-info.interface.js +2 -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 +175 -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 +87 -1
- package/build/src/models/subscribed-pricing-plan-model.d.ts +48 -6
- package/build/src/models/subscribed-pricing-plan-model.js +447 -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/exceptions/app-badrequest.exception";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/exceptions/app-badrequest.exception"), exports);
|
package/build/src/@enum.d.ts
CHANGED
|
@@ -24,3 +24,6 @@ export * from "./enums/bookings-status.enum";
|
|
|
24
24
|
export * from "./enums/organization-type.enum";
|
|
25
25
|
export * from "./enums/environment.enum";
|
|
26
26
|
export * from "./enums/availability-view.enum";
|
|
27
|
+
export * from "./enums/socket-io-booking-operation.enum";
|
|
28
|
+
export * from "./enums/pitch-sports.enum";
|
|
29
|
+
export * from "./enums/pitch-operation.enum";
|
package/build/src/@enum.js
CHANGED
|
@@ -40,3 +40,6 @@ __exportStar(require("./enums/bookings-status.enum"), exports);
|
|
|
40
40
|
__exportStar(require("./enums/organization-type.enum"), exports);
|
|
41
41
|
__exportStar(require("./enums/environment.enum"), exports);
|
|
42
42
|
__exportStar(require("./enums/availability-view.enum"), exports);
|
|
43
|
+
__exportStar(require("./enums/socket-io-booking-operation.enum"), exports);
|
|
44
|
+
__exportStar(require("./enums/pitch-sports.enum"), exports);
|
|
45
|
+
__exportStar(require("./enums/pitch-operation.enum"), exports);
|
package/build/src/@type.d.ts
CHANGED
|
@@ -31,3 +31,5 @@ export * from "./interface/ui/upgrade-subscription-data.interface";
|
|
|
31
31
|
export * from "./interface/ui/booking-data.interface";
|
|
32
32
|
export * from "./interface/ng-date-structure.interface";
|
|
33
33
|
export * from "./interface/convert-to-midnight-time.interface";
|
|
34
|
+
export * from "./interface/socket-io-bookings.interface";
|
|
35
|
+
export * from "./interface/user-entity-essential-info.interface";
|
package/build/src/@type.js
CHANGED
|
@@ -48,3 +48,5 @@ __exportStar(require("./interface/ui/upgrade-subscription-data.interface"), expo
|
|
|
48
48
|
__exportStar(require("./interface/ui/booking-data.interface"), exports);
|
|
49
49
|
__exportStar(require("./interface/ng-date-structure.interface"), exports);
|
|
50
50
|
__exportStar(require("./interface/convert-to-midnight-time.interface"), exports);
|
|
51
|
+
__exportStar(require("./interface/socket-io-bookings.interface"), exports);
|
|
52
|
+
__exportStar(require("./interface/user-entity-essential-info.interface"), exports);
|
|
@@ -21,3 +21,25 @@ 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
|
+
};
|
|
36
|
+
};
|
|
37
|
+
billing_cycle: {
|
|
38
|
+
[key: string]: {
|
|
39
|
+
from: number;
|
|
40
|
+
to: number;
|
|
41
|
+
name: string;
|
|
42
|
+
key: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -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,25 @@ 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
|
+
billing_cost_code: string;
|
|
45
|
+
}
|
|
@@ -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,161 @@ 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, _b;
|
|
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
|
+
billing_cost_code: (_a = this.billingCostCode) !== null && _a !== void 0 ? _a : ''
|
|
183
|
+
};
|
|
184
|
+
var billingCycle = (_b = this.subscriptionCycle) === null || _b === void 0 ? void 0 : _b.split(",");
|
|
185
|
+
billingCycle === null || billingCycle === void 0 ? void 0 : billingCycle.forEach(function (billing, index) {
|
|
186
|
+
var billingArray = billing.split('_');
|
|
187
|
+
responseObj.billing_cycle[index] = {
|
|
188
|
+
from: Number(billingArray[0].slice(0, 3)),
|
|
189
|
+
to: Number(billingArray[0].slice(3, 6)),
|
|
190
|
+
// discount: billingArray[1],
|
|
191
|
+
name: billingArray.slice(2).join('_'),
|
|
192
|
+
key: billingArray.slice(2).join('-').toLowerCase().replace(/ /g, '-'),
|
|
193
|
+
};
|
|
194
|
+
});
|
|
195
|
+
var billingCycleSet = new Set();
|
|
196
|
+
this.billingCostCode.split(',').forEach(function (code, index) {
|
|
197
|
+
var costCode = code.split('#');
|
|
198
|
+
billingCycleSet.add(costCode[0]);
|
|
199
|
+
});
|
|
200
|
+
billingCycleSet.forEach(function (pitchRange, index) {
|
|
201
|
+
var from = Number(pitchRange.split('_')[0]);
|
|
202
|
+
var to = Number(pitchRange.split('_')[1]);
|
|
203
|
+
responseObj.pitch_slab[index] = {
|
|
204
|
+
from: from,
|
|
205
|
+
to: to,
|
|
206
|
+
// discount: costCode[1],
|
|
207
|
+
};
|
|
208
|
+
});
|
|
209
|
+
responseObj.effective_from_date = Number(booking_code_model_1.BookingCode.getDateCode(this.effectiveFrom));
|
|
210
|
+
responseObj.effective_to_date = Number(booking_code_model_1.BookingCode.getDateCode(this.effectiveTo));
|
|
211
|
+
responseObj.unit = this.unit;
|
|
212
|
+
responseObj.base_price = this.basePrice;
|
|
213
|
+
return responseObj;
|
|
214
|
+
};
|
|
215
|
+
// toObject(): GetPricingPlanByDateResponseV2 {
|
|
216
|
+
// const responseObj: GetPricingPlanByDateResponseV2 = {
|
|
217
|
+
// id: this.id,
|
|
218
|
+
// effective_from_date: 0,
|
|
219
|
+
// effective_to_date: 0,
|
|
220
|
+
// base_price: 0,
|
|
221
|
+
// unit: "per_hour_per_pitch",
|
|
222
|
+
// pitch_slab: {},
|
|
223
|
+
// billing_cycle: {},
|
|
224
|
+
// billing_cost_code: this.billingCostCode??''
|
|
225
|
+
// };
|
|
226
|
+
// const billingCycle = this.subscriptionCycle?.split(",");
|
|
227
|
+
// billingCycle?.forEach((billing, index) => {
|
|
228
|
+
// const billingArray = billing.split("_");
|
|
229
|
+
// responseObj.billing_cycle[index] = {
|
|
230
|
+
// from: Number(billingArray[0].slice(0, 3)),
|
|
231
|
+
// to: Number(billingArray[0].slice(3, 6)),
|
|
232
|
+
// // discount: billingArray[1],
|
|
233
|
+
// name: billingArray.slice(2).join("_"),
|
|
234
|
+
// key: billingArray.slice(2).join("-").toLowerCase().replace(/ /g, "-"),
|
|
235
|
+
// };
|
|
236
|
+
// });
|
|
237
|
+
// this.billingCostCode!.split(",").forEach((code, index) => {
|
|
238
|
+
// const costCode = code.split("#");
|
|
239
|
+
// responseObj.pitch_slab[index] = {
|
|
240
|
+
// from: Number(costCode[0]),
|
|
241
|
+
// to: Number(costCode[0]),
|
|
242
|
+
// // discount: costCode[1],
|
|
243
|
+
// };
|
|
244
|
+
// });
|
|
245
|
+
// responseObj.effective_from_date = Number(
|
|
246
|
+
// BookingCode.getDateCode(this.effectiveFrom)
|
|
247
|
+
// );
|
|
248
|
+
// responseObj.effective_to_date = Number(
|
|
249
|
+
// BookingCode.getDateCode(this.effectiveTo)
|
|
250
|
+
// );
|
|
251
|
+
// responseObj.unit = this.unit;
|
|
252
|
+
// responseObj.base_price = this.basePrice;
|
|
253
|
+
// return responseObj;
|
|
254
|
+
// }
|
|
255
|
+
PricingPlanEntityModelV2.prototype.toPitchSlabs = function () {
|
|
256
|
+
return this.billingCostCode
|
|
257
|
+
.split(",")
|
|
258
|
+
.map(function (cost_code) { return new PitchSlabParserV2(cost_code).parseToModel(); });
|
|
259
|
+
};
|
|
260
|
+
PricingPlanEntityModelV2.prototype.toBillingCycles = function () {
|
|
261
|
+
return this.subscriptionCycle
|
|
262
|
+
.split(",")
|
|
263
|
+
.map(function (billingCode) {
|
|
264
|
+
return new BillingCycleCodeParserV2(billingCode).parseToModel();
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
return PricingPlanEntityModelV2;
|
|
268
|
+
}());
|
|
269
|
+
exports.PricingPlanEntityModelV2 = PricingPlanEntityModelV2;
|
|
270
|
+
// Done
|
|
271
|
+
var BillingCycleCodeParserV2 = /** @class */ (function () {
|
|
272
|
+
function BillingCycleCodeParserV2(code) {
|
|
273
|
+
this.code = code;
|
|
274
|
+
}
|
|
275
|
+
BillingCycleCodeParserV2.prototype.parse = function () {
|
|
276
|
+
var billingCycleComponents = this.code.split("_");
|
|
277
|
+
this.from = parseInt(billingCycleComponents[0].slice(0, 3));
|
|
278
|
+
this.to = parseInt(billingCycleComponents[0].slice(3, 6));
|
|
279
|
+
// this.discount = billingCycleComponents[1];
|
|
280
|
+
this.name = billingCycleComponents[2];
|
|
281
|
+
return this;
|
|
282
|
+
};
|
|
283
|
+
BillingCycleCodeParserV2.prototype.parseToModel = function () {
|
|
284
|
+
var billingCycleComponents = this.code.split("_");
|
|
285
|
+
this.from = parseInt(billingCycleComponents[0].slice(0, 3));
|
|
286
|
+
this.to = parseInt(billingCycleComponents[0].slice(3, 6));
|
|
287
|
+
// this.discount = billingCycleComponents[1];
|
|
288
|
+
this.name = billingCycleComponents[2];
|
|
289
|
+
return new billing_cycle_model_1.BillingCycleModelV2({
|
|
290
|
+
// discount: this.discount,
|
|
291
|
+
from: this.from,
|
|
292
|
+
to: this.to,
|
|
293
|
+
name: this.name,
|
|
294
|
+
key: this.getKey(),
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
BillingCycleCodeParserV2.prototype.getKey = function () {
|
|
298
|
+
return this.name.toLowerCase().replace(" ", "-");
|
|
299
|
+
};
|
|
300
|
+
return BillingCycleCodeParserV2;
|
|
301
|
+
}());
|
|
302
|
+
exports.BillingCycleCodeParserV2 = BillingCycleCodeParserV2;
|