@getjones/test-infra 3.1.4 → 3.1.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.
- package/package.json +1 -1
- package/src/defaults/configs/polices.js +3 -1
- package/src/resources/virusFile.pdf +0 -0
- package/src/saas/internal-api/coi/models/submit.coi.model.js +6 -16
- package/src/saas/internal-api/coi/utils/utils.js +7 -29
- package/src/saas/internal-api/compliance/utils/auditUtil.js +2 -2
- package/src/saas/internal-api/requirements/consts/attributeTypes.json +4 -2
- package/src/saas/internal-api/requirements/models/policy.model.js +4 -2
- package/src/saas/internal-api/requirements/utils/utils.js +18 -5
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.api.js +7 -1
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.service.js +11 -0
package/package.json
CHANGED
|
@@ -58,7 +58,9 @@ const attributeNames = {
|
|
|
58
58
|
followsForm: 'Follows Form',
|
|
59
59
|
followFormEndorsement: 'Follow-Form Endorsement',
|
|
60
60
|
waiverOfSubrogation: 'Waiver of Subrogation',
|
|
61
|
-
waiverOfSubrogationEndorsement: 'Waiver of Subrogation Endorsement'
|
|
61
|
+
waiverOfSubrogationEndorsement: 'Waiver of Subrogation Endorsement',
|
|
62
|
+
amBestRating: 'AM Best Rating',
|
|
63
|
+
amBestFinancialSizeCategory: 'AM Best Financial Size Category'
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
module.exports = {
|
|
Binary file
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
recordDateModified,
|
|
8
|
-
isContractorExist = true
|
|
9
|
-
}) {
|
|
10
|
-
this.contractorId = contractorId;
|
|
11
|
-
this.chosenIds = fileIds;
|
|
12
|
-
this.uploadedBy = uploadedBy;
|
|
13
|
-
this.uploaderEmail = uploaderEmail;
|
|
14
|
-
this.isContractorExist = isContractorExist;
|
|
15
|
-
this.recordDateModified = recordDateModified;
|
|
16
|
-
}
|
|
1
|
+
function SubmitCoiModel(contractorId, fileIds, uploadedBy, uploaderEmail, isContractorExist = true) {
|
|
2
|
+
this.contractorId = contractorId;
|
|
3
|
+
this.chosenIds = fileIds;
|
|
4
|
+
this.uploadedBy = uploadedBy;
|
|
5
|
+
this.uploaderEmail = uploaderEmail;
|
|
6
|
+
this.isContractorExist = isContractorExist;
|
|
17
7
|
}
|
|
18
8
|
|
|
19
9
|
module.exports = { SubmitCoiModel };
|
|
@@ -2,58 +2,36 @@ const fs = require('fs');
|
|
|
2
2
|
|
|
3
3
|
const services = require('../api/coi.service');
|
|
4
4
|
const { SubmitCoiModel } = require('../models/submit.coi.model');
|
|
5
|
-
const { getContractorById } = require('../../contractors/api/contractors.service');
|
|
6
|
-
const { getIcsCookie } = require('../../auth/api/auth.service');
|
|
7
5
|
|
|
8
6
|
const uploadFileToStorage = (recordId, filePath) => {
|
|
9
7
|
const fileData = fs.createReadStream(filePath);
|
|
10
8
|
return services.uploadToS3(recordId, fileData);
|
|
11
9
|
};
|
|
12
10
|
|
|
13
|
-
const submitCoiFilesUpload = ({
|
|
14
|
-
|
|
15
|
-
fileIds,
|
|
16
|
-
uploadedBy,
|
|
17
|
-
uploaderEmail,
|
|
18
|
-
recordDateModified
|
|
19
|
-
}) => {
|
|
20
|
-
const submitCoiModel = new SubmitCoiModel({
|
|
11
|
+
const submitCoiFilesUpload = (recordId, fileIds, uploaderType, uploaderEmail) => {
|
|
12
|
+
const submitCoiModel = new SubmitCoiModel(
|
|
21
13
|
recordId,
|
|
22
14
|
fileIds,
|
|
23
|
-
|
|
24
|
-
uploaderEmail
|
|
25
|
-
|
|
26
|
-
});
|
|
15
|
+
uploaderType,
|
|
16
|
+
uploaderEmail
|
|
17
|
+
);
|
|
27
18
|
return services.submitCoi(submitCoiModel);
|
|
28
19
|
};
|
|
29
20
|
|
|
30
21
|
const uploadCoi = async (
|
|
31
22
|
recordId,
|
|
32
23
|
filePath,
|
|
33
|
-
|
|
24
|
+
uploaderType,
|
|
34
25
|
uploaderEmail,
|
|
35
26
|
{
|
|
36
27
|
markAsScaned, // Should be passed with context
|
|
37
28
|
context
|
|
38
29
|
} = {}
|
|
39
30
|
) => {
|
|
40
|
-
if (!context) {
|
|
41
|
-
context = await getIcsCookie();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const recordResponse = await getContractorById(recordId, context);
|
|
45
|
-
const recordDateModified = recordResponse.data.dateModified;
|
|
46
31
|
const uploadResponse = await uploadFileToStorage(recordId, filePath);
|
|
47
32
|
const fileId = uploadResponse.data.fileId;
|
|
48
33
|
|
|
49
|
-
const submitResponse = fileId && await submitCoiFilesUpload(
|
|
50
|
-
recordId,
|
|
51
|
-
fileIds: [fileId],
|
|
52
|
-
uploadedBy,
|
|
53
|
-
uploaderEmail,
|
|
54
|
-
recordDateModified
|
|
55
|
-
});
|
|
56
|
-
|
|
34
|
+
const submitResponse = fileId && await submitCoiFilesUpload(recordId, [fileId], uploaderType, uploaderEmail);
|
|
57
35
|
const uploadedCoi = !!submitResponse.data.fileName && { id: fileId, name: submitResponse.data.fileName };
|
|
58
36
|
|
|
59
37
|
if (uploadedCoi.name && markAsScaned && context) {
|
|
@@ -138,7 +138,7 @@ const parseAuditConfig = function(config) {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
const selection = { attributeName: getAttributeKey(field) };
|
|
141
|
-
|
|
141
|
+
certificateEndorsementsList.includes(field) && (selection.policyName = field);
|
|
142
142
|
|
|
143
143
|
if (isArray(config[field])) {
|
|
144
144
|
selection.status = AUDIT_ENTITY_STATUSES[(config[field][0]).toUpperCase()];
|
|
@@ -180,7 +180,7 @@ module.exports = {
|
|
|
180
180
|
getAllWaivablePolicies
|
|
181
181
|
};
|
|
182
182
|
|
|
183
|
-
const
|
|
183
|
+
const certificateEndorsementsList = [
|
|
184
184
|
'Waiver Of Subrogation',
|
|
185
185
|
'Certificate Holder',
|
|
186
186
|
'Additional Information',
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"endorsement": "ENDORSEMENT",
|
|
3
3
|
"limit": "LIMIT",
|
|
4
4
|
"boolean": "BOOLEAN",
|
|
5
5
|
"multiple": "MULTIPLE",
|
|
6
|
-
"numeric": "NUMERIC"
|
|
6
|
+
"numeric": "NUMERIC",
|
|
7
|
+
"amBestRating": "AM_BEST_RATING",
|
|
8
|
+
"amBestFinancialSizeCategory": "AM_BEST_FINANCIAL_SIZE_CATEGORY"
|
|
7
9
|
}
|
|
@@ -23,11 +23,13 @@ class AttributeModel {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const AttributeTypes = new Enum({
|
|
26
|
-
'
|
|
26
|
+
'ENDORSEMENT': 'endorsment', //typo in BE
|
|
27
27
|
'LIMIT': 'limit',
|
|
28
28
|
'BOOLEAN': 'boolean',
|
|
29
29
|
'NUMERIC': 'numeric',
|
|
30
|
-
'MULTIPLE': 'multiple'
|
|
30
|
+
'MULTIPLE': 'multiple',
|
|
31
|
+
'AM_BEST_RATING': 'amBestRating',
|
|
32
|
+
'AM_BEST_FINANCIAL_SIZE_CATEGORY': 'amBestFinancialSizeCategory'
|
|
31
33
|
}, { name: 'AttributeTypes' });
|
|
32
34
|
|
|
33
35
|
module.exports = { PolicyModel, AttributeModel, AttributeTypes };
|
|
@@ -7,8 +7,11 @@ const { CreateRequirementModel } = require('../models/create.requirement.model')
|
|
|
7
7
|
const customAttributes = {
|
|
8
8
|
Including: 'multiple' //because attributeTypes.multiple => 'Multiple' with capital M
|
|
9
9
|
};
|
|
10
|
-
|
|
11
10
|
const numericAttributes = ['Indemnity Period', 'Notice of Cancellation', 'Notice of Cancellation Endorsement'];
|
|
11
|
+
const amBestAttributes = {
|
|
12
|
+
amBestRating: 'AM Best Rating',
|
|
13
|
+
amBestFinancialSizeCategory: 'AM Best Financial Size Category'
|
|
14
|
+
};
|
|
12
15
|
|
|
13
16
|
const convertNumericValuesToNumberType = function(value, attributeName) {
|
|
14
17
|
if (dataTypeUtils.isString(value) && value.startsWith('$')) {
|
|
@@ -35,15 +38,25 @@ const preparePolicyAttributesTypes = function(value, attributeName) {
|
|
|
35
38
|
return AttributeTypes.get(attributeTypes.boolean);
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
if (dataTypeUtils.isString(attributesValue)) {
|
|
42
|
+
if (attributeName === amBestAttributes.amBestRating) {
|
|
43
|
+
return AttributeTypes.get(attributeTypes.amBestRating);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (attributeName === amBestAttributes.amBestFinancialSizeCategory) {
|
|
47
|
+
return AttributeTypes.get(attributeTypes.amBestFinancialSizeCategory);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
38
51
|
return AttributeTypes.get(attributeTypes.multiple);
|
|
39
52
|
};
|
|
40
53
|
|
|
41
|
-
const
|
|
54
|
+
const prepareEndorsementAttributesTypes = function(value) {
|
|
42
55
|
if (dataTypeUtils.isBoolean(value)) {
|
|
43
56
|
return AttributeTypes.get(attributeTypes.boolean);
|
|
44
57
|
}
|
|
45
58
|
|
|
46
|
-
return AttributeTypes.get(attributeTypes.
|
|
59
|
+
return AttributeTypes.get(attributeTypes.endorsement);
|
|
47
60
|
};
|
|
48
61
|
|
|
49
62
|
const parseRequirementConfig = function(config) {
|
|
@@ -63,7 +76,7 @@ const parseRequirementConfig = function(config) {
|
|
|
63
76
|
attributes.push({
|
|
64
77
|
name: attributeName,
|
|
65
78
|
type: preparePolicyAttributesTypes(config[policy][attribute], attributeName),
|
|
66
|
-
values: attributeName === customAttributes.Including ?
|
|
79
|
+
values: attributeName === customAttributes.Including ? //Including attributes in Automobile Liability
|
|
67
80
|
config[policy][attribute].split(', ') :
|
|
68
81
|
[convertNumericValuesToNumberType(config[policy][attribute], attributeName)]
|
|
69
82
|
});
|
|
@@ -71,7 +84,7 @@ const parseRequirementConfig = function(config) {
|
|
|
71
84
|
} else {
|
|
72
85
|
attributes.push({
|
|
73
86
|
name: policy,
|
|
74
|
-
type:
|
|
87
|
+
type: prepareEndorsementAttributesTypes(config[policy]),
|
|
75
88
|
values: [config[policy]]
|
|
76
89
|
});
|
|
77
90
|
}
|
|
@@ -4,6 +4,7 @@ const { backendUrl } = require('../../../../../env').getEnv();
|
|
|
4
4
|
const Endpoints = {
|
|
5
5
|
invite: projectId => `${backendUrl}/saas/project/${projectId}/tenants`,
|
|
6
6
|
getTenantsByProjectId: projectId => `${backendUrl}/saas/project/${projectId}/tenants`,
|
|
7
|
+
getTenantsByAccountId: accountId => `${backendUrl}/saas/account/${accountId}/tenants`,
|
|
7
8
|
signupUser: `${backendUrl}/_saas/guests/signup`,
|
|
8
9
|
removeTenantUser: (projectId, userId) => `${backendUrl}/saas/project/${projectId}/tenant/${userId}`
|
|
9
10
|
};
|
|
@@ -16,6 +17,10 @@ const getTenantUsersByProjectId = (projectId, context) => {
|
|
|
16
17
|
return requests.getRequestHandler(Endpoints.getTenantsByProjectId(projectId), {}, context, {});
|
|
17
18
|
};
|
|
18
19
|
|
|
20
|
+
const getTenantsByAccountId = (accountId, context) => {
|
|
21
|
+
return requests.getRequestHandler(Endpoints.getTenantsByAccountId(accountId), {}, context, {});
|
|
22
|
+
};
|
|
23
|
+
|
|
19
24
|
const signupUser = (signupUserModel, context) => {
|
|
20
25
|
return requests.postRequestHandler(Endpoints.signupUser, signupUserModel, context, {}, {});
|
|
21
26
|
};
|
|
@@ -28,5 +33,6 @@ module.exports = {
|
|
|
28
33
|
invite,
|
|
29
34
|
getTenantUsersByProjectId,
|
|
30
35
|
signupUser,
|
|
31
|
-
removeTenantUser
|
|
36
|
+
removeTenantUser,
|
|
37
|
+
getTenantsByAccountId
|
|
32
38
|
};
|
|
@@ -34,6 +34,16 @@ const getTenantUsersByProjectId = async (projectId, context) => {
|
|
|
34
34
|
return tenantResponse.data;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
const getTenantsByAccountId = async (accountId, context) => {
|
|
38
|
+
const tenantResponse = await tenantAPI.getTenantsByAccountId(accountId, context);
|
|
39
|
+
|
|
40
|
+
if (tenantResponse.status !== httpResponseStatusCodes.OK) {
|
|
41
|
+
throw new Error(`Failed to retrieve tenants users from tenant account, accountId - ${accountId} response status - \n${tenantResponse.status}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return tenantResponse.data;
|
|
45
|
+
};
|
|
46
|
+
|
|
37
47
|
const getTenantUserByEmail = async (projectId, email, context) => {
|
|
38
48
|
const allTenants = await getTenantUsersByProjectId(projectId, context);
|
|
39
49
|
|
|
@@ -92,6 +102,7 @@ module.exports = {
|
|
|
92
102
|
inviteTenantUser,
|
|
93
103
|
getTenantUsersByProjectId,
|
|
94
104
|
getOrCreateTenantUser,
|
|
105
|
+
getTenantsByAccountId,
|
|
95
106
|
removeTenantUser,
|
|
96
107
|
removeAllTenantUsersFromProject
|
|
97
108
|
};
|