@lendi/integrations-transform 1.4.8 → 1.5.1
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/lib/index.js +1 -5
- package/lib/schemas/public-application-event.json +6 -0
- package/lib/schemas/public-required-document-event.json +269 -1
- package/lib/transform-events/generate-required-document.d.ts +48 -5
- package/lib/transform-events/generate-required-document.js +108 -39
- package/lib/transform-events/transform-application.js +16 -10
- package/lib/transform-events/transform-funding-position.d.ts +2 -1
- package/lib/transform-events/transform-funding-position.js +4 -2
- package/lib/types/enum-mappings/index.js +1 -5
- package/lib/types/enum-mappings/verification.d.ts +7 -0
- package/lib/types/enum-mappings/verification.js +14 -0
- package/lib/types/events/public-application.d.ts +1 -0
- package/lib/types/events/public-required-document.d.ts +275 -0
- package/lib/types/events/public-required-document.js +254 -1
- package/lib/utils/formatYesNo.d.ts +9 -0
- package/lib/utils/formatYesNo.js +13 -0
- package/lib/utils/iso-date.d.ts +8 -0
- package/lib/utils/iso-date.js +13 -0
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
|
@@ -119,6 +119,9 @@
|
|
|
119
119
|
"description": "Indication that this application carries high customer intent",
|
|
120
120
|
"type": "boolean"
|
|
121
121
|
},
|
|
122
|
+
"hasOptedInRateLock": {
|
|
123
|
+
"type": "boolean"
|
|
124
|
+
},
|
|
122
125
|
"payload": {
|
|
123
126
|
"type": "object",
|
|
124
127
|
"additionalProperties": false,
|
|
@@ -147,6 +150,9 @@
|
|
|
147
150
|
"brand": {
|
|
148
151
|
"enum": ["lendi", "domain", "domain variation", "lendi variation"]
|
|
149
152
|
},
|
|
153
|
+
"hasOptedInRateLock": {
|
|
154
|
+
"$ref": "#/definitions/hasOptedInRateLock"
|
|
155
|
+
},
|
|
150
156
|
"preliminary": {
|
|
151
157
|
"type": "object",
|
|
152
158
|
"additionalProperties": false,
|
|
@@ -39,9 +39,14 @@
|
|
|
39
39
|
"description": "Application ID",
|
|
40
40
|
"type": "string"
|
|
41
41
|
},
|
|
42
|
+
"expiryDate": {
|
|
43
|
+
"description": "Expiry Date (can be null if no expiry date set)",
|
|
44
|
+
"type": ["string", "null"],
|
|
45
|
+
"format": "date"
|
|
46
|
+
},
|
|
42
47
|
"status": {
|
|
43
48
|
"description": "Status",
|
|
44
|
-
"type": "string",
|
|
49
|
+
"type": ["string"],
|
|
45
50
|
"enum": [
|
|
46
51
|
"pending_upload",
|
|
47
52
|
"pending_verification",
|
|
@@ -87,6 +92,269 @@
|
|
|
87
92
|
"description": "ID Title (can be null if migrated from SF as they do not have this field)",
|
|
88
93
|
"type": ["string", "null"],
|
|
89
94
|
"enum": ["DR", "MISS", "MR", "MRS", "MS", "OTHER", "UNKNOWN", null]
|
|
95
|
+
},
|
|
96
|
+
"idFirstName": {
|
|
97
|
+
"description": "ID First Name",
|
|
98
|
+
"type": "string"
|
|
99
|
+
},
|
|
100
|
+
"idMiddleName": {
|
|
101
|
+
"description": "ID Middle Name (can be null as it is an optional field)",
|
|
102
|
+
"type": ["string", "null"]
|
|
103
|
+
},
|
|
104
|
+
"idLastName": {
|
|
105
|
+
"description": "ID Last Name",
|
|
106
|
+
"type": "string"
|
|
107
|
+
},
|
|
108
|
+
"australianState": {
|
|
109
|
+
"description": "Australian State (can be null as it is an optional field)",
|
|
110
|
+
"type": ["string", "null"],
|
|
111
|
+
"enum": ["NSW", "QLD", "VIC", "ACT", "WA", "SA", "NT", "TAS", null]
|
|
112
|
+
},
|
|
113
|
+
"issuingCountry": {
|
|
114
|
+
"description": "Issuing Country (can be null as it is an optional field)",
|
|
115
|
+
"type": ["string", "null"],
|
|
116
|
+
"enum": [
|
|
117
|
+
"Afghanistan",
|
|
118
|
+
"Albania",
|
|
119
|
+
"Algeria",
|
|
120
|
+
"American Samoa",
|
|
121
|
+
"Andorra",
|
|
122
|
+
"Angola",
|
|
123
|
+
"Anguilla",
|
|
124
|
+
"Antarctica",
|
|
125
|
+
"Antigua And Barbuda",
|
|
126
|
+
"Argentina",
|
|
127
|
+
"Armenia",
|
|
128
|
+
"Aruba",
|
|
129
|
+
"Australia",
|
|
130
|
+
"Austria",
|
|
131
|
+
"Azerbaijan",
|
|
132
|
+
"Bahamas",
|
|
133
|
+
"Bahrain",
|
|
134
|
+
"Bangladesh",
|
|
135
|
+
"Barbados",
|
|
136
|
+
"Belarus",
|
|
137
|
+
"Belgium",
|
|
138
|
+
"Belize",
|
|
139
|
+
"Benin",
|
|
140
|
+
"Bermuda",
|
|
141
|
+
"Bhutan",
|
|
142
|
+
"Bolivia",
|
|
143
|
+
"Bosnia And Herzegovina",
|
|
144
|
+
"Botswana",
|
|
145
|
+
"Bouvet Island",
|
|
146
|
+
"Brazil",
|
|
147
|
+
"British Indian Ocean Territory",
|
|
148
|
+
"Brunei Darussalam",
|
|
149
|
+
"Bulgaria",
|
|
150
|
+
"Burkina Faso",
|
|
151
|
+
"Burundi",
|
|
152
|
+
"Cambodia",
|
|
153
|
+
"Cameroon",
|
|
154
|
+
"Canada",
|
|
155
|
+
"Cape Verde",
|
|
156
|
+
"Cayman Islands",
|
|
157
|
+
"Central African Republic",
|
|
158
|
+
"Chad",
|
|
159
|
+
"Chile",
|
|
160
|
+
"China",
|
|
161
|
+
"Christmas Island",
|
|
162
|
+
"Cocos (Keeling) Islands",
|
|
163
|
+
"Colombia",
|
|
164
|
+
"Comoros",
|
|
165
|
+
"Democratic People's Republic of Korea",
|
|
166
|
+
"Democratic Republic Of The Congo",
|
|
167
|
+
"Cook Islands",
|
|
168
|
+
"Costa Rica",
|
|
169
|
+
"Cote D'ivoire",
|
|
170
|
+
"Croatia",
|
|
171
|
+
"Cuba",
|
|
172
|
+
"Cyprus",
|
|
173
|
+
"Czech Republic",
|
|
174
|
+
"Denmark",
|
|
175
|
+
"Djibouti",
|
|
176
|
+
"Dominica",
|
|
177
|
+
"Dominican Republic",
|
|
178
|
+
"East Timor",
|
|
179
|
+
"Ecuador",
|
|
180
|
+
"Egypt",
|
|
181
|
+
"El Salvador",
|
|
182
|
+
"Equatorial Guinea",
|
|
183
|
+
"Eritrea",
|
|
184
|
+
"Estonia",
|
|
185
|
+
"Ethiopia",
|
|
186
|
+
"Falkland Islands",
|
|
187
|
+
"Faroe Islands",
|
|
188
|
+
"Fiji",
|
|
189
|
+
"Finland",
|
|
190
|
+
"France",
|
|
191
|
+
"French Guiana",
|
|
192
|
+
"French Polynesia",
|
|
193
|
+
"French Southern Territories",
|
|
194
|
+
"Gabon",
|
|
195
|
+
"Gambia",
|
|
196
|
+
"Georgia",
|
|
197
|
+
"Germany",
|
|
198
|
+
"Ghana",
|
|
199
|
+
"Gibraltar",
|
|
200
|
+
"Greece",
|
|
201
|
+
"Greenland",
|
|
202
|
+
"Grenada",
|
|
203
|
+
"Guadeloupe",
|
|
204
|
+
"Guam",
|
|
205
|
+
"Guatemala",
|
|
206
|
+
"Guinea",
|
|
207
|
+
"Guinea-bissau",
|
|
208
|
+
"Guyana",
|
|
209
|
+
"Haiti",
|
|
210
|
+
"Heard Island And Mcdonald Islands",
|
|
211
|
+
"Holy See (Vatican City State)",
|
|
212
|
+
"Honduras",
|
|
213
|
+
"Hong Kong",
|
|
214
|
+
"Hungary",
|
|
215
|
+
"Iceland",
|
|
216
|
+
"India",
|
|
217
|
+
"Indonesia",
|
|
218
|
+
"Iran",
|
|
219
|
+
"Iraq",
|
|
220
|
+
"Ireland",
|
|
221
|
+
"Israel",
|
|
222
|
+
"Italy",
|
|
223
|
+
"Jamaica",
|
|
224
|
+
"Japan",
|
|
225
|
+
"Jordan",
|
|
226
|
+
"Kazakstan",
|
|
227
|
+
"Kenya",
|
|
228
|
+
"Kiribati",
|
|
229
|
+
"Kosovo",
|
|
230
|
+
"Kuwait",
|
|
231
|
+
"Kyrgyzstan",
|
|
232
|
+
"Laos",
|
|
233
|
+
"Latvia",
|
|
234
|
+
"Lebanon",
|
|
235
|
+
"Lesotho",
|
|
236
|
+
"Liberia",
|
|
237
|
+
"Libyan Arab Jamahiriya",
|
|
238
|
+
"Liechtenstein",
|
|
239
|
+
"Lithuania",
|
|
240
|
+
"Luxembourg",
|
|
241
|
+
"Macau",
|
|
242
|
+
"Macedonia",
|
|
243
|
+
"Madagascar",
|
|
244
|
+
"Malawi",
|
|
245
|
+
"Malaysia",
|
|
246
|
+
"Maldives",
|
|
247
|
+
"Mali",
|
|
248
|
+
"Malta",
|
|
249
|
+
"Marshall Islands",
|
|
250
|
+
"Martinique",
|
|
251
|
+
"Mauritania",
|
|
252
|
+
"Mauritius",
|
|
253
|
+
"Mayotte",
|
|
254
|
+
"Mexico",
|
|
255
|
+
"Federated States Of Micronesia",
|
|
256
|
+
"Republic Of Moldova",
|
|
257
|
+
"Monaco",
|
|
258
|
+
"Mongolia",
|
|
259
|
+
"Montserrat",
|
|
260
|
+
"Montenegro",
|
|
261
|
+
"Morocco",
|
|
262
|
+
"Mozambique",
|
|
263
|
+
"Myanmar",
|
|
264
|
+
"Namibia",
|
|
265
|
+
"Nauru",
|
|
266
|
+
"Nepal",
|
|
267
|
+
"Netherlands",
|
|
268
|
+
"Netherlands Antilles",
|
|
269
|
+
"New Caledonia",
|
|
270
|
+
"New Zealand",
|
|
271
|
+
"Nicaragua",
|
|
272
|
+
"Niger",
|
|
273
|
+
"Nigeria",
|
|
274
|
+
"Niue",
|
|
275
|
+
"Norfolk Island",
|
|
276
|
+
"Northern Mariana Islands",
|
|
277
|
+
"Norway",
|
|
278
|
+
"Oman",
|
|
279
|
+
"Pakistan",
|
|
280
|
+
"Palau",
|
|
281
|
+
"Palestinian Territory",
|
|
282
|
+
"Panama",
|
|
283
|
+
"Papua New Guinea",
|
|
284
|
+
"Paraguay",
|
|
285
|
+
"Peru",
|
|
286
|
+
"Philippines",
|
|
287
|
+
"Pitcairn",
|
|
288
|
+
"Poland",
|
|
289
|
+
"Portugal",
|
|
290
|
+
"Puerto Rico",
|
|
291
|
+
"Qatar",
|
|
292
|
+
"Romania",
|
|
293
|
+
"Russian Federation",
|
|
294
|
+
"Rwanda",
|
|
295
|
+
"Saint Helena",
|
|
296
|
+
"Saint Kitts And Nevis",
|
|
297
|
+
"Saint Lucia",
|
|
298
|
+
"Saint Pierre And Miquelon",
|
|
299
|
+
"Saint Vincent And The Grenadines",
|
|
300
|
+
"Samoa",
|
|
301
|
+
"San Marino",
|
|
302
|
+
"Sao Tome And Principe",
|
|
303
|
+
"Saudi Arabia",
|
|
304
|
+
"Senegal",
|
|
305
|
+
"Serbia",
|
|
306
|
+
"Seychelles",
|
|
307
|
+
"Sierra Leone",
|
|
308
|
+
"Singapore",
|
|
309
|
+
"Slovakia",
|
|
310
|
+
"Slovenia",
|
|
311
|
+
"Solomon Islands",
|
|
312
|
+
"Somalia",
|
|
313
|
+
"South Africa",
|
|
314
|
+
"South Georgia And The South Sandwich Islands",
|
|
315
|
+
"The Republic of South Korea",
|
|
316
|
+
"Spain",
|
|
317
|
+
"Sri Lanka",
|
|
318
|
+
"Sudan",
|
|
319
|
+
"Suriname",
|
|
320
|
+
"Svalbard And Jan Mayen",
|
|
321
|
+
"Swaziland",
|
|
322
|
+
"Sweden",
|
|
323
|
+
"Switzerland",
|
|
324
|
+
"Syrian Arab Republic",
|
|
325
|
+
"Taiwan",
|
|
326
|
+
"Tajikistan",
|
|
327
|
+
"Tanzania",
|
|
328
|
+
"Thailand",
|
|
329
|
+
"Togo",
|
|
330
|
+
"Tokelau",
|
|
331
|
+
"Tonga",
|
|
332
|
+
"Trinidad And Tobago",
|
|
333
|
+
"Tunisia",
|
|
334
|
+
"Turkey",
|
|
335
|
+
"Turkmenistan",
|
|
336
|
+
"Turks And Caicos Islands",
|
|
337
|
+
"Tuvalu",
|
|
338
|
+
"Uganda",
|
|
339
|
+
"Ukraine",
|
|
340
|
+
"United Arab Emirates",
|
|
341
|
+
"United Kingdom",
|
|
342
|
+
"United States of America",
|
|
343
|
+
"United States Minor Outlying Islands",
|
|
344
|
+
"Uruguay",
|
|
345
|
+
"Uzbekistan",
|
|
346
|
+
"Vanuatu",
|
|
347
|
+
"Venezuela",
|
|
348
|
+
"Vietnam",
|
|
349
|
+
"British Virgin Islands",
|
|
350
|
+
"US Virgin Islands",
|
|
351
|
+
"Wallis And Futuna",
|
|
352
|
+
"Western Sahara",
|
|
353
|
+
"Yemen",
|
|
354
|
+
"Zambia",
|
|
355
|
+
"Zimbabwe",
|
|
356
|
+
null
|
|
357
|
+
]
|
|
90
358
|
}
|
|
91
359
|
},
|
|
92
360
|
"required": ["idNumber", "idType"]
|
|
@@ -1,8 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PersonApplicantPrivacy } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
|
|
2
|
+
import { ProofOfIdentity } from '@lendi/integrations-protocol/lib/types/lixi-internal-request';
|
|
3
|
+
import { EConsent, Identification, Payload as RequiredDocumentPayload } from '../types/events/public-required-document';
|
|
2
4
|
/**
|
|
3
|
-
*
|
|
5
|
+
* Gets the applicant gender from the identification data
|
|
4
6
|
*
|
|
5
|
-
* @param
|
|
6
|
-
*
|
|
7
|
+
* @param identification Identification data
|
|
8
|
+
*
|
|
9
|
+
* @returns The gender of the applicant
|
|
10
|
+
*/
|
|
11
|
+
export declare const getApplicantGenderFromIdentification: (identification: Identification) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Gets full name on document from the identification data
|
|
14
|
+
*
|
|
15
|
+
* @param identification Identification data
|
|
16
|
+
*
|
|
17
|
+
* @returns The full name on document
|
|
18
|
+
*/
|
|
19
|
+
export declare const getNameOnDocument: (identification: Identification) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Transforms identification data into a partial proof of identity document
|
|
22
|
+
*
|
|
23
|
+
* @param identification Identification data
|
|
24
|
+
*
|
|
25
|
+
* @returns Partial proof of identity object
|
|
26
|
+
*/
|
|
27
|
+
export declare const transformIdentification: (identification: Identification) => Partial<ProofOfIdentity>;
|
|
28
|
+
/**
|
|
29
|
+
* Generates partial details for document used to verify identity
|
|
30
|
+
*
|
|
31
|
+
* @param requiredDocument RequiredDocumentCreated/RequiredDocumentUpdated event payload
|
|
32
|
+
*
|
|
33
|
+
* @returns Partial proof of identity document object
|
|
34
|
+
*/
|
|
35
|
+
export declare const generateProofOfIdentity: (requiredDocument: RequiredDocumentPayload) => Partial<ProofOfIdentity>;
|
|
36
|
+
/**
|
|
37
|
+
* Generates an applicants disclosure details mapping for the partial application
|
|
38
|
+
*
|
|
39
|
+
* @param eConsent E-Consent detials from the RequiredDocumentCreated/RequqiredDocumentUpdated event payload
|
|
40
|
+
*
|
|
41
|
+
* @returns Applicant disclosure details for partial application
|
|
42
|
+
*/
|
|
43
|
+
export declare const generatePersonApplicantPrivacy: (eConsent: EConsent) => PersonApplicantPrivacy;
|
|
44
|
+
/**
|
|
45
|
+
* Transforms a RequiredDocumentCreated or RequiredDocumentUpdated event payload into a partial application
|
|
46
|
+
*
|
|
47
|
+
* @param requiredDocument A RequiredDocumentCreated or RequiredDocumentUpdated event payload
|
|
48
|
+
*
|
|
49
|
+
* @return A partial application
|
|
7
50
|
*/
|
|
8
|
-
export declare function
|
|
51
|
+
export declare function transformRequiredDocument(requiredDocument: RequiredDocumentPayload): {};
|
|
@@ -1,54 +1,123 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
exports.__esModule = true;
|
|
3
|
-
exports.
|
|
14
|
+
exports.transformRequiredDocument = exports.generatePersonApplicantPrivacy = exports.generateProofOfIdentity = exports.transformIdentification = exports.getNameOnDocument = exports.getApplicantGenderFromIdentification = void 0;
|
|
4
15
|
var lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
|
|
5
16
|
var application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
|
|
6
|
-
var date_fns_1 = require("date-fns");
|
|
7
17
|
var lodash_1 = require("lodash");
|
|
18
|
+
var enum_mappings_1 = require("../types/enum-mappings");
|
|
8
19
|
var proof_of_identity_1 = require("../types/enum-mappings/proof-of-identity");
|
|
9
20
|
var title_gender_1 = require("../types/enum-mappings/title-gender");
|
|
21
|
+
var verification_1 = require("../types/enum-mappings/verification");
|
|
10
22
|
var public_required_document_1 = require("../types/events/public-required-document");
|
|
23
|
+
var formatYesNo_1 = require("../utils/formatYesNo");
|
|
24
|
+
var iso_date_1 = require("../utils/iso-date");
|
|
11
25
|
/**
|
|
12
|
-
*
|
|
26
|
+
* Gets the applicant gender from the identification data
|
|
13
27
|
*
|
|
14
|
-
* @param
|
|
15
|
-
*
|
|
28
|
+
* @param identification Identification data
|
|
29
|
+
*
|
|
30
|
+
* @returns The gender of the applicant
|
|
16
31
|
*/
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
else {
|
|
37
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.PersonApplicant, ".@Gender"), title_gender_1.titleGenderMapping[idTitle]);
|
|
38
|
-
}
|
|
39
|
-
break;
|
|
40
|
-
case 'eConsent':
|
|
41
|
-
var _e = requiredDocument.eConsent.consentedAt, consentedAt = _e === void 0 ? new Date() : _e;
|
|
42
|
-
var hasValidConsent = requiredDocument.status === public_required_document_1.Status.Verified ? lixi_internal_request_1.YesNoList.Yes : lixi_internal_request_1.YesNoList.No;
|
|
43
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Privacy, ".@CreditAuthoritySigned"), hasValidConsent);
|
|
44
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Privacy, ".@DateSigned"), (0, date_fns_1.format)(new Date(consentedAt), 'yyyy-MM-dd'));
|
|
45
|
-
break;
|
|
46
|
-
default:
|
|
47
|
-
(0, lodash_1.set)(partialApplication, requiredDocsMapping[key], value);
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
32
|
+
var getApplicantGenderFromIdentification = function (identification) {
|
|
33
|
+
var gender = identification.gender, idTitle = identification.idTitle;
|
|
34
|
+
return gender ? (0, lodash_1.capitalize)(gender) : title_gender_1.titleGenderMapping[idTitle || public_required_document_1.IDTitle.Unknown];
|
|
35
|
+
};
|
|
36
|
+
exports.getApplicantGenderFromIdentification = getApplicantGenderFromIdentification;
|
|
37
|
+
/**
|
|
38
|
+
* Gets full name on document from the identification data
|
|
39
|
+
*
|
|
40
|
+
* @param identification Identification data
|
|
41
|
+
*
|
|
42
|
+
* @returns The full name on document
|
|
43
|
+
*/
|
|
44
|
+
var getNameOnDocument = function (identification) {
|
|
45
|
+
var idFirstName = identification.idFirstName, idMiddleName = identification.idMiddleName, idLastName = identification.idLastName;
|
|
46
|
+
return [idFirstName, idMiddleName, idLastName].reduce(function (fullName, nameComponent) {
|
|
47
|
+
var newFullName = fullName;
|
|
48
|
+
var nameSubstring = nameComponent === null || nameComponent === void 0 ? void 0 : nameComponent.trim();
|
|
49
|
+
if (nameSubstring) {
|
|
50
|
+
newFullName += "".concat(fullName ? ' ' : '').concat(nameSubstring);
|
|
50
51
|
}
|
|
52
|
+
return newFullName;
|
|
53
|
+
}, '');
|
|
54
|
+
};
|
|
55
|
+
exports.getNameOnDocument = getNameOnDocument;
|
|
56
|
+
/**
|
|
57
|
+
* Transforms identification data into a partial proof of identity document
|
|
58
|
+
*
|
|
59
|
+
* @param identification Identification data
|
|
60
|
+
*
|
|
61
|
+
* @returns Partial proof of identity object
|
|
62
|
+
*/
|
|
63
|
+
var transformIdentification = function (identification) {
|
|
64
|
+
var australianState = identification.australianState, idNumber = identification.idNumber, idType = identification.idType, _a = identification.issuingCountry, issuingCountry = _a === void 0 ? public_required_document_1.IssuingCountry.Australia : _a;
|
|
65
|
+
var nameOnDocument = (0, exports.getNameOnDocument)(identification);
|
|
66
|
+
return __assign(__assign(__assign(__assign({}, (nameOnDocument && { '@NameOnDocument': nameOnDocument })), (idNumber && { '@DocumentNumber': idNumber })), (australianState && { '@PlaceOfIssue': australianState })), (idType === public_required_document_1.IDType.Passport && issuingCountry !== public_required_document_1.IssuingCountry.Australia
|
|
67
|
+
? {
|
|
68
|
+
'@DocumentType': lixi_internal_request_1.DocumentTypeList.InternationalPassport,
|
|
69
|
+
'@CountryOfIssue': enum_mappings_1.countryCodeMapping[issuingCountry],
|
|
70
|
+
'@PlaceOfIssue': enum_mappings_1.countryCodeMapping[issuingCountry]
|
|
71
|
+
}
|
|
72
|
+
: { '@DocumentType': proof_of_identity_1.proofOfIdentityMapping[idType] }));
|
|
73
|
+
};
|
|
74
|
+
exports.transformIdentification = transformIdentification;
|
|
75
|
+
/**
|
|
76
|
+
* Generates partial details for document used to verify identity
|
|
77
|
+
*
|
|
78
|
+
* @param requiredDocument RequiredDocumentCreated/RequiredDocumentUpdated event payload
|
|
79
|
+
*
|
|
80
|
+
* @returns Partial proof of identity document object
|
|
81
|
+
*/
|
|
82
|
+
var generateProofOfIdentity = function (requiredDocument) {
|
|
83
|
+
var id = requiredDocument.id, status = requiredDocument.status, expiryDate = requiredDocument.expiryDate, identification = requiredDocument.identification;
|
|
84
|
+
return __assign(__assign(__assign({ '@UniqueID': id, '@CountryOfIssue': lixi_internal_request_1.CountryCodeList.Au, '@PlaceOfIssue': lixi_internal_request_1.CountryCodeList.Au }, (expiryDate && { '@ExpiryDate': (0, iso_date_1.isoDate)(expiryDate) })), (status && { '@PhotographVerified': verification_1.verificationMapping[status] })), (identification && (0, exports.transformIdentification)(identification)));
|
|
85
|
+
};
|
|
86
|
+
exports.generateProofOfIdentity = generateProofOfIdentity;
|
|
87
|
+
/**
|
|
88
|
+
* Generates an applicants disclosure details mapping for the partial application
|
|
89
|
+
*
|
|
90
|
+
* @param eConsent E-Consent detials from the RequiredDocumentCreated/RequqiredDocumentUpdated event payload
|
|
91
|
+
*
|
|
92
|
+
* @returns Applicant disclosure details for partial application
|
|
93
|
+
*/
|
|
94
|
+
var generatePersonApplicantPrivacy = function (eConsent) {
|
|
95
|
+
var hasConsented = eConsent.hasConsented, _a = eConsent.consentedAt, consentedAt = _a === void 0 ? new Date() : _a;
|
|
96
|
+
return {
|
|
97
|
+
'@CreditAuthoritySigned': (0, formatYesNo_1.formatYesNo)(hasConsented),
|
|
98
|
+
'@DateSigned': (0, iso_date_1.isoDate)(consentedAt)
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
exports.generatePersonApplicantPrivacy = generatePersonApplicantPrivacy;
|
|
102
|
+
/**
|
|
103
|
+
* Transforms a RequiredDocumentCreated or RequiredDocumentUpdated event payload into a partial application
|
|
104
|
+
*
|
|
105
|
+
* @param requiredDocument A RequiredDocumentCreated or RequiredDocumentUpdated event payload
|
|
106
|
+
*
|
|
107
|
+
* @return A partial application
|
|
108
|
+
*/
|
|
109
|
+
function transformRequiredDocument(requiredDocument) {
|
|
110
|
+
var partialApplication = {};
|
|
111
|
+
var applicantId = requiredDocument.applicantId, applicationId = requiredDocument.applicationId, identification = requiredDocument.identification, eConsent = requiredDocument.eConsent;
|
|
112
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.PersonApplicant, ".@UniqueID"), applicantId);
|
|
113
|
+
(0, lodash_1.set)(partialApplication, application_paths_1.paths.ApplicationId, applicationId);
|
|
114
|
+
if (identification) {
|
|
115
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.PersonApplicant, ".@Gender"), (0, exports.getApplicantGenderFromIdentification)(identification));
|
|
116
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.ProofOfIdentity), (0, exports.generateProofOfIdentity)(requiredDocument));
|
|
117
|
+
}
|
|
118
|
+
if (eConsent) {
|
|
119
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Privacy), (0, exports.generatePersonApplicantPrivacy)(eConsent));
|
|
51
120
|
}
|
|
52
121
|
return partialApplication;
|
|
53
122
|
}
|
|
54
|
-
exports.
|
|
123
|
+
exports.transformRequiredDocument = transformRequiredDocument;
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
exports.__esModule = true;
|
|
3
3
|
exports.transformApplication = void 0;
|
|
4
4
|
var lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
5
|
-
var application_paths_1 = require("@lendi/integrations-protocol/
|
|
6
|
-
var application_paths_2 = require("@lendi/integrations-
|
|
5
|
+
var application_paths_1 = require("@lendi/integrations-credit-protocol/utils/application-paths");
|
|
6
|
+
var application_paths_2 = require("@lendi/integrations-protocol/lib/utils/application-paths");
|
|
7
7
|
var lodash_1 = require("lodash");
|
|
8
8
|
var enum_mappings_1 = require("../types/enum-mappings/");
|
|
9
|
+
var transform_applicant_1 = require("./transform-applicant");
|
|
9
10
|
/**
|
|
10
11
|
* Transforms a partial opportunity event to a partial internal request.
|
|
11
12
|
*
|
|
@@ -15,16 +16,18 @@ var enum_mappings_1 = require("../types/enum-mappings/");
|
|
|
15
16
|
function transformApplication(opportunity) {
|
|
16
17
|
var partialApplication = {};
|
|
17
18
|
var opportunityMapping = {
|
|
18
|
-
brand:
|
|
19
|
-
id:
|
|
20
|
-
paymentType: "".concat(
|
|
19
|
+
brand: application_paths_2.paths.BusinessName,
|
|
20
|
+
id: application_paths_2.paths.ApplicationId,
|
|
21
|
+
paymentType: "".concat(application_paths_2.paths.LoanTerm, ".@PaymentType"),
|
|
21
22
|
preliminary: 'preliminary',
|
|
22
|
-
primaryPurpose:
|
|
23
|
-
brokerPrimaryPurpose: 'Package.Content.NeedsAnalysis.PurposeOfApplication[0].@Description'
|
|
23
|
+
primaryPurpose: application_paths_2.paths.PurposeOfApplication,
|
|
24
|
+
brokerPrimaryPurpose: 'Package.Content.NeedsAnalysis.PurposeOfApplication[0].@Description',
|
|
25
|
+
hasOptedInRateLock: "".concat(application_paths_1.paths.FeaturesSelected, ".@RateLock")
|
|
24
26
|
};
|
|
25
|
-
(0, lodash_1.set)(partialApplication, "".concat(
|
|
26
|
-
(0, lodash_1.set)(partialApplication, "".concat(
|
|
27
|
-
(0, lodash_1.set)(partialApplication, "".concat(
|
|
27
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_2.paths.LoanDetail, ".@UniqueID"), "".concat(opportunity.id, "-loanDetails"));
|
|
28
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Instructions, ".@UniqueID"), "".concat(opportunity.id, "-stage"));
|
|
29
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Instructions, ".@Name"), lixi_internal_request_1.EventNameApplicationInstructionsList.ApplicationReceived);
|
|
30
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.FeaturesSelected, ".@RateLock"), lixi_internal_request_1.YesNoList.No);
|
|
28
31
|
for (var _i = 0, _a = Object.entries(opportunity); _i < _a.length; _i++) {
|
|
29
32
|
var _b = _a[_i], opportunityKey = _b[0], opportunityValue = _b[1];
|
|
30
33
|
if (opportunityMapping[opportunityKey]) {
|
|
@@ -43,6 +46,9 @@ function transformApplication(opportunity) {
|
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
}
|
|
49
|
+
else if (opportunityKey === 'hasOptedInRateLock') {
|
|
50
|
+
(0, lodash_1.set)(partialApplication, opportunityMapping[opportunityKey], (0, transform_applicant_1.booleanMapping)(opportunityValue));
|
|
51
|
+
}
|
|
46
52
|
else {
|
|
47
53
|
(0, lodash_1.set)(partialApplication, opportunityMapping[opportunityKey], opportunityValue);
|
|
48
54
|
}
|
|
@@ -5,9 +5,10 @@ import { PartialApplication } from '../types/partial-application';
|
|
|
5
5
|
* GenerateFundingPosition
|
|
6
6
|
*
|
|
7
7
|
* @param fundingPosition a partialFundingPosition.
|
|
8
|
+
* @param uniqueIdSuffix
|
|
8
9
|
* @return partialApplication with fees, grants and borrowers contributions added.
|
|
9
10
|
*/
|
|
10
|
-
export declare function transformFundingPosition(fundingPosition: FundingPositionPayload): PartialApplication;
|
|
11
|
+
export declare function transformFundingPosition(fundingPosition: FundingPositionPayload, uniqueIdSuffix?: string): PartialApplication;
|
|
11
12
|
/**
|
|
12
13
|
* getFee
|
|
13
14
|
*
|
|
@@ -9,9 +9,11 @@ var enum_mappings_1 = require("../types/enum-mappings");
|
|
|
9
9
|
* GenerateFundingPosition
|
|
10
10
|
*
|
|
11
11
|
* @param fundingPosition a partialFundingPosition.
|
|
12
|
+
* @param uniqueIdSuffix
|
|
12
13
|
* @return partialApplication with fees, grants and borrowers contributions added.
|
|
13
14
|
*/
|
|
14
|
-
function transformFundingPosition(fundingPosition) {
|
|
15
|
+
function transformFundingPosition(fundingPosition, uniqueIdSuffix) {
|
|
16
|
+
if (uniqueIdSuffix === void 0) { uniqueIdSuffix = 'loanDetails'; }
|
|
15
17
|
var partialApplication = {};
|
|
16
18
|
var contributionFunds = [];
|
|
17
19
|
var applicationId = fundingPosition.applicationId, id = fundingPosition.id, _a = fundingPosition.lmi, lmi = _a === void 0 ? 0 : _a, _b = fundingPosition.lmiIncluded, lmiIncluded = _b === void 0 ? false : _b;
|
|
@@ -41,7 +43,7 @@ function transformFundingPosition(fundingPosition) {
|
|
|
41
43
|
break;
|
|
42
44
|
case 'totalCashOut':
|
|
43
45
|
(0, lodash_1.set)(partialApplication, fundingPositionMapping[key], value);
|
|
44
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.LoanDetail, ".@UniqueID"), "".concat(applicationId, "-
|
|
46
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.LoanDetail, ".@UniqueID"), "".concat(applicationId, "-").concat(uniqueIdSuffix));
|
|
45
47
|
break;
|
|
46
48
|
case 'fundsRequested':
|
|
47
49
|
(0, lodash_1.set)(partialApplication, fundingPositionMapping[key], Math.round(value));
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Status } from '../events/public-required-document';
|
|
2
|
+
import { YesNoList } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
|
|
3
|
+
declare type VerificationMapping = {
|
|
4
|
+
[key in Status]: YesNoList;
|
|
5
|
+
};
|
|
6
|
+
export declare const verificationMapping: VerificationMapping;
|
|
7
|
+
export {};
|