ia-common 1.0.1-beta.77 → 1.0.1-beta.79
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.d.ts +1 -1
- package/build/@model.js +1 -1
- package/build/model/organization-entity-model.d.ts +1 -0
- package/build/model/organization-entity-model.js +5 -0
- package/build/model/pricing-plan-entity-model.js +4 -2
- package/build/model/subscription-entity-model.d.ts +25 -0
- package/build/model/subscription-entity-model.js +58 -0
- package/build/model/user-entity-model.d.ts +1 -0
- package/build/model/user-entity-model.js +5 -0
- package/package.json +1 -1
package/build/@model.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export * from "./model/subscribed-pricing-plan-model";
|
|
|
3
3
|
export * from "./exception/app-badrequest.exception";
|
|
4
4
|
export * from "./model/organization-entity-model";
|
|
5
5
|
export * from "./model/user-entity-model";
|
|
6
|
-
export * from "./model/subscription-model";
|
|
6
|
+
export * from "./model/subscription-entity-model";
|
|
7
7
|
export * from "./model/bank-details-entity-model";
|
package/build/@model.js
CHANGED
|
@@ -19,5 +19,5 @@ __exportStar(require("./model/subscribed-pricing-plan-model"), exports);
|
|
|
19
19
|
__exportStar(require("./exception/app-badrequest.exception"), exports);
|
|
20
20
|
__exportStar(require("./model/organization-entity-model"), exports);
|
|
21
21
|
__exportStar(require("./model/user-entity-model"), exports);
|
|
22
|
-
__exportStar(require("./model/subscription-model"), exports);
|
|
22
|
+
__exportStar(require("./model/subscription-entity-model"), exports);
|
|
23
23
|
__exportStar(require("./model/bank-details-entity-model"), exports);
|
|
@@ -31,4 +31,5 @@ export declare class OrganizationEntityModel implements IOrganizationEntity {
|
|
|
31
31
|
getDeedFileName(): string | undefined;
|
|
32
32
|
getSebiCertificateFolderName(): string | undefined;
|
|
33
33
|
getSebiCertificateFileName(): string | undefined;
|
|
34
|
+
static findByRegistrationId(organizationEntities: IOrganizationEntity[], registrationId: number): IOrganizationEntity | undefined;
|
|
34
35
|
}
|
|
@@ -59,6 +59,11 @@ var OrganizationEntityModel = /** @class */ (function () {
|
|
|
59
59
|
var _a;
|
|
60
60
|
return (_a = this.sebiCertificate) === null || _a === void 0 ? void 0 : _a.split("/").slice(3, 5)[1];
|
|
61
61
|
};
|
|
62
|
+
OrganizationEntityModel.findByRegistrationId = function (organizationEntities, registrationId) {
|
|
63
|
+
return organizationEntities.find(function (organizationEntity) {
|
|
64
|
+
return organizationEntity.registrationId == registrationId;
|
|
65
|
+
});
|
|
66
|
+
};
|
|
62
67
|
return OrganizationEntityModel;
|
|
63
68
|
}());
|
|
64
69
|
exports.OrganizationEntityModel = OrganizationEntityModel;
|
|
@@ -48,7 +48,7 @@ var PricingPlanEntityModel = /** @class */ (function () {
|
|
|
48
48
|
throw new _model_1.AppBadRequestException({
|
|
49
49
|
key: "noOfMonths.".concat(key),
|
|
50
50
|
message: [
|
|
51
|
-
"No of months should be greater than ".concat(previousMonthCount),
|
|
51
|
+
"No of months at index ".concat(key, " should be greater than ").concat(previousMonthCount),
|
|
52
52
|
],
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -64,7 +64,9 @@ var PricingPlanEntityModel = /** @class */ (function () {
|
|
|
64
64
|
if (recentBillingCycleIndex !== billingCycleIndex - 1) {
|
|
65
65
|
throw new _model_1.AppBadRequestException({
|
|
66
66
|
key: "billingCycleIndex.".concat(billingCycleIndex),
|
|
67
|
-
message: [
|
|
67
|
+
message: [
|
|
68
|
+
"billingCycleIndex should be ".concat(recentBillingCycleIndex + 1, " at index ").concat(billingCycleIndex),
|
|
69
|
+
],
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
72
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SubscriptionStatus } from "../@enum";
|
|
2
|
+
import { ICreateSubscriptionRequest, ISubscriptionEntity, IUserEntity } from "../@type";
|
|
3
|
+
export declare class SubscriptionEntityModel implements ISubscriptionEntity {
|
|
4
|
+
id: number;
|
|
5
|
+
fromDateCode: number;
|
|
6
|
+
toDateCode: number;
|
|
7
|
+
organizationId: number;
|
|
8
|
+
type: string;
|
|
9
|
+
grossAmount: number;
|
|
10
|
+
discount: string;
|
|
11
|
+
netAmount: number;
|
|
12
|
+
amountPaid: number;
|
|
13
|
+
status: SubscriptionStatus;
|
|
14
|
+
remarks: string;
|
|
15
|
+
registrationId: number;
|
|
16
|
+
pricingPlanId: number;
|
|
17
|
+
createdOn: Date;
|
|
18
|
+
updatedOn: Date;
|
|
19
|
+
createdBy: number;
|
|
20
|
+
updatedBy: number;
|
|
21
|
+
constructor(subscriptionEntity: ISubscriptionEntity);
|
|
22
|
+
static getEntityInstanceByICreateSubscriptionRequestUserEntity(body: ICreateSubscriptionRequest, userEntity: IUserEntity, status: SubscriptionStatus, pricingPlanId: number): ISubscriptionEntity;
|
|
23
|
+
validateAdvanceAmount(isAmountPaidValidation?: boolean): void;
|
|
24
|
+
filterByOrganizationId(subScriptionEntities: ISubscriptionEntity[], organizationId: number): ISubscriptionEntity[];
|
|
25
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscriptionEntityModel = void 0;
|
|
4
|
+
var _model_1 = require("../@model");
|
|
5
|
+
var SubscriptionEntityModel = /** @class */ (function () {
|
|
6
|
+
function SubscriptionEntityModel(subscriptionEntity) {
|
|
7
|
+
Object.assign(this, subscriptionEntity);
|
|
8
|
+
}
|
|
9
|
+
SubscriptionEntityModel.getEntityInstanceByICreateSubscriptionRequestUserEntity = function (body, userEntity, status, pricingPlanId) {
|
|
10
|
+
var _a;
|
|
11
|
+
var subscriptionEntity = {};
|
|
12
|
+
subscriptionEntity.organizationId = userEntity.organizationId;
|
|
13
|
+
subscriptionEntity.fromDateCode = body.from;
|
|
14
|
+
subscriptionEntity.toDateCode = body.to;
|
|
15
|
+
subscriptionEntity.type = body.type;
|
|
16
|
+
subscriptionEntity.grossAmount = body.grossAmount;
|
|
17
|
+
subscriptionEntity.discount = body.discount;
|
|
18
|
+
subscriptionEntity.netAmount = body.netAmount;
|
|
19
|
+
subscriptionEntity.amountPaid = body.amountPaid;
|
|
20
|
+
subscriptionEntity.status = status;
|
|
21
|
+
subscriptionEntity.remarks = (_a = body.remarks) !== null && _a !== void 0 ? _a : "";
|
|
22
|
+
subscriptionEntity.createdBy = userEntity.id;
|
|
23
|
+
subscriptionEntity.createdOn = new Date();
|
|
24
|
+
subscriptionEntity.updatedBy = userEntity.id;
|
|
25
|
+
subscriptionEntity.updatedOn = new Date();
|
|
26
|
+
subscriptionEntity.pricingPlanId = pricingPlanId;
|
|
27
|
+
subscriptionEntity.registrationId = userEntity.registrationId;
|
|
28
|
+
return subscriptionEntity;
|
|
29
|
+
};
|
|
30
|
+
SubscriptionEntityModel.prototype.validateAdvanceAmount = function (isAmountPaidValidation) {
|
|
31
|
+
if (isAmountPaidValidation === void 0) { isAmountPaidValidation = false; }
|
|
32
|
+
if (this.amountPaid > this.netAmount) {
|
|
33
|
+
if (isAmountPaidValidation) {
|
|
34
|
+
throw new _model_1.AppBadRequestException({
|
|
35
|
+
key: "amountPaid",
|
|
36
|
+
message: [
|
|
37
|
+
"amount paid ".concat(this.amountPaid, " is not equal to net amount ").concat(this.netAmount),
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
throw new _model_1.AppBadRequestException({
|
|
43
|
+
key: "advanceAmount",
|
|
44
|
+
message: [
|
|
45
|
+
"advance should not greater than net amount:'".concat(this.netAmount, "'"),
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
SubscriptionEntityModel.prototype.filterByOrganizationId = function (subScriptionEntities, organizationId) {
|
|
52
|
+
return subScriptionEntities.filter(function (subScriptionEntity) {
|
|
53
|
+
return subScriptionEntity.organizationId === organizationId;
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
return SubscriptionEntityModel;
|
|
57
|
+
}());
|
|
58
|
+
exports.SubscriptionEntityModel = SubscriptionEntityModel;
|
|
@@ -21,4 +21,5 @@ export declare class UserEntityModel implements IUserEntity {
|
|
|
21
21
|
updatedBy: number;
|
|
22
22
|
constructor(userEntity: IUserEntity);
|
|
23
23
|
static getEntityInstanceByRegistrationEntityOrganizationId(registrationEntity: IRegistrationEntity, hashPassword: string, organizationId: number): IUserEntity;
|
|
24
|
+
filterByOrganizationId(userEntities: IUserEntity[], organizationId: number): IUserEntity[];
|
|
24
25
|
}
|
|
@@ -26,6 +26,11 @@ var UserEntityModel = /** @class */ (function () {
|
|
|
26
26
|
userEntity.organizationId = organizationId;
|
|
27
27
|
return userEntity;
|
|
28
28
|
};
|
|
29
|
+
UserEntityModel.prototype.filterByOrganizationId = function (userEntities, organizationId) {
|
|
30
|
+
return userEntities.filter(function (userEntity) {
|
|
31
|
+
return userEntity.organizationId === organizationId;
|
|
32
|
+
});
|
|
33
|
+
};
|
|
29
34
|
return UserEntityModel;
|
|
30
35
|
}());
|
|
31
36
|
exports.UserEntityModel = UserEntityModel;
|