@getjones/test-infra 4.5.0 → 4.5.2
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 +30 -30
- package/src/common/commonFlows/auth/auth.js +40 -40
- package/src/common/commonFlows/index.js +4 -4
- package/src/common/commonFlows/records/records.js +260 -260
- package/src/common/consts/accountSettings.js +14 -14
- package/src/common/consts/activationStatuses.js +6 -6
- package/src/common/consts/autocomplete.js +10 -10
- package/src/common/consts/constantsForRecordsSortingAndFilters.js +48 -48
- package/src/common/consts/dashboardCharts.js +18 -18
- package/src/common/consts/homepage/AttentionTab.js +5 -5
- package/src/common/consts/homepage/sortOptions.js +14 -14
- package/src/common/consts/ocrStatuses.js +6 -6
- package/src/common/consts/projectSettings.js +21 -21
- package/src/common/consts/recordTypes.js +5 -5
- package/src/common/consts/requirementActions.js +10 -10
- package/src/common/consts/s3FileTypes.js +13 -13
- package/src/common/consts/userRoles.js +18 -18
- package/src/common/consts/userTypes.js +8 -8
- package/src/common/errorCodes.js +3 -3
- package/src/common/httpResponseStatusCodes.json +11 -11
- package/src/common/httpResponseTypes.json +2 -2
- package/src/common/requests/apiKeyAuth/requests.js +44 -44
- package/src/common/requests/cookieAuth/requests.js +40 -40
- package/src/common/requests/internalAuth/requests.js +48 -48
- package/src/common/requests/requestHandlers.js +80 -80
- package/src/common/utils/complianceUtil.js +114 -114
- package/src/common/utils/configsUtil.js +22 -22
- package/src/common/utils/dataTypeUtils.js +41 -41
- package/src/common/utils/numberUtils.js +22 -22
- package/src/common/utils/objectUtils.js +7 -7
- package/src/common/utils/timeUtils.js +177 -177
- package/src/common/validations/errorValidation.js +16 -16
- package/src/common/validations/typeValidations.js +36 -36
- package/src/defaults/configs/auditConfigs.js +146 -125
- package/src/defaults/configs/coverage.js +236 -227
- package/src/defaults/configs/polices.js +75 -75
- package/src/defaults/configs/requirement.js +32 -32
- package/src/defaults/index.js +6 -6
- package/src/env.js +57 -57
- package/src/factory/globalRecord/globalRecord.js +43 -43
- package/src/factory/index.js +8 -8
- package/src/factory/records/records.js +297 -229
- package/src/factory/users/users.js +86 -86
- package/src/index.js +97 -97
- package/src/resources/virusFile.pdf +0 -0
- package/src/saas/internal-api/accountDirectory/api/accountDirectory.api.js +50 -50
- package/src/saas/internal-api/accountDirectory/api/accountDirectory.service.js +182 -182
- package/src/saas/internal-api/accountDirectory/index.js +4 -4
- package/src/saas/internal-api/accountDirectory/models/accountDirectory.model.js +40 -40
- package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +35 -35
- package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +93 -93
- package/src/saas/internal-api/accounts/api/emailCustomization/accounts.email.customizations.api.js +29 -29
- package/src/saas/internal-api/accounts/api/emailCustomization/accounts.email.customizations.service.js +61 -61
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +48 -48
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +74 -74
- package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
- package/src/saas/internal-api/accounts/api/settings/settings.service.js +41 -41
- package/src/saas/internal-api/accounts/consts/consts.js +8 -8
- package/src/saas/internal-api/accounts/index.js +22 -22
- package/src/saas/internal-api/accounts/models/core/create.account.model.js +16 -16
- package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +51 -51
- package/src/saas/internal-api/accounts/utils/utils.js +60 -60
- package/src/saas/internal-api/agreement/api/agreement.api.js +39 -39
- package/src/saas/internal-api/agreement/api/agreement.service.js +121 -121
- package/src/saas/internal-api/agreement/consts/consts.js +11 -11
- package/src/saas/internal-api/agreement/index.js +12 -12
- package/src/saas/internal-api/agreement/models/create.agreement.model.js +12 -12
- package/src/saas/internal-api/agreement/models/createAgreementByAuditorModel.js +11 -11
- package/src/saas/internal-api/agreement/models/createAgreementByPMModel.js +13 -13
- package/src/saas/internal-api/auditCustomerRules/api/customer.rules.api.js +43 -43
- package/src/saas/internal-api/auditCustomerRules/api/customer.rules.service.js +105 -105
- package/src/saas/internal-api/auditCustomerRules/consts/customer.rule.js +11 -11
- package/src/saas/internal-api/auditCustomerRules/index.js +6 -6
- package/src/saas/internal-api/auditCustomerRules/models/customer.rule.model.js +46 -46
- package/src/saas/internal-api/auditCustomerRules/utils/customer.rule.util.js +19 -19
- package/src/saas/internal-api/auditNotes/api/audit.notes.api.js +40 -40
- package/src/saas/internal-api/auditNotes/api/audit.notes.service.js +115 -115
- package/src/saas/internal-api/auditNotes/index.js +4 -4
- package/src/saas/internal-api/auditNotes/models/audit.note.model.js +30 -30
- package/src/saas/internal-api/auth/api/auth.api.js +27 -27
- package/src/saas/internal-api/auth/api/auth.service.js +90 -90
- package/src/saas/internal-api/auth/index.js +3 -3
- package/src/saas/internal-api/coi/api/coi.api.js +45 -45
- package/src/saas/internal-api/coi/api/coi.service.js +39 -39
- package/src/saas/internal-api/coi/consts/hashes.js +4 -4
- package/src/saas/internal-api/coi/consts/uploaderTypes.js +5 -5
- package/src/saas/internal-api/coi/index.js +14 -14
- package/src/saas/internal-api/coi/models/Combine.last.two.cois.model.js +25 -25
- package/src/saas/internal-api/coi/models/submit.coi.model.js +19 -19
- package/src/saas/internal-api/coi/utils/utils.js +117 -117
- package/src/saas/internal-api/compliance/api/amBestRating/am.best.rating.api.js +12 -12
- package/src/saas/internal-api/compliance/api/amBestRating/am.best.rating.service.js +14 -14
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +115 -115
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +300 -300
- package/src/saas/internal-api/compliance/api/convert/convert.api.js +17 -17
- package/src/saas/internal-api/compliance/api/convert/convert.service.js +11 -11
- package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
- package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +50 -48
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.api.js +38 -38
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +183 -183
- package/src/saas/internal-api/compliance/consts/audit.js +111 -111
- package/src/saas/internal-api/compliance/index.js +36 -36
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +96 -96
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +49 -49
- package/src/saas/internal-api/compliance/utils/auditUtil.js +254 -254
- package/src/saas/internal-api/compliance/utils/coverageUtil.js +55 -40
- package/src/saas/internal-api/contractors/api/contractors.api.js +209 -209
- package/src/saas/internal-api/contractors/api/contractors.service.js +361 -361
- package/src/saas/internal-api/contractors/consts/consts.js +6 -6
- package/src/saas/internal-api/contractors/index.js +8 -8
- package/src/saas/internal-api/contractors/models/assign.requirement.model.js +10 -10
- package/src/saas/internal-api/contractors/models/edit.contractor.model.js +73 -73
- package/src/saas/internal-api/contractors/models/link.request.model.js +10 -10
- package/src/saas/internal-api/contractors/models/subscription.contractor.model.js +13 -13
- package/src/saas/internal-api/contractors/models/verification.contractor.model.js +27 -27
- package/src/saas/internal-api/contractors/utils.js +25 -25
- package/src/saas/internal-api/dashboard/api/recordList.api.js +38 -38
- package/src/saas/internal-api/dashboard/api/recordList.service.js +60 -60
- package/src/saas/internal-api/dashboard/index.js +5 -5
- package/src/saas/internal-api/dashboard/models/dashboard.filter.criteria.model.js +38 -38
- package/src/saas/internal-api/dbEmails/api/db.emails.api.js +25 -25
- package/src/saas/internal-api/dbEmails/api/db.emails.service.js +156 -156
- package/src/saas/internal-api/dbEmails/consts/consts.js +55 -55
- package/src/saas/internal-api/dbEmails/index.js +6 -6
- package/src/saas/internal-api/dbEmails/models/db.emails.model.js +22 -22
- package/src/saas/internal-api/dbEmails/utils/util.js +87 -87
- package/src/saas/internal-api/emailCustomization/api/email.customization.api.js +26 -26
- package/src/saas/internal-api/emailCustomization/api/email.customization.service.js +50 -50
- package/src/saas/internal-api/emailCustomization/index.js +3 -3
- package/src/saas/internal-api/globalRecord/api/global.record.api.js +95 -95
- package/src/saas/internal-api/globalRecord/api/global.record.service.js +112 -112
- package/src/saas/internal-api/globalRecord/consts.js +20 -20
- package/src/saas/internal-api/globalRecord/index.js +6 -6
- package/src/saas/internal-api/globalRecord/models/global.record.model.js +60 -60
- package/src/saas/internal-api/globalRecord/utils/util.js +161 -161
- package/src/saas/internal-api/homepageCharts/api/charts.api.js +12 -12
- package/src/saas/internal-api/homepageCharts/api/charts.service.js +7 -7
- package/src/saas/internal-api/homepageCharts/index.js +3 -3
- package/src/saas/internal-api/policyFile/api/policy.file.api.js +43 -43
- package/src/saas/internal-api/policyFile/api/policy.file.service.js +117 -117
- package/src/saas/internal-api/policyFile/consts.js +21 -21
- package/src/saas/internal-api/policyFile/index.js +11 -11
- package/src/saas/internal-api/policyFile/models/create.policy.file.model.js +11 -11
- package/src/saas/internal-api/policyFile/models/set.publish.flag.to.policy.model.js +13 -13
- package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
- package/src/saas/internal-api/projects/api/core/projects.service.js +77 -77
- package/src/saas/internal-api/projects/api/settings/project.settings.api.js +18 -18
- package/src/saas/internal-api/projects/api/settings/project.settings.service.js +35 -35
- package/src/saas/internal-api/projects/consts/defaultProject.js +3 -3
- package/src/saas/internal-api/projects/index.js +24 -24
- package/src/saas/internal-api/projects/models/core/create.project.model.js +41 -41
- package/src/saas/internal-api/projects/models/core/update.project.model.js +47 -47
- package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +40 -40
- package/src/saas/internal-api/projects/utils/utils.js +155 -155
- package/src/saas/internal-api/recordHub/api/record.hub.api.js +14 -14
- package/src/saas/internal-api/recordHub/api/record.hub.service.js +21 -21
- package/src/saas/internal-api/recordHub/index.js +3 -3
- package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
- package/src/saas/internal-api/recordNotes/api/record.notes.service.js +47 -47
- package/src/saas/internal-api/recordNotes/api/record.notes.utils.js +12 -12
- package/src/saas/internal-api/recordNotes/index.js +3 -3
- package/src/saas/internal-api/reports/api/reports.api.js +62 -62
- package/src/saas/internal-api/reports/api/reports.service.js +79 -79
- package/src/saas/internal-api/reports/consts/consts.js +74 -74
- package/src/saas/internal-api/reports/index.js +15 -15
- package/src/saas/internal-api/reports/models/report.model.js +27 -27
- package/src/saas/internal-api/requests/api/requests.api.js +126 -126
- package/src/saas/internal-api/requests/api/requests.service.js +301 -301
- package/src/saas/internal-api/requests/index.js +21 -21
- package/src/saas/internal-api/requests/models/create.request.model.js +36 -36
- package/src/saas/internal-api/requests/models/draft.request.criteria.model.js +18 -18
- package/src/saas/internal-api/requests/models/draft.request.report.model.js +14 -14
- package/src/saas/internal-api/requests/models/edit.request.model.js +31 -31
- package/src/saas/internal-api/requests/models/homepageRequestCriteriaModel.js +19 -19
- package/src/saas/internal-api/requests/models/requestListCriteriaModel.js +17 -17
- package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -9
- package/src/saas/internal-api/requests/utils.js +16 -16
- package/src/saas/internal-api/requestsTable/api/requests.table.api.js +20 -20
- package/src/saas/internal-api/requestsTable/api/requests.table.service.js +14 -14
- package/src/saas/internal-api/requestsTable/index.js +3 -3
- package/src/saas/internal-api/requirements/api/requirements.api.js +57 -57
- package/src/saas/internal-api/requirements/api/requirements.service.js +177 -177
- package/src/saas/internal-api/requirements/consts/attributeTypes.json +8 -8
- package/src/saas/internal-api/requirements/consts/consts.js +6 -6
- package/src/saas/internal-api/requirements/index.js +10 -10
- package/src/saas/internal-api/requirements/models/create.requirement.model.js +17 -17
- package/src/saas/internal-api/requirements/models/policy.model.js +35 -35
- package/src/saas/internal-api/requirements/models/update.requirement.model.js +19 -19
- package/src/saas/internal-api/requirements/utils/utils.js +129 -129
- package/src/saas/internal-api/serviceArea/api/coordinates.api.js +12 -12
- package/src/saas/internal-api/serviceArea/api/coordinates.service.js +7 -7
- package/src/saas/internal-api/serviceArea/index.js +4 -4
- package/src/saas/internal-api/serviceArea/utils/utils.js +8 -8
- package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
- package/src/saas/internal-api/tabs/api/tabs.service.js +54 -54
- package/src/saas/internal-api/tabs/index.js +3 -3
- package/src/saas/internal-api/tabs/models/tabs.model.js +19 -19
- package/src/saas/internal-api/thread-scheduler/runner.js +55 -55
- package/src/saas/internal-api/uploadFiles/api/upload.file.api.js +43 -43
- package/src/saas/internal-api/uploadFiles/api/upload.file.service.js +107 -107
- package/src/saas/internal-api/uploadFiles/consts.js +12 -12
- package/src/saas/internal-api/uploadFiles/index.js +5 -5
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.api.js +38 -38
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.service.js +108 -108
- package/src/saas/internal-api/users/api/users.api.js +127 -127
- package/src/saas/internal-api/users/api/users.service.js +258 -258
- package/src/saas/internal-api/users/index.js +16 -16
- package/src/saas/internal-api/users/models/create.inner.system.user.model.js +18 -18
- package/src/saas/internal-api/users/models/notification.settings.model.js +12 -12
- package/src/saas/internal-api/users/models/tenent.user.model.js +11 -11
- package/src/saas/internal-api/users/models/users.model.js +43 -43
- package/src/saas/internal-api/users/utils/util.js +39 -39
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +26 -26
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +19 -19
- package/src/saas/internal-api/vendorProfile/index.js +3 -3
- package/src/saas/openapi/accounts/accounts.api.js +17 -17
- package/src/saas/openapi/accounts/accounts.service.js +11 -11
- package/src/saas/openapi/coi/coi.api.js +30 -30
- package/src/saas/openapi/coi/coi.service.js +43 -43
- package/src/saas/openapi/projects/projects.api.js +83 -83
- package/src/saas/openapi/projects/projects.service.js +64 -64
- package/src/saas/openapi/requests/index.js +7 -7
- package/src/saas/openapi/requests/models/invite.request.model.js +40 -40
- package/src/saas/openapi/requests/models/update.request.model.js +35 -35
- package/src/saas/openapi/requests/requests.api.js +93 -93
- package/src/saas/openapi/requests/requests.service.js +94 -94
- package/src/saas/openapi/requirements/index.js +6 -6
- package/src/saas/openapi/requirements/models/copy.requirement.model.js +10 -10
- package/src/saas/openapi/requirements/requirements.api.js +41 -41
- package/src/saas/openapi/requirements/requirements.service.js +49 -49
- package/src/saas/openapi/tabs/index.js +6 -6
- package/src/saas/openapi/tabs/models/create.tab.model.js +6 -6
- package/src/saas/openapi/tabs/tabs.api.js +27 -27
- package/src/saas/openapi/tabs/tabs.service.js +19 -19
- package/src/saas/openapi/users/user.model.js +10 -10
- package/src/saas/openapi/users/users.api.js +33 -33
- package/src/saas/openapi/users/users.service.js +51 -51
- package/tests/env.test.js +40 -40
- package/tests/validation.test.js +83 -83
|
@@ -1,260 +1,260 @@
|
|
|
1
|
-
const { expect } = require('chai');
|
|
2
|
-
|
|
3
|
-
const threadScheduler = require('../../../saas/internal-api/thread-scheduler/runner');
|
|
4
|
-
const timeUtils = require('../../utils/timeUtils');
|
|
5
|
-
const httpResponseStatusCodes = require('../../../common/httpResponseStatusCodes.json');
|
|
6
|
-
const ocrStatuses = require('../../consts/ocrStatuses');
|
|
7
|
-
const contractors = require('../../../saas/internal-api/contractors');
|
|
8
|
-
const compliance = require('../../../saas/internal-api/compliance');
|
|
9
|
-
const requests = require('../../../saas/internal-api/requests');
|
|
10
|
-
const dbEmails = require('../../../saas/internal-api/dbEmails');
|
|
11
|
-
const activationStatuses = require('../../../common/consts/activationStatuses');
|
|
12
|
-
const recordTypes = require('../../../common/consts/recordTypes');
|
|
13
|
-
|
|
14
|
-
const makeRecordNotResponsive = async function(recordId, context) {
|
|
15
|
-
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
16
|
-
const isTenant = record.recordType === recordTypes.TENANTS;
|
|
17
|
-
|
|
18
|
-
const offsetInDaysList = isTenant ?
|
|
19
|
-
timeUtils.getInviteActionOffsetInDaysForNotResponsiveTenant() :
|
|
20
|
-
timeUtils.getInviteActionOffsetInDaysForNotResponsiveVendor();
|
|
21
|
-
|
|
22
|
-
for (const offsetInDays of offsetInDaysList) {
|
|
23
|
-
await updateLastInviteActionDate(recordId, offsetInDays, context);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const resendInvitationByRecordId = async (recordId, tabId, context) => {
|
|
28
|
-
const { id: requestId } = await requests.services.getRequestFromTabByRecordId(recordId, tabId, context);
|
|
29
|
-
const recordModifyDateVerificationModel = await contractors.services.getRecordVerificationModel(recordId, context);
|
|
30
|
-
|
|
31
|
-
const resendInvitationResponse = await contractors.services.resendInvitation(requestId, recordModifyDateVerificationModel, context);
|
|
32
|
-
|
|
33
|
-
if (resendInvitationResponse.status !== httpResponseStatusCodes.OK) {
|
|
34
|
-
throw new Error(`Failed to resend invitation for record: ${resendInvitationResponse.statusText}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return resendInvitationResponse;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const editRequestAndRecordDetails = async function(request, recordConfig, context, { isDraft, expectError } = {}) {
|
|
41
|
-
const tabModel = new requests.models.TabModel(request.tab.type);
|
|
42
|
-
const recordDetailsModel = contractors.services.getContractorDetailsModel(recordConfig);
|
|
43
|
-
|
|
44
|
-
const record = isDraft ?
|
|
45
|
-
new contractors.models.edit.DraftRecordModel(
|
|
46
|
-
request.record.contractorId,
|
|
47
|
-
request.record.recordType,
|
|
48
|
-
recordConfig.company,
|
|
49
|
-
recordConfig.emailAddress,
|
|
50
|
-
recordDetailsModel,
|
|
51
|
-
isDraft,
|
|
52
|
-
recordConfig.requirementsAction
|
|
53
|
-
) :
|
|
54
|
-
new contractors.models.edit.ContractorModel(
|
|
55
|
-
request.record.contractorId,
|
|
56
|
-
request.record.recordType,
|
|
57
|
-
recordConfig.company,
|
|
58
|
-
recordConfig.emailAddress,
|
|
59
|
-
recordDetailsModel
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
const requestEditModel = new requests.models.RequestModel(request.id, record, tabModel, {});
|
|
63
|
-
|
|
64
|
-
const editRequestResponse = await requests.services.editRequestAndRecordDetails(requestEditModel, context);
|
|
65
|
-
|
|
66
|
-
if (editRequestResponse.status !== httpResponseStatusCodes.OK && !expectError) {
|
|
67
|
-
throw Error(`Failed to edit record \n${editRequestResponse.data.message}`);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return editRequestResponse;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const updateInviteDate = async function(recordId, inviteDate, context) {
|
|
74
|
-
await timeUtils.waitFor(1).seconds;
|
|
75
|
-
const updateResponse = await contractors.services.updateInviteDate(recordId, inviteDate, context);
|
|
76
|
-
|
|
77
|
-
if (updateResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
78
|
-
throw new Error(`Failed to update record invite date\n${updateResponse}`);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const threadSchedulerResponse = await threadScheduler.runForRecords([recordId]);
|
|
82
|
-
|
|
83
|
-
if (threadSchedulerResponse.status !== httpResponseStatusCodes.OK) {
|
|
84
|
-
throw new Error(`Failed to run thread scheduler\n${threadSchedulerResponse}`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
await timeUtils.waitFor(2.5).seconds; // calls for the same records can override each other
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const updateLastInviteActionDate = async function(recordId, offsetInDays, context) {
|
|
91
|
-
await timeUtils.waitFor(1).seconds;
|
|
92
|
-
//In order to prevent situations where the date of the compliance audit action is equal or greater than the date of the last mail send audit,
|
|
93
|
-
//we move back another day!!
|
|
94
|
-
const complianceAuditActionOffsetInDays = offsetInDays + 1;
|
|
95
|
-
/*
|
|
96
|
-
To run the reminders mails successfully we must first update the compliance audit actions date,
|
|
97
|
-
Since the thread scheduler will trigger the logic of the reminders mails
|
|
98
|
-
only if last invite action date will be equal or after compliance audit actions date
|
|
99
|
-
*/
|
|
100
|
-
const updateComplianceAuditResponse = await compliance.services.audit.updateComplianceAuditActionsDate(recordId, complianceAuditActionOffsetInDays, context);
|
|
101
|
-
|
|
102
|
-
if (updateComplianceAuditResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
103
|
-
throw new Error(`Failed to update compliance audit date\n${updateComplianceAuditResponse}`);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const updateLastInviteActionResponse = await contractors.services.updateLastInviteActionDate(recordId, offsetInDays, context);
|
|
107
|
-
|
|
108
|
-
if (updateLastInviteActionResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
109
|
-
throw new Error(`Failed to update record invite date\n${updateLastInviteActionResponse}`);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const threadSchedulerResponse = await threadScheduler.runForRecords([recordId]);
|
|
113
|
-
|
|
114
|
-
if (threadSchedulerResponse.status !== httpResponseStatusCodes.OK) {
|
|
115
|
-
throw new Error(`Failed to run thread scheduler\n${threadSchedulerResponse}`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
await timeUtils.waitFor(2.5).seconds; // calls for the same records can override each other
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const runOverAllRenewalDatesForRecord = async function(recordId, policyName) {
|
|
122
|
-
const dates = timeUtils.getAutomaticRenewalsExpirationDates();
|
|
123
|
-
|
|
124
|
-
for (const date of dates) {
|
|
125
|
-
await updatePolicyExpiryDateForRecord(recordId, date, policyName);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const updatePolicyExpiryDateForRecord = async function(recordId, expiryDate, policyName) {
|
|
130
|
-
const updateResponse = await contractors.services.updateExpiryDate(recordId, expiryDate, policyName);
|
|
131
|
-
|
|
132
|
-
if (updateResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
133
|
-
throw new Error(`Record expiry date could not be updated\n${updateResponse}`);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const threadSchedulerResponse = await threadScheduler.runForRecords([recordId]);
|
|
137
|
-
|
|
138
|
-
if (threadSchedulerResponse.status !== httpResponseStatusCodes.OK) {
|
|
139
|
-
throw new Error(`Thread scheduler has failed to run\n${threadSchedulerResponse}`);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
await timeUtils.waitFor(2.5).seconds; // calls for the same records can override each other
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const getHistoryEvents = async function(recordId, context) {
|
|
146
|
-
const recordHistory = await contractors.services.getRecordHistory(recordId, context);
|
|
147
|
-
expect(recordHistory.status, 'Expected record history response status to equal 200.').to.equal(httpResponseStatusCodes.OK);
|
|
148
|
-
|
|
149
|
-
return recordHistory.data.map(item => item.itemTitle).reverse();
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const getFirstHistoryEventId = async function(recordId, context) {
|
|
153
|
-
const recordHistory = await contractors.services.getRecordHistory(recordId, context);
|
|
154
|
-
expect(recordHistory.status, 'Expected record history response status to equal 200.').to.equal(httpResponseStatusCodes.OK);
|
|
155
|
-
return recordHistory.data[recordHistory.data.length - 1].itemId;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const getLatestHistoryEventId = async function(recordId, context) {
|
|
159
|
-
const recordHistory = await contractors.services.getRecordHistory(recordId, context);
|
|
160
|
-
expect(recordHistory.status, 'Expected record history response status to equal 200.').to.equal(httpResponseStatusCodes.OK);
|
|
161
|
-
return recordHistory.data[0].itemId;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const getLatestRecordHistoryEventByItemTitle = async function(recordId, itemTitle, context) {
|
|
165
|
-
const recordHistory = await contractors.services.getRecordHistory(recordId, context);
|
|
166
|
-
expect(recordHistory.status, 'Expected record history response status to equal 200.').to.equal(httpResponseStatusCodes.OK);
|
|
167
|
-
|
|
168
|
-
const latestHistoryByTitle = recordHistory.data.find(historyItem => historyItem.itemTitle === itemTitle);
|
|
169
|
-
|
|
170
|
-
if (!latestHistoryByTitle) {
|
|
171
|
-
throw new Error(`History event with title ${itemTitle} not found`);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return latestHistoryByTitle;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const getLatestRecordHistoryEventIdByItemTitle = async function(recordId, itemTitle, context) {
|
|
178
|
-
const latestHistoryByTitle = await getLatestRecordHistoryEventByItemTitle(recordId, itemTitle, context);
|
|
179
|
-
|
|
180
|
-
return latestHistoryByTitle.itemId;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
const getRecordHistoryItemById = async (recordId, itemId, context) => {
|
|
184
|
-
const recordHistory = await contractors.services.getRecordHistory(recordId, context);
|
|
185
|
-
|
|
186
|
-
return recordHistory.data.find(item => item.itemId === itemId);
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
const waitForOcrStatus = async function(recordId, context, { expectedStatus = ocrStatuses.SUCCESS } = {}) {
|
|
190
|
-
let { data: recordOcrStatus } = await contractors.services.getRecordOcrStatus(recordId, context);
|
|
191
|
-
let maxRetries = 25;
|
|
192
|
-
while (recordOcrStatus !== expectedStatus && recordOcrStatus !== ocrStatuses.FAILED && maxRetries > 0) {
|
|
193
|
-
await timeUtils.waitFor(5).seconds;
|
|
194
|
-
recordOcrStatus = (await contractors.services.getRecordOcrStatus(recordId, context)).data;
|
|
195
|
-
maxRetries--;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (recordOcrStatus !== expectedStatus) {
|
|
199
|
-
throw new Error(`Record OCR status not is as expected. Expected: ${expectedStatus}, Actual: ${recordOcrStatus}`);
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
const deleteAllRequestsInProject = async function(accountId, projectId, context) {
|
|
204
|
-
const activationStatus = [activationStatuses.ACTIVE, activationStatuses.ARCHIVED, activationStatuses.DRAFT];
|
|
205
|
-
const { data: requestsInAccount } = await requests.services.getRequestsByAccountId(accountId, context, activationStatus);
|
|
206
|
-
|
|
207
|
-
for (const request of requestsInAccount) {
|
|
208
|
-
if (request.projectInfo.projectId === projectId) {
|
|
209
|
-
const response = await contractors.services.deleteByContractorId(request.record.contractorId, context);
|
|
210
|
-
|
|
211
|
-
if (response.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
212
|
-
throw new Error(`Failed to delete request ${request.id}\n${response}`);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
const generateSubscriptionModelFromMail = async function(recipients) {
|
|
219
|
-
const data = await dbEmails.services.getSubscriptionData(recipients);
|
|
220
|
-
return contractors.services.getSubscriptionModel(data);
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
const overrideGap = async (recordId, reason, note, policyName, attributeName, context) => {
|
|
224
|
-
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
225
|
-
const overrideModel = compliance.services.overrideGap.getWaiveModel(record, policyName, attributeName, reason, note);
|
|
226
|
-
return compliance.services.overrideGap.overrideGap({ waiveRequestModel: overrideModel, context });
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
const retractOverriddenGap = async (recordId, policyName, attributeName, context) => {
|
|
230
|
-
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
231
|
-
const retractModel = compliance.services.overrideGap.getRetractModel(record, policyName, attributeName);
|
|
232
|
-
return compliance.services.overrideGap.retractOverride(retractModel, context);
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
const waiveAllGaps = async (recordId, context) => {
|
|
236
|
-
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
237
|
-
await compliance.services.overrideGap.waiveAll(record, context);
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
module.exports = {
|
|
241
|
-
makeRecordNotResponsive,
|
|
242
|
-
resendInvitationByRecordId,
|
|
243
|
-
runOverAllRenewalDatesForRecord,
|
|
244
|
-
editRequestAndRecordDetails,
|
|
245
|
-
updateInviteDate,
|
|
246
|
-
updatePolicyExpiryDateForRecord,
|
|
247
|
-
getHistoryEvents,
|
|
248
|
-
getFirstHistoryEventId,
|
|
249
|
-
getLatestHistoryEventId,
|
|
250
|
-
updateLastInviteActionDate,
|
|
251
|
-
waitForOcrStatus,
|
|
252
|
-
generateSubscriptionModelFromMail,
|
|
253
|
-
deleteAllRequestsInProject,
|
|
254
|
-
getLatestRecordHistoryEventIdByItemTitle,
|
|
255
|
-
getRecordHistoryItemById,
|
|
256
|
-
getLatestRecordHistoryEventByItemTitle,
|
|
257
|
-
waiveAllGaps,
|
|
258
|
-
overrideGap,
|
|
259
|
-
retractOverriddenGap
|
|
260
|
-
};
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
|
|
3
|
+
const threadScheduler = require('../../../saas/internal-api/thread-scheduler/runner');
|
|
4
|
+
const timeUtils = require('../../utils/timeUtils');
|
|
5
|
+
const httpResponseStatusCodes = require('../../../common/httpResponseStatusCodes.json');
|
|
6
|
+
const ocrStatuses = require('../../consts/ocrStatuses');
|
|
7
|
+
const contractors = require('../../../saas/internal-api/contractors');
|
|
8
|
+
const compliance = require('../../../saas/internal-api/compliance');
|
|
9
|
+
const requests = require('../../../saas/internal-api/requests');
|
|
10
|
+
const dbEmails = require('../../../saas/internal-api/dbEmails');
|
|
11
|
+
const activationStatuses = require('../../../common/consts/activationStatuses');
|
|
12
|
+
const recordTypes = require('../../../common/consts/recordTypes');
|
|
13
|
+
|
|
14
|
+
const makeRecordNotResponsive = async function(recordId, context) {
|
|
15
|
+
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
16
|
+
const isTenant = record.recordType === recordTypes.TENANTS;
|
|
17
|
+
|
|
18
|
+
const offsetInDaysList = isTenant ?
|
|
19
|
+
timeUtils.getInviteActionOffsetInDaysForNotResponsiveTenant() :
|
|
20
|
+
timeUtils.getInviteActionOffsetInDaysForNotResponsiveVendor();
|
|
21
|
+
|
|
22
|
+
for (const offsetInDays of offsetInDaysList) {
|
|
23
|
+
await updateLastInviteActionDate(recordId, offsetInDays, context);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const resendInvitationByRecordId = async (recordId, tabId, context) => {
|
|
28
|
+
const { id: requestId } = await requests.services.getRequestFromTabByRecordId(recordId, tabId, context);
|
|
29
|
+
const recordModifyDateVerificationModel = await contractors.services.getRecordVerificationModel(recordId, context);
|
|
30
|
+
|
|
31
|
+
const resendInvitationResponse = await contractors.services.resendInvitation(requestId, recordModifyDateVerificationModel, context);
|
|
32
|
+
|
|
33
|
+
if (resendInvitationResponse.status !== httpResponseStatusCodes.OK) {
|
|
34
|
+
throw new Error(`Failed to resend invitation for record: ${resendInvitationResponse.statusText}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return resendInvitationResponse;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const editRequestAndRecordDetails = async function(request, recordConfig, context, { isDraft, expectError } = {}) {
|
|
41
|
+
const tabModel = new requests.models.TabModel(request.tab.type);
|
|
42
|
+
const recordDetailsModel = contractors.services.getContractorDetailsModel(recordConfig);
|
|
43
|
+
|
|
44
|
+
const record = isDraft ?
|
|
45
|
+
new contractors.models.edit.DraftRecordModel(
|
|
46
|
+
request.record.contractorId,
|
|
47
|
+
request.record.recordType,
|
|
48
|
+
recordConfig.company,
|
|
49
|
+
recordConfig.emailAddress,
|
|
50
|
+
recordDetailsModel,
|
|
51
|
+
isDraft,
|
|
52
|
+
recordConfig.requirementsAction
|
|
53
|
+
) :
|
|
54
|
+
new contractors.models.edit.ContractorModel(
|
|
55
|
+
request.record.contractorId,
|
|
56
|
+
request.record.recordType,
|
|
57
|
+
recordConfig.company,
|
|
58
|
+
recordConfig.emailAddress,
|
|
59
|
+
recordDetailsModel
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const requestEditModel = new requests.models.RequestModel(request.id, record, tabModel, {});
|
|
63
|
+
|
|
64
|
+
const editRequestResponse = await requests.services.editRequestAndRecordDetails(requestEditModel, context);
|
|
65
|
+
|
|
66
|
+
if (editRequestResponse.status !== httpResponseStatusCodes.OK && !expectError) {
|
|
67
|
+
throw Error(`Failed to edit record \n${editRequestResponse.data.message}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return editRequestResponse;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const updateInviteDate = async function(recordId, inviteDate, context) {
|
|
74
|
+
await timeUtils.waitFor(1).seconds;
|
|
75
|
+
const updateResponse = await contractors.services.updateInviteDate(recordId, inviteDate, context);
|
|
76
|
+
|
|
77
|
+
if (updateResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
78
|
+
throw new Error(`Failed to update record invite date\n${updateResponse}`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const threadSchedulerResponse = await threadScheduler.runForRecords([recordId]);
|
|
82
|
+
|
|
83
|
+
if (threadSchedulerResponse.status !== httpResponseStatusCodes.OK) {
|
|
84
|
+
throw new Error(`Failed to run thread scheduler\n${threadSchedulerResponse}`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
await timeUtils.waitFor(2.5).seconds; // calls for the same records can override each other
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const updateLastInviteActionDate = async function(recordId, offsetInDays, context) {
|
|
91
|
+
await timeUtils.waitFor(1).seconds;
|
|
92
|
+
//In order to prevent situations where the date of the compliance audit action is equal or greater than the date of the last mail send audit,
|
|
93
|
+
//we move back another day!!
|
|
94
|
+
const complianceAuditActionOffsetInDays = offsetInDays + 1;
|
|
95
|
+
/*
|
|
96
|
+
To run the reminders mails successfully we must first update the compliance audit actions date,
|
|
97
|
+
Since the thread scheduler will trigger the logic of the reminders mails
|
|
98
|
+
only if last invite action date will be equal or after compliance audit actions date
|
|
99
|
+
*/
|
|
100
|
+
const updateComplianceAuditResponse = await compliance.services.audit.updateComplianceAuditActionsDate(recordId, complianceAuditActionOffsetInDays, context);
|
|
101
|
+
|
|
102
|
+
if (updateComplianceAuditResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
103
|
+
throw new Error(`Failed to update compliance audit date\n${updateComplianceAuditResponse}`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const updateLastInviteActionResponse = await contractors.services.updateLastInviteActionDate(recordId, offsetInDays, context);
|
|
107
|
+
|
|
108
|
+
if (updateLastInviteActionResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
109
|
+
throw new Error(`Failed to update record invite date\n${updateLastInviteActionResponse}`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const threadSchedulerResponse = await threadScheduler.runForRecords([recordId]);
|
|
113
|
+
|
|
114
|
+
if (threadSchedulerResponse.status !== httpResponseStatusCodes.OK) {
|
|
115
|
+
throw new Error(`Failed to run thread scheduler\n${threadSchedulerResponse}`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
await timeUtils.waitFor(2.5).seconds; // calls for the same records can override each other
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const runOverAllRenewalDatesForRecord = async function(recordId, policyName) {
|
|
122
|
+
const dates = timeUtils.getAutomaticRenewalsExpirationDates();
|
|
123
|
+
|
|
124
|
+
for (const date of dates) {
|
|
125
|
+
await updatePolicyExpiryDateForRecord(recordId, date, policyName);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const updatePolicyExpiryDateForRecord = async function(recordId, expiryDate, policyName) {
|
|
130
|
+
const updateResponse = await contractors.services.updateExpiryDate(recordId, expiryDate, policyName);
|
|
131
|
+
|
|
132
|
+
if (updateResponse.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
133
|
+
throw new Error(`Record expiry date could not be updated\n${updateResponse}`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const threadSchedulerResponse = await threadScheduler.runForRecords([recordId]);
|
|
137
|
+
|
|
138
|
+
if (threadSchedulerResponse.status !== httpResponseStatusCodes.OK) {
|
|
139
|
+
throw new Error(`Thread scheduler has failed to run\n${threadSchedulerResponse}`);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
await timeUtils.waitFor(2.5).seconds; // calls for the same records can override each other
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const getHistoryEvents = async function(recordId, context) {
|
|
146
|
+
const recordHistory = await contractors.services.getRecordHistory(recordId, context);
|
|
147
|
+
expect(recordHistory.status, 'Expected record history response status to equal 200.').to.equal(httpResponseStatusCodes.OK);
|
|
148
|
+
|
|
149
|
+
return recordHistory.data.map(item => item.itemTitle).reverse();
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const getFirstHistoryEventId = async function(recordId, context) {
|
|
153
|
+
const recordHistory = await contractors.services.getRecordHistory(recordId, context);
|
|
154
|
+
expect(recordHistory.status, 'Expected record history response status to equal 200.').to.equal(httpResponseStatusCodes.OK);
|
|
155
|
+
return recordHistory.data[recordHistory.data.length - 1].itemId;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const getLatestHistoryEventId = async function(recordId, context) {
|
|
159
|
+
const recordHistory = await contractors.services.getRecordHistory(recordId, context);
|
|
160
|
+
expect(recordHistory.status, 'Expected record history response status to equal 200.').to.equal(httpResponseStatusCodes.OK);
|
|
161
|
+
return recordHistory.data[0].itemId;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const getLatestRecordHistoryEventByItemTitle = async function(recordId, itemTitle, context) {
|
|
165
|
+
const recordHistory = await contractors.services.getRecordHistory(recordId, context);
|
|
166
|
+
expect(recordHistory.status, 'Expected record history response status to equal 200.').to.equal(httpResponseStatusCodes.OK);
|
|
167
|
+
|
|
168
|
+
const latestHistoryByTitle = recordHistory.data.find(historyItem => historyItem.itemTitle === itemTitle);
|
|
169
|
+
|
|
170
|
+
if (!latestHistoryByTitle) {
|
|
171
|
+
throw new Error(`History event with title ${itemTitle} not found`);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return latestHistoryByTitle;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const getLatestRecordHistoryEventIdByItemTitle = async function(recordId, itemTitle, context) {
|
|
178
|
+
const latestHistoryByTitle = await getLatestRecordHistoryEventByItemTitle(recordId, itemTitle, context);
|
|
179
|
+
|
|
180
|
+
return latestHistoryByTitle.itemId;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const getRecordHistoryItemById = async (recordId, itemId, context) => {
|
|
184
|
+
const recordHistory = await contractors.services.getRecordHistory(recordId, context);
|
|
185
|
+
|
|
186
|
+
return recordHistory.data.find(item => item.itemId === itemId);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const waitForOcrStatus = async function(recordId, context, { expectedStatus = ocrStatuses.SUCCESS } = {}) {
|
|
190
|
+
let { data: recordOcrStatus } = await contractors.services.getRecordOcrStatus(recordId, context);
|
|
191
|
+
let maxRetries = 25;
|
|
192
|
+
while (recordOcrStatus !== expectedStatus && recordOcrStatus !== ocrStatuses.FAILED && maxRetries > 0) {
|
|
193
|
+
await timeUtils.waitFor(5).seconds;
|
|
194
|
+
recordOcrStatus = (await contractors.services.getRecordOcrStatus(recordId, context)).data;
|
|
195
|
+
maxRetries--;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (recordOcrStatus !== expectedStatus) {
|
|
199
|
+
throw new Error(`Record OCR status not is as expected. Expected: ${expectedStatus}, Actual: ${recordOcrStatus}`);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const deleteAllRequestsInProject = async function(accountId, projectId, context) {
|
|
204
|
+
const activationStatus = [activationStatuses.ACTIVE, activationStatuses.ARCHIVED, activationStatuses.DRAFT];
|
|
205
|
+
const { data: requestsInAccount } = await requests.services.getRequestsByAccountId(accountId, context, activationStatus);
|
|
206
|
+
|
|
207
|
+
for (const request of requestsInAccount) {
|
|
208
|
+
if (request.projectInfo.projectId === projectId) {
|
|
209
|
+
const response = await contractors.services.deleteByContractorId(request.record.contractorId, context);
|
|
210
|
+
|
|
211
|
+
if (response.status !== httpResponseStatusCodes.NO_CONTENT) {
|
|
212
|
+
throw new Error(`Failed to delete request ${request.id}\n${response}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const generateSubscriptionModelFromMail = async function(recipients) {
|
|
219
|
+
const data = await dbEmails.services.getSubscriptionData(recipients);
|
|
220
|
+
return contractors.services.getSubscriptionModel(data);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const overrideGap = async (recordId, reason, note, policyName, attributeName, context) => {
|
|
224
|
+
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
225
|
+
const overrideModel = compliance.services.overrideGap.getWaiveModel(record, policyName, attributeName, reason, note);
|
|
226
|
+
return compliance.services.overrideGap.overrideGap({ waiveRequestModel: overrideModel, context });
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
const retractOverriddenGap = async (recordId, policyName, attributeName, context) => {
|
|
230
|
+
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
231
|
+
const retractModel = compliance.services.overrideGap.getRetractModel(record, policyName, attributeName);
|
|
232
|
+
return compliance.services.overrideGap.retractOverride(retractModel, context);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const waiveAllGaps = async (recordId, context) => {
|
|
236
|
+
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
237
|
+
await compliance.services.overrideGap.waiveAll(record, context);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
module.exports = {
|
|
241
|
+
makeRecordNotResponsive,
|
|
242
|
+
resendInvitationByRecordId,
|
|
243
|
+
runOverAllRenewalDatesForRecord,
|
|
244
|
+
editRequestAndRecordDetails,
|
|
245
|
+
updateInviteDate,
|
|
246
|
+
updatePolicyExpiryDateForRecord,
|
|
247
|
+
getHistoryEvents,
|
|
248
|
+
getFirstHistoryEventId,
|
|
249
|
+
getLatestHistoryEventId,
|
|
250
|
+
updateLastInviteActionDate,
|
|
251
|
+
waitForOcrStatus,
|
|
252
|
+
generateSubscriptionModelFromMail,
|
|
253
|
+
deleteAllRequestsInProject,
|
|
254
|
+
getLatestRecordHistoryEventIdByItemTitle,
|
|
255
|
+
getRecordHistoryItemById,
|
|
256
|
+
getLatestRecordHistoryEventByItemTitle,
|
|
257
|
+
waiveAllGaps,
|
|
258
|
+
overrideGap,
|
|
259
|
+
retractOverriddenGap
|
|
260
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
isOcrEnabled: {
|
|
3
|
-
on: { isOcrEnabled: true },
|
|
4
|
-
off: { isOcrEnabled: false }
|
|
5
|
-
},
|
|
6
|
-
isAccountRequirementsEnabled: {
|
|
7
|
-
on: { isAccountRequirementsEnabled: true },
|
|
8
|
-
off: { isAccountRequirementsEnabled: false }
|
|
9
|
-
},
|
|
10
|
-
isPolicyVerificationEnabled: {
|
|
11
|
-
on: { hasPolicyVerification: true },
|
|
12
|
-
off: { hasPolicyVerification: false }
|
|
13
|
-
}
|
|
14
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
isOcrEnabled: {
|
|
3
|
+
on: { isOcrEnabled: true },
|
|
4
|
+
off: { isOcrEnabled: false }
|
|
5
|
+
},
|
|
6
|
+
isAccountRequirementsEnabled: {
|
|
7
|
+
on: { isAccountRequirementsEnabled: true },
|
|
8
|
+
off: { isAccountRequirementsEnabled: false }
|
|
9
|
+
},
|
|
10
|
+
isPolicyVerificationEnabled: {
|
|
11
|
+
on: { hasPolicyVerification: true },
|
|
12
|
+
off: { hasPolicyVerification: false }
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
ACTIVE: 'Active',
|
|
3
|
-
ARCHIVED: 'Archived',
|
|
4
|
-
DRAFT: 'Draft',
|
|
5
|
-
DELETED: 'Deleted'
|
|
6
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
ACTIVE: 'Active',
|
|
3
|
+
ARCHIVED: 'Archived',
|
|
4
|
+
DRAFT: 'Draft',
|
|
5
|
+
DELETED: 'Deleted'
|
|
6
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const autocompleteResultType = {
|
|
2
|
-
account: 'Account',
|
|
3
|
-
jonesGlobalCoi: 'JonesGlobalCoi',
|
|
4
|
-
network: 'Network',
|
|
5
|
-
policiesOnFile: 'PoliciesOnFile'
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
autocompleteResultType
|
|
10
|
-
};
|
|
1
|
+
const autocompleteResultType = {
|
|
2
|
+
account: 'Account',
|
|
3
|
+
jonesGlobalCoi: 'JonesGlobalCoi',
|
|
4
|
+
network: 'Network',
|
|
5
|
+
policiesOnFile: 'PoliciesOnFile'
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
autocompleteResultType
|
|
10
|
+
};
|