turf-common 1.4.2-beta.2 → 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.
@@ -72,6 +72,7 @@ export declare class SubscribedPricingPlanModelV2 extends PricingPlanModelV2 {
72
72
  }): number;
73
73
  getBillingDiscount(): number;
74
74
  getBillingDiscountV2(): number;
75
+ getDiscountBasePrice(): number;
75
76
  getMonthDifference(that: SubscribedPricingPlanModelV2): number;
76
77
  getGrossAmountByMonth(month: number): number;
77
78
  getNetAmountByMonth(month: number): number;
@@ -292,7 +292,7 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
292
292
  SubscribedPricingPlanModelV2.prototype.getNetAmountV2 = function (config) {
293
293
  if (config === void 0) { config = { roundDown: false }; }
294
294
  var roundDown = config.roundDown;
295
- var netAmount = this.base_price * (1 - this.getBillingDiscountV2() / 100) * this.pitchCount * this.getTotalHours();
295
+ var netAmount = this.base_price * this.getDiscountBasePrice() * this.pitchCount * this.getTotalHours();
296
296
  if (roundDown) {
297
297
  return Math.floor(netAmount);
298
298
  }
@@ -317,6 +317,10 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
317
317
  return parseFloat(((basePriceByPitchSlab - basePriceByPitchCycle) / basePriceByPitchSlab * 100).toFixed(2));
318
318
  };
319
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 () {
320
324
  var _this = this;
321
325
  var codesByBillingCycle = this.getCodeByCycle();
322
326
  var codeByPitchCycle = codesByBillingCycle.filter(function (code) {
@@ -379,7 +383,7 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
379
383
  };
380
384
  // Tested
381
385
  SubscribedPricingPlanModelV2.prototype.getBasePriceBySelectedBillingCycleDiscount = function () {
382
- return parseFloat(this.getBillingDiscountV2().toFixed(2));
386
+ return this.getDiscountBasePrice();
383
387
  };
384
388
  // Tested
385
389
  SubscribedPricingPlanModelV2.prototype.getTotalHours = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.4.2-beta.2",
3
+ "version": "1.4.2-beta.3",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",