@lendi/integrations-transform 1.6.6 → 1.6.7-beta.0
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/schemas/public-applicant-event.json +416 -70
- package/lib/schemas/public-application-event.json +1 -1
- package/lib/transform-events/transform-applicant.d.ts +2 -32
- package/lib/transform-events/transform-applicant.js +84 -132
- package/lib/transform-events/transform-application.d.ts +6 -0
- package/lib/transform-events/transform-application.js +6 -0
- package/lib/types/enum-mappings/applicant-gender.d.ts +6 -0
- package/lib/types/enum-mappings/applicant-gender.js +11 -0
- package/lib/types/enum-mappings/applicant-type.d.ts +6 -0
- package/lib/types/enum-mappings/applicant-type.js +10 -0
- package/lib/types/events/public-applicant.d.ts +144 -5
- package/lib/types/events/public-applicant.js +60 -2
- package/lib/types/events/public-application.d.ts +1 -0
- package/lib/types/events/public-application.js +1 -0
- package/lib/types/partial-application.d.ts +1 -1
- package/lib/update-application/remove-ids-not-required.d.ts +1 -11
- package/lib/update-application/remove-ids-not-required.js +18 -9
- package/lib/utils/errors.d.ts +28 -0
- package/lib/utils/errors.js +43 -0
- package/package.json +3 -3
|
@@ -1,58 +1,78 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const lixi_internal_request_1 = require("@lendi/integrations-protocol/
|
|
3
|
+
exports.transformApplicant = exports.booleanMapping = void 0;
|
|
4
|
+
const lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
5
|
+
const lixi_internal_request_2 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
|
|
5
6
|
const application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
|
|
6
7
|
const lodash_1 = require("lodash");
|
|
7
|
-
const address_tools_1 = require("../utils/address-tools");
|
|
8
8
|
const enum_mappings_1 = require("../types/enum-mappings");
|
|
9
|
+
const applicant_gender_1 = require("../types/enum-mappings/applicant-gender");
|
|
10
|
+
const applicant_type_1 = require("../types/enum-mappings/applicant-type");
|
|
11
|
+
const guarantor_relationship_type_1 = require("../types/enum-mappings/guarantor-relationship-type");
|
|
9
12
|
const public_applicant_1 = require("../types/events/public-applicant");
|
|
13
|
+
const errors_1 = require("../utils/errors");
|
|
10
14
|
const normalise_date_1 = require("../utils/normalise-date");
|
|
11
|
-
const booleanMapping = (input = false) => (input === true ?
|
|
15
|
+
const booleanMapping = (input = false) => (input === true ? lixi_internal_request_2.YesNoList.Yes : lixi_internal_request_2.YesNoList.No);
|
|
12
16
|
exports.booleanMapping = booleanMapping;
|
|
13
|
-
const applicantMapping = {
|
|
14
|
-
applicationId: application_paths_1.paths.ApplicationId,
|
|
15
|
-
citizenship: `${application_paths_1.paths.PersonApplicant}.@Citizenship`,
|
|
16
|
-
contact: `${application_paths_1.paths.PersonApplicant}.Contact`,
|
|
17
|
-
dependants: 'dependants',
|
|
18
|
-
dateOfBirth: `${application_paths_1.paths.PersonApplicant}.@DateOfBirth`,
|
|
19
|
-
firstName: `${application_paths_1.paths.PersonApplicant}.PersonName.@FirstName`,
|
|
20
|
-
id: `${application_paths_1.paths.PersonApplicant}.@UniqueID`,
|
|
21
|
-
isFirstHomeBuyer: `${application_paths_1.paths.PersonApplicant}.@FirstHomeBuyer`,
|
|
22
|
-
isPrimaryApplicant: `${application_paths_1.paths.PersonApplicant}.@PrimaryApplicant`,
|
|
23
|
-
lastName: `${application_paths_1.paths.PersonApplicant}.PersonName.@Surname`,
|
|
24
|
-
maritalStatus: `${application_paths_1.paths.PersonApplicant}.@MaritalStatus`,
|
|
25
|
-
maritalDetails: `${application_paths_1.paths.PersonApplicant}.MaritalStatusDetails.@x_Spouse`,
|
|
26
|
-
middleName: `${application_paths_1.paths.PersonApplicant}.PersonName.@MiddleNames`,
|
|
27
|
-
residencyStatus: `${application_paths_1.paths.PersonApplicant}.@ResidencyStatus`,
|
|
28
|
-
title: `${application_paths_1.paths.PersonName}.@NameTitle`,
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Transforms a partial Applicant event to a partial LIXI application.
|
|
32
|
-
*
|
|
33
|
-
* @param applicant: A partial applicant.
|
|
34
|
-
* @param applicant
|
|
35
|
-
* @returns partialApplication an incomplete application.
|
|
36
|
-
*/
|
|
37
17
|
function transformApplicant(applicant) {
|
|
38
18
|
const partialApplication = {};
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
19
|
+
const applicantId = applicant.id; // This is how SF events cross reference applicant with its entities.
|
|
20
|
+
const applicantMapping = {
|
|
21
|
+
applicantType: `${application_paths_1.paths.PersonApplicant}.@ApplicantType`,
|
|
22
|
+
applicationId: application_paths_1.paths.ApplicationId,
|
|
23
|
+
citizenship: `${application_paths_1.paths.PersonApplicant}.@Citizenship`,
|
|
24
|
+
cityOfBirth: `${application_paths_1.paths.PersonApplicant}.@PlaceOfBirth`,
|
|
25
|
+
contact: 'contact',
|
|
26
|
+
countryOfBirth: `${application_paths_1.paths.PersonApplicant}.@CountryOfBirth`,
|
|
27
|
+
dateOfBirth: `${application_paths_1.paths.PersonApplicant}.@DateOfBirth`,
|
|
28
|
+
dependants: 'dependants',
|
|
29
|
+
email: `${application_paths_1.paths.PersonApplicant}.Contact.EmailAddress[0].@Email`,
|
|
30
|
+
firstName: `${application_paths_1.paths.PersonApplicant}.PersonName.@FirstName`,
|
|
31
|
+
id: `${application_paths_1.paths.PersonApplicant}.@UniqueID`,
|
|
32
|
+
lastName: `${application_paths_1.paths.PersonApplicant}.PersonName.@Surname`,
|
|
33
|
+
maritalDetails: `${application_paths_1.paths.PersonApplicant}.MaritalStatusDetails.@x_Spouse`,
|
|
34
|
+
maritalStatus: `${application_paths_1.paths.PersonApplicant}.@MaritalStatus`,
|
|
35
|
+
middleName: `${application_paths_1.paths.PersonApplicant}.PersonName.@MiddleNames`,
|
|
36
|
+
mothersMaidenName: `${application_paths_1.paths.PersonApplicant}.@MothersMaidenName`,
|
|
37
|
+
phone: `${application_paths_1.paths.PersonApplicant}.Contact.Mobile.@Number`,
|
|
38
|
+
residencyStatus: `${application_paths_1.paths.PersonApplicant}.@ResidencyStatus`,
|
|
39
|
+
title: `${application_paths_1.paths.PersonName}.@NameTitle`,
|
|
40
|
+
};
|
|
41
|
+
// Any applicant event need to have at least dateOfBirth, firstName and lastName.
|
|
42
|
+
if (!(applicant.dateOfBirth && applicant.firstName && applicant.lastName)) {
|
|
43
|
+
throw new errors_1.InvalidEvent('Applicant needs to have dateOfBirth, firstName and lastName');
|
|
44
|
+
}
|
|
45
|
+
// If applicant event comes without an applicantType then default it to ApplicantType.Borrower
|
|
46
|
+
if (!applicant.applicantType) {
|
|
47
|
+
applicant.applicantType = public_applicant_1.ApplicantType.Borrower;
|
|
48
|
+
}
|
|
49
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonName}.@NameTitle`, lixi_internal_request_1.NameTitleList.Other);
|
|
50
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@PrimaryApplicant`, (0, exports.booleanMapping)(applicant.isPrimaryApplicant));
|
|
51
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@FirstHomeBuyer`, (0, exports.booleanMapping)(applicant.isFirstHomeBuyer));
|
|
52
|
+
if (applicant.applicantType === public_applicant_1.ApplicantType.Guarantor) {
|
|
53
|
+
const mappedGuarantorRelationship = applicant.guarantorRelationshipToBorrower
|
|
54
|
+
? guarantor_relationship_type_1.guarantorRelationshipTypeMappings[applicant.guarantorRelationshipToBorrower.type]
|
|
55
|
+
: lixi_internal_request_1.KinRelationshipList.OtherRelative;
|
|
56
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@RelationshipToPrimaryApplicant`, mappedGuarantorRelationship);
|
|
57
|
+
// Credit Report event is not available for Guarantors, we should use
|
|
58
|
+
// the gender from the applicant event. If a Guarantor were to be converted to
|
|
59
|
+
// Borrower, the credit report should override the value for `@Gender`
|
|
60
|
+
if (applicant.gender) {
|
|
61
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@Gender`, applicant_gender_1.applicantGenderMapping[applicant.gender]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
for (const [key, value] of Object.entries(applicant)) {
|
|
45
65
|
if (applicantMapping[key]) {
|
|
46
66
|
switch (key) {
|
|
67
|
+
case 'applicantType':
|
|
68
|
+
(0, lodash_1.set)(partialApplication, applicantMapping[key], applicant_type_1.applicantTypeMapping[value]);
|
|
69
|
+
break;
|
|
47
70
|
case 'dateOfBirth':
|
|
48
71
|
(0, lodash_1.set)(partialApplication, applicantMapping[key], (0, normalise_date_1.normaliseDate)(value));
|
|
49
72
|
break;
|
|
50
73
|
case 'maritalStatus':
|
|
51
74
|
(0, lodash_1.set)(partialApplication, applicantMapping[key], enum_mappings_1.maritalStatusMapping[value]);
|
|
52
75
|
break;
|
|
53
|
-
case 'citizenship':
|
|
54
|
-
(0, lodash_1.set)(partialApplication, applicantMapping[key], enum_mappings_1.countryCodeMapping[value]);
|
|
55
|
-
break;
|
|
56
76
|
case 'residencyStatus':
|
|
57
77
|
(0, lodash_1.set)(partialApplication, applicantMapping[key], enum_mappings_1.residencyStatusMapping[value]);
|
|
58
78
|
// Certain bank integrations require the ability to differentiate between permanentResident and Citizen
|
|
@@ -61,24 +81,44 @@ function transformApplicant(applicant) {
|
|
|
61
81
|
// If citizen this field will be always added and value will be AU.
|
|
62
82
|
// @tsilva 21/11/19
|
|
63
83
|
if (value === public_applicant_1.ResidencyStatus.AustralianCitizen) {
|
|
64
|
-
(0, lodash_1.set)(partialApplication,
|
|
84
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@Citizenship`, lixi_internal_request_2.CountryCodeList.Au);
|
|
65
85
|
}
|
|
66
86
|
break;
|
|
87
|
+
case 'countryOfBirth':
|
|
88
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@CountryOfBirth`, enum_mappings_1.countryCodeMapping[value]);
|
|
89
|
+
break;
|
|
90
|
+
case 'citizenship':
|
|
91
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@Citizenship`, enum_mappings_1.countryCodeMapping[value]);
|
|
92
|
+
break;
|
|
93
|
+
case 'title':
|
|
94
|
+
(0, lodash_1.set)(partialApplication, applicantMapping[key], enum_mappings_1.titleMapping[value]);
|
|
95
|
+
break;
|
|
67
96
|
case 'maritalDetails':
|
|
68
97
|
const id = (0, lodash_1.get)(value, 'applicantId');
|
|
69
98
|
if (id)
|
|
70
99
|
(0, lodash_1.set)(partialApplication, applicantMapping[key], id);
|
|
71
100
|
break;
|
|
72
101
|
case 'contact':
|
|
73
|
-
const
|
|
74
|
-
(0, lodash_1.
|
|
75
|
-
if (
|
|
76
|
-
(0, lodash_1.set)(partialApplication,
|
|
102
|
+
const emailAddress = (0, lodash_1.get)(value, 'emailAddress');
|
|
103
|
+
const mobileNumber = (0, lodash_1.get)(value, 'mobileNumber');
|
|
104
|
+
if (emailAddress) {
|
|
105
|
+
(0, lodash_1.set)(partialApplication, applicantMapping.email, emailAddress);
|
|
106
|
+
}
|
|
107
|
+
if (mobileNumber) {
|
|
108
|
+
(0, lodash_1.set)(partialApplication, applicantMapping.phone, mobileNumber.replace('+61', '0'));
|
|
77
109
|
}
|
|
78
110
|
break;
|
|
79
111
|
case 'dependants':
|
|
80
|
-
|
|
81
|
-
|
|
112
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Household}.@UniqueID`, `${applicant.applicationId}-household`);
|
|
113
|
+
const dependants = value.map((dependant) => ({
|
|
114
|
+
'@Age': dependant.age,
|
|
115
|
+
'@UniqueID': dependant.id,
|
|
116
|
+
FinancialProvider: [
|
|
117
|
+
{
|
|
118
|
+
'@x_Party': applicantId,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
}));
|
|
82
122
|
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Household}.Dependant`, dependants);
|
|
83
123
|
break;
|
|
84
124
|
default:
|
|
@@ -90,91 +130,3 @@ function transformApplicant(applicant) {
|
|
|
90
130
|
return partialApplication;
|
|
91
131
|
}
|
|
92
132
|
exports.transformApplicant = transformApplicant;
|
|
93
|
-
const contactMapping = {
|
|
94
|
-
emailAddress: 'EmailAddress.0.@Email',
|
|
95
|
-
mobileNumber: 'Mobile.@Number',
|
|
96
|
-
currentAddress: 'CurrentAddress',
|
|
97
|
-
previousAddresses: 'PreviousAddress',
|
|
98
|
-
priorAddress: 'PriorAddress',
|
|
99
|
-
mailingAddress: 'CurrentAddress.@x_MailingAddress',
|
|
100
|
-
postSettlementAddress: 'PostSettlementAddress',
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Generates a LIXI contact from given contact.
|
|
104
|
-
*
|
|
105
|
-
* @param contact
|
|
106
|
-
* @param id
|
|
107
|
-
*/
|
|
108
|
-
function generateContact(contact, id) {
|
|
109
|
-
const lixiContact = {};
|
|
110
|
-
const lixiAddresses = [];
|
|
111
|
-
for (const [key, value] of Object.entries(contact)) {
|
|
112
|
-
if (contactMapping[key]) {
|
|
113
|
-
switch (key) {
|
|
114
|
-
case 'currentAddress':
|
|
115
|
-
{
|
|
116
|
-
const addressId = `${id}-current`;
|
|
117
|
-
const { lixiAddress, lixiContactAddress } = (0, address_tools_1.rebuildAddress)(value, addressId);
|
|
118
|
-
lixiAddresses.push(lixiAddress);
|
|
119
|
-
(0, lodash_1.set)(lixiContact, contactMapping[key], lixiContactAddress);
|
|
120
|
-
}
|
|
121
|
-
break;
|
|
122
|
-
case 'postSettlementAddress':
|
|
123
|
-
{
|
|
124
|
-
const addressId = `${id}-postSettlement`;
|
|
125
|
-
const { lixiAddress, lixiContactAddress } = (0, address_tools_1.rebuildAddress)({ residentialAddress: value }, addressId);
|
|
126
|
-
lixiAddresses.push(lixiAddress);
|
|
127
|
-
(0, lodash_1.set)(lixiContact, contactMapping[key], lixiContactAddress);
|
|
128
|
-
}
|
|
129
|
-
break;
|
|
130
|
-
case 'mailingAddress':
|
|
131
|
-
{
|
|
132
|
-
const addressId = `${id}-mailing`;
|
|
133
|
-
const { lixiAddress } = (0, address_tools_1.rebuildAddress)({ residentialAddress: value }, addressId);
|
|
134
|
-
lixiAddresses.push(lixiAddress);
|
|
135
|
-
(0, lodash_1.set)(lixiContact, contactMapping[key], addressId);
|
|
136
|
-
}
|
|
137
|
-
break;
|
|
138
|
-
case 'previousAddresses':
|
|
139
|
-
{
|
|
140
|
-
const addressId = `${id}-previous`;
|
|
141
|
-
const previousAddresses = value.sort((lhs, rhs) => lhs.endDate.localeCompare(rhs.endDate));
|
|
142
|
-
const previousAddress = previousAddresses.pop();
|
|
143
|
-
const { lixiAddress, lixiContactAddress } = (0, address_tools_1.rebuildAddress)(previousAddress, addressId);
|
|
144
|
-
lixiAddresses.push(lixiAddress);
|
|
145
|
-
(0, lodash_1.set)(lixiContact, contactMapping[key], lixiContactAddress);
|
|
146
|
-
// PriorAddresses
|
|
147
|
-
previousAddresses.forEach((address, index) => {
|
|
148
|
-
const { lixiAddress, lixiContactAddress } = (0, address_tools_1.rebuildAddress)(address, `${id}-prior-${index}`);
|
|
149
|
-
lixiAddresses.push(lixiAddress);
|
|
150
|
-
(0, lodash_1.set)(lixiContact, `${contactMapping['priorAddress']}.${index}`, lixiContactAddress);
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
break;
|
|
154
|
-
default:
|
|
155
|
-
(0, lodash_1.set)(lixiContact, contactMapping[key], value);
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return { lixiContact, lixiAddresses };
|
|
161
|
-
}
|
|
162
|
-
exports.generateContact = generateContact;
|
|
163
|
-
/**
|
|
164
|
-
* Generate dependants
|
|
165
|
-
*
|
|
166
|
-
* @param dependants
|
|
167
|
-
* @param id
|
|
168
|
-
*/
|
|
169
|
-
function generateDependants(dependants, id) {
|
|
170
|
-
return dependants.map((dependant) => ({
|
|
171
|
-
'@Age': dependant.age,
|
|
172
|
-
'@UniqueID': dependant.id,
|
|
173
|
-
FinancialProvider: [
|
|
174
|
-
{
|
|
175
|
-
'@x_Party': id,
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
}));
|
|
179
|
-
}
|
|
180
|
-
exports.generateDependants = generateDependants;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Payload as ApplicationPayload } from '../types/events/public-application';
|
|
2
2
|
export interface TransformApplicationOptions {
|
|
3
3
|
uniqueIdSuffix?: string;
|
|
4
|
+
/**
|
|
5
|
+
* Enables/disables the rate lock mapping (Used to enable the mapping in AW and disable in DW simulatenously due to having to notify integrated approval confidence lenders of schema changes if the attribute is added to schema)
|
|
6
|
+
*/
|
|
4
7
|
enableRateLock?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Enables/disables the fast refi mapping (Used to enable the mapping in AW and disable in DW simulatenously due to having to notify integrated approval confidence lenders of schema changes if the attribute is added to schema)
|
|
10
|
+
*/
|
|
5
11
|
enableFastRefi?: boolean;
|
|
6
12
|
}
|
|
7
13
|
/**
|
|
@@ -32,6 +32,12 @@ function transformApplication(opportunity, options = {}) {
|
|
|
32
32
|
if (enableRateLock) {
|
|
33
33
|
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.FeaturesSelected}.@RateLock`, (0, transform_applicant_1.booleanMapping)(hasOptedInRateLock));
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Please note that fast refinance is only applicable to applications where the primary purpose of the application is Refinance
|
|
37
|
+
* Hence there is logic in the fixApplicationInconsistencies method used by the updateApplication middleware in AW that removes or defaults the value of the FastRefinance attribute
|
|
38
|
+
* based on the primary purpose of the application. This logic was placed in the fixApplicationInconsistencies method in the updateApplication middleware as this is where we know the correct primary purpose of the
|
|
39
|
+
* application.
|
|
40
|
+
*/
|
|
35
41
|
if (enableFastRefi) {
|
|
36
42
|
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Overview}.@FastRefinance`, (0, transform_applicant_1.booleanMapping)(isFastRefi));
|
|
37
43
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Gender } from '../events/public-applicant';
|
|
2
|
+
import { GenderList } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
|
|
3
|
+
export declare type ApplicantGenderMapping = {
|
|
4
|
+
[key in Gender]: GenderList;
|
|
5
|
+
};
|
|
6
|
+
export declare const applicantGenderMapping: ApplicantGenderMapping;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applicantGenderMapping = void 0;
|
|
4
|
+
const public_applicant_1 = require("../events/public-applicant");
|
|
5
|
+
const lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
6
|
+
exports.applicantGenderMapping = {
|
|
7
|
+
[public_applicant_1.Gender.Female]: lixi_internal_request_1.GenderList.Female,
|
|
8
|
+
[public_applicant_1.Gender.Male]: lixi_internal_request_1.GenderList.Male,
|
|
9
|
+
[public_applicant_1.Gender.Undisclosed]: lixi_internal_request_1.GenderList.Undisclosed,
|
|
10
|
+
[public_applicant_1.Gender.Unknown]: lixi_internal_request_1.GenderList.Undisclosed,
|
|
11
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ApplicantTypeList } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
|
|
2
|
+
import { ApplicantType } from '../events/public-applicant';
|
|
3
|
+
export declare type ApplicantTypeMapping = {
|
|
4
|
+
[key in ApplicantType]: ApplicantTypeList;
|
|
5
|
+
};
|
|
6
|
+
export declare const applicantTypeMapping: ApplicantTypeMapping;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applicantTypeMapping = void 0;
|
|
4
|
+
const lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
5
|
+
const public_applicant_1 = require("../events/public-applicant");
|
|
6
|
+
exports.applicantTypeMapping = {
|
|
7
|
+
[public_applicant_1.ApplicantType.Borrower]: lixi_internal_request_1.ApplicantTypeList.Borrower,
|
|
8
|
+
[public_applicant_1.ApplicantType.BorrowerAndGuarantor]: lixi_internal_request_1.ApplicantTypeList.BorrowerAndGuarantor,
|
|
9
|
+
[public_applicant_1.ApplicantType.Guarantor]: lixi_internal_request_1.ApplicantTypeList.Guarantor,
|
|
10
|
+
};
|
|
@@ -10,53 +10,140 @@ export interface PublicApplicant {
|
|
|
10
10
|
version: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* trust payload.
|
|
14
|
+
*
|
|
15
|
+
* company payload.
|
|
16
|
+
*
|
|
17
|
+
* applicant payload.
|
|
14
18
|
*/
|
|
15
19
|
export interface Payload {
|
|
20
|
+
abn?: string;
|
|
21
|
+
acn?: string;
|
|
22
|
+
actingAsFranchiseDetails?: string;
|
|
16
23
|
applicantType?: ApplicantType;
|
|
17
24
|
/**
|
|
18
25
|
* uuid of application
|
|
19
26
|
*/
|
|
20
27
|
applicationId: string;
|
|
28
|
+
branch?: string;
|
|
21
29
|
citizenship?: Countries;
|
|
30
|
+
cityOfBirth?: string;
|
|
22
31
|
/**
|
|
23
32
|
* uuid of source applicant
|
|
24
33
|
*/
|
|
25
34
|
clonedFromApplicantId?: string;
|
|
35
|
+
companyName?: string;
|
|
36
|
+
companyStructure?: CompanyStructure;
|
|
37
|
+
companyType?: CompanyType;
|
|
26
38
|
contact?: Contact;
|
|
27
39
|
countryOfBirth?: Countries;
|
|
28
40
|
creditStatus?: CreditStatus;
|
|
41
|
+
currentLender?: string;
|
|
29
42
|
/**
|
|
30
43
|
* uuid of customer
|
|
31
44
|
*/
|
|
32
|
-
customerId
|
|
45
|
+
customerId?: string;
|
|
33
46
|
dateOfBirth?: string;
|
|
34
47
|
dependants?: Dependant[];
|
|
48
|
+
/**
|
|
49
|
+
* 100% funding required for Term Loans
|
|
50
|
+
*/
|
|
51
|
+
doesTermLoanNeed100PercentFunding?: boolean;
|
|
35
52
|
employmentType?: EmploymentType;
|
|
53
|
+
/**
|
|
54
|
+
* applicant's entity. For a trust applicant this is 'TRUST'
|
|
55
|
+
*
|
|
56
|
+
* applicant's entity. For a company applicant this is 'COMPANY'
|
|
57
|
+
*
|
|
58
|
+
* applicant's entity. For a person applicant this is 'PERSON'
|
|
59
|
+
*/
|
|
36
60
|
entity?: Entity;
|
|
37
61
|
firstName?: string;
|
|
38
62
|
gender?: Gender;
|
|
39
63
|
guarantorRelationshipToBorrower?: GuarantorRelationshipToBorrowerDefinition;
|
|
64
|
+
/**
|
|
65
|
+
* Has the applicant had any late payments, loan arrears or adverse credit history such as
|
|
66
|
+
* current or prior defaults or bankruptcies?
|
|
67
|
+
*/
|
|
68
|
+
hadLatePaymentsOrArrearsOrAdverseCreditHistory?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Have you had any difficulty in meeting your existing loan repayments, or had any
|
|
71
|
+
* financial judgments or legal proceedings, in the past two years?
|
|
72
|
+
*/
|
|
73
|
+
hadRepaymentDifficultyOrLegalProceedings?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The applicant has not been over the credit limit, in arrears or in hardship in relation
|
|
76
|
+
* to any existing credit or other fixed expenses
|
|
77
|
+
*/
|
|
78
|
+
hasGoodConduct?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Company doing more than 25% of business with one customer or supplier
|
|
81
|
+
*/
|
|
82
|
+
hasMoreThan25PercentBusinessWithOneCustomer?: boolean;
|
|
83
|
+
hasOutstandingTax?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Have you or a company with which you are associated had any past or current debts that
|
|
86
|
+
* were or are in default of the payment arrangement?
|
|
87
|
+
*/
|
|
88
|
+
hasPastOrCurrentDebts?: boolean;
|
|
40
89
|
hasSelfEmploymentProof?: boolean;
|
|
41
90
|
/**
|
|
42
91
|
* uuid of applicant
|
|
43
92
|
*/
|
|
44
93
|
id: string;
|
|
94
|
+
industryCode?: string;
|
|
95
|
+
investingInPropertyDetails?: string;
|
|
45
96
|
invitationStatus?: InvitationStatus;
|
|
97
|
+
isActingAsFranchise?: YesNoIntend;
|
|
98
|
+
isCommercialRelationship?: boolean;
|
|
99
|
+
isDiversified?: boolean;
|
|
46
100
|
isFirstHomeBuyer?: boolean;
|
|
101
|
+
isInvestingInProperty?: YesNoIntend;
|
|
102
|
+
isPassiveEntity?: boolean;
|
|
47
103
|
isPrimaryApplicant?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Is the principal place of business leased
|
|
106
|
+
*/
|
|
107
|
+
isPrincipalPlaceOfBusinessLeased?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Is the applicant a US citizen or resident for US tax purposes?
|
|
110
|
+
*/
|
|
111
|
+
isUSCitizenOrResident?: boolean;
|
|
112
|
+
isWorkingInImportExport?: YesNoIntend;
|
|
48
113
|
lastName?: string;
|
|
114
|
+
legalEntitiesInGroup?: number;
|
|
115
|
+
legalEntitiesWithCurrentLender?: number;
|
|
116
|
+
mailingAddress?: Address;
|
|
49
117
|
maritalDetails?: ApplicantKeyObject;
|
|
50
118
|
maritalStatus?: MaritalStatus;
|
|
51
|
-
meta
|
|
119
|
+
meta: ApplicantMeta;
|
|
52
120
|
middleName?: string;
|
|
121
|
+
monthsWithCurrentLender?: number;
|
|
122
|
+
moreThan25PercentBusinessWithOneCustomerDetails?: string;
|
|
53
123
|
/**
|
|
54
124
|
* Mothers Maiden Name
|
|
55
125
|
*/
|
|
56
126
|
mothersMaidenName?: string;
|
|
127
|
+
outstandingTaxDetails?: string;
|
|
128
|
+
principalPlaceOfBusinessLeasedDetails?: string;
|
|
129
|
+
registeredAddress?: Address;
|
|
130
|
+
registeredCountry?: Countries;
|
|
131
|
+
registeredDate?: string;
|
|
132
|
+
registeredState?: AustralianStates;
|
|
57
133
|
residencyStatus?: ResidencyStatus;
|
|
134
|
+
termLoanNeed100PercentFundingDetails?: string;
|
|
58
135
|
title?: Title;
|
|
59
136
|
totalIncomeEstimate?: number;
|
|
137
|
+
trustName?: string;
|
|
138
|
+
trustType?: TrustType;
|
|
139
|
+
/**
|
|
140
|
+
* Have you been: bankrupt or insolvent, petitioned or aware of anyone petitioning you for
|
|
141
|
+
* bankruptcy, advised to seek bankruptcy, or associated with a company that was or
|
|
142
|
+
* threatened to be placed into administration?
|
|
143
|
+
*/
|
|
144
|
+
wasBankruptOrInsolvent?: boolean;
|
|
145
|
+
workingInImportExportDetails?: string;
|
|
146
|
+
yearsOfTrading?: YearsOfTrading;
|
|
60
147
|
}
|
|
61
148
|
export declare enum ApplicantType {
|
|
62
149
|
Borrower = "BORROWER",
|
|
@@ -304,6 +391,18 @@ export declare enum Countries {
|
|
|
304
391
|
Zambia = "Zambia",
|
|
305
392
|
Zimbabwe = "Zimbabwe"
|
|
306
393
|
}
|
|
394
|
+
export declare enum CompanyStructure {
|
|
395
|
+
Corporation = "CORPORATION",
|
|
396
|
+
Partnership = "PARTNERSHIP",
|
|
397
|
+
SoleTrader = "SOLE_TRADER",
|
|
398
|
+
Trust = "TRUST"
|
|
399
|
+
}
|
|
400
|
+
export declare enum CompanyType {
|
|
401
|
+
Incorporated = "INCORPORATED",
|
|
402
|
+
Ltd = "LTD",
|
|
403
|
+
Nl = "NL",
|
|
404
|
+
PtyLtd = "PTY_LTD"
|
|
405
|
+
}
|
|
307
406
|
export interface Contact {
|
|
308
407
|
currentAddress?: CommonAddressProperties;
|
|
309
408
|
/**
|
|
@@ -410,7 +509,8 @@ export interface ApplicantKeyObject {
|
|
|
410
509
|
applicantId?: string;
|
|
411
510
|
}
|
|
412
511
|
/**
|
|
413
|
-
* applicant's employment type
|
|
512
|
+
* LEGACY. DO NOT USE. Historic events only - applicant's employment type. Use the
|
|
513
|
+
* employment events instead!
|
|
414
514
|
*/
|
|
415
515
|
export declare enum EmploymentType {
|
|
416
516
|
Employee = "EMPLOYEE",
|
|
@@ -418,11 +518,16 @@ export declare enum EmploymentType {
|
|
|
418
518
|
Unknown = "UNKNOWN"
|
|
419
519
|
}
|
|
420
520
|
/**
|
|
521
|
+
* applicant's entity. For a trust applicant this is 'TRUST'
|
|
522
|
+
*
|
|
523
|
+
* applicant's entity. For a company applicant this is 'COMPANY'
|
|
524
|
+
*
|
|
421
525
|
* applicant's entity. For a person applicant this is 'PERSON'
|
|
422
526
|
*/
|
|
423
527
|
export declare enum Entity {
|
|
424
528
|
Company = "COMPANY",
|
|
425
|
-
Person = "PERSON"
|
|
529
|
+
Person = "PERSON",
|
|
530
|
+
Trust = "TRUST"
|
|
426
531
|
}
|
|
427
532
|
export declare enum Gender {
|
|
428
533
|
Female = "FEMALE",
|
|
@@ -458,6 +563,11 @@ export declare enum InvitationStatus {
|
|
|
458
563
|
Expired = "EXPIRED",
|
|
459
564
|
Pending = "PENDING"
|
|
460
565
|
}
|
|
566
|
+
export declare enum YesNoIntend {
|
|
567
|
+
Intend = "Intend",
|
|
568
|
+
No = "No",
|
|
569
|
+
Yes = "Yes"
|
|
570
|
+
}
|
|
461
571
|
export declare enum MaritalStatus {
|
|
462
572
|
DeFacto = "DE_FACTO",
|
|
463
573
|
Divorced = "DIVORCED",
|
|
@@ -485,6 +595,16 @@ export declare enum ActionedByRole {
|
|
|
485
595
|
Customer = "customer",
|
|
486
596
|
Team = "team"
|
|
487
597
|
}
|
|
598
|
+
export declare enum AustralianStates {
|
|
599
|
+
Act = "ACT",
|
|
600
|
+
NT = "NT",
|
|
601
|
+
Nsw = "NSW",
|
|
602
|
+
Qld = "QLD",
|
|
603
|
+
Sa = "SA",
|
|
604
|
+
Tas = "TAS",
|
|
605
|
+
Vic = "VIC",
|
|
606
|
+
Wa = "WA"
|
|
607
|
+
}
|
|
488
608
|
export declare enum ResidencyStatus {
|
|
489
609
|
AustralianCitizen = "AUSTRALIAN_CITIZEN",
|
|
490
610
|
PermanentResident = "PERMANENT_RESIDENT",
|
|
@@ -499,7 +619,26 @@ export declare enum Title {
|
|
|
499
619
|
Mrs = "MRS",
|
|
500
620
|
Unknown = "UNKNOWN"
|
|
501
621
|
}
|
|
622
|
+
export declare enum TrustType {
|
|
623
|
+
CashManagementTrust = "CASH_MANAGEMENT_TRUST",
|
|
624
|
+
DiscretionaryTrust = "DISCRETIONARY_TRUST",
|
|
625
|
+
Fixed = "FIXED",
|
|
626
|
+
Hybrid = "HYBRID",
|
|
627
|
+
Other = "OTHER",
|
|
628
|
+
SuperannuationTrusts = "SUPERANNUATION_TRUSTS",
|
|
629
|
+
Unit = "UNIT"
|
|
630
|
+
}
|
|
631
|
+
export declare enum YearsOfTrading {
|
|
632
|
+
The1 = "1",
|
|
633
|
+
The10 = ">10",
|
|
634
|
+
The2 = "2",
|
|
635
|
+
The3 = "3",
|
|
636
|
+
The4 = "4",
|
|
637
|
+
The5 = "5",
|
|
638
|
+
The510 = "5-10"
|
|
639
|
+
}
|
|
502
640
|
export declare enum Type {
|
|
503
641
|
CreateApplicant = "CreateApplicant",
|
|
642
|
+
DeleteApplicant = "DeleteApplicant",
|
|
504
643
|
UpdateApplicant = "UpdateApplicant"
|
|
505
644
|
}
|