ia-common 1.0.1-beta.39 → 1.0.1-beta.40
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.
- package/build/@type.d.ts +1 -0
- package/build/@type.js +1 -0
- package/build/interface/api/get-pricing-plan-by-date.interface.d.ts +1 -0
- package/build/interface/selected-billing-cycle.interface.d.ts +7 -0
- package/build/interface/selected-billing-cycle.interface.js +2 -0
- package/build/model/pricing-plan-entity-model.js +3 -2
- package/build/model/pricing-plan-model.d.ts +3 -13
- package/build/model/subscribed-pricing-plan-model.d.ts +2 -6
- package/build/model/subscribed-pricing-plan-model.js +2 -3
- package/package.json +1 -1
package/build/@type.d.ts
CHANGED
|
@@ -10,3 +10,4 @@ export * from "./interface/user-entity-without-password.interface";
|
|
|
10
10
|
export * from "./interface/pricing-plan-model.interface";
|
|
11
11
|
export * from "./interface/ng-date-struct.interface";
|
|
12
12
|
export * from "./interface/subscription-data.inteface";
|
|
13
|
+
export * from "./interface/selected-billing-cycle.interface";
|
package/build/@type.js
CHANGED
|
@@ -26,3 +26,4 @@ __exportStar(require("./interface/user-entity-without-password.interface"), expo
|
|
|
26
26
|
__exportStar(require("./interface/pricing-plan-model.interface"), exports);
|
|
27
27
|
__exportStar(require("./interface/ng-date-struct.interface"), exports);
|
|
28
28
|
__exportStar(require("./interface/subscription-data.inteface"), exports);
|
|
29
|
+
__exportStar(require("./interface/selected-billing-cycle.interface"), exports);
|
|
@@ -19,8 +19,9 @@ var PricingPlanEntityModel = /** @class */ (function () {
|
|
|
19
19
|
responseObj.billingCycle[index] = {
|
|
20
20
|
noOfMonths: Number(billingArray[0]),
|
|
21
21
|
discount: billingArray[1],
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
value: parseFloat(billingArray[2]),
|
|
23
|
+
name: billingArray.slice(3).join("_"),
|
|
24
|
+
key: billingArray.slice(3).join("-").toLowerCase().replace(/ /g, "-"),
|
|
24
25
|
};
|
|
25
26
|
});
|
|
26
27
|
responseObj.effectiveFromDate = this.effectiveFrom;
|
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
import { IGetPricingPlanByDateResponse, IPricingPlanModel } from "../@type";
|
|
1
|
+
import { IGetPricingPlanByDateResponse, IPricingPlanModel, ISelectedBillingCycle } from "../@type";
|
|
2
2
|
export declare class PricingPlanModel implements IPricingPlanModel {
|
|
3
3
|
id: number;
|
|
4
4
|
effectiveFromDate: number;
|
|
5
5
|
effectiveToDate: number;
|
|
6
6
|
basePrice: number;
|
|
7
7
|
billingCycle: {
|
|
8
|
-
[key: string]:
|
|
9
|
-
noOfMonths: number;
|
|
10
|
-
discount: string;
|
|
11
|
-
name: string;
|
|
12
|
-
key: string;
|
|
13
|
-
};
|
|
8
|
+
[key: string]: ISelectedBillingCycle;
|
|
14
9
|
};
|
|
15
10
|
constructor(data: IGetPricingPlanByDateResponse);
|
|
16
11
|
getBillingCycleKeys(): string[];
|
|
17
12
|
getNoOfSubscriptionDays(type: string): number;
|
|
18
|
-
getBillCycleByKey(type: string):
|
|
19
|
-
noOfMonths: number;
|
|
20
|
-
discount: string;
|
|
21
|
-
name: string;
|
|
22
|
-
key: string;
|
|
23
|
-
};
|
|
13
|
+
getBillCycleByKey(type: string): ISelectedBillingCycle;
|
|
24
14
|
validateBillingCycleKey(key: string): void;
|
|
25
15
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
+
import { ISelectedBillingCycle } from "../@type";
|
|
1
2
|
import { PricingPlanModel } from "./pricing-plan-model";
|
|
2
3
|
export declare class SubscribedPricingPlanModel {
|
|
3
4
|
billingCycleKey: string;
|
|
4
|
-
selectedBillingCycle:
|
|
5
|
-
noOfMonths: number;
|
|
6
|
-
discount: string;
|
|
7
|
-
name: string;
|
|
8
|
-
key: string;
|
|
9
|
-
};
|
|
5
|
+
selectedBillingCycle: ISelectedBillingCycle;
|
|
10
6
|
basePrice: number;
|
|
11
7
|
pricingPlanModel: PricingPlanModel;
|
|
12
8
|
constructor(data: PricingPlanModel, billingCycleKey: string);
|
|
@@ -4,7 +4,6 @@ exports.SubscribedPricingPlanModel = void 0;
|
|
|
4
4
|
var _utils_1 = require("../@utils");
|
|
5
5
|
var SubscribedPricingPlanModel = /** @class */ (function () {
|
|
6
6
|
function SubscribedPricingPlanModel(data, billingCycleKey) {
|
|
7
|
-
// super(data);
|
|
8
7
|
this.basePrice = data.basePrice;
|
|
9
8
|
this.billingCycleKey = billingCycleKey;
|
|
10
9
|
this.selectedBillingCycle = data.getBillCycleByKey(billingCycleKey);
|
|
@@ -29,12 +28,12 @@ var SubscribedPricingPlanModel = /** @class */ (function () {
|
|
|
29
28
|
if (config === void 0) { config = { roundDown: false }; }
|
|
30
29
|
var roundDown = config.roundDown;
|
|
31
30
|
if (roundDown) {
|
|
32
|
-
return Math.floor(this.
|
|
31
|
+
return Math.floor(this.selectedBillingCycle.value *
|
|
33
32
|
(1 - this.getBillingDiscount() / 100) *
|
|
34
33
|
this.selectedBillingCycle.noOfMonths);
|
|
35
34
|
}
|
|
36
35
|
else {
|
|
37
|
-
return Math.round(this.
|
|
36
|
+
return Math.round(this.selectedBillingCycle.value *
|
|
38
37
|
(1 - this.getBillingDiscount() / 100) *
|
|
39
38
|
this.selectedBillingCycle.noOfMonths);
|
|
40
39
|
}
|