turf-common 1.4.2-beta.1 → 1.4.2-beta.3
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.
|
@@ -61,10 +61,18 @@ export declare class SubscribedPricingPlanModelV2 extends PricingPlanModelV2 {
|
|
|
61
61
|
getGrossAmount(config?: {
|
|
62
62
|
roundDown: boolean;
|
|
63
63
|
}): number;
|
|
64
|
+
getGrossAmountV2(config?: {
|
|
65
|
+
roundDown: boolean;
|
|
66
|
+
}): number;
|
|
64
67
|
getNetAmount(config?: {
|
|
65
68
|
roundDown: boolean;
|
|
66
69
|
}): number;
|
|
70
|
+
getNetAmountV2(config?: {
|
|
71
|
+
roundDown: boolean;
|
|
72
|
+
}): number;
|
|
67
73
|
getBillingDiscount(): number;
|
|
74
|
+
getBillingDiscountV2(): number;
|
|
75
|
+
getDiscountBasePrice(): number;
|
|
68
76
|
getMonthDifference(that: SubscribedPricingPlanModelV2): number;
|
|
69
77
|
getGrossAmountByMonth(month: number): number;
|
|
70
78
|
getNetAmountByMonth(month: number): number;
|
|
@@ -254,6 +254,17 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
254
254
|
return Math.round(this.selectedPitchSlabBasePrice * this.pitchCount * this.getTotalHours());
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
+
SubscribedPricingPlanModelV2.prototype.getGrossAmountV2 = function (config) {
|
|
258
|
+
if (config === void 0) { config = { roundDown: false }; }
|
|
259
|
+
var grossAmount = this.base_price * this.pitchCount * this.getTotalHours();
|
|
260
|
+
var roundDown = config.roundDown;
|
|
261
|
+
if (roundDown) {
|
|
262
|
+
return Math.floor(grossAmount);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
return Math.round(grossAmount);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
257
268
|
// Tested
|
|
258
269
|
SubscribedPricingPlanModelV2.prototype.getNetAmount = function (config) {
|
|
259
270
|
var _this = this;
|
|
@@ -278,6 +289,17 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
278
289
|
this.getTotalHours());
|
|
279
290
|
}
|
|
280
291
|
};
|
|
292
|
+
SubscribedPricingPlanModelV2.prototype.getNetAmountV2 = function (config) {
|
|
293
|
+
if (config === void 0) { config = { roundDown: false }; }
|
|
294
|
+
var roundDown = config.roundDown;
|
|
295
|
+
var netAmount = this.base_price * this.getDiscountBasePrice() * this.pitchCount * this.getTotalHours();
|
|
296
|
+
if (roundDown) {
|
|
297
|
+
return Math.floor(netAmount);
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
return Math.round(netAmount);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
281
303
|
// Tested
|
|
282
304
|
SubscribedPricingPlanModelV2.prototype.getBillingDiscount = function () {
|
|
283
305
|
var _this = this;
|
|
@@ -294,6 +316,19 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
294
316
|
var basePriceByPitchCycle = parseFloat(codeByPitchCycle.split("#")[2]);
|
|
295
317
|
return parseFloat(((basePriceByPitchSlab - basePriceByPitchCycle) / basePriceByPitchSlab * 100).toFixed(2));
|
|
296
318
|
};
|
|
319
|
+
SubscribedPricingPlanModelV2.prototype.getBillingDiscountV2 = function () {
|
|
320
|
+
var discountBasePrice = this.getDiscountBasePrice();
|
|
321
|
+
return parseFloat(((this.base_price - discountBasePrice) / this.base_price * 100).toFixed(2));
|
|
322
|
+
};
|
|
323
|
+
SubscribedPricingPlanModelV2.prototype.getDiscountBasePrice = function () {
|
|
324
|
+
var _this = this;
|
|
325
|
+
var codesByBillingCycle = this.getCodeByCycle();
|
|
326
|
+
var codeByPitchCycle = codesByBillingCycle.filter(function (code) {
|
|
327
|
+
var _a = code.split("#")[0].split("_"), from = _a[0], to = _a[1];
|
|
328
|
+
return _this.pitchCount >= parseInt(from) && _this.pitchCount <= parseInt(to);
|
|
329
|
+
})[0];
|
|
330
|
+
return parseFloat(parseFloat(codeByPitchCycle.split("#")[2]).toFixed(2));
|
|
331
|
+
};
|
|
297
332
|
SubscribedPricingPlanModelV2.prototype.getMonthDifference = function (that) {
|
|
298
333
|
return that.getMonths() - this.getMonths();
|
|
299
334
|
};
|
|
@@ -348,14 +383,7 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
348
383
|
};
|
|
349
384
|
// Tested
|
|
350
385
|
SubscribedPricingPlanModelV2.prototype.getBasePriceBySelectedBillingCycleDiscount = function () {
|
|
351
|
-
|
|
352
|
-
var codesByBillingCycle = this.getCodeByCycle();
|
|
353
|
-
var codeByPitchCycle = codesByBillingCycle.filter(function (code) {
|
|
354
|
-
var _a = code.split("#")[0].split("_"), from = _a[0], to = _a[1];
|
|
355
|
-
return _this.pitchCount >= parseInt(from) && _this.pitchCount <= parseInt(to);
|
|
356
|
-
})[0];
|
|
357
|
-
var basePriceByPitchCycle = parseFloat(codeByPitchCycle.split("#")[2]);
|
|
358
|
-
return parseFloat(basePriceByPitchCycle.toFixed(2));
|
|
386
|
+
return this.getDiscountBasePrice();
|
|
359
387
|
};
|
|
360
388
|
// Tested
|
|
361
389
|
SubscribedPricingPlanModelV2.prototype.getTotalHours = function () {
|