@lendi/integrations-transform 1.1.6 → 1.2.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.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/schemas/public-asset-event.json +86 -93
- package/lib/transform-events/generate-asset-liability-link.js +2 -2
- package/lib/transform-events/generate-credit-report-rebuilt.js +1 -1
- package/lib/transform-events/generate-employment.js +17 -17
- package/lib/transform-events/generate-funding-position.js +6 -6
- package/lib/transform-events/generate-liability.js +15 -15
- package/lib/transform-events/generate-opportunity.js +2 -2
- package/lib/transform-events/generate-required-document.js +7 -7
- package/lib/transform-events/transform-applicant.js +26 -29
- package/lib/transform-events/transform-application.js +7 -8
- package/lib/transform-events/transform-asset.d.ts +44 -0
- package/lib/transform-events/transform-asset.js +271 -0
- package/lib/transform-events/transform-expenses.js +6 -7
- package/lib/transform-events/{generate-income.d.ts → transform-income.d.ts} +1 -1
- package/lib/transform-events/{generate-income.js → transform-income.js} +35 -31
- package/lib/transform-events/{generate-lixi-percentowned.d.ts → transform-percent-owned.d.ts} +1 -1
- package/lib/transform-events/{generate-lixi-percentowned.js → transform-percent-owned.js} +3 -3
- package/lib/types/enum-mappings/asset-type.d.ts +3 -0
- package/lib/types/enum-mappings/asset-type.js +18 -0
- package/lib/types/enum-mappings/index.d.ts +26 -0
- package/lib/types/enum-mappings/index.js +38 -0
- package/lib/types/enum-mappings/to-be-purchased.d.ts +5 -0
- package/lib/types/enum-mappings/to-be-purchased.js +8 -0
- package/lib/types/enum-mappings/to-be-used-as-security.d.ts +5 -0
- package/lib/types/enum-mappings/to-be-used-as-security.js +8 -0
- package/lib/types/events/public-asset.d.ts +16 -17
- package/lib/types/events/public-asset.js +3 -0
- package/lib/utils/address-tools.d.ts +14 -1
- package/lib/utils/address-tools.js +35 -3
- package/lib/utils/generate-address.d.ts +3 -4
- package/lib/utils/generate-address.js +8 -9
- package/lib/utils/is-asset-type.d.ts +25 -0
- package/lib/utils/is-asset-type.js +46 -0
- package/lib/utils/normalise-date.js +1 -1
- package/package.json +4 -4
- package/lib/transform-events/generate-asset.d.ts +0 -17
- package/lib/transform-events/generate-asset.js +0 -178
|
@@ -23,17 +23,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
};
|
|
24
24
|
var _a;
|
|
25
25
|
exports.__esModule = true;
|
|
26
|
-
exports.generateBAS = exports.generateIncomeBusinessDetails = exports.createRentalIncome = exports.
|
|
26
|
+
exports.generateBAS = exports.generateIncomeBusinessDetails = exports.createRentalIncome = exports.transformIncome = exports.getIncomeMapping = exports.EmploymentIncomeTypeMapping = void 0;
|
|
27
27
|
var lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
|
|
28
28
|
var application_paths_1 = require("@lendi/integrations-credit-protocol/utils/application-paths");
|
|
29
29
|
var lodash_1 = require("lodash");
|
|
30
|
-
var
|
|
31
|
-
var government_benefits_1 = require("../types/enum-mappings/government-benefits");
|
|
32
|
-
var income_type_1 = require("../types/enum-mappings/income-type");
|
|
30
|
+
var enum_mappings_1 = require("../types/enum-mappings");
|
|
33
31
|
var public_income_1 = require("../types/events/public-income");
|
|
34
32
|
var is_income_type_1 = require("../utils/is-income-type");
|
|
35
33
|
var round_decimal_1 = require("../utils/round-decimal");
|
|
36
|
-
var
|
|
34
|
+
var transform_percent_owned_1 = require("./transform-percent-owned");
|
|
37
35
|
var netWorkAllowanceAmount = 'Income.@NetWorkAllowanceAmount';
|
|
38
36
|
var netWorkAllowanceFrequency = 'Income.@NetWorkAllowanceFrequency';
|
|
39
37
|
// Income types mapping from internal to LIXI types /paths.
|
|
@@ -70,44 +68,47 @@ exports.EmploymentIncomeTypeMapping = (_a = {},
|
|
|
70
68
|
amount: 'Income.@GrossRegularOvertimeAmount',
|
|
71
69
|
frequency: 'Income.@GrossRegularOvertimeFrequency'
|
|
72
70
|
},
|
|
71
|
+
_a[public_income_1.IncomeType.SelfEmployedBusinessIncome] = {
|
|
72
|
+
amount: 'BusinessIncomeRecent.@ProfitBeforeTax'
|
|
73
|
+
},
|
|
73
74
|
_a);
|
|
74
75
|
function getIncomeMapping(incomeType) {
|
|
75
76
|
var basePath = application_paths_1.paths.OtherIncome;
|
|
76
77
|
if ((0, is_income_type_1.isRentalIncome)(incomeType)) {
|
|
77
78
|
basePath = application_paths_1.paths.RealEstateAsset;
|
|
78
79
|
return {
|
|
79
|
-
assetId:
|
|
80
|
-
percentOwned:
|
|
80
|
+
assetId: basePath + ".@UniqueID",
|
|
81
|
+
percentOwned: basePath + ".RentalIncome"
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
84
|
if ((0, is_income_type_1.isFullDocOrLowDocIncome)(incomeType)) {
|
|
84
85
|
basePath = application_paths_1.paths.CompanyApplicant;
|
|
85
86
|
return {
|
|
86
|
-
bas:
|
|
87
|
-
companyId:
|
|
88
|
-
incomes:
|
|
89
|
-
gross:
|
|
87
|
+
bas: basePath + ".Income[0].BusinessActivityStatement",
|
|
88
|
+
companyId: basePath + ".@UniqueID",
|
|
89
|
+
incomes: basePath + ".Income",
|
|
90
|
+
gross: basePath + ".DeclaredIncome.@IncomeAmount"
|
|
90
91
|
};
|
|
91
92
|
}
|
|
92
93
|
if ((0, is_income_type_1.isSelfEmployedIncome)(incomeType)) {
|
|
93
94
|
basePath = application_paths_1.paths.SelfEmployed;
|
|
94
95
|
var amount = exports.EmploymentIncomeTypeMapping[incomeType].amount;
|
|
95
96
|
return {
|
|
96
|
-
amount:
|
|
97
|
-
employmentId:
|
|
97
|
+
amount: basePath + "." + amount,
|
|
98
|
+
employmentId: basePath + ".@UniqueID"
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
101
|
if ((0, is_income_type_1.isPaygIncome)(incomeType)) {
|
|
101
102
|
basePath = application_paths_1.paths.PAYG;
|
|
102
103
|
var _a = exports.EmploymentIncomeTypeMapping[incomeType], amount = _a.amount, frequency = _a.frequency;
|
|
103
|
-
return __assign({ amount:
|
|
104
|
+
return __assign({ amount: basePath + "." + amount, employmentId: basePath + ".@UniqueID" }, (frequency && { frequency: basePath + "." + frequency }));
|
|
104
105
|
}
|
|
105
106
|
return {
|
|
106
|
-
amount:
|
|
107
|
-
frequency:
|
|
108
|
-
percentOwned:
|
|
109
|
-
type:
|
|
110
|
-
benefitType:
|
|
107
|
+
amount: basePath + ".@Amount",
|
|
108
|
+
frequency: basePath + ".@Frequency",
|
|
109
|
+
percentOwned: basePath + ".PercentOwned",
|
|
110
|
+
type: basePath + ".@Type",
|
|
111
|
+
benefitType: basePath + ".@GovernmentBenefitsType"
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
114
|
exports.getIncomeMapping = getIncomeMapping;
|
|
@@ -118,16 +119,16 @@ exports.getIncomeMapping = getIncomeMapping;
|
|
|
118
119
|
* @param applicantId PersonApplicant uniqueId on the application.
|
|
119
120
|
* @return partialApplication an incomplete application.
|
|
120
121
|
*/
|
|
121
|
-
function
|
|
122
|
+
function transformIncome(payload, applicantId) {
|
|
122
123
|
var applicationId = payload.applicationId, id = payload.id, income = payload.income;
|
|
123
124
|
var incomeAmount = income.amount, incomeType = income.type, incomeFrequency = income.frequency;
|
|
124
125
|
var partialApplication = {};
|
|
125
126
|
(0, lodash_1.set)(partialApplication, application_paths_1.paths.ApplicationId, applicationId);
|
|
126
127
|
if (!(0, is_income_type_1.isRentalIncome)(incomeType) && applicantId) {
|
|
127
|
-
(0, lodash_1.set)(partialApplication,
|
|
128
|
+
(0, lodash_1.set)(partialApplication, application_paths_1.paths.PersonApplicant + ".@UniqueID", applicantId);
|
|
128
129
|
}
|
|
129
130
|
if ((0, is_income_type_1.isOtherIncome)(incomeType)) {
|
|
130
|
-
(0, lodash_1.set)(partialApplication,
|
|
131
|
+
(0, lodash_1.set)(partialApplication, application_paths_1.paths.OtherIncome + ".@UniqueID", id);
|
|
131
132
|
}
|
|
132
133
|
var incomeMapping = getIncomeMapping(incomeType);
|
|
133
134
|
for (var _i = 0, _a = Object.entries(income); _i < _a.length; _i++) {
|
|
@@ -144,11 +145,11 @@ function generateIncome(payload, applicantId) {
|
|
|
144
145
|
(0, lodash_1.set)(partialApplication, incomeMapping[key], generateBAS(basWithAmount));
|
|
145
146
|
break;
|
|
146
147
|
case 'frequency':
|
|
147
|
-
(0, lodash_1.set)(partialApplication, incomeMapping[key],
|
|
148
|
+
(0, lodash_1.set)(partialApplication, incomeMapping[key], enum_mappings_1.incomeExpenseFrequencyMapping[value]);
|
|
148
149
|
break;
|
|
149
150
|
case 'percentOwned':
|
|
150
151
|
var ownership = value;
|
|
151
|
-
var percentOwned = (0,
|
|
152
|
+
var percentOwned = (0, transform_percent_owned_1.transformPercentOwned)(ownership);
|
|
152
153
|
if ((0, is_income_type_1.isRentalIncome)(incomeType)) {
|
|
153
154
|
percentOwned = createRentalIncome(incomeAmount, incomeFrequency, ownership.owners);
|
|
154
155
|
}
|
|
@@ -158,9 +159,9 @@ function generateIncome(payload, applicantId) {
|
|
|
158
159
|
break;
|
|
159
160
|
case 'type':
|
|
160
161
|
if (!(0, is_income_type_1.isRentalIncome)(incomeType)) {
|
|
161
|
-
var mappedType =
|
|
162
|
+
var mappedType = enum_mappings_1.otherIncomeMapping[value];
|
|
162
163
|
if ((0, is_income_type_1.isOtherIncomeWithDesc)(value)) {
|
|
163
|
-
(0, lodash_1.set)(partialApplication,
|
|
164
|
+
(0, lodash_1.set)(partialApplication, application_paths_1.paths.OtherIncome + ".@Description", mappedType);
|
|
164
165
|
(0, lodash_1.set)(partialApplication, incomeMapping[key], lixi_internal_request_1.OtherIncomeTypeList.OtherIncome);
|
|
165
166
|
}
|
|
166
167
|
else {
|
|
@@ -169,7 +170,7 @@ function generateIncome(payload, applicantId) {
|
|
|
169
170
|
}
|
|
170
171
|
break;
|
|
171
172
|
case 'benefitType':
|
|
172
|
-
(0, lodash_1.set)(partialApplication, incomeMapping[key],
|
|
173
|
+
(0, lodash_1.set)(partialApplication, incomeMapping[key], enum_mappings_1.governmentBenefitsMapping[value]);
|
|
173
174
|
break;
|
|
174
175
|
case 'incomes':
|
|
175
176
|
var sortedIncomeList = value
|
|
@@ -185,7 +186,7 @@ function generateIncome(payload, applicantId) {
|
|
|
185
186
|
}
|
|
186
187
|
return partialApplication;
|
|
187
188
|
}
|
|
188
|
-
exports.
|
|
189
|
+
exports.transformIncome = transformIncome;
|
|
189
190
|
/**
|
|
190
191
|
* Creates Rental Income array.
|
|
191
192
|
* @param amount Amount
|
|
@@ -203,7 +204,7 @@ function createRentalIncome(amount, frequency, ownership) {
|
|
|
203
204
|
var percent = owner.percent, applicantId = owner.applicantId;
|
|
204
205
|
var ownerAmount = amount * percent;
|
|
205
206
|
rentalIncome.push({
|
|
206
|
-
'@Frequency':
|
|
207
|
+
'@Frequency': enum_mappings_1.rentalIncomeFrequencyMapping[frequency],
|
|
207
208
|
'@RentalAmount': ownerAmount,
|
|
208
209
|
'@x_Owner': applicantId
|
|
209
210
|
});
|
|
@@ -219,7 +220,7 @@ var selfEmploymentIncomeMapping = {
|
|
|
219
220
|
interest: 'Addback.@Interest',
|
|
220
221
|
lease: 'Addback.@Lease',
|
|
221
222
|
nonRecurringExpenses: 'Addback.@NonRecurringExpenses',
|
|
222
|
-
other: 'Addback.@
|
|
223
|
+
other: 'Addback.OtherAddback[0].@Amount',
|
|
223
224
|
salary: 'Addback.@Salary',
|
|
224
225
|
superannuationExcess: 'Addback.@SuperannuationExcess'
|
|
225
226
|
},
|
|
@@ -239,11 +240,14 @@ function generateIncomeBusinessDetails(data) {
|
|
|
239
240
|
if (key === 'addback') {
|
|
240
241
|
for (var _c = 0, _d = Object.entries(value); _c < _d.length; _c++) {
|
|
241
242
|
var _e = _d[_c], addbackKey = _e[0], addbackValue = _e[1];
|
|
243
|
+
if (addbackKey === 'other') {
|
|
244
|
+
(0, lodash_1.set)(income, 'Addback.OtherAddback[0].@Description', 'other');
|
|
245
|
+
}
|
|
242
246
|
(0, lodash_1.set)(income, addbackMapping[addbackKey], addbackValue);
|
|
243
247
|
}
|
|
244
248
|
}
|
|
245
249
|
else if (key === 'year') {
|
|
246
|
-
(0, lodash_1.set)(income, dateAndIncomeMapping[key], value
|
|
250
|
+
(0, lodash_1.set)(income, dateAndIncomeMapping[key], value + "-01-01");
|
|
247
251
|
}
|
|
248
252
|
else {
|
|
249
253
|
(0, lodash_1.set)(income, dateAndIncomeMapping[key], value);
|
package/lib/transform-events/{generate-lixi-percentowned.d.ts → transform-percent-owned.d.ts}
RENAMED
|
@@ -6,4 +6,4 @@ import { PercentOwned as LIXIPercentOwned } from '@lendi/integrations-protocol/l
|
|
|
6
6
|
* @param percentOwned PercentOwned for an asset or liability on public liability event.
|
|
7
7
|
* @returns {LIXIPercentOwned} transformed Lixi PercentOwned.
|
|
8
8
|
*/
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function transformPercentOwned({ owners }: PercentOwned): LIXIPercentOwned;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformPercentOwned = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Transform percentOwned to lixi's format.
|
|
6
6
|
*
|
|
7
7
|
* @param percentOwned PercentOwned for an asset or liability on public liability event.
|
|
8
8
|
* @returns {LIXIPercentOwned} transformed Lixi PercentOwned.
|
|
9
9
|
*/
|
|
10
|
-
function
|
|
10
|
+
function transformPercentOwned(_a) {
|
|
11
11
|
var _b = _a.owners, owners = _b === void 0 ? [] : _b;
|
|
12
12
|
if (owners.length === 0)
|
|
13
13
|
return null;
|
|
@@ -21,4 +21,4 @@ function generateLIXIPercentOwned(_a) {
|
|
|
21
21
|
})
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
exports.
|
|
24
|
+
exports.transformPercentOwned = transformPercentOwned;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.assetTypeMapping = void 0;
|
|
5
|
+
var lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
6
|
+
var public_asset_1 = require("../events/public-asset");
|
|
7
|
+
exports.assetTypeMapping = (_a = {},
|
|
8
|
+
_a[public_asset_1.AssetType.Gifts] = lixi_internal_request_1.NonRealEstateAssetTypeList.Other,
|
|
9
|
+
_a[public_asset_1.AssetType.HomeContents] = lixi_internal_request_1.NonRealEstateAssetTypeList.Other,
|
|
10
|
+
_a[public_asset_1.AssetType.ManagedFunds] = lixi_internal_request_1.NonRealEstateAssetTypeList.FinancialAsset,
|
|
11
|
+
_a[public_asset_1.AssetType.OtherAsset] = lixi_internal_request_1.NonRealEstateAssetTypeList.Other,
|
|
12
|
+
_a[public_asset_1.AssetType.Property] = null,
|
|
13
|
+
_a[public_asset_1.AssetType.SavingCheckAccount] = lixi_internal_request_1.NonRealEstateAssetTypeList.FinancialAsset,
|
|
14
|
+
_a[public_asset_1.AssetType.Shares] = lixi_internal_request_1.NonRealEstateAssetTypeList.FinancialAsset,
|
|
15
|
+
_a[public_asset_1.AssetType.Superannuation] = lixi_internal_request_1.NonRealEstateAssetTypeList.FinancialAsset,
|
|
16
|
+
_a[public_asset_1.AssetType.TermDeposit] = lixi_internal_request_1.NonRealEstateAssetTypeList.FinancialAsset,
|
|
17
|
+
_a[public_asset_1.AssetType.Vehicle] = lixi_internal_request_1.NonRealEstateAssetTypeList.MotorVehicleAndTransport,
|
|
18
|
+
_a);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from './alieo-frequency';
|
|
2
|
+
export * from './asset-type';
|
|
3
|
+
export * from './country-code';
|
|
4
|
+
export * from './employment-basis';
|
|
5
|
+
export * from './expense-frequency';
|
|
6
|
+
export * from './funding-position';
|
|
7
|
+
export * from './government-benefits';
|
|
8
|
+
export * from './housing-status';
|
|
9
|
+
export * from './income-type';
|
|
10
|
+
export * from './liability-payment-type';
|
|
11
|
+
export * from './liability-type';
|
|
12
|
+
export * from './living-expense';
|
|
13
|
+
export * from './marital-status';
|
|
14
|
+
export * from './postcode';
|
|
15
|
+
export * from './preferred-repayment';
|
|
16
|
+
export * from './proof-of-identity';
|
|
17
|
+
export * from './public-financial-asset';
|
|
18
|
+
export * from './public-primary-purpose';
|
|
19
|
+
export * from './public-property-status';
|
|
20
|
+
export * from './public-property-type';
|
|
21
|
+
export * from './residency-status';
|
|
22
|
+
export * from './title-gender';
|
|
23
|
+
export * from './title';
|
|
24
|
+
export * from './to-be-purchased';
|
|
25
|
+
export * from './to-be-used-as-security';
|
|
26
|
+
export * from './transaction-type';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
exports.__esModule = true;
|
|
13
|
+
__exportStar(require("./alieo-frequency"), exports);
|
|
14
|
+
__exportStar(require("./asset-type"), exports);
|
|
15
|
+
__exportStar(require("./country-code"), exports);
|
|
16
|
+
__exportStar(require("./employment-basis"), exports);
|
|
17
|
+
__exportStar(require("./expense-frequency"), exports);
|
|
18
|
+
__exportStar(require("./funding-position"), exports);
|
|
19
|
+
__exportStar(require("./government-benefits"), exports);
|
|
20
|
+
__exportStar(require("./housing-status"), exports);
|
|
21
|
+
__exportStar(require("./income-type"), exports);
|
|
22
|
+
__exportStar(require("./liability-payment-type"), exports);
|
|
23
|
+
__exportStar(require("./liability-type"), exports);
|
|
24
|
+
__exportStar(require("./living-expense"), exports);
|
|
25
|
+
__exportStar(require("./marital-status"), exports);
|
|
26
|
+
__exportStar(require("./postcode"), exports);
|
|
27
|
+
__exportStar(require("./preferred-repayment"), exports);
|
|
28
|
+
__exportStar(require("./proof-of-identity"), exports);
|
|
29
|
+
__exportStar(require("./public-financial-asset"), exports);
|
|
30
|
+
__exportStar(require("./public-primary-purpose"), exports);
|
|
31
|
+
__exportStar(require("./public-property-status"), exports);
|
|
32
|
+
__exportStar(require("./public-property-type"), exports);
|
|
33
|
+
__exportStar(require("./residency-status"), exports);
|
|
34
|
+
__exportStar(require("./title-gender"), exports);
|
|
35
|
+
__exportStar(require("./title"), exports);
|
|
36
|
+
__exportStar(require("./to-be-purchased"), exports);
|
|
37
|
+
__exportStar(require("./to-be-used-as-security"), exports);
|
|
38
|
+
__exportStar(require("./transaction-type"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.toBePurchasedMapping = void 0;
|
|
4
|
+
var lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
|
|
5
|
+
exports.toBePurchasedMapping = {
|
|
6
|
+
"true": lixi_internal_request_1.AssetTransactionList.Purchasing,
|
|
7
|
+
"false": lixi_internal_request_1.AssetTransactionList.Owns
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.toBeUsedAsSecurityMapping = void 0;
|
|
4
|
+
var lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
5
|
+
exports.toBeUsedAsSecurityMapping = {
|
|
6
|
+
"true": lixi_internal_request_1.YesNoList.Yes,
|
|
7
|
+
"false": lixi_internal_request_1.YesNoList.No
|
|
8
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Create
|
|
2
|
+
* Create or update
|
|
3
3
|
*/
|
|
4
4
|
export interface PublicAsset {
|
|
5
|
-
payload:
|
|
6
|
-
type: Type;
|
|
5
|
+
payload: Payload;
|
|
7
6
|
/**
|
|
8
7
|
* schema version
|
|
9
8
|
*/
|
|
9
|
+
type: Type;
|
|
10
10
|
version: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* create
|
|
13
|
+
* create Asset payload
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
15
|
+
export interface Payload {
|
|
16
16
|
applicationId: string;
|
|
17
17
|
asset: Asset;
|
|
18
18
|
/**
|
|
@@ -26,9 +26,12 @@ export interface Asset {
|
|
|
26
26
|
constructionDetails?: ConstructionDetails;
|
|
27
27
|
contractDetails?: ContractDetails;
|
|
28
28
|
contractPriceAmount?: number;
|
|
29
|
+
dataType?: string;
|
|
29
30
|
description?: string;
|
|
30
31
|
estimatedValue?: number;
|
|
31
32
|
financialInstitution?: string;
|
|
33
|
+
financialInstitutionAccountNumber?: string;
|
|
34
|
+
financialInstitutionBsb?: string;
|
|
32
35
|
financialInstitutionShortName?: string;
|
|
33
36
|
knockDownToRebuild?: boolean;
|
|
34
37
|
make?: string;
|
|
@@ -37,6 +40,7 @@ export interface Asset {
|
|
|
37
40
|
primaryPurpose?: PrimaryPurpose;
|
|
38
41
|
propertyStatus?: PropertyStatus;
|
|
39
42
|
propertyType?: PropertyType;
|
|
43
|
+
relationId?: string;
|
|
40
44
|
toBePurchased?: boolean;
|
|
41
45
|
toBeSold?: boolean;
|
|
42
46
|
toBeUsedAsSecurity?: boolean;
|
|
@@ -46,7 +50,7 @@ export interface Asset {
|
|
|
46
50
|
}
|
|
47
51
|
export interface Address {
|
|
48
52
|
/**
|
|
49
|
-
* The
|
|
53
|
+
* The suburb name
|
|
50
54
|
*/
|
|
51
55
|
city?: string;
|
|
52
56
|
country?: Countries;
|
|
@@ -55,12 +59,12 @@ export interface Address {
|
|
|
55
59
|
*/
|
|
56
60
|
formatted?: string;
|
|
57
61
|
/**
|
|
58
|
-
*
|
|
62
|
+
* A 4 digit postcode
|
|
59
63
|
*/
|
|
60
64
|
postcode?: string;
|
|
61
65
|
standard?: AddressStandard;
|
|
62
66
|
/**
|
|
63
|
-
*
|
|
67
|
+
* One our great nation's states
|
|
64
68
|
*/
|
|
65
69
|
state?: string;
|
|
66
70
|
}
|
|
@@ -310,10 +314,6 @@ export interface AddressStandard {
|
|
|
310
314
|
* The building name
|
|
311
315
|
*/
|
|
312
316
|
buildingName?: string;
|
|
313
|
-
/**
|
|
314
|
-
* Postal address, usually a PO Box or Locked Bag
|
|
315
|
-
*/
|
|
316
|
-
deliveryAddress?: string;
|
|
317
317
|
/**
|
|
318
318
|
* The level of the unit/apartment
|
|
319
319
|
*/
|
|
@@ -330,10 +330,6 @@ export interface AddressStandard {
|
|
|
330
330
|
* The street number
|
|
331
331
|
*/
|
|
332
332
|
streetNumber?: string;
|
|
333
|
-
/**
|
|
334
|
-
* The street suffix
|
|
335
|
-
*/
|
|
336
|
-
streetSuffix?: string;
|
|
337
333
|
/**
|
|
338
334
|
* The type of the street i.e. road
|
|
339
335
|
*/
|
|
@@ -370,7 +366,7 @@ export interface ContractDetails {
|
|
|
370
366
|
estimatedSettlementDate?: string;
|
|
371
367
|
}
|
|
372
368
|
export interface PercentOwned {
|
|
373
|
-
owners
|
|
369
|
+
owners: ApplicantOwnership[];
|
|
374
370
|
/**
|
|
375
371
|
* Indicate whether ownership proportions are equal, specified individually for each one or
|
|
376
372
|
* not specified.
|
|
@@ -463,6 +459,9 @@ export declare enum ActionedByRole {
|
|
|
463
459
|
Customer = "customer",
|
|
464
460
|
Team = "team"
|
|
465
461
|
}
|
|
462
|
+
/**
|
|
463
|
+
* schema version
|
|
464
|
+
*/
|
|
466
465
|
export declare enum Type {
|
|
467
466
|
AssetCreated = "AssetCreated",
|
|
468
467
|
AssetUpdated = "AssetUpdated"
|
|
@@ -312,6 +312,9 @@ var ActionedByRole;
|
|
|
312
312
|
ActionedByRole["Customer"] = "customer";
|
|
313
313
|
ActionedByRole["Team"] = "team";
|
|
314
314
|
})(ActionedByRole = exports.ActionedByRole || (exports.ActionedByRole = {}));
|
|
315
|
+
/**
|
|
316
|
+
* schema version
|
|
317
|
+
*/
|
|
315
318
|
var Type;
|
|
316
319
|
(function (Type) {
|
|
317
320
|
Type["AssetCreated"] = "AssetCreated";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* A set of tools for manipulating addresses in LIXI applications.
|
|
3
3
|
*/
|
|
4
4
|
import { AddressType, CurrentAddress, PreviousAddress } from '@lendi/integrations-protocol/lib/types/lixi-internal-request';
|
|
5
|
-
import { CommonAddressProperties, PreviousAddress as InternalPreviousAddress } from '../types/events/public-applicant';
|
|
5
|
+
import { Address, CommonAddressProperties, Countries, PreviousAddress as InternalPreviousAddress } from '../types/events/public-applicant';
|
|
6
6
|
/**
|
|
7
7
|
* Type definition for functions used to transform types while mapping from event values to LIXI values.
|
|
8
8
|
*/
|
|
@@ -25,6 +25,7 @@ export interface MappedTransform {
|
|
|
25
25
|
*/
|
|
26
26
|
export declare type PathMappedTransform = Record<string, MappedTransform>;
|
|
27
27
|
export declare const lixiContactAddressMapping: PathMappedTransform;
|
|
28
|
+
export declare const australianStates: string[];
|
|
28
29
|
/**
|
|
29
30
|
* The transform map used for the LIXI address
|
|
30
31
|
*/
|
|
@@ -66,4 +67,16 @@ export declare function isMissingCountry(addressEvent: EventAddressType): boolea
|
|
|
66
67
|
* @param address
|
|
67
68
|
*/
|
|
68
69
|
export declare function setCountry(address: EventAddressType): EventAddressType;
|
|
70
|
+
/**
|
|
71
|
+
* @description Extract a country from a formatted address.
|
|
72
|
+
* @param {string} formatted - A formatted Address.
|
|
73
|
+
* @returns {Countries} The country extracted from the Address.
|
|
74
|
+
*/
|
|
75
|
+
export declare function extractCountryFromFormatted(formatted?: string): Countries;
|
|
76
|
+
/**
|
|
77
|
+
* @description If the address has an overseas country or state, it returns true, defaults to false if no country and state found.
|
|
78
|
+
* @param {Address} address - Asset Address
|
|
79
|
+
* @returns {boolean} - Returns true if overseas address.
|
|
80
|
+
*/
|
|
81
|
+
export declare function isOverseasAddress({ country, formatted, state }?: Address): boolean;
|
|
69
82
|
export {};
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* A set of tools for manipulating addresses in LIXI applications.
|
|
4
4
|
*/
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports.setCountry = exports.isMissingCountry = exports.rebuildPreviousAddress = exports.rebuildAddress = exports.mapTransform = exports.lixiAddressMapping = exports.lixiContactAddressMapping = void 0;
|
|
6
|
+
exports.isOverseasAddress = exports.extractCountryFromFormatted = exports.setCountry = exports.isMissingCountry = exports.rebuildPreviousAddress = exports.rebuildAddress = exports.mapTransform = exports.lixiAddressMapping = exports.australianStates = exports.lixiContactAddressMapping = void 0;
|
|
7
|
+
var lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
|
|
7
8
|
var lodash_1 = require("lodash");
|
|
8
9
|
var country_code_1 = require("../types/enum-mappings/country-code");
|
|
9
10
|
var housing_status_1 = require("../types/enum-mappings/housing-status");
|
|
@@ -24,6 +25,7 @@ exports.lixiContactAddressMapping = {
|
|
|
24
25
|
path: '@EndDate'
|
|
25
26
|
}
|
|
26
27
|
};
|
|
28
|
+
exports.australianStates = Object.values(lixi_internal_request_1.AuStateList);
|
|
27
29
|
/**
|
|
28
30
|
* The transform map used for the LIXI address
|
|
29
31
|
*/
|
|
@@ -136,11 +138,41 @@ exports.isMissingCountry = isMissingCountry;
|
|
|
136
138
|
* @param address
|
|
137
139
|
*/
|
|
138
140
|
function setCountry(address) {
|
|
139
|
-
var _a;
|
|
140
141
|
var formatted = (0, lodash_1.get)(address, 'residentialAddress.formatted');
|
|
141
142
|
if (formatted && !address.residentialAddress.country) {
|
|
142
|
-
address.residentialAddress.country = (
|
|
143
|
+
address.residentialAddress.country = extractCountryFromFormatted(formatted);
|
|
143
144
|
}
|
|
144
145
|
return address;
|
|
145
146
|
}
|
|
146
147
|
exports.setCountry = setCountry;
|
|
148
|
+
/**
|
|
149
|
+
* @description Extract a country from a formatted address.
|
|
150
|
+
* @param {string} formatted - A formatted Address.
|
|
151
|
+
* @returns {Countries} The country extracted from the Address.
|
|
152
|
+
*/
|
|
153
|
+
function extractCountryFromFormatted(formatted) {
|
|
154
|
+
var _a;
|
|
155
|
+
if (formatted === void 0) { formatted = ''; }
|
|
156
|
+
return (_a = formatted === null || formatted === void 0 ? void 0 : formatted.split(',').pop()) === null || _a === void 0 ? void 0 : _a.trim();
|
|
157
|
+
}
|
|
158
|
+
exports.extractCountryFromFormatted = extractCountryFromFormatted;
|
|
159
|
+
/**
|
|
160
|
+
* @description If the address has an overseas country or state, it returns true, defaults to false if no country and state found.
|
|
161
|
+
* @param {Address} address - Asset Address
|
|
162
|
+
* @returns {boolean} - Returns true if overseas address.
|
|
163
|
+
*/
|
|
164
|
+
function isOverseasAddress(_a) {
|
|
165
|
+
var _b = _a === void 0 ? {} : _a, country = _b.country, formatted = _b.formatted, state = _b.state;
|
|
166
|
+
if (country) {
|
|
167
|
+
return country !== public_applicant_1.Countries.Australia;
|
|
168
|
+
}
|
|
169
|
+
if (formatted) {
|
|
170
|
+
var lastPast = extractCountryFromFormatted(formatted);
|
|
171
|
+
return lastPast !== public_applicant_1.Countries.Australia;
|
|
172
|
+
}
|
|
173
|
+
if (state) {
|
|
174
|
+
return !exports.australianStates.includes(state);
|
|
175
|
+
}
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
exports.isOverseasAddress = isOverseasAddress;
|
|
@@ -4,10 +4,9 @@ export declare const StreetNumberMaxLength = 16;
|
|
|
4
4
|
export declare const StreetTypeArray: StreetTypeList[];
|
|
5
5
|
/**
|
|
6
6
|
* Generates an address for an asset.
|
|
7
|
-
|
|
8
|
-
* @param
|
|
9
|
-
* @
|
|
10
|
-
* @return A transformed address object.
|
|
7
|
+
* @param {Address} address - An address object.
|
|
8
|
+
* @param {string} id - Id of asset object.
|
|
9
|
+
* @return {Partial<AddressType>} A transformed address object.
|
|
11
10
|
*/
|
|
12
11
|
export declare function generateAddress(address: Address, id: string): Partial<AddressType>;
|
|
13
12
|
/**
|
|
@@ -6,7 +6,9 @@ var lodash_1 = require("lodash");
|
|
|
6
6
|
var country_code_1 = require("..//types/enum-mappings/country-code");
|
|
7
7
|
var postcode_1 = require("../types/enum-mappings/postcode");
|
|
8
8
|
var public_asset_1 = require("../types/events/public-asset");
|
|
9
|
+
var address_tools_1 = require("./address-tools");
|
|
9
10
|
exports.StreetNumberMaxLength = 16;
|
|
11
|
+
exports.StreetTypeArray = Object.values(lixi_internal_request_1.StreetTypeList);
|
|
10
12
|
var addressMapping = {
|
|
11
13
|
country: '@Country',
|
|
12
14
|
city: '@Suburb',
|
|
@@ -21,21 +23,18 @@ var standardMapping = {
|
|
|
21
23
|
level: '@Level',
|
|
22
24
|
unit: '@Unit'
|
|
23
25
|
};
|
|
24
|
-
exports.StreetTypeArray = Object.values(lixi_internal_request_1.StreetTypeList);
|
|
25
26
|
/**
|
|
26
27
|
* Generates an address for an asset.
|
|
27
|
-
|
|
28
|
-
* @param
|
|
29
|
-
* @
|
|
30
|
-
* @return A transformed address object.
|
|
28
|
+
* @param {Address} address - An address object.
|
|
29
|
+
* @param {string} id - Id of asset object.
|
|
30
|
+
* @return {Partial<AddressType>} A transformed address object.
|
|
31
31
|
*/
|
|
32
32
|
function generateAddress(address, id) {
|
|
33
|
-
var _a;
|
|
34
33
|
var transformedAddress = {
|
|
35
34
|
'@Country': lixi_internal_request_1.CountryCodeList.Au,
|
|
36
35
|
'@UniqueID': id
|
|
37
36
|
};
|
|
38
|
-
var country = (
|
|
37
|
+
var country = (0, address_tools_1.extractCountryFromFormatted)(address.formatted);
|
|
39
38
|
if (!address.country && country.length > 0) {
|
|
40
39
|
address.country = country;
|
|
41
40
|
}
|
|
@@ -50,8 +49,8 @@ function generateAddress(address, id) {
|
|
|
50
49
|
transformedAddress['@AustralianPostCode'] = postcode_1.postcodeMapping[address.state];
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
|
-
for (var _i = 0,
|
|
54
|
-
var
|
|
52
|
+
for (var _i = 0, _a = Object.entries(address); _i < _a.length; _i++) {
|
|
53
|
+
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
55
54
|
if (addressMapping[key]) {
|
|
56
55
|
switch (key) {
|
|
57
56
|
case 'standard':
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Asset } from '../types/events/public-asset';
|
|
2
|
+
/**
|
|
3
|
+
* @description Checks if the asset is of financial type.
|
|
4
|
+
* @param {Asset} asset asset payload.
|
|
5
|
+
* @returns {boolean} returns true if asset is a financial asset.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isFinancialAsset(asset: Asset): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @description Is Asset a Real Estate Asset.
|
|
10
|
+
* @param {Asset} asset An Asset.
|
|
11
|
+
* @returns {boolean} returns true if Asset is a Real Estate Asset.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isRealEstateAsset(asset: Asset): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* @description Is Asset a Motor Vehicle.
|
|
16
|
+
* @param {Asset} asset An Asset.
|
|
17
|
+
* @returns {boolean} returns true if an Asset is a vehicle.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isMotorVehicle(asset: Asset): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @description Is Asset of LIXI type `OtherAsset`.
|
|
22
|
+
* @param {Asset} asset An Asset.
|
|
23
|
+
* @returns {boolean} returns true if asset is `OtherAsset`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isOtherAsset(asset: Asset): boolean;
|