@lendi/act-credit-decisions-transform 2.0.15 → 2.0.17
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/logger.d.ts +1 -4
- package/lib/schemas/public-asset-event.json +4 -1
- package/lib/schemas/public-expense-event.json +5 -2
- package/lib/transform-events/transform-asset.js +27 -1
- package/lib/transform-events/transform-employment.d.ts +1 -0
- package/lib/transform-events/transform-employment.js +4 -0
- package/lib/transform-events/transform-expenses.js +31 -2
- package/lib/transform-events/transform-income.d.ts +4 -0
- package/lib/transform-events/transform-income.js +20 -7
- package/lib/types/enum-mappings/living-expense.js +3 -1
- package/lib/types/enum-mappings/property-expense-category.js +2 -0
- package/lib/types/events/public-asset.d.ts +5 -0
- package/lib/types/events/public-asset.js +5 -0
- package/lib/types/events/public-expense.d.ts +7 -2
- package/lib/types/events/public-expense.js +6 -1
- package/lib/types/events/public-income.d.ts +3 -0
- package/lib/utils/is-income-type.d.ts +7 -4
- package/lib/utils/is-income-type.js +21 -14
- package/package.json +5 -3
- package/CHANGELOG.md +0 -64
package/lib/logger.d.ts
CHANGED
|
@@ -529,11 +529,14 @@
|
|
|
529
529
|
"properties": {
|
|
530
530
|
"type": {
|
|
531
531
|
"type": "string",
|
|
532
|
+
"description": "BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX is deprecated.",
|
|
532
533
|
"enum": [
|
|
533
534
|
"BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX",
|
|
534
535
|
"PRIMARY_RESIDENCE_RUNNING_COSTS",
|
|
535
536
|
"INVESTMENT_PROPERTY_RUNNING_COSTS",
|
|
536
|
-
"SECONDARY_RESIDENCE_RUNNING_COSTS"
|
|
537
|
+
"SECONDARY_RESIDENCE_RUNNING_COSTS",
|
|
538
|
+
"STRATA_BODY_CORPORATE_FEES",
|
|
539
|
+
"LAND_TAX"
|
|
537
540
|
]
|
|
538
541
|
},
|
|
539
542
|
"amount": {
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"properties": {
|
|
68
68
|
"type": {
|
|
69
69
|
"type": "string",
|
|
70
|
+
"description": "BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX has been deprecated",
|
|
70
71
|
"enum": [
|
|
71
72
|
"RENT_UTILITIES",
|
|
72
73
|
"LIVING_EXPENSES_ESTIMATE",
|
|
@@ -81,7 +82,6 @@
|
|
|
81
82
|
"TELEPHONE_INTERNET_PAY_TV_AND_MEDIA_STREAMING_SUBSCRIPTIONS",
|
|
82
83
|
"PET_CARE",
|
|
83
84
|
"TRANSPORT",
|
|
84
|
-
"BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX",
|
|
85
85
|
"PRIMARY_RESIDENCE_RUNNING_COSTS",
|
|
86
86
|
"INVESTMENT_PROPERTY_RUNNING_COSTS",
|
|
87
87
|
"SECONDARY_RESIDENCE_RUNNING_COSTS",
|
|
@@ -91,7 +91,10 @@
|
|
|
91
91
|
"MEDICAL_AND_HEALTH",
|
|
92
92
|
"RENT",
|
|
93
93
|
"BOARD",
|
|
94
|
-
"OTHER"
|
|
94
|
+
"OTHER",
|
|
95
|
+
"BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX",
|
|
96
|
+
"STRATA_BODY_CORPORATE_FEES",
|
|
97
|
+
"LAND_TAX"
|
|
95
98
|
]
|
|
96
99
|
},
|
|
97
100
|
"amount": {
|
|
@@ -263,7 +263,7 @@ exports.getAssetMapping = getAssetMapping;
|
|
|
263
263
|
*/
|
|
264
264
|
function generateLivingExpenses(percentOwned, assetId, propertyExpenses) {
|
|
265
265
|
let livingExpenses = [];
|
|
266
|
-
const filteredPropertyExpenses = propertyExpenses.filter((expense) => expense.amount !== undefined);
|
|
266
|
+
const filteredPropertyExpenses = preSumUpStrataExpense(propertyExpenses.filter((expense) => expense.amount !== undefined));
|
|
267
267
|
percentOwned.owners.forEach((owner) => {
|
|
268
268
|
const expenses = filteredPropertyExpenses.map((expense) => {
|
|
269
269
|
normalizeAmounts(expense);
|
|
@@ -287,6 +287,32 @@ function generateLivingExpenses(percentOwned, assetId, propertyExpenses) {
|
|
|
287
287
|
return livingExpenses;
|
|
288
288
|
}
|
|
289
289
|
exports.generateLivingExpenses = generateLivingExpenses;
|
|
290
|
+
/**
|
|
291
|
+
* Pre-sum the body strata and land tax amount into one record.
|
|
292
|
+
* When the BodyCorporateFeesStrataFeesAndLandTax is fully deprecated, we can remove this function to let the StrataBodyCorporateFees and LandTax to flow out as normal
|
|
293
|
+
*
|
|
294
|
+
* @param expenses
|
|
295
|
+
*/
|
|
296
|
+
function preSumUpStrataExpense(expenses) {
|
|
297
|
+
const summingTypes = [
|
|
298
|
+
public_asset_1.PropertyExpenseType.BodyCorporateFeesStrataFeesAndLandTax,
|
|
299
|
+
public_asset_1.PropertyExpenseType.StrataBodyCorporateFees,
|
|
300
|
+
public_asset_1.PropertyExpenseType.LandTax,
|
|
301
|
+
];
|
|
302
|
+
const effectedExpenses = expenses.filter((expense) => summingTypes.includes(expense.type));
|
|
303
|
+
const unEffectedExpenses = expenses.filter((expense) => !summingTypes.includes(expense.type));
|
|
304
|
+
if (!effectedExpenses.length)
|
|
305
|
+
return unEffectedExpenses;
|
|
306
|
+
const sumEffectedExpenses = (0, lodash_1.sumBy)(effectedExpenses, 'amount');
|
|
307
|
+
return [
|
|
308
|
+
...(sumEffectedExpenses > 0
|
|
309
|
+
? [
|
|
310
|
+
Object.assign(Object.assign({}, effectedExpenses[0]), { type: public_asset_1.PropertyExpenseType.BodyCorporateFeesStrataFeesAndLandTax, amount: sumEffectedExpenses }),
|
|
311
|
+
]
|
|
312
|
+
: []),
|
|
313
|
+
...unEffectedExpenses,
|
|
314
|
+
];
|
|
315
|
+
}
|
|
290
316
|
/**
|
|
291
317
|
* Creates PropertyExpense array on RealEstateAsset from the same array on the event.
|
|
292
318
|
*
|
|
@@ -3,6 +3,7 @@ import { Payload } from '../types/events/public-employment';
|
|
|
3
3
|
* Generates a partial application from a employment event.
|
|
4
4
|
*
|
|
5
5
|
* @param employment a employment event payload.
|
|
6
|
+
* @param isSelfEmployed
|
|
6
7
|
* @returns partialApplication an incomplete application.
|
|
7
8
|
*/
|
|
8
9
|
export declare function transformEmployment(employment: Payload, isSelfEmployed: boolean): {};
|
|
@@ -11,6 +11,7 @@ const enum_mappings_1 = require("../types/enum-mappings");
|
|
|
11
11
|
* Generates a partial application from a employment event.
|
|
12
12
|
*
|
|
13
13
|
* @param employment a employment event payload.
|
|
14
|
+
* @param isSelfEmployed
|
|
14
15
|
* @returns partialApplication an incomplete application.
|
|
15
16
|
*/
|
|
16
17
|
function transformEmployment(employment, isSelfEmployed) {
|
|
@@ -32,6 +33,9 @@ function transformEmployment(employment, isSelfEmployed) {
|
|
|
32
33
|
break;
|
|
33
34
|
case public_employment_1.EmploymentType.SelfEmployed:
|
|
34
35
|
employmentPath = application_paths_1.paths.SelfEmployed;
|
|
36
|
+
/**
|
|
37
|
+
* @todo This is wrong but does not harm anything coz right now we dont call this function with `isSelfEmployed`
|
|
38
|
+
*/
|
|
35
39
|
if (companyId && isSelfEmployed) {
|
|
36
40
|
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.CompanyApplicant}.@UniqueID`, companyId);
|
|
37
41
|
(0, lodash_1.set)(partialApplication, `${employmentPath}.@x_Employer`, companyId);
|
|
@@ -14,6 +14,8 @@ exports.otherCommitmentExpenseTypes = [
|
|
|
14
14
|
const propertyExpenseCategories = [
|
|
15
15
|
public_expense_1.ExpenseType.InvestmentPropertyRunningCosts,
|
|
16
16
|
public_expense_1.ExpenseType.BodyCorporateFeesStrataFeesAndLandTax,
|
|
17
|
+
public_expense_1.ExpenseType.StrataBodyCorporateFees,
|
|
18
|
+
public_expense_1.ExpenseType.LandTax,
|
|
17
19
|
public_expense_1.ExpenseType.SecondaryResidenceRunningCosts,
|
|
18
20
|
public_expense_1.ExpenseType.PrimaryResidenceRunningCosts,
|
|
19
21
|
];
|
|
@@ -29,7 +31,7 @@ function transformExpenses(expense) {
|
|
|
29
31
|
return partialApplication;
|
|
30
32
|
}
|
|
31
33
|
const normalisedExpenses = expenses.map(normaliseExpenseAmount);
|
|
32
|
-
const filteredLivingExpensesWithAmount = normalisedExpenses.filter((expense) => expense.amount || !propertyExpenseCategories.includes(expense.type));
|
|
34
|
+
const filteredLivingExpensesWithAmount = preSumUpStrataExpense(normalisedExpenses.filter((expense) => expense.amount || !propertyExpenseCategories.includes(expense.type)));
|
|
33
35
|
const livingExpenseEstimate = filteredLivingExpensesWithAmount.find(isLivingExpenseEstimate);
|
|
34
36
|
const otherCommitments = filteredLivingExpensesWithAmount.filter(isOtherCommitment);
|
|
35
37
|
const expenseBreakdown = filteredLivingExpensesWithAmount.filter((item) => !(isOtherCommitment(item) || isLivingExpenseEstimate(item)));
|
|
@@ -73,7 +75,8 @@ function transformExpense(expense, applicantId, index, id) {
|
|
|
73
75
|
'@Amount': expense.amount,
|
|
74
76
|
'@Category': enum_mappings_1.livingExpenseMapping[expense.type],
|
|
75
77
|
'@Description': expense.type,
|
|
76
|
-
'@UniqueID': isOtherCommitment(expense) ? `${id}-commitment-${index}` : `${id}-living-expense-${index}`,
|
|
78
|
+
// '@UniqueID': isOtherCommitment(expense) ? `${id}-commitment-${index}` : `${id}-living-expense-${index}`,
|
|
79
|
+
'@UniqueID': `${id}-${applicantId}-${expense.type}`,
|
|
77
80
|
'@Frequency': enum_mappings_1.frequencyMapping[expense.frequency],
|
|
78
81
|
PercentResponsible: {
|
|
79
82
|
Owner: [
|
|
@@ -103,6 +106,32 @@ function normaliseExpenseAmount(expense) {
|
|
|
103
106
|
return expense;
|
|
104
107
|
}
|
|
105
108
|
exports.normaliseExpenseAmount = normaliseExpenseAmount;
|
|
109
|
+
/**
|
|
110
|
+
* Pre-sum the body strata and land tax amount into one record.
|
|
111
|
+
* When the BodyCorporateFeesStrataFeesAndLandTax is fully deprecated, we can remove this function to let the StrataBodyCorporateFees and LandTax to flow out as normal
|
|
112
|
+
*
|
|
113
|
+
* @param expenses
|
|
114
|
+
*/
|
|
115
|
+
function preSumUpStrataExpense(expenses) {
|
|
116
|
+
const summingTypes = [
|
|
117
|
+
public_expense_1.ExpenseType.BodyCorporateFeesStrataFeesAndLandTax,
|
|
118
|
+
public_expense_1.ExpenseType.StrataBodyCorporateFees,
|
|
119
|
+
public_expense_1.ExpenseType.LandTax,
|
|
120
|
+
];
|
|
121
|
+
const effectedExpenses = expenses.filter((expense) => summingTypes.includes(expense.type));
|
|
122
|
+
const unEffectedExpenses = expenses.filter((expense) => !summingTypes.includes(expense.type));
|
|
123
|
+
if (!effectedExpenses.length)
|
|
124
|
+
return unEffectedExpenses;
|
|
125
|
+
const sumEffectedExpenses = (0, lodash_1.sumBy)(effectedExpenses, 'amount');
|
|
126
|
+
return [
|
|
127
|
+
...(sumEffectedExpenses > 0
|
|
128
|
+
? [
|
|
129
|
+
Object.assign(Object.assign({}, effectedExpenses[0]), { type: public_expense_1.ExpenseType.BodyCorporateFeesStrataFeesAndLandTax, amount: (0, lodash_1.sumBy)(effectedExpenses, 'amount') }),
|
|
130
|
+
]
|
|
131
|
+
: []),
|
|
132
|
+
...unEffectedExpenses,
|
|
133
|
+
];
|
|
134
|
+
}
|
|
106
135
|
/**
|
|
107
136
|
* @description Verify if expense is an OtherCommitment.
|
|
108
137
|
* @param {Expense} expense Any Expense item.
|
|
@@ -17,6 +17,7 @@ export declare function getIncomeMapping(incomeType: IncomeType): Record<string,
|
|
|
17
17
|
*
|
|
18
18
|
* @param payload a partial income event.
|
|
19
19
|
* @param applicantId PersonApplicant uniqueId on the application.
|
|
20
|
+
* @param storedApplication The stored application version, to retrieve the applicant id when processing SelfEmployed Income
|
|
20
21
|
* @returns partialApplication an incomplete application.
|
|
21
22
|
*/
|
|
22
23
|
export declare function transformIncome(payload: IncomePayload, applicantId?: string): PartialApplication;
|
|
@@ -32,6 +33,9 @@ export interface SelfEmploymentIncomeMapping {
|
|
|
32
33
|
year: string;
|
|
33
34
|
companyProfitBeforeTax: string;
|
|
34
35
|
addback: Record<string, string>;
|
|
36
|
+
/**
|
|
37
|
+
* @todo to map this field, currently no field in SelfEmployed to map this field to
|
|
38
|
+
*/
|
|
35
39
|
nonRecurringIncome: string;
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
@@ -76,16 +76,21 @@ function getIncomeMapping(incomeType) {
|
|
|
76
76
|
if ((0, is_income_type_1.isFullDocOrLowDocIncome)(incomeType)) {
|
|
77
77
|
basePath = application_paths_1.paths.SelfEmployed;
|
|
78
78
|
return {
|
|
79
|
+
// Low Doc and Full Doc common fields
|
|
80
|
+
companyId: `${basePath}.@x_Employer`,
|
|
81
|
+
gross: `${basePath}.DeclaredIncome.@IncomeAmount`,
|
|
82
|
+
// Full Doc
|
|
83
|
+
incomes: `${basePath}.BusinessIncome`,
|
|
79
84
|
/**
|
|
80
|
-
* @todo
|
|
85
|
+
* @todo To map bas correctly. Currently there is no way to map bas to SelfEmployed
|
|
81
86
|
*/
|
|
82
|
-
bas: `${basePath}.Income[0].BusinessActivityStatement`,
|
|
83
|
-
incomes: `${basePath}.Income`,
|
|
84
|
-
// companyId: `${basePath}.@UniqueID`,
|
|
87
|
+
// bas: `${basePath}.Income[0].BusinessActivityStatement`,
|
|
85
88
|
//
|
|
86
|
-
gross: `${basePath}.DeclaredIncome.@IncomeAmount`,
|
|
87
89
|
};
|
|
88
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated This is legacy version and shall not be used
|
|
93
|
+
*/
|
|
89
94
|
if ((0, is_income_type_1.isSelfEmployedIncome)(incomeType)) {
|
|
90
95
|
basePath = application_paths_1.paths.SelfEmployed;
|
|
91
96
|
const { amount } = exports.EmploymentIncomeTypeMapping[incomeType];
|
|
@@ -113,9 +118,10 @@ exports.getIncomeMapping = getIncomeMapping;
|
|
|
113
118
|
*
|
|
114
119
|
* @param payload a partial income event.
|
|
115
120
|
* @param applicantId PersonApplicant uniqueId on the application.
|
|
121
|
+
* @param storedApplication The stored application version, to retrieve the applicant id when processing SelfEmployed Income
|
|
116
122
|
* @returns partialApplication an incomplete application.
|
|
117
123
|
*/
|
|
118
|
-
function transformIncome(payload, applicantId) {
|
|
124
|
+
function transformIncome(payload, applicantId = undefined) {
|
|
119
125
|
const { applicationId, id, income } = payload;
|
|
120
126
|
const { amount: incomeAmount, type: incomeType, frequency: incomeFrequency } = income;
|
|
121
127
|
const partialApplication = {};
|
|
@@ -179,6 +185,9 @@ function transformIncome(payload, applicantId) {
|
|
|
179
185
|
}
|
|
180
186
|
}
|
|
181
187
|
}
|
|
188
|
+
if ((0, is_income_type_1.isFullDocOrLowDocIncome)(incomeType)) {
|
|
189
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@UniqueID`, applicantId);
|
|
190
|
+
}
|
|
182
191
|
return partialApplication;
|
|
183
192
|
}
|
|
184
193
|
exports.transformIncome = transformIncome;
|
|
@@ -209,7 +218,7 @@ function createRentalIncome(amount, frequency, ownership = []) {
|
|
|
209
218
|
exports.createRentalIncome = createRentalIncome;
|
|
210
219
|
const selfEmploymentIncomeMapping = {
|
|
211
220
|
year: '@StartDate',
|
|
212
|
-
companyProfitBeforeTax: '@
|
|
221
|
+
companyProfitBeforeTax: '@ProfitBeforeTax',
|
|
213
222
|
addback: {
|
|
214
223
|
depreciation: 'Addback.@Depreciation',
|
|
215
224
|
interest: 'Addback.@Interest',
|
|
@@ -219,6 +228,10 @@ const selfEmploymentIncomeMapping = {
|
|
|
219
228
|
salary: 'Addback.@Salary',
|
|
220
229
|
superannuationExcess: 'Addback.@SuperannuationExcess',
|
|
221
230
|
},
|
|
231
|
+
/**
|
|
232
|
+
* @todo to map this field, currently no field in SelfEmployed to map this field to
|
|
233
|
+
* Due to some limitation, leave this field here which will map the data wrongly but eventually will be removed by the validator
|
|
234
|
+
*/
|
|
222
235
|
nonRecurringIncome: 'NonRecurringIncome[0].@Amount',
|
|
223
236
|
};
|
|
224
237
|
/**
|
|
@@ -5,7 +5,6 @@ const lixi_internal_request_1 = require("@lendi/act-eac-integrations-protocol/li
|
|
|
5
5
|
const public_expense_1 = require("../events/public-expense");
|
|
6
6
|
exports.livingExpenseMapping = {
|
|
7
7
|
[public_expense_1.ExpenseType.Board]: lixi_internal_request_1.OtherCommitmentCategoryList.Board,
|
|
8
|
-
[public_expense_1.ExpenseType.BodyCorporateFeesStrataFeesAndLandTax]: lixi_internal_request_1.LivingExpenseCategoryList.BodyCorporateFeesStrataFeesAndLandTaxOnOwnerOccupiedPrincipalPlaceOfResidence,
|
|
9
8
|
[public_expense_1.ExpenseType.ChildAndSpousalMaintenance]: lixi_internal_request_1.OtherCommitmentCategoryList.ChildAndSpousalMaintenance,
|
|
10
9
|
[public_expense_1.ExpenseType.Childcare]: lixi_internal_request_1.LivingExpenseCategoryList.Childcare,
|
|
11
10
|
[public_expense_1.ExpenseType.ClothingAndPersonalCare]: lixi_internal_request_1.LivingExpenseCategoryList.ClothingAndPersonalCare,
|
|
@@ -28,4 +27,7 @@ exports.livingExpenseMapping = {
|
|
|
28
27
|
[public_expense_1.ExpenseType.SecondaryResidenceRunningCosts]: lixi_internal_request_1.LivingExpenseCategoryList.SecondaryResidenceRunningCosts,
|
|
29
28
|
[public_expense_1.ExpenseType.TelephoneInternetPayTvAndMediaStreamingSubscriptions]: lixi_internal_request_1.LivingExpenseCategoryList.TelephoneInternetPayTVAndMediaStreamingSubscriptions,
|
|
30
29
|
[public_expense_1.ExpenseType.Transport]: lixi_internal_request_1.LivingExpenseCategoryList.Transport,
|
|
30
|
+
[public_expense_1.ExpenseType.BodyCorporateFeesStrataFeesAndLandTax]: lixi_internal_request_1.LivingExpenseCategoryList.BodyCorporateFeesStrataFeesAndLandTaxOnOwnerOccupiedPrincipalPlaceOfResidence,
|
|
31
|
+
[public_expense_1.ExpenseType.StrataBodyCorporateFees]: lixi_internal_request_1.LivingExpenseCategoryList.BodyCorporateFeesStrataFeesAndLandTaxOnOwnerOccupiedPrincipalPlaceOfResidence,
|
|
32
|
+
[public_expense_1.ExpenseType.LandTax]: lixi_internal_request_1.LivingExpenseCategoryList.BodyCorporateFeesStrataFeesAndLandTaxOnOwnerOccupiedPrincipalPlaceOfResidence,
|
|
31
33
|
};
|
|
@@ -8,4 +8,6 @@ exports.propertyExpenseCategoryMapping = {
|
|
|
8
8
|
[public_asset_1.PropertyExpenseType.InvestmentPropertyRunningCosts]: lixi_internal_request_1.PropertyExpenseCategoryList.RunningCosts,
|
|
9
9
|
[public_asset_1.PropertyExpenseType.PrimaryResidenceRunningCosts]: lixi_internal_request_1.PropertyExpenseCategoryList.RunningCosts,
|
|
10
10
|
[public_asset_1.PropertyExpenseType.SecondaryResidenceRunningCosts]: lixi_internal_request_1.PropertyExpenseCategoryList.RunningCosts,
|
|
11
|
+
[public_asset_1.PropertyExpenseType.StrataBodyCorporateFees]: lixi_internal_request_1.PropertyExpenseCategoryList.BodyCorporateFeesStrataFeesAndLandTax,
|
|
12
|
+
[public_asset_1.PropertyExpenseType.LandTax]: lixi_internal_request_1.PropertyExpenseCategoryList.BodyCorporateFeesStrataFeesAndLandTax,
|
|
11
13
|
};
|
|
@@ -426,7 +426,12 @@ export declare enum Frequency {
|
|
|
426
426
|
Yearly = "YEARLY"
|
|
427
427
|
}
|
|
428
428
|
export declare enum PropertyExpenseType {
|
|
429
|
+
/**
|
|
430
|
+
* @deprecated The field has been deprecated and replaced with StrataBodyCorporateFees and LandTax
|
|
431
|
+
*/
|
|
429
432
|
BodyCorporateFeesStrataFeesAndLandTax = "BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX",
|
|
433
|
+
StrataBodyCorporateFees = "STRATA_BODY_CORPORATE_FEES",
|
|
434
|
+
LandTax = "LAND_TAX",
|
|
430
435
|
InvestmentPropertyRunningCosts = "INVESTMENT_PROPERTY_RUNNING_COSTS",
|
|
431
436
|
PrimaryResidenceRunningCosts = "PRIMARY_RESIDENCE_RUNNING_COSTS",
|
|
432
437
|
SecondaryResidenceRunningCosts = "SECONDARY_RESIDENCE_RUNNING_COSTS"
|
|
@@ -279,7 +279,12 @@ var Frequency;
|
|
|
279
279
|
})(Frequency || (exports.Frequency = Frequency = {}));
|
|
280
280
|
var PropertyExpenseType;
|
|
281
281
|
(function (PropertyExpenseType) {
|
|
282
|
+
/**
|
|
283
|
+
* @deprecated The field has been deprecated and replaced with StrataBodyCorporateFees and LandTax
|
|
284
|
+
*/
|
|
282
285
|
PropertyExpenseType["BodyCorporateFeesStrataFeesAndLandTax"] = "BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX";
|
|
286
|
+
PropertyExpenseType["StrataBodyCorporateFees"] = "STRATA_BODY_CORPORATE_FEES";
|
|
287
|
+
PropertyExpenseType["LandTax"] = "LAND_TAX";
|
|
283
288
|
PropertyExpenseType["InvestmentPropertyRunningCosts"] = "INVESTMENT_PROPERTY_RUNNING_COSTS";
|
|
284
289
|
PropertyExpenseType["PrimaryResidenceRunningCosts"] = "PRIMARY_RESIDENCE_RUNNING_COSTS";
|
|
285
290
|
PropertyExpenseType["SecondaryResidenceRunningCosts"] = "SECONDARY_RESIDENCE_RUNNING_COSTS";
|
|
@@ -34,7 +34,6 @@ export declare enum Frequency {
|
|
|
34
34
|
}
|
|
35
35
|
export declare enum ExpenseType {
|
|
36
36
|
Board = "BOARD",
|
|
37
|
-
BodyCorporateFeesStrataFeesAndLandTax = "BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX",
|
|
38
37
|
ChildAndSpousalMaintenance = "CHILD_AND_SPOUSAL_MAINTENANCE",
|
|
39
38
|
Childcare = "CHILDCARE",
|
|
40
39
|
ClothingAndPersonalCare = "CLOTHING_AND_PERSONAL_CARE",
|
|
@@ -56,7 +55,13 @@ export declare enum ExpenseType {
|
|
|
56
55
|
RentUtilities = "RENT_UTILITIES",
|
|
57
56
|
SecondaryResidenceRunningCosts = "SECONDARY_RESIDENCE_RUNNING_COSTS",
|
|
58
57
|
TelephoneInternetPayTvAndMediaStreamingSubscriptions = "TELEPHONE_INTERNET_PAY_TV_AND_MEDIA_STREAMING_SUBSCRIPTIONS",
|
|
59
|
-
Transport = "TRANSPORT"
|
|
58
|
+
Transport = "TRANSPORT",
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated The field has been deprecated and replaced with StrataBodyCorporateFees and LandTax
|
|
61
|
+
*/
|
|
62
|
+
BodyCorporateFeesStrataFeesAndLandTax = "BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX",
|
|
63
|
+
StrataBodyCorporateFees = "STRATA_BODY_CORPORATE_FEES",
|
|
64
|
+
LandTax = "LAND_TAX"
|
|
60
65
|
}
|
|
61
66
|
/**
|
|
62
67
|
* The metadata of the alieo
|
|
@@ -12,7 +12,6 @@ var Frequency;
|
|
|
12
12
|
var ExpenseType;
|
|
13
13
|
(function (ExpenseType) {
|
|
14
14
|
ExpenseType["Board"] = "BOARD";
|
|
15
|
-
ExpenseType["BodyCorporateFeesStrataFeesAndLandTax"] = "BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX";
|
|
16
15
|
ExpenseType["ChildAndSpousalMaintenance"] = "CHILD_AND_SPOUSAL_MAINTENANCE";
|
|
17
16
|
ExpenseType["Childcare"] = "CHILDCARE";
|
|
18
17
|
ExpenseType["ClothingAndPersonalCare"] = "CLOTHING_AND_PERSONAL_CARE";
|
|
@@ -35,6 +34,12 @@ var ExpenseType;
|
|
|
35
34
|
ExpenseType["SecondaryResidenceRunningCosts"] = "SECONDARY_RESIDENCE_RUNNING_COSTS";
|
|
36
35
|
ExpenseType["TelephoneInternetPayTvAndMediaStreamingSubscriptions"] = "TELEPHONE_INTERNET_PAY_TV_AND_MEDIA_STREAMING_SUBSCRIPTIONS";
|
|
37
36
|
ExpenseType["Transport"] = "TRANSPORT";
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated The field has been deprecated and replaced with StrataBodyCorporateFees and LandTax
|
|
39
|
+
*/
|
|
40
|
+
ExpenseType["BodyCorporateFeesStrataFeesAndLandTax"] = "BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX";
|
|
41
|
+
ExpenseType["StrataBodyCorporateFees"] = "STRATA_BODY_CORPORATE_FEES";
|
|
42
|
+
ExpenseType["LandTax"] = "LAND_TAX";
|
|
38
43
|
})(ExpenseType || (exports.ExpenseType = ExpenseType = {}));
|
|
39
44
|
/**
|
|
40
45
|
* role of the user that made the action
|
|
@@ -43,25 +43,28 @@ export declare function isFullDocOrLowDocIncome(incomeType: IncomeType): boolean
|
|
|
43
43
|
* Checks if there is some employment for the applicant that has the same employment id as the employment id in the income event
|
|
44
44
|
*
|
|
45
45
|
* @param {PersonApplicant} applicant - An applicant
|
|
46
|
-
* @param {string}
|
|
46
|
+
* @param {string} lookupId - Could be EmploymentId or x_EmployerId
|
|
47
|
+
* @param lookupField
|
|
47
48
|
* @returns {boolean} - Whether or not the applicant has an employment with matching employmentId
|
|
48
49
|
*/
|
|
49
|
-
export declare const
|
|
50
|
+
export declare const hasMatchingEmployment: (lookupField: string) => (applicant: PersonApplicant, lookupId: string) => boolean;
|
|
50
51
|
/**
|
|
51
52
|
* Gets the applicant id using the employment id
|
|
52
53
|
*
|
|
53
54
|
* @param {PersonApplicant[]} applicants - An array of applicants.
|
|
54
55
|
* @param {string} employmentId - Employment ID
|
|
56
|
+
* @param lookupId
|
|
57
|
+
* @param lookupField
|
|
55
58
|
* @returns {string | undefined} - Applicant id or undefined
|
|
56
59
|
*/
|
|
57
|
-
export declare function
|
|
60
|
+
export declare function getApplicantIdFromEmployment(applicants: PersonApplicant[], lookupId: string, lookupField: string): string | undefined;
|
|
58
61
|
/**
|
|
59
62
|
* @description Get an applicantId from the event or the applicants.
|
|
60
63
|
* @param {Income} income Income.
|
|
61
64
|
* @param {PersonApplicant[]} applicants An array of LIXI applicants.
|
|
62
65
|
* @returns {string | undefined} An applicantId or undefined.
|
|
63
66
|
*/
|
|
64
|
-
export declare function getApplicantId({ percentOwned, employmentId }: Income, applicants?: PersonApplicant[]): string | undefined;
|
|
67
|
+
export declare function getApplicantId({ percentOwned, employmentId, companyId }: Income, applicants?: PersonApplicant[]): string | undefined;
|
|
65
68
|
/**
|
|
66
69
|
* @description Sort Business Income By Year.
|
|
67
70
|
* @param incomeA Income Details for Self Employed Full Doc.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sortBusinessIncome = exports.getApplicantId = exports.
|
|
3
|
+
exports.sortBusinessIncome = exports.getApplicantId = exports.getApplicantIdFromEmployment = exports.hasMatchingEmployment = exports.isFullDocOrLowDocIncome = exports.isOtherIncomeWithDesc = exports.isOtherIncome = exports.isRentalIncome = exports.isSelfEmployedIncome = exports.isPaygIncome = exports.otherIncomeList = exports.PAYGList = exports.descriptionOtherIncomeTypes = void 0;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
const public_income_1 = require("../types/events/public-income");
|
|
6
6
|
exports.descriptionOtherIncomeTypes = [
|
|
@@ -86,40 +86,47 @@ exports.isFullDocOrLowDocIncome = isFullDocOrLowDocIncome;
|
|
|
86
86
|
* Checks if there is some employment for the applicant that has the same employment id as the employment id in the income event
|
|
87
87
|
*
|
|
88
88
|
* @param {PersonApplicant} applicant - An applicant
|
|
89
|
-
* @param {string}
|
|
89
|
+
* @param {string} lookupId - Could be EmploymentId or x_EmployerId
|
|
90
|
+
* @param lookupField
|
|
90
91
|
* @returns {boolean} - Whether or not the applicant has an employment with matching employmentId
|
|
91
92
|
*/
|
|
92
|
-
const
|
|
93
|
-
const id = (0, lodash_1.get)(employment,
|
|
94
|
-
(0, lodash_1.get)(employment,
|
|
95
|
-
(0, lodash_1.get)(employment,
|
|
96
|
-
return id ===
|
|
93
|
+
const hasMatchingEmployment = (lookupField) => (applicant, lookupId) => (applicant.Employment || []).some((employment) => {
|
|
94
|
+
const id = (0, lodash_1.get)(employment, `PAYG.${lookupField}`) ||
|
|
95
|
+
(0, lodash_1.get)(employment, `SelfEmployed.${lookupField}`) ||
|
|
96
|
+
(0, lodash_1.get)(employment, `NotEmployed.${lookupField}`);
|
|
97
|
+
return id === lookupId;
|
|
97
98
|
});
|
|
98
|
-
exports.
|
|
99
|
+
exports.hasMatchingEmployment = hasMatchingEmployment;
|
|
99
100
|
/**
|
|
100
101
|
* Gets the applicant id using the employment id
|
|
101
102
|
*
|
|
102
103
|
* @param {PersonApplicant[]} applicants - An array of applicants.
|
|
103
104
|
* @param {string} employmentId - Employment ID
|
|
105
|
+
* @param lookupId
|
|
106
|
+
* @param lookupField
|
|
104
107
|
* @returns {string | undefined} - Applicant id or undefined
|
|
105
108
|
*/
|
|
106
|
-
function
|
|
109
|
+
function getApplicantIdFromEmployment(applicants, lookupId, lookupField) {
|
|
107
110
|
let applicantId;
|
|
108
|
-
if (applicants &&
|
|
109
|
-
const applicant = applicants.find((applicant) => (0, exports.
|
|
111
|
+
if (applicants && lookupId) {
|
|
112
|
+
const applicant = applicants.find((applicant) => (0, exports.hasMatchingEmployment)(lookupField)(applicant, lookupId));
|
|
110
113
|
applicantId = applicant === null || applicant === void 0 ? void 0 : applicant['@UniqueID'];
|
|
111
114
|
}
|
|
112
115
|
return applicantId;
|
|
113
116
|
}
|
|
114
|
-
exports.
|
|
117
|
+
exports.getApplicantIdFromEmployment = getApplicantIdFromEmployment;
|
|
115
118
|
/**
|
|
116
119
|
* @description Get an applicantId from the event or the applicants.
|
|
117
120
|
* @param {Income} income Income.
|
|
118
121
|
* @param {PersonApplicant[]} applicants An array of LIXI applicants.
|
|
119
122
|
* @returns {string | undefined} An applicantId or undefined.
|
|
120
123
|
*/
|
|
121
|
-
function getApplicantId({ percentOwned, employmentId }, applicants = []) {
|
|
122
|
-
return (0, lodash_1.get)(percentOwned, 'owners[0].applicantId') ||
|
|
124
|
+
function getApplicantId({ percentOwned, employmentId, companyId }, applicants = []) {
|
|
125
|
+
return ((0, lodash_1.get)(percentOwned, 'owners[0].applicantId') ||
|
|
126
|
+
// for company applicant
|
|
127
|
+
getApplicantIdFromEmployment(applicants, employmentId, '@UniqueID') ||
|
|
128
|
+
// for selfemployed
|
|
129
|
+
getApplicantIdFromEmployment(applicants, companyId, '@x_Employer'));
|
|
123
130
|
}
|
|
124
131
|
exports.getApplicantId = getApplicantId;
|
|
125
132
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lendi/act-credit-decisions-transform",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
|
+
"private": false,
|
|
4
5
|
"description": "Library for kafka event data transforming",
|
|
5
6
|
"author": "Integrations <integrations@lendi.com.au>",
|
|
6
7
|
"homepage": "https://bitbucket.org/lendi-dev/integrations-shared-packages#readme",
|
|
@@ -22,13 +23,14 @@
|
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@lendi/integrations-credit-protocol": "1.18.8",
|
|
25
|
-
"@lendi/act-eac-integrations-protocol": "3.1.
|
|
26
|
+
"@lendi/act-eac-integrations-protocol": "3.1.8",
|
|
26
27
|
"clean-deep": "^3.4.0",
|
|
27
28
|
"date-fns": "2.19.0",
|
|
28
29
|
"lodash": "^4.17.15"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
|
-
"pino": "^8.1.0"
|
|
32
|
+
"pino": "^8.1.0",
|
|
33
|
+
"uuid": "^8.3.2"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
36
|
"@lendi/prettier-config": "^1.0.0",
|
package/CHANGELOG.md
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# 1.9.0
|
|
2
|
-
|
|
3
|
-
Changes
|
|
4
|
-
|
|
5
|
-
- Clone from https://bitbucket.org/lendi-dev/integrations-shared-packages/commits/f1ac57093b49cc53f872cb3986d006ad90d49b10
|
|
6
|
-
|
|
7
|
-
# 1.8.6
|
|
8
|
-
|
|
9
|
-
Changes
|
|
10
|
-
|
|
11
|
-
- Update `merge-application` to merge the company applicant directors
|
|
12
|
-
|
|
13
|
-
# 1.8.5
|
|
14
|
-
|
|
15
|
-
Changes
|
|
16
|
-
|
|
17
|
-
- Update `transfrom-funding-position` to set pledge amount on application if it exists in property
|
|
18
|
-
|
|
19
|
-
# 1.8.4
|
|
20
|
-
|
|
21
|
-
Changes
|
|
22
|
-
|
|
23
|
-
- Update `applicant-event` to include SIMPLE_OR_BARE trust type and update mapping in transform
|
|
24
|
-
|
|
25
|
-
# 1.8.3
|
|
26
|
-
|
|
27
|
-
Changes
|
|
28
|
-
|
|
29
|
-
- Update `@lendi/transform-events` to support company applicant mappings
|
|
30
|
-
|
|
31
|
-
# 1.8.2
|
|
32
|
-
|
|
33
|
-
Changes
|
|
34
|
-
|
|
35
|
-
- Use `@lendi/integrations-protocol@2.7.4`
|
|
36
|
-
|
|
37
|
-
# 1.8.1
|
|
38
|
-
|
|
39
|
-
Changes
|
|
40
|
-
|
|
41
|
-
- Update `transformApplicationWorkflow` to support `applicationStatus`
|
|
42
|
-
- Use `@lendi/integrations-protocol@2.7.2`
|
|
43
|
-
|
|
44
|
-
# 1.7.3
|
|
45
|
-
|
|
46
|
-
Fix
|
|
47
|
-
|
|
48
|
-
- Remove some unnecessary `additionalProperties` from event schema to void AJV warning msg
|
|
49
|
-
|
|
50
|
-
# 1.7.0
|
|
51
|
-
|
|
52
|
-
BREAKING CHANGES
|
|
53
|
-
|
|
54
|
-
- Change to use `@lendi/integration-protocols@2.7.0` for better Identification fields support
|
|
55
|
-
|
|
56
|
-
# 1.6.0
|
|
57
|
-
|
|
58
|
-
BREAKING CHANGES
|
|
59
|
-
|
|
60
|
-
- Change to module `commonjs` to make it compatible with existing codebase
|
|
61
|
-
|
|
62
|
-
Changes
|
|
63
|
-
|
|
64
|
-
- Upgrade `@lendi/integrations-protocol` to `v2.6.4`
|