turf-common 1.4.2-beta.2 → 1.4.2-beta.5

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.
@@ -44,6 +44,7 @@ export declare class SubscribedPricingPlanModelV2 extends PricingPlanModelV2 {
44
44
  hourInMonth: number;
45
45
  months: number | undefined;
46
46
  constructor(data: IPricingPlanModelV2, pitchCount: number, billingCycle: string);
47
+ getPlanBasePriceFormatted(): string;
47
48
  getCodeByPitchCountCycle(): string;
48
49
  getCodeByCycle(): string[];
49
50
  getDiscount(): string;
@@ -72,6 +73,7 @@ export declare class SubscribedPricingPlanModelV2 extends PricingPlanModelV2 {
72
73
  }): number;
73
74
  getBillingDiscount(): number;
74
75
  getBillingDiscountV2(): number;
76
+ getDiscountBasePrice(): number;
75
77
  getMonthDifference(that: SubscribedPricingPlanModelV2): number;
76
78
  getGrossAmountByMonth(month: number): number;
77
79
  getNetAmountByMonth(month: number): number;
@@ -150,6 +150,13 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
150
150
  return _this;
151
151
  // this.selectedPitchSlabBasePrice = this.base_price;
152
152
  }
153
+ SubscribedPricingPlanModelV2.prototype.getPlanBasePriceFormatted = function () {
154
+ // Format -> #.##
155
+ return parseFloat((this.getBasePriceV2()).toFixed(2)).toLocaleString('en-IN', {
156
+ minimumFractionDigits: 2,
157
+ maximumFractionDigits: 2,
158
+ });
159
+ };
153
160
  SubscribedPricingPlanModelV2.prototype.getCodeByPitchCountCycle = function () {
154
161
  var _this = this;
155
162
  var codes = this.billing_cost_code.split(",");
@@ -292,7 +299,7 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
292
299
  SubscribedPricingPlanModelV2.prototype.getNetAmountV2 = function (config) {
293
300
  if (config === void 0) { config = { roundDown: false }; }
294
301
  var roundDown = config.roundDown;
295
- var netAmount = this.base_price * (1 - this.getBillingDiscountV2() / 100) * this.pitchCount * this.getTotalHours();
302
+ var netAmount = this.base_price * this.getDiscountBasePrice() * this.pitchCount * this.getTotalHours();
296
303
  if (roundDown) {
297
304
  return Math.floor(netAmount);
298
305
  }
@@ -317,6 +324,10 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
317
324
  return parseFloat(((basePriceByPitchSlab - basePriceByPitchCycle) / basePriceByPitchSlab * 100).toFixed(2));
318
325
  };
319
326
  SubscribedPricingPlanModelV2.prototype.getBillingDiscountV2 = function () {
327
+ var discountBasePrice = this.getDiscountBasePrice();
328
+ return parseFloat(((this.base_price - discountBasePrice) / this.base_price * 100).toFixed(2));
329
+ };
330
+ SubscribedPricingPlanModelV2.prototype.getDiscountBasePrice = function () {
320
331
  var _this = this;
321
332
  var codesByBillingCycle = this.getCodeByCycle();
322
333
  var codeByPitchCycle = codesByBillingCycle.filter(function (code) {
@@ -379,7 +390,7 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
379
390
  };
380
391
  // Tested
381
392
  SubscribedPricingPlanModelV2.prototype.getBasePriceBySelectedBillingCycleDiscount = function () {
382
- return parseFloat(this.getBillingDiscountV2().toFixed(2));
393
+ return this.getDiscountBasePrice();
383
394
  };
384
395
  // Tested
385
396
  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.5",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",