turf-common 1.4.1-beta.11 → 1.4.1-beta.12
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.
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// import { PricingPlanStatus } from "../../enums/pricing-plan-status.enum";
|
|
3
|
+
// import { IBillingCycleModel, IBillingCycleModelV2 } from "../../interface/billing-cycle.interface";
|
|
4
|
+
// import { GetPricingPlanByDateResponse, GetPricingPlanByDateResponseV2 } from "../../interface/get-pricing-plan-by-date-response.interface";
|
|
5
|
+
// import { IPitchSlab, IPitchSlabV2 } from "../../interface/pitch-slab.interface";
|
|
6
|
+
// import { IPricingPlanEntityModel, IPricingPlanEntityModelV2 } from "../../interface/model/pricing-plan-entity-model.interface";
|
|
7
|
+
// import { IPricingPlanEntity, IPricingPlanEntityV2 } from "../../interface/entity/pricing-plan-entity.interface";
|
|
8
|
+
// import { BillingCycleModel, BillingCycleModelV2 } from "../billing-cycle-model";
|
|
9
|
+
// import { BookingCode } from "../booking-code-model";
|
|
10
|
+
// import { PitchSlabModel, PitchSlabModelV2 } from "../pitch-slab-model";
|
|
11
|
+
// import { PricingPlanModel, PricingPlanModelV2 } from "../pricing-plan-model";
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
13
|
exports.BillingCycleCodeParserV2 = exports.PricingPlanEntityModelV2 = exports.BillingCycleCodeParser = exports.PitchSlabParserV2 = exports.PitchSlabParser = exports.PricingPlanEntityModel = void 0;
|
|
4
14
|
var billing_cycle_model_1 = require("../billing-cycle-model");
|
|
@@ -99,8 +109,8 @@ var PitchSlabParserV2 = /** @class */ (function () {
|
|
|
99
109
|
this.code = code;
|
|
100
110
|
}
|
|
101
111
|
PitchSlabParserV2.prototype.parseToModel = function () {
|
|
102
|
-
var costCodeComponents = this.code.split("
|
|
103
|
-
costCodeComponents = costCodeComponents[0].split("_");
|
|
112
|
+
var costCodeComponents = this.code.split("_");
|
|
113
|
+
// costCodeComponents = costCodeComponents[0].split("_");
|
|
104
114
|
return new pitch_slab_model_1.PitchSlabModelV2({
|
|
105
115
|
// discount: costCodeComponents[1],
|
|
106
116
|
from: parseInt(costCodeComponents[0]),
|
|
@@ -253,7 +263,11 @@ var PricingPlanEntityModelV2 = /** @class */ (function () {
|
|
|
253
263
|
// return responseObj;
|
|
254
264
|
// }
|
|
255
265
|
PricingPlanEntityModelV2.prototype.toPitchSlabs = function () {
|
|
256
|
-
|
|
266
|
+
var codes = this.billingCostCode
|
|
267
|
+
.split(",").map(function (code) { return code.split("#")[0]; }).join(",");
|
|
268
|
+
// Remove duplicates from codes
|
|
269
|
+
codes = codes.split(",").filter(function (value, index, self) { return self.indexOf(value) === index; }).join(",");
|
|
270
|
+
return codes
|
|
257
271
|
.split(",")
|
|
258
272
|
.map(function (cost_code) { return new PitchSlabParserV2(cost_code).parseToModel(); });
|
|
259
273
|
};
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// import { IGetPricingPlanByDateResponse, IGetPricingPlanByDateResponseV2 } from "../@type";
|
|
3
|
+
// import { IPricingPlanModel, IPricingPlanModelV2 } from "../interface/pricing-plan.interface";
|
|
4
|
+
// import { dateUtilService } from "../utils/date-util";
|
|
5
|
+
// import { mathUtil } from "../utils/math-util";
|
|
6
|
+
// import { BillingCycleModel, BillingCycleModelV2 } from "./billing-cycle-model";
|
|
7
|
+
// import { SubscriptionModel, SubscriptionModelV2 } from "./entity";
|
|
8
|
+
// import { PitchSlabModel, PitchSlabModelV2 } from "./pitch-slab-model";
|
|
9
|
+
// import { PricingPlanModel, PricingPlanModelV2 } from "./pricing-plan-model";
|
|
2
10
|
var __extends = (this && this.__extends) || (function () {
|
|
3
11
|
var extendStatics = function (d, b) {
|
|
4
12
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -69,12 +77,14 @@ var SubscribedPricingPlanModel = /** @class */ (function (_super) {
|
|
|
69
77
|
SubscribedPricingPlanModel.prototype.getMonthDifference = function (that) {
|
|
70
78
|
return that.getMonths() - this.getMonths();
|
|
71
79
|
};
|
|
80
|
+
// Not used
|
|
72
81
|
SubscribedPricingPlanModel.prototype.getGrossAmountByMonth = function (month) {
|
|
73
82
|
return Math.round(this.selectedPitchSlabBasePrice *
|
|
74
83
|
this.pitchCount *
|
|
75
84
|
this.hourInMonth *
|
|
76
85
|
month);
|
|
77
86
|
};
|
|
87
|
+
// Not used
|
|
78
88
|
SubscribedPricingPlanModel.prototype.getNetAmountByMonth = function (month) {
|
|
79
89
|
return Math.round(this.selectedPitchSlabBasePrice *
|
|
80
90
|
(1 - this.getBillingDiscount() / 100) *
|
|
@@ -85,6 +95,7 @@ var SubscribedPricingPlanModel = /** @class */ (function (_super) {
|
|
|
85
95
|
SubscribedPricingPlanModel.prototype.getGrossAmountByPitchDays = function (pitchCount, days) {
|
|
86
96
|
return Math.round(this.selectedPitchSlabBasePrice * pitchCount * days * 24);
|
|
87
97
|
};
|
|
98
|
+
// Not used
|
|
88
99
|
SubscribedPricingPlanModel.prototype.getNetAmountByPitchDays = function (pitchCount, days) {
|
|
89
100
|
return Math.round(this.selectedPitchSlabBasePrice *
|
|
90
101
|
(1 - this.getBillingDiscount() / 100) *
|
|
@@ -92,6 +103,7 @@ var SubscribedPricingPlanModel = /** @class */ (function (_super) {
|
|
|
92
103
|
days *
|
|
93
104
|
24);
|
|
94
105
|
};
|
|
106
|
+
// Used in backend
|
|
95
107
|
SubscribedPricingPlanModel.prototype.getGrossAmountByPitchDaysBasePrice = function (basePrice, pitchCount, days) {
|
|
96
108
|
return Math.round(basePrice * pitchCount * days * 24);
|
|
97
109
|
};
|
|
@@ -110,9 +122,10 @@ var SubscribedPricingPlanModel = /** @class */ (function (_super) {
|
|
|
110
122
|
SubscribedPricingPlanModel.prototype.getSelectedPitchSlabBasePrice = function () {
|
|
111
123
|
return this.selectedPitchSlabBasePrice;
|
|
112
124
|
};
|
|
125
|
+
// Used in frontend
|
|
113
126
|
SubscribedPricingPlanModel.prototype.getBasePriceBySelectedBillingCycleDiscount = function () {
|
|
114
|
-
return (this.selectedPitchSlabBasePrice -
|
|
115
|
-
math_util_1.mathUtil.getDiscountAmount(this.selectedBillingCycle.discount, this.selectedPitchSlabBasePrice));
|
|
127
|
+
return parseFloat((this.selectedPitchSlabBasePrice -
|
|
128
|
+
math_util_1.mathUtil.getDiscountAmount(this.selectedBillingCycle.discount, this.selectedPitchSlabBasePrice)).toFixed(2));
|
|
116
129
|
};
|
|
117
130
|
SubscribedPricingPlanModel.prototype.getTotalHours = function () {
|
|
118
131
|
return this.hourInMonth * this.selectedBillingCycle.to;
|
|
@@ -133,9 +146,9 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
133
146
|
// this.selectedPitchSlabBasePrice = this.selectedPitchSlab.getBasePrice(
|
|
134
147
|
// this.base_price
|
|
135
148
|
// );
|
|
136
|
-
|
|
137
|
-
_this.selectedPitchSlabBasePrice = _this.base_price;
|
|
149
|
+
_this.selectedPitchSlabBasePrice = _this.getBasePriceByPitchSlab();
|
|
138
150
|
return _this;
|
|
151
|
+
// this.selectedPitchSlabBasePrice = this.base_price;
|
|
139
152
|
}
|
|
140
153
|
SubscribedPricingPlanModelV2.prototype.getCodeByPitchCountCycle = function () {
|
|
141
154
|
var _this = this;
|
|
@@ -187,8 +200,11 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
187
200
|
var codes = this.billing_cost_code.split(",");
|
|
188
201
|
var code = codes.filter(function (code) {
|
|
189
202
|
var _a = code.split("_"), from = _a[0], to = _a[1];
|
|
203
|
+
to = to.split("#")[0];
|
|
204
|
+
// console.log(from, to)
|
|
190
205
|
return _this.pitchCount >= parseInt(from) && _this.pitchCount <= parseInt(to);
|
|
191
206
|
});
|
|
207
|
+
// console.log(code)
|
|
192
208
|
code.sort();
|
|
193
209
|
if (code) {
|
|
194
210
|
var _a = code[0].split("#"), from = _a[0], to = _a[1], price = _a[2];
|
|
@@ -224,12 +240,15 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
224
240
|
};
|
|
225
241
|
});
|
|
226
242
|
};
|
|
243
|
+
// Tested
|
|
227
244
|
SubscribedPricingPlanModelV2.prototype.getMonths = function () {
|
|
228
245
|
return this.selectedBillingCycle.to;
|
|
229
246
|
};
|
|
247
|
+
// Tested
|
|
230
248
|
SubscribedPricingPlanModelV2.prototype.getBasePrice = function () {
|
|
231
249
|
return this.selectedPitchSlabBasePrice;
|
|
232
250
|
};
|
|
251
|
+
// Tested
|
|
233
252
|
SubscribedPricingPlanModelV2.prototype.getGrossAmount = function (config) {
|
|
234
253
|
if (config === void 0) { config = { roundDown: false }; }
|
|
235
254
|
var roundDown = config.roundDown;
|
|
@@ -240,46 +259,54 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
240
259
|
return Math.round(this.selectedPitchSlabBasePrice * this.pitchCount * this.getTotalHours());
|
|
241
260
|
}
|
|
242
261
|
};
|
|
262
|
+
// Tested
|
|
243
263
|
SubscribedPricingPlanModelV2.prototype.getNetAmount = function (config) {
|
|
264
|
+
var _this = this;
|
|
244
265
|
if (config === void 0) { config = { roundDown: false }; }
|
|
245
266
|
var roundDown = config.roundDown;
|
|
267
|
+
var codesByBillingCycle = this.getCodeByCycle();
|
|
268
|
+
var codeByPitchCycle = codesByBillingCycle.filter(function (code) {
|
|
269
|
+
var _a = code.split("#")[0].split("_"), from = _a[0], to = _a[1];
|
|
270
|
+
return _this.pitchCount >= parseInt(from) && _this.pitchCount <= parseInt(to);
|
|
271
|
+
})[0];
|
|
272
|
+
var basePriceByPitchCycle = parseFloat(codeByPitchCycle.split("#")[2]);
|
|
246
273
|
if (roundDown) {
|
|
247
|
-
return Math.floor(this.
|
|
248
|
-
|
|
274
|
+
return Math.floor(this.base_price *
|
|
275
|
+
basePriceByPitchCycle *
|
|
249
276
|
this.pitchCount *
|
|
250
277
|
this.getTotalHours());
|
|
251
278
|
}
|
|
252
279
|
else {
|
|
253
|
-
return Math.round(this.
|
|
254
|
-
|
|
280
|
+
return Math.round(this.base_price *
|
|
281
|
+
basePriceByPitchCycle *
|
|
255
282
|
this.pitchCount *
|
|
256
283
|
this.getTotalHours());
|
|
257
284
|
}
|
|
258
285
|
};
|
|
286
|
+
// Tested
|
|
259
287
|
SubscribedPricingPlanModelV2.prototype.getBillingDiscount = function () {
|
|
260
|
-
|
|
261
|
-
//
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
return parseFloat(this.getDiscount());
|
|
271
|
-
// 6_10#1#97,6_10#6#90
|
|
272
|
-
// return this.selectedBillingCycle.getDiscount();
|
|
288
|
+
var _this = this;
|
|
289
|
+
// const codesByPitchCount = this.getCodesByPitchSlab();
|
|
290
|
+
var basePriceByPitchSlab = this.getBasePriceByPitchSlab();
|
|
291
|
+
var codesByBillingCycle = this.getCodeByCycle();
|
|
292
|
+
var codeByPitchCycle = codesByBillingCycle.filter(function (code) {
|
|
293
|
+
var _a = code.split("#")[0].split("_"), from = _a[0], to = _a[1];
|
|
294
|
+
return _this.pitchCount >= parseInt(from) && _this.pitchCount <= parseInt(to);
|
|
295
|
+
})[0];
|
|
296
|
+
var basePriceByPitchCycle = parseFloat(codeByPitchCycle.split("#")[2]);
|
|
297
|
+
return parseFloat(((basePriceByPitchSlab - basePriceByPitchCycle) / basePriceByPitchSlab * 100).toFixed(2));
|
|
273
298
|
};
|
|
274
299
|
SubscribedPricingPlanModelV2.prototype.getMonthDifference = function (that) {
|
|
275
300
|
return that.getMonths() - this.getMonths();
|
|
276
301
|
};
|
|
302
|
+
// Tested
|
|
277
303
|
SubscribedPricingPlanModelV2.prototype.getGrossAmountByMonth = function (month) {
|
|
278
304
|
return Math.round(this.selectedPitchSlabBasePrice *
|
|
279
305
|
this.pitchCount *
|
|
280
306
|
this.hourInMonth *
|
|
281
307
|
month);
|
|
282
308
|
};
|
|
309
|
+
// Tested
|
|
283
310
|
SubscribedPricingPlanModelV2.prototype.getNetAmountByMonth = function (month) {
|
|
284
311
|
return Math.round(this.selectedPitchSlabBasePrice *
|
|
285
312
|
(1 - this.getBillingDiscount() / 100) *
|
|
@@ -287,9 +314,11 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
287
314
|
this.hourInMonth *
|
|
288
315
|
month);
|
|
289
316
|
};
|
|
317
|
+
// Tested
|
|
290
318
|
SubscribedPricingPlanModelV2.prototype.getGrossAmountByPitchDays = function (pitchCount, days) {
|
|
291
319
|
return Math.round(this.selectedPitchSlabBasePrice * pitchCount * days * 24);
|
|
292
320
|
};
|
|
321
|
+
// Tested
|
|
293
322
|
SubscribedPricingPlanModelV2.prototype.getNetAmountByPitchDays = function (pitchCount, days) {
|
|
294
323
|
return Math.round(this.selectedPitchSlabBasePrice *
|
|
295
324
|
(1 - this.getBillingDiscount() / 100) *
|
|
@@ -297,12 +326,15 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
297
326
|
days *
|
|
298
327
|
24);
|
|
299
328
|
};
|
|
329
|
+
// Not Tested
|
|
300
330
|
SubscribedPricingPlanModelV2.prototype.getGrossAmountByPitchDaysBasePrice = function (basePrice, pitchCount, days) {
|
|
301
331
|
return Math.round(basePrice * pitchCount * days * 24);
|
|
302
332
|
};
|
|
333
|
+
// Not Tested
|
|
303
334
|
SubscribedPricingPlanModelV2.prototype.getNetAmountByPitchDaysBasePrice = function (basePrice, pitchCount, days) {
|
|
304
335
|
return Math.round(basePrice * (1 - this.getBillingDiscount() / 100) * pitchCount * days * 24);
|
|
305
336
|
};
|
|
337
|
+
// Not Tested
|
|
306
338
|
SubscribedPricingPlanModelV2.prototype.getNextBillingCycleDateRange = function (date) {
|
|
307
339
|
// const dateService = new DateUtilService();
|
|
308
340
|
var startDate = date_util_1.dateUtilService.addNDaysToDate(date, 1);
|
|
@@ -312,19 +344,22 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
312
344
|
SubscribedPricingPlanModelV2.getInstanceBySubscriptionData = function (data, subscriptionDataModel) {
|
|
313
345
|
return new SubscribedPricingPlanModelV2(data, subscriptionDataModel.noOfPitches, subscriptionDataModel.type);
|
|
314
346
|
};
|
|
347
|
+
// Tested
|
|
315
348
|
SubscribedPricingPlanModelV2.prototype.getSelectedPitchSlabBasePrice = function () {
|
|
316
349
|
return this.selectedPitchSlabBasePrice;
|
|
317
350
|
};
|
|
351
|
+
// Tested
|
|
318
352
|
SubscribedPricingPlanModelV2.prototype.getBasePriceBySelectedBillingCycleDiscount = function () {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
353
|
+
var _this = this;
|
|
354
|
+
var codesByBillingCycle = this.getCodeByCycle();
|
|
355
|
+
var codeByPitchCycle = codesByBillingCycle.filter(function (code) {
|
|
356
|
+
var _a = code.split("#")[0].split("_"), from = _a[0], to = _a[1];
|
|
357
|
+
return _this.pitchCount >= parseInt(from) && _this.pitchCount <= parseInt(to);
|
|
358
|
+
})[0];
|
|
359
|
+
var basePriceByPitchCycle = parseFloat(codeByPitchCycle.split("#")[2]);
|
|
360
|
+
return parseFloat(basePriceByPitchCycle.toFixed(2));
|
|
327
361
|
};
|
|
362
|
+
// Tested
|
|
328
363
|
SubscribedPricingPlanModelV2.prototype.getTotalHours = function () {
|
|
329
364
|
return this.hourInMonth * this.selectedBillingCycle.to;
|
|
330
365
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var _enum_1 = require("../../../@enum");
|
|
4
|
+
var _model_1 = require("../../../@model");
|
|
5
|
+
// 001005_0P_1,006010_2P_1,011999_5P_1
|
|
6
|
+
// 000001_0P_Monthly,000003_5P_Quarterly,000006_7P_Half-Yearly,000012_10P_Yearly
|
|
7
|
+
// 1_5#1#1#0P,1_5#3#0.95#5P,1_5#6#0.93#7P,1_5#12#0.9#10P,6_10#1#0.98#2P,6_10#3#0.931#6.9P,6_10#6#0.9114#8.86P,6_10#12#0.882#11.8P,11_99#1#0.95#5P,11_99#3#0.9025#9.75P,11_99#6#0.8835#11.65P,11_99#12#0.855#14.5P
|
|
8
|
+
describe("AppController (e2e)", function () {
|
|
9
|
+
it("exceute all methods of pricingPlanEntityModel", function () {
|
|
10
|
+
var pricingPlanEntity = {
|
|
11
|
+
id: 1,
|
|
12
|
+
effectiveFrom: new Date(),
|
|
13
|
+
effectiveTo: new Date(),
|
|
14
|
+
status: _enum_1.PricingPlanStatus.ACTIVE,
|
|
15
|
+
createdBy: 1,
|
|
16
|
+
createdOn: new Date(),
|
|
17
|
+
updatedBy: 1,
|
|
18
|
+
updatedOn: new Date(),
|
|
19
|
+
basePrice: 1,
|
|
20
|
+
unit: "unit",
|
|
21
|
+
subscriptionCycle: "cycle",
|
|
22
|
+
billingCostCode: "code",
|
|
23
|
+
costCode: "001005_0P_1,006010_2P_1,011999_5P_1",
|
|
24
|
+
billingCycle: "000001_0P_Monthly,000003_5P_Quarterly,000006_7P_Half-Yearly,000012_10P_Yearly",
|
|
25
|
+
};
|
|
26
|
+
var pricingPlanEntityV2 = {
|
|
27
|
+
id: 1,
|
|
28
|
+
effectiveFrom: new Date(),
|
|
29
|
+
effectiveTo: new Date(),
|
|
30
|
+
status: _enum_1.PricingPlanStatus.ACTIVE,
|
|
31
|
+
createdBy: 1,
|
|
32
|
+
createdOn: new Date(),
|
|
33
|
+
updatedBy: 1,
|
|
34
|
+
updatedOn: new Date(),
|
|
35
|
+
basePrice: 1,
|
|
36
|
+
unit: "unit",
|
|
37
|
+
subscriptionCycle: "000001_0P_Monthly,000003_5P_Quarterly,000006_7P_Half-Yearly,000012_10P_Yearly",
|
|
38
|
+
billingCostCode: "1_5#1#1#0P,1_5#3#0.95#5P,1_5#6#0.93#7P,1_5#12#0.9#10P,6_10#1#0.98#2P,6_10#3#0.931#6.9P,6_10#6#0.9114#8.86P,6_10#12#0.882#11.8P,11_99#1#0.95#5P,11_99#3#0.9025#9.75P,11_99#6#0.8835#11.65P,11_99#12#0.855#14.5P",
|
|
39
|
+
// costCode: "001005_0P_1,006010_2P_1,011999_5P_1",
|
|
40
|
+
// billingCycle: "000001_0P_Monthly,000003_5P_Quarterly,000006_7P_Half-Yearly,000012_10P_Yearly"
|
|
41
|
+
};
|
|
42
|
+
var pricingPlanEntityModel = new _model_1.PricingPlanEntityModel(pricingPlanEntity);
|
|
43
|
+
var pricingPlanEntityModel2 = new _model_1.PricingPlanEntityModelV2(pricingPlanEntityV2);
|
|
44
|
+
// console.log(pricingPlanEntityModel.toPitchSlabs())
|
|
45
|
+
// console.log(pricingPlanEntityModel2.toPitchSlabs())
|
|
46
|
+
// console.log(pricingPlanEntityModel.toBillingCycles())
|
|
47
|
+
// console.log(pricingPlanEntityModel2.toBillingCycles())
|
|
48
|
+
// console.log(pricingPlanEntityModel.getBillingCycleKeys())
|
|
49
|
+
// console.log(pricingPlanEntityModel2.getBillingCycleKeys())
|
|
50
|
+
// console.log(pricingPlanEntityModel.toModel())
|
|
51
|
+
// console.log(pricingPlanEntityModel2.toModel())
|
|
52
|
+
// console.log(pricingPlanEntityModel.arrayToIndexedObject([]))
|
|
53
|
+
// console.log(pricingPlanEntityModel.toObject())
|
|
54
|
+
// console.log(pricingPlanEntityModel2.toObject())
|
|
55
|
+
var pricingPlanModel = new _model_1.PricingPlanModel(pricingPlanEntityModel.toModel());
|
|
56
|
+
var pricingPlanModelV2 = new _model_1.PricingPlanModelV2(pricingPlanEntityModel2.toModel());
|
|
57
|
+
// console.log(pricingPlanModel.formatPitchSlab(0))
|
|
58
|
+
// console.log(pricingPlanModelV2.formatPitchSlab(0))
|
|
59
|
+
// console.log(pricingPlanModel.formatPitchSlab(1))
|
|
60
|
+
// console.log(pricingPlanModelV2.formatPitchSlab(1))
|
|
61
|
+
// console.log(pricingPlanModel.formatPitchSlab(2))
|
|
62
|
+
// console.log(pricingPlanModelV2.formatPitchSlab(2))
|
|
63
|
+
// console.log(pricingPlanModel.getPitchSlab(1))
|
|
64
|
+
// console.log(pricingPlanModelV2.getPitchSlab(1))
|
|
65
|
+
// console.log(pricingPlanModel.getPitchSlab(4))
|
|
66
|
+
// console.log(pricingPlanModelV2.getPitchSlab(4))
|
|
67
|
+
// console.log(pricingPlanModel.getPitchSlab(6))
|
|
68
|
+
// console.log(pricingPlanModelV2.getPitchSlab(6))
|
|
69
|
+
// console.log(pricingPlanModel.getPitchSlab(10))
|
|
70
|
+
// console.log(pricingPlanModelV2.getPitchSlab(10))
|
|
71
|
+
// console.log(pricingPlanModel.getPitchSlab(11))
|
|
72
|
+
// console.log(pricingPlanModelV2.getPitchSlab(11))
|
|
73
|
+
// console.log(pricingPlanModel.getBillingCycle("half-yearly"))
|
|
74
|
+
// console.log(pricingPlanModelV2.getBillingCycle("half-yearly"))
|
|
75
|
+
// console.log(pricingPlanModel.getBillingCycle("quarterly"))
|
|
76
|
+
// console.log(pricingPlanModelV2.getBillingCycle("quarterly"))
|
|
77
|
+
// console.log(pricingPlanModel.getMonth("half-yearly"))
|
|
78
|
+
// console.log(pricingPlanModelV2.getMonth("half-yearly"))
|
|
79
|
+
// console.log(pricingPlanModel.getMonth("quarterly"))
|
|
80
|
+
// console.log(pricingPlanModelV2.getMonth("quarterly"))
|
|
81
|
+
// console.log(pricingPlanModel.getNoOfSubscriptionDays("half-yearly"))
|
|
82
|
+
// console.log(pricingPlanModelV2.getNoOfSubscriptionDays("half-yearly"))
|
|
83
|
+
// console.log(pricingPlanModel.getNoOfSubscriptionDays("quarterly"))
|
|
84
|
+
// console.log(pricingPlanModelV2.getNoOfSubscriptionDays("quarterly"))
|
|
85
|
+
// console.log(pricingPlanModel.getBillingCycleKeys())
|
|
86
|
+
// console.log(pricingPlanModelV2.getBillingCycleKeys())
|
|
87
|
+
// pricingPlanModel.validateBillingCycleKey("half-yearly")
|
|
88
|
+
// pricingPlanModelV2.validateBillingCycleKey("half-yearly")
|
|
89
|
+
// console.log(pricingPlanModel.getBillingCycleByDay(3))
|
|
90
|
+
// console.log(pricingPlanModelV2.getBillingCycleByDay(3))
|
|
91
|
+
// console.log(pricingPlanModel.getBillingCycleByDay(30))
|
|
92
|
+
// console.log(pricingPlanModelV2.getBillingCycleByDay(30))
|
|
93
|
+
// console.log(pricingPlanModel.getBillingCycleByDay(31))
|
|
94
|
+
// console.log(pricingPlanModelV2.getBillingCycleByDay(31))
|
|
95
|
+
// console.log(pricingPlanModel.getBillingCycleByDay(90))
|
|
96
|
+
// console.log(pricingPlanModelV2.getBillingCycleByDay(90))
|
|
97
|
+
// console.log(pricingPlanModel.getBillingCycleByDay(91))
|
|
98
|
+
// console.log(pricingPlanModelV2.getBillingCycleByDay(91))
|
|
99
|
+
// console.log(pricingPlanModel.getBillingCycleByDay(180))
|
|
100
|
+
// console.log(pricingPlanModelV2.getBillingCycleByDay(180))
|
|
101
|
+
// console.log(pricingPlanModel.getBillingCycleByDay(181))
|
|
102
|
+
// console.log(pricingPlanModelV2.getBillingCycleByDay(181))
|
|
103
|
+
// console.log(pricingPlanModel.getBillingCycleByDay(360))
|
|
104
|
+
// console.log(pricingPlanModelV2.getBillingCycleByDay(360))
|
|
105
|
+
// console.log(pricingPlanModel.getBillingCycleByDay(361))
|
|
106
|
+
// console.log(pricingPlanModelV2.getBillingCycleByDay(361))
|
|
107
|
+
// Remaining
|
|
108
|
+
// console.log(pricingPlanModel.getPitchSlabIndex(1))
|
|
109
|
+
// console.log(pricingPlanModelV2.getPitchSlabIndex(1))
|
|
110
|
+
// console.log(pricingPlanModel.getPitchSlabIndex(4))
|
|
111
|
+
// console.log(pricingPlanModelV2.getPitchSlabIndex(4))
|
|
112
|
+
// console.log(pricingPlanModel.getPitchSlabIndex(6))
|
|
113
|
+
// console.log(pricingPlanModelV2.getPitchSlabIndex(6))
|
|
114
|
+
// console.log(pricingPlanModel.getPitchSlabIndex(10))
|
|
115
|
+
// console.log(pricingPlanModelV2.getPitchSlabIndex(10))
|
|
116
|
+
// console.log(pricingPlanModel.getPitchSlabIndex(11))
|
|
117
|
+
// console.log(pricingPlanModelV2.getPitchSlabIndex(11))
|
|
118
|
+
// console.log(pricingPlanModel.getBillingCycleIndexByMonths(1))
|
|
119
|
+
// console.log(pricingPlanModelV2.getBillingCycleIndexByMonths(1))
|
|
120
|
+
// console.log(pricingPlanModel.getBillingCycleIndexByMonths(3))
|
|
121
|
+
// console.log(pricingPlanModelV2.getBillingCycleIndexByMonths(3))
|
|
122
|
+
// console.log(pricingPlanModel.getBillingCycleIndexByMonths(5))
|
|
123
|
+
// console.log(pricingPlanModelV2.getBillingCycleIndexByMonths(5))
|
|
124
|
+
// console.log(pricingPlanModel.getBillingCycleIndexByMonths(6))
|
|
125
|
+
// console.log(pricingPlanModelV2.getBillingCycleIndexByMonths(6))
|
|
126
|
+
// console.log(pricingPlanModel.getBillingCycleIndexByMonths(9))
|
|
127
|
+
// console.log(pricingPlanModelV2.getBillingCycleIndexByMonths(9))
|
|
128
|
+
// console.log(pricingPlanModel.getBillingCycleIndexByMonths(12))
|
|
129
|
+
// console.log(pricingPlanModelV2.getBillingCycleIndexByMonths(12))
|
|
130
|
+
// const pitchCount = 11;
|
|
131
|
+
// const billingCycleKey = 'quarterly';
|
|
132
|
+
var pitchCounts = [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 70];
|
|
133
|
+
var billingCycleKeys = ["monthly", "quarterly", "half-yearly", "yearly"];
|
|
134
|
+
for (var _i = 0, pitchCounts_1 = pitchCounts; _i < pitchCounts_1.length; _i++) {
|
|
135
|
+
var pitchCount = pitchCounts_1[_i];
|
|
136
|
+
for (var _a = 0, billingCycleKeys_1 = billingCycleKeys; _a < billingCycleKeys_1.length; _a++) {
|
|
137
|
+
var billingCycleKey = billingCycleKeys_1[_a];
|
|
138
|
+
var subscribebPricingPlanModel = new _model_1.SubscribedPricingPlanModel(pricingPlanModel, pitchCount, billingCycleKey);
|
|
139
|
+
var subscribedPricingPlanModelV2 = new _model_1.SubscribedPricingPlanModelV2(pricingPlanModelV2, pitchCount, billingCycleKey);
|
|
140
|
+
// const subscribebPricingPlanModel = new SubscribedPricingPlanModel(pricingPlanModel, pitchCount, billingCycleKey);
|
|
141
|
+
// const subscribedPricingPlanModelV2 =new SubscribedPricingPlanModelV2(pricingPlanModelV2, pitchCount, billingCycleKey);
|
|
142
|
+
// console.log(`subscribebPricingPlanModel.getMonths() : ${subscribebPricingPlanModel.getMonths()}`)
|
|
143
|
+
// console.log(`subscribedPricingPlanModelV2.getMonths() : ${subscribedPricingPlanModelV2.getMonths()}`)
|
|
144
|
+
expect(subscribebPricingPlanModel.getMonths()).toEqual(subscribedPricingPlanModelV2.getMonths());
|
|
145
|
+
// console.log(`subscribebPricingPlanModel.getBasePrice(): ${subscribebPricingPlanModel.getBasePrice()}`)
|
|
146
|
+
// console.log(`subscribedPricingPlanModelV2.getBasePrice(): ${subscribedPricingPlanModelV2.getBasePrice()}`)
|
|
147
|
+
expect(subscribebPricingPlanModel.getBasePrice()).toEqual(subscribedPricingPlanModelV2.getBasePrice());
|
|
148
|
+
// console.log(`subscribebPricingPlanModel.getBillingDiscount(): ${subscribebPricingPlanModel.getBillingDiscount()}`)
|
|
149
|
+
// console.log(`subscribedPricingPlanModelV2.getBillingDiscount(): ${subscribedPricingPlanModelV2.getBillingDiscount()}`)
|
|
150
|
+
expect(subscribebPricingPlanModel.getBillingDiscount()).toEqual(subscribedPricingPlanModelV2.getBillingDiscount());
|
|
151
|
+
// console.log(`subscribebPricingPlanModel.getGrossAmount(): ${subscribebPricingPlanModel.getGrossAmount()}`)
|
|
152
|
+
// console.log(`subscribedPricingPlanModelV2.getGrossAmount(): ${subscribedPricingPlanModelV2.getGrossAmount()}`)
|
|
153
|
+
expect(subscribebPricingPlanModel.getGrossAmount()).toEqual(subscribedPricingPlanModelV2.getGrossAmount());
|
|
154
|
+
// console.log(`subscribebPricingPlanModel.getNetAmount(): ${subscribebPricingPlanModel.getNetAmount()}`)
|
|
155
|
+
// console.log(`subscribedPricingPlanModelV2.getNetAmount(): ${subscribedPricingPlanModelV2.getNetAmount()}`)
|
|
156
|
+
expect(subscribebPricingPlanModel.getNetAmount()).toEqual(subscribedPricingPlanModelV2.getNetAmount());
|
|
157
|
+
// console.log(`subscribebPricingPlanModel.getGrossAmountByPitchDays(): ${subscribebPricingPlanModel.getGrossAmountByPitchDays(11, 3)}`)
|
|
158
|
+
// console.log(`subscribedPricingPlanModelV2.getGrossAmountByPitchDays(): ${subscribedPricingPlanModelV2.getGrossAmountByPitchDays(11, 3)}`)
|
|
159
|
+
expect(subscribebPricingPlanModel.getGrossAmountByPitchDays(11, 3)).toEqual(subscribedPricingPlanModelV2.getGrossAmountByPitchDays(11, 3));
|
|
160
|
+
// console.log(`subscribebPricingPlanModel.getNetAmountByPitchDays(): ${subscribebPricingPlanModel.getNetAmountByPitchDays(11, 3)}`)
|
|
161
|
+
// console.log(`subscribedPricingPlanModelV2.getNetAmountByPitchDays(): ${subscribedPricingPlanModelV2.getNetAmountByPitchDays(11, 3)}`)
|
|
162
|
+
expect(subscribebPricingPlanModel.getNetAmountByPitchDays(11, 3)).toEqual(subscribedPricingPlanModelV2.getNetAmountByPitchDays(11, 3));
|
|
163
|
+
// console.log(`subscribebPricingPlanModel.getBasePriceBySelectedBillingCycleDiscount(): ${subscribebPricingPlanModel.getBasePriceBySelectedBillingCycleDiscount()}`)
|
|
164
|
+
// console.log(`subscribedPricingPlanModelV2.getBasePriceBySelectedBillingCycleDiscount(): ${subscribedPricingPlanModelV2.getBasePriceBySelectedBillingCycleDiscount()}`)
|
|
165
|
+
expect(subscribebPricingPlanModel.getBasePriceBySelectedBillingCycleDiscount()).toEqual(subscribedPricingPlanModelV2.getBasePriceBySelectedBillingCycleDiscount());
|
|
166
|
+
var months = [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
167
|
+
for (var _b = 0, months_1 = months; _b < months_1.length; _b++) {
|
|
168
|
+
var month = months_1[_b];
|
|
169
|
+
// console.log(`subscribebPricingPlanModel.getGrossAmountByMonth(${month}): ${subscribebPricingPlanModel.getGrossAmountByMonth(month)}`)
|
|
170
|
+
// console.log(`subscribedPricingPlanModelV2.getGrossAmountByMonth(${month}): ${subscribedPricingPlanModelV2.getGrossAmountByMonth(month)}`)
|
|
171
|
+
expect(subscribebPricingPlanModel.getGrossAmountByMonth(month)).toEqual(subscribedPricingPlanModelV2.getGrossAmountByMonth(month));
|
|
172
|
+
// console.log(`subscribebPricingPlanModel.getNetAmountByMonth(${month}): ${subscribebPricingPlanModel.getNetAmountByMonth(month)}`)
|
|
173
|
+
// console.log(`subscribedPricingPlanModelV2.getNetAmountByMonth(${month}): ${subscribedPricingPlanModelV2.getNetAmountByMonth(month)}`)
|
|
174
|
+
expect(subscribebPricingPlanModel.getNetAmountByMonth(month)).toEqual(subscribedPricingPlanModelV2.getNetAmountByMonth(month));
|
|
175
|
+
}
|
|
176
|
+
// console.log(`subscribebPricingPlanModel.getSelectedPitchSlabBasePrice(): ${subscribebPricingPlanModel.getSelectedPitchSlabBasePrice()}`)
|
|
177
|
+
// console.log(`subscribedPricingPlanModelV2.getSelectedPitchSlabBasePrice(): ${subscribedPricingPlanModelV2.getSelectedPitchSlabBasePrice()}`)
|
|
178
|
+
expect(subscribebPricingPlanModel.getSelectedPitchSlabBasePrice()).toEqual(subscribedPricingPlanModelV2.getSelectedPitchSlabBasePrice());
|
|
179
|
+
// console.log(`subscribebPricingPlanModel.getTotalHours(): ${subscribebPricingPlanModel.getTotalHours()}`)
|
|
180
|
+
// console.log(`subscribedPricingPlanModelV2.getTotalHours(): ${subscribedPricingPlanModelV2.getTotalHours()}`)
|
|
181
|
+
expect(subscribebPricingPlanModel.getTotalHours()).toEqual(subscribedPricingPlanModelV2.getTotalHours());
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
});
|