ia-common 1.0.1-beta.74 → 1.0.1-beta.76
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/model/pricing-plan-entity-model.d.ts +4 -1
- package/build/model/pricing-plan-entity-model.js +41 -0
- package/build/model/pricing-plan-model.d.ts +1 -2
- package/build/model/pricing-plan-model.js +0 -7
- package/build/model/subscription-model.d.ts +1 -1
- package/build/model/subscription-model.js +7 -7
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PricingPlanStatus } from "../@enum";
|
|
2
|
-
import { IGetPricingPlanByDateResponse, IPricingPlanEntity } from "../@type";
|
|
2
|
+
import { IBillingCycle, IGetPricingPlanByDateResponse, IPricingPlanEntity } from "../@type";
|
|
3
3
|
export declare class PricingPlanEntityModel implements IPricingPlanEntity {
|
|
4
4
|
id: number;
|
|
5
5
|
effectiveFrom: number;
|
|
@@ -13,6 +13,9 @@ export declare class PricingPlanEntityModel implements IPricingPlanEntity {
|
|
|
13
13
|
billingCycle: string;
|
|
14
14
|
constructor(data: IPricingPlanEntity);
|
|
15
15
|
toObject(): IGetPricingPlanByDateResponse;
|
|
16
|
+
static getBillingCycleString(billingCycle: IBillingCycle): string;
|
|
17
|
+
validateNoOfMonthsByBillingCycle(billingCycle: IBillingCycle): void;
|
|
18
|
+
validateBillingCycleIndexByBillingCycle(billingCycle: IBillingCycle): void;
|
|
16
19
|
}
|
|
17
20
|
export declare class BillingCycleModel {
|
|
18
21
|
code: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BillingCycleModel = exports.PricingPlanEntityModel = void 0;
|
|
4
|
+
var _model_1 = require("../@model");
|
|
4
5
|
var PricingPlanEntityModel = /** @class */ (function () {
|
|
5
6
|
function PricingPlanEntityModel(data) {
|
|
6
7
|
Object.assign(this, data);
|
|
@@ -29,6 +30,46 @@ var PricingPlanEntityModel = /** @class */ (function () {
|
|
|
29
30
|
responseObj.basePrice = this.basePrice;
|
|
30
31
|
return responseObj;
|
|
31
32
|
};
|
|
33
|
+
PricingPlanEntityModel.getBillingCycleString = function (billingCycle) {
|
|
34
|
+
var billingCycles = [];
|
|
35
|
+
Object.values(billingCycle).forEach(function (billing) {
|
|
36
|
+
billingCycles.push("".concat(billing.noOfMonths, "_").concat(billing.discount, "_").concat(billing.value, "_").concat(billing.name));
|
|
37
|
+
});
|
|
38
|
+
return billingCycles.join(",");
|
|
39
|
+
};
|
|
40
|
+
PricingPlanEntityModel.prototype.validateNoOfMonthsByBillingCycle = function (billingCycle) {
|
|
41
|
+
var billingCycleKeys = Object.keys(billingCycle);
|
|
42
|
+
var previousMonthCount = 0;
|
|
43
|
+
for (var _i = 0, billingCycleKeys_1 = billingCycleKeys; _i < billingCycleKeys_1.length; _i++) {
|
|
44
|
+
var key = billingCycleKeys_1[_i];
|
|
45
|
+
var billingCycleObj = billingCycle[key];
|
|
46
|
+
var currentMonthCount = billingCycleObj.noOfMonths;
|
|
47
|
+
if (previousMonthCount >= currentMonthCount && key != "0") {
|
|
48
|
+
throw new _model_1.AppBadRequestException({
|
|
49
|
+
key: "noOfMonths.".concat(key),
|
|
50
|
+
message: [
|
|
51
|
+
"No of months should be greater than ".concat(previousMonthCount),
|
|
52
|
+
],
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
previousMonthCount = currentMonthCount;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
PricingPlanEntityModel.prototype.validateBillingCycleIndexByBillingCycle = function (billingCycle) {
|
|
59
|
+
var billingCycleKeys = Object.keys(billingCycle);
|
|
60
|
+
for (var i = 0; i < billingCycleKeys.length; i++) {
|
|
61
|
+
var billingCycleIndex = Number(billingCycleKeys[i]);
|
|
62
|
+
if (billingCycleIndex !== 0) {
|
|
63
|
+
var recentBillingCycleIndex = Number(billingCycleKeys[i - 1]);
|
|
64
|
+
if (recentBillingCycleIndex !== billingCycleIndex - 1) {
|
|
65
|
+
throw new _model_1.AppBadRequestException({
|
|
66
|
+
key: "billingCycleIndex.".concat(billingCycleIndex),
|
|
67
|
+
message: ["billingCycleIndex ".concat(recentBillingCycleIndex + 1)],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
32
73
|
return PricingPlanEntityModel;
|
|
33
74
|
}());
|
|
34
75
|
exports.PricingPlanEntityModel = PricingPlanEntityModel;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IGetPricingPlanByDateResponse, IPricingPlanModel, ISelectedBillingCycle } from "../@type";
|
|
2
2
|
export declare class PricingPlanModel implements IPricingPlanModel {
|
|
3
3
|
id: number;
|
|
4
4
|
effectiveFromDate: number;
|
|
@@ -18,5 +18,4 @@ export declare class PricingPlanModel implements IPricingPlanModel {
|
|
|
18
18
|
fromDateCode: number;
|
|
19
19
|
toDateCode: number;
|
|
20
20
|
};
|
|
21
|
-
getBillingCycleString(billingCycle: IBillingCycle): string;
|
|
22
21
|
}
|
|
@@ -58,13 +58,6 @@ var PricingPlanModel = /** @class */ (function () {
|
|
|
58
58
|
toDateCode: toDateCode,
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
|
-
PricingPlanModel.prototype.getBillingCycleString = function (billingCycle) {
|
|
62
|
-
var billingCycles = [];
|
|
63
|
-
Object.values(billingCycle).forEach(function (billing) {
|
|
64
|
-
billingCycles.push("".concat(billing.noOfMonths, "_").concat(billing.discount, "_").concat(billing.value, "_").concat(billing.name));
|
|
65
|
-
});
|
|
66
|
-
return billingCycles.join(",");
|
|
67
|
-
};
|
|
68
61
|
return PricingPlanModel;
|
|
69
62
|
}());
|
|
70
63
|
exports.PricingPlanModel = PricingPlanModel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SubscriptionStatus } from "../@enum";
|
|
2
2
|
import { ICreateSubscriptionRequest, ISubscriptionEntity, IUserEntity } from "../@type";
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class SubscriptionEntityModel implements ISubscriptionEntity {
|
|
4
4
|
id: number;
|
|
5
5
|
fromDateCode: number;
|
|
6
6
|
toDateCode: number;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SubscriptionEntityModel = void 0;
|
|
4
4
|
var _model_1 = require("../@model");
|
|
5
|
-
var
|
|
6
|
-
function
|
|
5
|
+
var SubscriptionEntityModel = /** @class */ (function () {
|
|
6
|
+
function SubscriptionEntityModel(subscriptionEntity) {
|
|
7
7
|
Object.assign(this, subscriptionEntity);
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
SubscriptionEntityModel.getEntityInstanceByICreateSubscriptionRequestUserEntity = function (body, userEntity, status, pricingPlanId) {
|
|
10
10
|
var _a;
|
|
11
11
|
var subscriptionEntity = {};
|
|
12
12
|
subscriptionEntity.organizationId = userEntity.organizationId;
|
|
@@ -27,7 +27,7 @@ var SubscriptionModel = /** @class */ (function () {
|
|
|
27
27
|
subscriptionEntity.registrationId = userEntity.registrationId;
|
|
28
28
|
return subscriptionEntity;
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
SubscriptionEntityModel.prototype.validateAdvanceAmount = function (isAmountPaidValidation) {
|
|
31
31
|
if (isAmountPaidValidation === void 0) { isAmountPaidValidation = false; }
|
|
32
32
|
if (this.amountPaid > this.netAmount) {
|
|
33
33
|
if (isAmountPaidValidation) {
|
|
@@ -48,6 +48,6 @@ var SubscriptionModel = /** @class */ (function () {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
return
|
|
51
|
+
return SubscriptionEntityModel;
|
|
52
52
|
}());
|
|
53
|
-
exports.
|
|
53
|
+
exports.SubscriptionEntityModel = SubscriptionEntityModel;
|