turf-common 1.4.2-beta.1 → 1.4.2-beta.2
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,17 @@ 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;
|
|
68
75
|
getMonthDifference(that: SubscribedPricingPlanModelV2): number;
|
|
69
76
|
getGrossAmountByMonth(month: number): number;
|
|
70
77
|
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 * (1 - this.getBillingDiscountV2() / 100) * 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,15 @@ 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 _this = this;
|
|
321
|
+
var codesByBillingCycle = this.getCodeByCycle();
|
|
322
|
+
var codeByPitchCycle = codesByBillingCycle.filter(function (code) {
|
|
323
|
+
var _a = code.split("#")[0].split("_"), from = _a[0], to = _a[1];
|
|
324
|
+
return _this.pitchCount >= parseInt(from) && _this.pitchCount <= parseInt(to);
|
|
325
|
+
})[0];
|
|
326
|
+
return parseFloat(parseFloat(codeByPitchCycle.split("#")[2]).toFixed(2));
|
|
327
|
+
};
|
|
297
328
|
SubscribedPricingPlanModelV2.prototype.getMonthDifference = function (that) {
|
|
298
329
|
return that.getMonths() - this.getMonths();
|
|
299
330
|
};
|
|
@@ -348,14 +379,7 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
348
379
|
};
|
|
349
380
|
// Tested
|
|
350
381
|
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));
|
|
382
|
+
return parseFloat(this.getBillingDiscountV2().toFixed(2));
|
|
359
383
|
};
|
|
360
384
|
// Tested
|
|
361
385
|
SubscribedPricingPlanModelV2.prototype.getTotalHours = function () {
|