@getjones/test-infra 4.4.4 → 4.4.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getjones/test-infra",
3
- "version": "4.4.4",
3
+ "version": "4.4.6",
4
4
  "description": "Providing internal and openapi interface",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -6,5 +6,9 @@ module.exports = {
6
6
  isAccountRequirementsEnabled: {
7
7
  on: { isAccountRequirementsEnabled: true },
8
8
  off: { isAccountRequirementsEnabled: false }
9
+ },
10
+ isPolicyVerificationEnabled: {
11
+ on: { hasPolicyVerification: true },
12
+ off: { hasPolicyVerification: false }
9
13
  }
10
14
  };
@@ -54,5 +54,6 @@ const attributesConvertor = {
54
54
  'Exclude account records from the Jones Network': 'isExcludedFromNetwork',
55
55
  'OCR Audit Enabled': 'isOcrEnabled',
56
56
  'Coverage Auditing': 'isCoverageAudit',
57
- 'Account Requirements': 'isAccountRequirementsEnabled'
57
+ 'Account Requirements': 'isAccountRequirementsEnabled',
58
+ 'Skip 50 miles autocomplete limitation': 'isWithoutAutocompleteDistanceLimitation'
58
59
  };
@@ -4,6 +4,8 @@ const { backendUrl } = require('../../../../env').getEnv();
4
4
  const Endpoints = {
5
5
  getRelatedDocPreSignedUrl: `${backendUrl}/saas/pre-signed-url/upload/document`,
6
6
  getCreatePolicyPreSignedUrl: `${backendUrl}/saas/pre-signed-url/upload/policy`,
7
+ getPolicyFilesForVendorReport: requestId => `${backendUrl}/saas/request/${requestId}/policy-files`,
8
+ createPolicyFiles: requestId => `${backendUrl}/saas/request/${requestId}/policy-files/create`,
7
9
  uploadRelatedDoc: recordId => `${backendUrl}/saas/contractor/${recordId}/document`,
8
10
  fileUpload: `${backendUrl}/file/finalize-upload`
9
11
  };
@@ -16,6 +18,14 @@ const getCreatePolicyPreSignedUrl = (formData, context) => {
16
18
  return requests.postRequestHandler(Endpoints.getCreatePolicyPreSignedUrl, formData, context, formData.getHeaders());
17
19
  };
18
20
 
21
+ const getPolicyFilesForVendorReport = (requestId, context) => {
22
+ return requests.getRequestHandler(Endpoints.getPolicyFilesForVendorReport(requestId), {}, context);
23
+ };
24
+
25
+ const createPolicyFiles = (requestId, policyFileList, context) => {
26
+ return requests.postRequestHandler(Endpoints.createPolicyFiles(requestId), policyFileList , context);
27
+ };
28
+
19
29
  const uploadFileToS3 = (preSignedUrl, file) => {
20
30
  return requests.putRequestHandler(preSignedUrl, file);
21
31
  };
@@ -33,5 +43,7 @@ module.exports = {
33
43
  getCreatePolicyPreSignedUrl,
34
44
  uploadRelatedDoc,
35
45
  uploadFileToS3,
36
- uploadFile
46
+ uploadFile,
47
+ getPolicyFilesForVendorReport,
48
+ createPolicyFiles
37
49
  };
@@ -13,7 +13,7 @@ const getRelatedDocPreSignedUrl = (recordId, context, { filePath }) => {
13
13
  const fileName = path.basename(filePath);
14
14
  formData.append('recordId', recordId);
15
15
  formData.append('fileType', TEMP_DOCUMENTS);
16
- formData.append('fileName', fileName) ;
16
+ formData.append('fileName', fileName);
17
17
 
18
18
  return uploadFileApi.getRelatedDocPreSignedUrl(formData, context);
19
19
  };
@@ -57,8 +57,30 @@ const uploadFile = (recordId, type, fileName) => {
57
57
  return uploadFileApi.uploadFile(formData);
58
58
  };
59
59
 
