@getjones/test-infra 4.4.10 → 4.4.11
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/common/commonFlows/records/records.js +36 -2
- package/src/defaults/configs/auditConfigs.js +2 -1
- package/src/factory/records/records.js +6 -8
- package/src/saas/internal-api/contractors/api/contractors.api.js +6 -0
- package/src/saas/internal-api/contractors/api/contractors.service.js +13 -0
package/package.json
CHANGED
|
@@ -131,7 +131,7 @@ const getLatestHistoryEventId = async function(recordId, context) {
|
|
|
131
131
|
return recordHistory.data[0].itemId;
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
const
|
|
134
|
+
const getLatestRecordHistoryEventByItemTitle = async function(recordId, itemTitle, context) {
|
|
135
135
|
const recordHistory = await contractors.services.getRecordHistory(recordId, context);
|
|
136
136
|
expect(recordHistory.status, 'Expected record history response status to equal 200.').to.equal(httpResponseStatusCodes.OK);
|
|
137
137
|
|
|
@@ -141,9 +141,21 @@ const getLatestRecordHistoryEventIdByItemTitle = async function(recordId, itemTi
|
|
|
141
141
|
throw new Error(`History event with title ${itemTitle} not found`);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
return latestHistoryByTitle;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const getLatestRecordHistoryEventIdByItemTitle = async function(recordId, itemTitle, context) {
|
|
148
|
+
const latestHistoryByTitle = await getLatestRecordHistoryEventByItemTitle(recordId, itemTitle, context);
|
|
149
|
+
|
|
144
150
|
return latestHistoryByTitle.itemId;
|
|
145
151
|
};
|
|
146
152
|
|
|
153
|
+
const getRecordHistoryItemById = async (recordId, itemId, context) => {
|
|
154
|
+
const recordHistory = await contractors.services.getRecordHistory(recordId, context);
|
|
155
|
+
|
|
156
|
+
return recordHistory.data.find(item => item.itemId === itemId);
|
|
157
|
+
};
|
|
158
|
+
|
|
147
159
|
const waitForOcrStatus = async function(recordId, context, { expectedStatus = ocrStatuses.SUCCESS } = {}) {
|
|
148
160
|
let { data: recordOcrStatus } = await contractors.services.getRecordOcrStatus(recordId, context);
|
|
149
161
|
let maxRetries = 25;
|
|
@@ -178,6 +190,23 @@ const generateSubscriptionModelFromMail = async function(recipients) {
|
|
|
178
190
|
return contractors.services.getSubscriptionModel(data);
|
|
179
191
|
};
|
|
180
192
|
|
|
193
|
+
const overrideGap = async (recordId, reason, note, policyName, attributeName, context) => {
|
|
194
|
+
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
195
|
+
const overrideModel = compliance.services.overrideGap.getWaiveModel(record, policyName, attributeName, reason, note);
|
|
196
|
+
return compliance.services.overrideGap.overrideGap({ waiveRequestModel: overrideModel, context });
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const retractOverriddenGap = async (recordId, policyName, attributeName, context) => {
|
|
200
|
+
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
201
|
+
const retractModel = compliance.services.overrideGap.getRetractModel(record, policyName, attributeName);
|
|
202
|
+
return compliance.services.overrideGap.retractOverride(retractModel, context);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const waiveAllGaps = async (recordId, context) => {
|
|
206
|
+
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
207
|
+
await compliance.services.overrideGap.waiveAll(record, context);
|
|
208
|
+
};
|
|
209
|
+
|
|
181
210
|
module.exports = {
|
|
182
211
|
makeRecordNotResponsive,
|
|
183
212
|
runOverAllRenewalDatesForRecord,
|
|
@@ -191,5 +220,10 @@ module.exports = {
|
|
|
191
220
|
waitForOcrStatus,
|
|
192
221
|
generateSubscriptionModelFromMail,
|
|
193
222
|
deleteAllRequestsInProject,
|
|
194
|
-
getLatestRecordHistoryEventIdByItemTitle
|
|
223
|
+
getLatestRecordHistoryEventIdByItemTitle,
|
|
224
|
+
getRecordHistoryItemById,
|
|
225
|
+
getLatestRecordHistoryEventByItemTitle,
|
|
226
|
+
waiveAllGaps,
|
|
227
|
+
overrideGap,
|
|
228
|
+
retractOverriddenGap
|
|
195
229
|
};
|
|
@@ -93,9 +93,9 @@ const prepareNotCompliantRecord = (recordCompany, recordEmail, tabId, requiremen
|
|
|
93
93
|
return prepareRecord(recordCompany, recordEmail, complianceStatuses.notCompliant, tabId, requirementId, context, { inviterEmail, shouldSendNotificationToPM, recordConfig, expiryStatus, glPolicyNumber });
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
const prepareWaivedRecord = async (recordCompany, recordEmail, tabId, requirementId, context, { recordConfig, expiryStatus, glPolicyNumber } = {}) => {
|
|
97
|
-
const recordId = await prepareRecord(recordCompany, recordEmail, complianceStatuses.notCompliant, tabId, requirementId, context, { recordConfig, expiryStatus, glPolicyNumber });
|
|
98
|
-
await waiveAllGaps(recordId, context);
|
|
96
|
+
const prepareWaivedRecord = async (recordCompany, recordEmail, tabId, requirementId, context, { inviterEmail, recordConfig, expiryStatus, glPolicyNumber } = {}) => {
|
|
97
|
+
const recordId = await prepareRecord(recordCompany, recordEmail, complianceStatuses.notCompliant, tabId, requirementId, context, { inviterEmail, recordConfig, expiryStatus, glPolicyNumber });
|
|
98
|
+
await recordFlows.waiveAllGaps(recordId, context);
|
|
99
99
|
return recordId;
|
|
100
100
|
};
|
|
101
101
|
|
|
@@ -145,11 +145,6 @@ const sendGaps = async (recordId, tabId, context) => {
|
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
-
const waiveAllGaps = async (recordId, context) => {
|
|
149
|
-
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
150
|
-
await compliance.services.overrideGap.waiveAll(record, context);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
148
|
const acceptAllGaps = async (recordId, context) => {
|
|
154
149
|
const { data: record } = await contractors.services.getContractorById(recordId, context);
|
|
155
150
|
await compliance.services.overrideGap.acceptAll(record, context);
|
|
@@ -172,6 +167,9 @@ const validateInsuranceAndExpiryStatus = async (insuranceStatus, expiryStatus) =
|
|
|
172
167
|
case complianceStatuses.underReview:
|
|
173
168
|
isValid = true;
|
|
174
169
|
break;
|
|
170
|
+
case complianceStatuses.noCoiRequire:
|
|
171
|
+
isValid = isWithoutExpiryStatus;
|
|
172
|
+
break;
|
|
175
173
|
default:
|
|
176
174
|
throw new Error(`Invalid insurance status: ${insuranceStatus}`);
|
|
177
175
|
}
|
|
@@ -8,6 +8,7 @@ const Endpoints = {
|
|
|
8
8
|
getContractorById: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
9
9
|
getRecordHistory: contractorId => `${backendUrl}/saas/record/${contractorId}/history`,
|
|
10
10
|
getRecordHistoryEventReport: recordHistoryId => `${backendUrl}/saas/record/compliance-history-report/${recordHistoryId}`,
|
|
11
|
+
getRecordHistoryOverrideEventGapData: recordHistoryId => `${backendUrl}/saas/record/gap/history/${recordHistoryId}/report`,
|
|
11
12
|
getRecordOcrStatus: contractorId => `${backendUrl}/saas/contractor/${contractorId}/ocr/status`,
|
|
12
13
|
delete: contractorId => `${backendUrl}/saas/contractor/${contractorId}`,
|
|
13
14
|
archive: contractorId => `${backendUrl}/saas/contractor/${contractorId}/archive`,
|
|
@@ -53,6 +54,10 @@ const getRecordHistoryEventReport = (recordHistoryId, context) => {
|
|
|
53
54
|
return requests.getRequestHandler(Endpoints.getRecordHistoryEventReport(recordHistoryId), {}, context);
|
|
54
55
|
};
|
|
55
56
|
|
|
57
|
+
const getRecordHistoryOverrideEventGapData = (recordHistoryId, context) => {
|
|
58
|
+
return requests.getRequestHandler(Endpoints.getRecordHistoryOverrideEventGapData(recordHistoryId), {}, context);
|
|
59
|
+
};
|
|
60
|
+
|
|
56
61
|
const getComplianceReport = (encryptedData, context) => {
|
|
57
62
|
return requests.getRequestHandler(Endpoints.getComplianceReport(encryptedData), {}, context);
|
|
58
63
|
};
|
|
@@ -176,6 +181,7 @@ module.exports = {
|
|
|
176
181
|
getContractorById,
|
|
177
182
|
getRecordHistory,
|
|
178
183
|
getRecordHistoryEventReport,
|
|
184
|
+
getRecordHistoryOverrideEventGapData,
|
|
179
185
|
getRecordOcrStatus,
|
|
180
186
|
getComplianceReport,
|
|
181
187
|
deleteByContractorId,
|
|
@@ -39,6 +39,18 @@ const getRecordHistoryEventReport = async (recordHistoryId, context, { expectErr
|
|
|
39
39
|
return historyEventReportResponse.data;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
const getRecordHistoryOverrideEventGapData = async (recordHistoryId, context, { expectError } = {}) => {
|
|
43
|
+
const gapDataResponse = await contractorsAPI.getRecordHistoryOverrideEventGapData(recordHistoryId, context);
|
|
44
|
+
|
|
45
|
+
if (expectError) {
|
|
46
|
+
return gapDataResponse;
|
|
47
|
+
} else if (gapDataResponse.status !== httpResponseStatusCodes.OK) {
|
|
48
|
+
throw new Error(`Failed to get record history event gap data: ${gapDataResponse.statusText}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return gapDataResponse.data;
|
|
52
|
+
};
|
|
53
|
+
|
|
42
54
|
const getRecordOcrStatus = (recordId, context) => {
|
|
43
55
|
return contractorsAPI.getRecordOcrStatus(recordId, context);
|
|
44
56
|
};
|
|
@@ -302,6 +314,7 @@ module.exports = {
|
|
|
302
314
|
getContractorById,
|
|
303
315
|
getRecordHistory,
|
|
304
316
|
getRecordHistoryEventReport,
|
|
317
|
+
getRecordHistoryOverrideEventGapData,
|
|
305
318
|
getRecordOcrStatus,
|
|
306
319
|
getComplianceReport,
|
|
307
320
|
archiveRecord,
|