60
+ const createPolicyFiles = async (requestId, policyFileList, context, { shouldExpectError } = {}) => {
61
+ const createPolicyFilesResponse = await uploadFileApi.createPolicyFiles(requestId, policyFileList, context);
62
+
63
+ if (createPolicyFilesResponse.status !== httpResponseStatusCodes.OK && !shouldExpectError) {
64
+ throw new Error('Failed to create policy files');
65
+ }
66
+
67
+ return createPolicyFilesResponse;
68
+ };
69
+
70
+ const getPolicyFilesForVendorReport = async (requestId, context, { shouldExpectError } = {}) => {
71
+ const policyPreSignedUrlResponse = await uploadFileApi.getPolicyFilesForVendorReport(requestId, context);
72
+
73
+ if (policyPreSignedUrlResponse.status !== httpResponseStatusCodes.OK && !shouldExpectError) {
74
+ throw new Error('Failed to get policy files for PM');
75
+ }
76
+
77
+ return policyPreSignedUrlResponse;
78
+ };
79
+
60
80
  module.exports = {
61
81
  getCreatePolicyPreSignedUrl,
62
82
  uploadRelatedDoc,
63
- uploadFileToS3
83
+ uploadFileToS3,
84
+ createPolicyFiles,
85
+ getPolicyFilesForVendorReport
64
86
  };
@@ -1,3 +1,9 @@
1
1
  const services = require('./api/upload.file.service');
2
2
 
3
- module.exports = { services };
3
+ const { CreatePolicyFileModel } = require('./models/create.policy.file.model');
4
+
5
+ const models = {
6
+ CreatePolicyFileModel
7
+ };
8
+
9
+ module.exports = { services, models };
@@ -0,0 +1,11 @@
1
+ class CreatePolicyFileModel {
2
+ constructor(
3
+ policyFileName,
4
+ policyType
5
+ ) {
6
+ this.policyFileName = policyFileName;
7
+ this.policyType = policyType;
8
+ }
9
+ }
10
+
11
+ module.exports = { CreatePolicyFileModel };
@@ -8,7 +8,8 @@ const Endpoints = {
8
8
  editUserProfile: `${backendUrl}/saas/user/update`,
9
9
  getByProjectId: projectId =>
10
10
  `${backendUrl}/saas/project/${projectId}/team-members`,
11
- getByEmail: email => `${backendUrl}/saas/team-member/by-email/${email}`,
11
+ getByEmail: email => `${backendUrl}/saas/integration-tests/user/by-email/${email}`,
12
+ getTeamMemberByEmail: (email, accountId) => `${backendUrl}/saas/team-member/account/${accountId}/email/${email}`,
12
13
  getEnabledAndDisabledByEmail: email => `${backendUrl}/saas/user/automation/email/${email}`,
13
14
  delete: userId => `${backendUrl}/saas/users/${userId}`,
14
15
  getUserListByRecordId: recordId => `${backendUrl}/saas/users/record/${recordId}`,
@@ -48,6 +49,10 @@ const getUserByEmail = (email, context) => {
48
49
  return requests.getRequestHandler(Endpoints.getByEmail(email), null, context);
49
50
  };
50
51
 
52
+ const getTeamMemberByEmail = (email, accountId, context) => {
53
+ return requests.getRequestHandler(Endpoints.getTeamMemberByEmail(email, accountId), null, context);
54
+ };
55
+
51
56
  const getEnabledAndDisabledByEmail = (email, context) => {
52
57
  return requests.getRequestHandler(Endpoints.getEnabledAndDisabledByEmail(email), null, context);
53
58
  };
@@ -105,6 +110,7 @@ module.exports = {
105
110
  getUsersByProjectId,
106
111
  getEnabledAndDisabledByEmail,
107
112
  getUserByEmail,
113
+ getTeamMemberByEmail,
108
114
  getUserEncryptedData,
109
115
  getUserListByRecordId,
110
116
  deleteUser,
@@ -36,6 +36,16 @@ const getUserByEmail = async (email, context) => {
36
36
  return userAPI.getUserByEmail(email, context);
37
37
  };
38
38
 
39
+ const getTeamMemberByEmail = async (email, accountId, context) => {
40
+ const response = await userAPI.getTeamMemberByEmail(email, accountId, context);
41
+
42
+ if (response.status !== httpResponseStatusCodes.OK) {
43
+ throw new Error(`Failed to get user by email ${email}`);
44
+ }
45
+
46
+ return response.data;
47
+ };
48
+
39
49
  const getEnabledAndDisabledByEmail = async (email, context) => {
40
50
  const response = await userAPI.getEnabledAndDisabledByEmail(email, context);
41
51
 
@@ -193,6 +203,7 @@ const getUserListByRecordId = async (recordId, context, { searchTerm } = {}) =>
193
203
  module.exports = {
194
204
  inviteUser,
195
205
  signupUser,
206
+ getTeamMemberByEmail,
196
207
  getUsersByProjectId,
197
208
  getUserByEmail,
198
209
  getEnabledAndDisabledByEmail,