@lendi/integrations-transform 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +26 -10
- package/lib/logger.js +5 -2
- package/lib/transform-events/generate-asset-liability-link.js +12 -8
- package/lib/transform-events/generate-credit-report-rebuilt.js +12 -8
- package/lib/transform-events/generate-employment.js +41 -37
- package/lib/transform-events/generate-required-document.js +41 -32
- package/lib/transform-events/transform-applicant.js +60 -53
- package/lib/transform-events/transform-application-workflow.js +9 -5
- package/lib/transform-events/transform-application.js +22 -18
- package/lib/transform-events/transform-asset-address.js +25 -19
- package/lib/transform-events/transform-asset.js +128 -118
- package/lib/transform-events/transform-expenses.js +39 -31
- package/lib/transform-events/transform-funding-position.js +32 -27
- package/lib/transform-events/transform-income.js +73 -65
- package/lib/transform-events/transform-liability.js +59 -55
- package/lib/transform-events/transform-percent-owned.js +7 -3
- package/lib/types/enum-mappings/alieo-frequency.js +22 -19
- package/lib/types/enum-mappings/asset-type.js +16 -13
- package/lib/types/enum-mappings/builder-type.js +8 -5
- package/lib/types/enum-mappings/construction-type.js +9 -6
- package/lib/types/enum-mappings/country-code.js +245 -242
- package/lib/types/enum-mappings/employment-basis.js +11 -8
- package/lib/types/enum-mappings/expense-frequency.js +10 -7
- package/lib/types/enum-mappings/funding-position.js +32 -29
- package/lib/types/enum-mappings/government-benefits.js +9 -6
- package/lib/types/enum-mappings/guarantor-relationship-type.js +15 -12
- package/lib/types/enum-mappings/housing-status.js +14 -11
- package/lib/types/enum-mappings/income-type.js +15 -12
- package/lib/types/enum-mappings/index.js +43 -27
- package/lib/types/enum-mappings/liability-payment-type.js +8 -5
- package/lib/types/enum-mappings/liability-type.js +20 -17
- package/lib/types/enum-mappings/living-expense.js +29 -26
- package/lib/types/enum-mappings/marital-status.js +11 -8
- package/lib/types/enum-mappings/postcode.js +13 -10
- package/lib/types/enum-mappings/preferred-repayment.js +9 -6
- package/lib/types/enum-mappings/proof-of-identity.js +9 -6
- package/lib/types/enum-mappings/property-expense-category.js +10 -7
- package/lib/types/enum-mappings/public-financial-asset.js +11 -8
- package/lib/types/enum-mappings/public-primary-purpose.js +8 -5
- package/lib/types/enum-mappings/public-property-status.js +10 -7
- package/lib/types/enum-mappings/public-property-type.js +22 -19
- package/lib/types/enum-mappings/residency-status.js +10 -7
- package/lib/types/enum-mappings/title-gender.js +12 -9
- package/lib/types/enum-mappings/title.js +12 -9
- package/lib/types/enum-mappings/to-be-purchased.js +7 -4
- package/lib/types/enum-mappings/to-be-used-as-security.js +7 -4
- package/lib/types/enum-mappings/transaction-type.js +8 -5
- package/lib/types/enum-mappings/verification.js +12 -9
- package/lib/types/events/applicant-delete.js +7 -4
- package/lib/types/events/application-workflow.js +13 -10
- package/lib/types/events/asset-delete.js +7 -4
- package/lib/types/events/asset-liability-relation-delete.js +7 -4
- package/lib/types/events/credit-report-retrieved.js +7 -4
- package/lib/types/events/employment-delete.js +5 -2
- package/lib/types/events/expense-delete.js +5 -2
- package/lib/types/events/funding-position.js +9 -6
- package/lib/types/events/income-delete.js +7 -4
- package/lib/types/events/liability-delete.js +5 -2
- package/lib/types/events/opportunity.js +9 -6
- package/lib/types/events/public-applicant.js +31 -28
- package/lib/types/events/public-application.js +29 -26
- package/lib/types/events/public-asset-liability-relation.js +7 -4
- package/lib/types/events/public-asset.js +29 -26
- package/lib/types/events/public-employment.js +21 -18
- package/lib/types/events/public-expense.js +11 -8
- package/lib/types/events/public-funding-position.js +5 -2
- package/lib/types/events/public-income.js +15 -12
- package/lib/types/events/public-liability.js +19 -16
- package/lib/types/events/public-required-document.js +17 -14
- package/lib/types/partial-application.js +2 -1
- package/lib/types/recursive-partial.js +2 -1
- package/lib/update-application/merge-application.js +6 -2
- package/lib/update-application/update-primary-applicant.js +17 -12
- package/lib/utils/address-tools.js +43 -33
- package/lib/utils/clean-up.js +7 -3
- package/lib/utils/formatYesNo.js +6 -2
- package/lib/utils/generate-address.js +26 -21
- package/lib/utils/get-financial-institution.js +8 -4
- package/lib/utils/is-asset-type.js +20 -13
- package/lib/utils/is-income-type.js +58 -45
- package/lib/utils/iso-date.js +6 -2
- package/lib/utils/normalise-date.js +5 -1
- package/lib/utils/round-decimal.js +5 -1
- package/package.json +2 -2
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFees = exports.transformFundingPosition = void 0;
|
|
4
|
+
const lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
|
|
5
|
+
const application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
|
|
6
|
+
const lodash_1 = require("lodash");
|
|
7
|
+
const enum_mappings_1 = require("../types/enum-mappings");
|
|
5
8
|
/**
|
|
6
9
|
* GenerateFundingPosition
|
|
7
10
|
*
|
|
@@ -9,18 +12,18 @@ import { categoryMapping, typeMapping, descriptionMapping, contributionMapping }
|
|
|
9
12
|
* @param uniqueIdSuffix
|
|
10
13
|
* @returns partialApplication with fees, grants and borrowers contributions added.
|
|
11
14
|
*/
|
|
12
|
-
|
|
15
|
+
function transformFundingPosition(fundingPosition, uniqueIdSuffix = 'loanDetails') {
|
|
13
16
|
const partialApplication = {};
|
|
14
17
|
const contributionFunds = [];
|
|
15
18
|
const { applicationId, id, lmi = 0, lmiIncluded = false } = fundingPosition;
|
|
16
19
|
const fundingPositionMapping = {
|
|
17
|
-
applicationId: paths.ApplicationId,
|
|
18
|
-
fundsRequested: `${paths.RolledUpAmounts}.@TotalNewFunds`,
|
|
19
|
-
lvr: `${paths.Summary}.LoanToValuationRatio.@ApplicationLVR`,
|
|
20
|
-
totalGovernmentContributions: paths.ContributionFunds,
|
|
21
|
-
totalDeposit: paths.ContributionFunds,
|
|
22
|
-
totalCashOut: `${paths.EquityRelease}.Amount.@LumpSum`,
|
|
23
|
-
fundsRequiredBreakdown: paths.SummaryFee,
|
|
20
|
+
applicationId: application_paths_1.paths.ApplicationId,
|
|
21
|
+
fundsRequested: `${application_paths_1.paths.RolledUpAmounts}.@TotalNewFunds`,
|
|
22
|
+
lvr: `${application_paths_1.paths.Summary}.LoanToValuationRatio.@ApplicationLVR`,
|
|
23
|
+
totalGovernmentContributions: application_paths_1.paths.ContributionFunds,
|
|
24
|
+
totalDeposit: application_paths_1.paths.ContributionFunds,
|
|
25
|
+
totalCashOut: `${application_paths_1.paths.EquityRelease}.Amount.@LumpSum`,
|
|
26
|
+
fundsRequiredBreakdown: application_paths_1.paths.SummaryFee,
|
|
24
27
|
};
|
|
25
28
|
for (const [key, value] of Object.entries(fundingPosition)) {
|
|
26
29
|
if (fundingPositionMapping[key]) {
|
|
@@ -29,29 +32,30 @@ export function transformFundingPosition(fundingPosition, uniqueIdSuffix = 'loan
|
|
|
29
32
|
case 'totalDeposit':
|
|
30
33
|
contributionFunds.push({
|
|
31
34
|
'@Amount': value,
|
|
32
|
-
'@Type': contributionMapping[key],
|
|
35
|
+
'@Type': enum_mappings_1.contributionMapping[key],
|
|
33
36
|
'@UniqueID': `${id}-${key}`,
|
|
34
37
|
});
|
|
35
38
|
break;
|
|
36
39
|
case 'fundsRequiredBreakdown':
|
|
37
|
-
set(partialApplication, paths.SummaryFee, getFees(value, lmi, lmiIncluded, id));
|
|
40
|
+
(0, lodash_1.set)(partialApplication, application_paths_1.paths.SummaryFee, getFees(value, lmi, lmiIncluded, id));
|
|
38
41
|
break;
|
|
39
42
|
case 'totalCashOut':
|
|
40
|
-
set(partialApplication, fundingPositionMapping[key], value);
|
|
41
|
-
set(partialApplication, `${paths.LoanDetail}.@UniqueID`, `${applicationId}-${uniqueIdSuffix}`);
|
|
43
|
+
(0, lodash_1.set)(partialApplication, fundingPositionMapping[key], value);
|
|
44
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.LoanDetail}.@UniqueID`, `${applicationId}-${uniqueIdSuffix}`);
|
|
42
45
|
break;
|
|
43
46
|
case 'fundsRequested':
|
|
44
|
-
set(partialApplication, fundingPositionMapping[key], Math.round(value));
|
|
47
|
+
(0, lodash_1.set)(partialApplication, fundingPositionMapping[key], Math.round(value));
|
|
45
48
|
break;
|
|
46
49
|
default:
|
|
47
|
-
set(partialApplication, fundingPositionMapping[key], value);
|
|
50
|
+
(0, lodash_1.set)(partialApplication, fundingPositionMapping[key], value);
|
|
48
51
|
break;
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
|
-
set(partialApplication, paths.ContributionFunds, contributionFunds);
|
|
55
|
+
(0, lodash_1.set)(partialApplication, application_paths_1.paths.ContributionFunds, contributionFunds);
|
|
53
56
|
return partialApplication;
|
|
54
57
|
}
|
|
58
|
+
exports.transformFundingPosition = transformFundingPosition;
|
|
55
59
|
/**
|
|
56
60
|
* getFee
|
|
57
61
|
*
|
|
@@ -61,29 +65,30 @@ export function transformFundingPosition(fundingPosition, uniqueIdSuffix = 'loan
|
|
|
61
65
|
* @param id
|
|
62
66
|
* @returns Array of fees
|
|
63
67
|
*/
|
|
64
|
-
|
|
68
|
+
function getFees(fundsRequiredBreakDown, lmi, lmiIncluded, id) {
|
|
65
69
|
// Adding lmi to fees to be transformed.
|
|
66
|
-
set(fundsRequiredBreakDown, 'lmi', lmi);
|
|
70
|
+
(0, lodash_1.set)(fundsRequiredBreakDown, 'lmi', lmi);
|
|
67
71
|
// Omitting constructionCosts as they don't belong in fees.
|
|
68
|
-
return Object.entries(omit(fundsRequiredBreakDown, 'constructionCosts')).map(([key, value]) => {
|
|
72
|
+
return Object.entries((0, lodash_1.omit)(fundsRequiredBreakDown, 'constructionCosts')).map(([key, value]) => {
|
|
69
73
|
const descriptionList = ['accruedInterest', 'otherSundries'];
|
|
70
74
|
const fee = {
|
|
71
75
|
'@Amount': value,
|
|
72
|
-
'@Category': categoryMapping[key],
|
|
73
|
-
'@Type': typeMapping[key],
|
|
76
|
+
'@Category': enum_mappings_1.categoryMapping[key],
|
|
77
|
+
'@Type': enum_mappings_1.typeMapping[key],
|
|
74
78
|
'@UniqueID': `${id}-${key}`,
|
|
75
79
|
};
|
|
76
80
|
if (descriptionList.includes(key)) {
|
|
77
|
-
fee['@Description'] = descriptionMapping[key];
|
|
81
|
+
fee['@Description'] = enum_mappings_1.descriptionMapping[key];
|
|
78
82
|
}
|
|
79
83
|
if (key === 'lmi') {
|
|
80
84
|
if (lmiIncluded)
|
|
81
|
-
fee['@CapitaliseFee'] = YesNoList.Yes;
|
|
85
|
+
fee['@CapitaliseFee'] = lixi_internal_request_1.YesNoList.Yes;
|
|
82
86
|
// If lmiIncluded is undefined we do not want to set '@CapitaliseFee'
|
|
83
87
|
// only if it is false as this will affect how we handle migration.
|
|
84
88
|
if (lmiIncluded === false)
|
|
85
|
-
fee['@CapitaliseFee'] = YesNoList.No;
|
|
89
|
+
fee['@CapitaliseFee'] = lixi_internal_request_1.YesNoList.No;
|
|
86
90
|
}
|
|
87
91
|
return fee;
|
|
88
92
|
});
|
|
89
93
|
}
|
|
94
|
+
exports.getFees = getFees;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
3
|
var t = {};
|
|
3
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -9,51 +10,53 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
10
|
}
|
|
10
11
|
return t;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.generateBAS = exports.generateIncomeBusinessDetails = exports.createRentalIncome = exports.transformIncome = exports.getIncomeMapping = exports.EmploymentIncomeTypeMapping = void 0;
|
|
15
|
+
const lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
|
|
16
|
+
const application_paths_1 = require("@lendi/integrations-credit-protocol/utils/application-paths");
|
|
17
|
+
const lodash_1 = require("lodash");
|
|
18
|
+
const enum_mappings_1 = require("../types/enum-mappings");
|
|
19
|
+
const public_income_1 = require("../types/events/public-income");
|
|
20
|
+
const is_income_type_1 = require("../utils/is-income-type");
|
|
21
|
+
const round_decimal_1 = require("../utils/round-decimal");
|
|
22
|
+
const transform_percent_owned_1 = require("./transform-percent-owned");
|
|
20
23
|
const netWorkAllowanceAmount = 'Income.@NetWorkAllowanceAmount';
|
|
21
24
|
const netWorkAllowanceFrequency = 'Income.@NetWorkAllowanceFrequency';
|
|
22
25
|
// Income types mapping from internal to LIXI types /paths.
|
|
23
|
-
|
|
24
|
-
[IncomeType.PaygAllowancesNotTaxed]: {
|
|
26
|
+
exports.EmploymentIncomeTypeMapping = {
|
|
27
|
+
[public_income_1.IncomeType.PaygAllowancesNotTaxed]: {
|
|
25
28
|
amount: 'Income.@WorkAllowanceAmount',
|
|
26
29
|
frequency: 'Income.@WorkAllowanceFrequency',
|
|
27
30
|
},
|
|
28
|
-
[IncomeType.PaygAllowancesTaxed]: {
|
|
31
|
+
[public_income_1.IncomeType.PaygAllowancesTaxed]: {
|
|
29
32
|
amount: netWorkAllowanceAmount,
|
|
30
33
|
frequency: netWorkAllowanceFrequency,
|
|
31
34
|
},
|
|
32
|
-
[IncomeType.PaygBaseSalary]: {
|
|
35
|
+
[public_income_1.IncomeType.PaygBaseSalary]: {
|
|
33
36
|
amount: 'Income.@GrossSalaryAmount',
|
|
34
37
|
frequency: 'Income.@GrossSalaryFrequency',
|
|
35
38
|
},
|
|
36
|
-
[IncomeType.PaygBonusIncome]: {
|
|
39
|
+
[public_income_1.IncomeType.PaygBonusIncome]: {
|
|
37
40
|
amount: 'Income.@BonusAmount',
|
|
38
41
|
frequency: 'Income.@BonusFrequency',
|
|
39
42
|
},
|
|
40
|
-
[IncomeType.PaygCommissionIncome]: {
|
|
43
|
+
[public_income_1.IncomeType.PaygCommissionIncome]: {
|
|
41
44
|
amount: 'Income.@CommissionAmount',
|
|
42
45
|
frequency: 'Income.@CommissionFrequency',
|
|
43
46
|
},
|
|
44
|
-
[IncomeType.PaygCompanyCar]: {
|
|
47
|
+
[public_income_1.IncomeType.PaygCompanyCar]: {
|
|
45
48
|
amount: 'Income.@NetCarAllowanceAmount',
|
|
46
49
|
frequency: 'Income.@NetCarAllowanceFrequency',
|
|
47
50
|
},
|
|
48
|
-
[IncomeType.PaygCarAllowance]: {
|
|
51
|
+
[public_income_1.IncomeType.PaygCarAllowance]: {
|
|
49
52
|
amount: 'Income.@CarAllowanceAmount',
|
|
50
53
|
frequency: 'Income.@CarAllowanceFrequency',
|
|
51
54
|
},
|
|
52
|
-
[IncomeType.PaygOvertimeIncome]: {
|
|
55
|
+
[public_income_1.IncomeType.PaygOvertimeIncome]: {
|
|
53
56
|
amount: 'Income.@GrossRegularOvertimeAmount',
|
|
54
57
|
frequency: 'Income.@GrossRegularOvertimeFrequency',
|
|
55
58
|
},
|
|
56
|
-
[IncomeType.SelfEmployedBusinessIncome]: {
|
|
59
|
+
[public_income_1.IncomeType.SelfEmployedBusinessIncome]: {
|
|
57
60
|
amount: 'BusinessIncomeRecent.@ProfitBeforeTax',
|
|
58
61
|
},
|
|
59
62
|
};
|
|
@@ -61,17 +64,17 @@ export const EmploymentIncomeTypeMapping = {
|
|
|
61
64
|
*
|
|
62
65
|
* @param incomeType
|
|
63
66
|
*/
|
|
64
|
-
|
|
65
|
-
let basePath = paths.OtherIncome;
|
|
66
|
-
if (isRentalIncome(incomeType)) {
|
|
67
|
-
basePath = paths.RealEstateAsset;
|
|
67
|
+
function getIncomeMapping(incomeType) {
|
|
68
|
+
let basePath = application_paths_1.paths.OtherIncome;
|
|
69
|
+
if ((0, is_income_type_1.isRentalIncome)(incomeType)) {
|
|
70
|
+
basePath = application_paths_1.paths.RealEstateAsset;
|
|
68
71
|
return {
|
|
69
72
|
assetId: `${basePath}.@UniqueID`,
|
|
70
73
|
percentOwned: `${basePath}.RentalIncome`,
|
|
71
74
|
};
|
|
72
75
|
}
|
|
73
|
-
if (isFullDocOrLowDocIncome(incomeType)) {
|
|
74
|
-
basePath = paths.CompanyApplicant;
|
|
76
|
+
if ((0, is_income_type_1.isFullDocOrLowDocIncome)(incomeType)) {
|
|
77
|
+
basePath = application_paths_1.paths.CompanyApplicant;
|
|
75
78
|
return {
|
|
76
79
|
bas: `${basePath}.Income[0].BusinessActivityStatement`,
|
|
77
80
|
companyId: `${basePath}.@UniqueID`,
|
|
@@ -79,17 +82,17 @@ export function getIncomeMapping(incomeType) {
|
|
|
79
82
|
gross: `${basePath}.DeclaredIncome.@IncomeAmount`,
|
|
80
83
|
};
|
|
81
84
|
}
|
|
82
|
-
if (isSelfEmployedIncome(incomeType)) {
|
|
83
|
-
basePath = paths.SelfEmployed;
|
|
84
|
-
const { amount } = EmploymentIncomeTypeMapping[incomeType];
|
|
85
|
+
if ((0, is_income_type_1.isSelfEmployedIncome)(incomeType)) {
|
|
86
|
+
basePath = application_paths_1.paths.SelfEmployed;
|
|
87
|
+
const { amount } = exports.EmploymentIncomeTypeMapping[incomeType];
|
|
85
88
|
return {
|
|
86
89
|
amount: `${basePath}.${amount}`,
|
|
87
90
|
employmentId: `${basePath}.@UniqueID`,
|
|
88
91
|
};
|
|
89
92
|
}
|
|
90
|
-
if (isPaygIncome(incomeType)) {
|
|
91
|
-
basePath = paths.PAYG;
|
|
92
|
-
const { amount, frequency } = EmploymentIncomeTypeMapping[incomeType];
|
|
93
|
+
if ((0, is_income_type_1.isPaygIncome)(incomeType)) {
|
|
94
|
+
basePath = application_paths_1.paths.PAYG;
|
|
95
|
+
const { amount, frequency } = exports.EmploymentIncomeTypeMapping[incomeType];
|
|
93
96
|
return Object.assign({ amount: `${basePath}.${amount}`, employmentId: `${basePath}.@UniqueID` }, (frequency && { frequency: `${basePath}.${frequency}` }));
|
|
94
97
|
}
|
|
95
98
|
return {
|
|
@@ -100,6 +103,7 @@ export function getIncomeMapping(incomeType) {
|
|
|
100
103
|
benefitType: `${basePath}.@GovernmentBenefitsType`,
|
|
101
104
|
};
|
|
102
105
|
}
|
|
106
|
+
exports.getIncomeMapping = getIncomeMapping;
|
|
103
107
|
/**
|
|
104
108
|
* Generates an partial application from a partial income event.
|
|
105
109
|
*
|
|
@@ -107,72 +111,73 @@ export function getIncomeMapping(incomeType) {
|
|
|
107
111
|
* @param applicantId PersonApplicant uniqueId on the application.
|
|
108
112
|
* @returns partialApplication an incomplete application.
|
|
109
113
|
*/
|
|
110
|
-
|
|
114
|
+
function transformIncome(payload, applicantId) {
|
|
111
115
|
const { applicationId, id, income } = payload;
|
|
112
116
|
const { amount: incomeAmount, type: incomeType, frequency: incomeFrequency } = income;
|
|
113
117
|
const partialApplication = {};
|
|
114
|
-
set(partialApplication, paths.ApplicationId, applicationId);
|
|
115
|
-
if (!isRentalIncome(incomeType) && applicantId) {
|
|
116
|
-
set(partialApplication, `${paths.PersonApplicant}.@UniqueID`, applicantId);
|
|
118
|
+
(0, lodash_1.set)(partialApplication, application_paths_1.paths.ApplicationId, applicationId);
|
|
119
|
+
if (!(0, is_income_type_1.isRentalIncome)(incomeType) && applicantId) {
|
|
120
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@UniqueID`, applicantId);
|
|
117
121
|
}
|
|
118
|
-
if (isOtherIncome(incomeType)) {
|
|
119
|
-
set(partialApplication, `${paths.OtherIncome}.@UniqueID`, id);
|
|
122
|
+
if ((0, is_income_type_1.isOtherIncome)(incomeType)) {
|
|
123
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.OtherIncome}.@UniqueID`, id);
|
|
120
124
|
}
|
|
121
125
|
const incomeMapping = getIncomeMapping(incomeType);
|
|
122
126
|
for (const [key, value] of Object.entries(income)) {
|
|
123
127
|
if (incomeMapping[key]) {
|
|
124
128
|
switch (key) {
|
|
125
129
|
case 'amount':
|
|
126
|
-
const amount = incomeFrequency === Frequency.Quarterly ? value * 4 : value;
|
|
127
|
-
set(partialApplication, incomeMapping[key], roundDecimal(amount));
|
|
130
|
+
const amount = incomeFrequency === public_income_1.Frequency.Quarterly ? value * 4 : value;
|
|
131
|
+
(0, lodash_1.set)(partialApplication, incomeMapping[key], (0, round_decimal_1.roundDecimal)(amount));
|
|
128
132
|
break;
|
|
129
133
|
case 'bas':
|
|
130
134
|
const basWithAmount = value.filter((bas) => bas.salesAmount !== undefined || false);
|
|
131
|
-
if (!isEmpty(basWithAmount))
|
|
132
|
-
set(partialApplication, incomeMapping[key], generateBAS(basWithAmount));
|
|
135
|
+
if (!(0, lodash_1.isEmpty)(basWithAmount))
|
|
136
|
+
(0, lodash_1.set)(partialApplication, incomeMapping[key], generateBAS(basWithAmount));
|
|
133
137
|
break;
|
|
134
138
|
case 'frequency':
|
|
135
|
-
set(partialApplication, incomeMapping[key],
|
|
139
|
+
(0, lodash_1.set)(partialApplication, incomeMapping[key], enum_mappings_1.incomeExpenseFrequencyMapping[value]);
|
|
136
140
|
break;
|
|
137
141
|
case 'percentOwned':
|
|
138
142
|
const ownership = value;
|
|
139
|
-
let percentOwned = transformPercentOwned(ownership);
|
|
140
|
-
if (isRentalIncome(incomeType)) {
|
|
143
|
+
let percentOwned = (0, transform_percent_owned_1.transformPercentOwned)(ownership);
|
|
144
|
+
if ((0, is_income_type_1.isRentalIncome)(incomeType)) {
|
|
141
145
|
percentOwned = createRentalIncome(incomeAmount, incomeFrequency, ownership.owners);
|
|
142
146
|
}
|
|
143
147
|
if (percentOwned) {
|
|
144
|
-
set(partialApplication, incomeMapping[key], percentOwned);
|
|
148
|
+
(0, lodash_1.set)(partialApplication, incomeMapping[key], percentOwned);
|
|
145
149
|
}
|
|
146
150
|
break;
|
|
147
151
|
case 'type':
|
|
148
|
-
if (!isRentalIncome(incomeType)) {
|
|
149
|
-
const mappedType = otherIncomeMapping[value];
|
|
150
|
-
if (isOtherIncomeWithDesc(value)) {
|
|
151
|
-
set(partialApplication, `${paths.OtherIncome}.@Description`, mappedType);
|
|
152
|
-
set(partialApplication, incomeMapping[key], OtherIncomeTypeList.OtherIncome);
|
|
152
|
+
if (!(0, is_income_type_1.isRentalIncome)(incomeType)) {
|
|
153
|
+
const mappedType = enum_mappings_1.otherIncomeMapping[value];
|
|
154
|
+
if ((0, is_income_type_1.isOtherIncomeWithDesc)(value)) {
|
|
155
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.OtherIncome}.@Description`, mappedType);
|
|
156
|
+
(0, lodash_1.set)(partialApplication, incomeMapping[key], lixi_internal_request_1.OtherIncomeTypeList.OtherIncome);
|
|
153
157
|
}
|
|
154
158
|
else {
|
|
155
|
-
set(partialApplication, incomeMapping[key], mappedType);
|
|
159
|
+
(0, lodash_1.set)(partialApplication, incomeMapping[key], mappedType);
|
|
156
160
|
}
|
|
157
161
|
}
|
|
158
162
|
break;
|
|
159
163
|
case 'benefitType':
|
|
160
|
-
set(partialApplication, incomeMapping[key], governmentBenefitsMapping[value]);
|
|
164
|
+
(0, lodash_1.set)(partialApplication, incomeMapping[key], enum_mappings_1.governmentBenefitsMapping[value]);
|
|
161
165
|
break;
|
|
162
166
|
case 'incomes':
|
|
163
167
|
const sortedIncomeList = value
|
|
164
|
-
.sort(sortBusinessIncome)
|
|
168
|
+
.sort(is_income_type_1.sortBusinessIncome)
|
|
165
169
|
.map(generateIncomeBusinessDetails);
|
|
166
|
-
set(partialApplication, incomeMapping[key], sortedIncomeList);
|
|
170
|
+
(0, lodash_1.set)(partialApplication, incomeMapping[key], sortedIncomeList);
|
|
167
171
|
break;
|
|
168
172
|
default:
|
|
169
|
-
set(partialApplication, incomeMapping[key], value);
|
|
173
|
+
(0, lodash_1.set)(partialApplication, incomeMapping[key], value);
|
|
170
174
|
break;
|
|
171
175
|
}
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
178
|
return partialApplication;
|
|
175
179
|
}
|
|
180
|
+
exports.transformIncome = transformIncome;
|
|
176
181
|
/**
|
|
177
182
|
* Creates Rental Income array.
|
|
178
183
|
*
|
|
@@ -180,23 +185,24 @@ export function transformIncome(payload, applicantId) {
|
|
|
180
185
|
* @param frequency Frequency
|
|
181
186
|
* @param ownership Owners.
|
|
182
187
|
*/
|
|
183
|
-
|
|
184
|
-
if (frequency === Frequency.Quarterly) {
|
|
188
|
+
function createRentalIncome(amount, frequency, ownership = []) {
|
|
189
|
+
if (frequency === public_income_1.Frequency.Quarterly) {
|
|
185
190
|
amount = Math.ceil(amount / 3);
|
|
186
|
-
frequency = Frequency.Monthly;
|
|
191
|
+
frequency = public_income_1.Frequency.Monthly;
|
|
187
192
|
}
|
|
188
193
|
const rentalIncome = [];
|
|
189
194
|
for (const owner of ownership) {
|
|
190
195
|
const { percent, applicantId } = owner;
|
|
191
|
-
const ownerAmount = roundDecimal(amount * percent);
|
|
196
|
+
const ownerAmount = (0, round_decimal_1.roundDecimal)(amount * percent);
|
|
192
197
|
rentalIncome.push({
|
|
193
|
-
'@Frequency': rentalIncomeFrequencyMapping[frequency],
|
|
198
|
+
'@Frequency': enum_mappings_1.rentalIncomeFrequencyMapping[frequency],
|
|
194
199
|
'@RentalAmount': ownerAmount,
|
|
195
200
|
'@x_Owner': applicantId,
|
|
196
201
|
});
|
|
197
202
|
}
|
|
198
203
|
return rentalIncome;
|
|
199
204
|
}
|
|
205
|
+
exports.createRentalIncome = createRentalIncome;
|
|
200
206
|
const selfEmploymentIncomeMapping = {
|
|
201
207
|
year: '@StartDate',
|
|
202
208
|
companyProfitBeforeTax: '@CompanyProfitBeforeTax',
|
|
@@ -216,7 +222,7 @@ const selfEmploymentIncomeMapping = {
|
|
|
216
222
|
* @param data Financial Year Income Details for Self Employed Income.
|
|
217
223
|
* @returns {IncomeElement} LIXI Income for the Self Employed.
|
|
218
224
|
*/
|
|
219
|
-
|
|
225
|
+
function generateIncomeBusinessDetails(data) {
|
|
220
226
|
const income = {};
|
|
221
227
|
const { addback: addbackMapping } = selfEmploymentIncomeMapping, dateAndIncomeMapping = __rest(selfEmploymentIncomeMapping, ["addback"]);
|
|
222
228
|
for (const [key, value] of Object.entries(data)) {
|
|
@@ -224,29 +230,31 @@ export function generateIncomeBusinessDetails(data) {
|
|
|
224
230
|
if (key === 'addback') {
|
|
225
231
|
for (const [addbackKey, addbackValue] of Object.entries(value)) {
|
|
226
232
|
if (addbackKey === 'other') {
|
|
227
|
-
set(income, 'Addback.OtherAddback[0].@Description', 'other');
|
|
233
|
+
(0, lodash_1.set)(income, 'Addback.OtherAddback[0].@Description', 'other');
|
|
228
234
|
}
|
|
229
|
-
set(income, addbackMapping[addbackKey], addbackValue);
|
|
235
|
+
(0, lodash_1.set)(income, addbackMapping[addbackKey], addbackValue);
|
|
230
236
|
}
|
|
231
237
|
}
|
|
232
238
|
else if (key === 'year') {
|
|
233
|
-
set(income, dateAndIncomeMapping[key], `${value}-01-01`);
|
|
239
|
+
(0, lodash_1.set)(income, dateAndIncomeMapping[key], `${value}-01-01`);
|
|
234
240
|
}
|
|
235
241
|
else {
|
|
236
|
-
set(income, dateAndIncomeMapping[key], value);
|
|
242
|
+
(0, lodash_1.set)(income, dateAndIncomeMapping[key], value);
|
|
237
243
|
}
|
|
238
244
|
}
|
|
239
245
|
}
|
|
240
246
|
return income;
|
|
241
247
|
}
|
|
248
|
+
exports.generateIncomeBusinessDetails = generateIncomeBusinessDetails;
|
|
242
249
|
/**
|
|
243
250
|
* Generates the BAS array from the bas definition on the event.
|
|
244
251
|
*
|
|
245
252
|
* @param bas
|
|
246
253
|
*/
|
|
247
|
-
|
|
254
|
+
function generateBAS(bas) {
|
|
248
255
|
return bas.map((bas) => ({
|
|
249
256
|
'@Quarter': bas.quarter,
|
|
250
257
|
'@SalesAmount': bas.salesAmount,
|
|
251
258
|
}));
|
|
252
259
|
}
|
|
260
|
+
exports.generateBAS = generateBAS;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformLiability = void 0;
|
|
4
|
+
const application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const alieo_frequency_1 = require("../types/enum-mappings/alieo-frequency");
|
|
7
|
+
const enum_mappings_1 = require("../types/enum-mappings");
|
|
8
|
+
const public_liability_1 = require("../types/events/public-liability");
|
|
9
|
+
const get_financial_institution_1 = require("../utils/get-financial-institution");
|
|
10
|
+
const round_decimal_1 = require("../utils/round-decimal");
|
|
11
|
+
const transform_percent_owned_1 = require("./transform-percent-owned");
|
|
12
|
+
const lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
|
|
13
|
+
const lixi_internal_request_2 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
11
14
|
/**
|
|
12
15
|
* Generates a partial internal request from a liability event payload.
|
|
13
16
|
*
|
|
@@ -17,42 +20,42 @@ import { FinancialInstitutionList, UnitsList } from '@lendi/integrations-credit-
|
|
|
17
20
|
* @param liabilityPayload:.liability
|
|
18
21
|
* @returns A partial InternalRequest.
|
|
19
22
|
*/
|
|
20
|
-
|
|
23
|
+
function transformLiability({ applicationId, id, liability }) {
|
|
21
24
|
const partialApplication = {};
|
|
22
25
|
const liabilityMapping = {
|
|
23
|
-
applicationId: paths.ApplicationId,
|
|
24
|
-
annualInterestRate: `${paths.Liability}.@AnnualInterestRate`,
|
|
25
|
-
id: `${paths.Liability}.@UniqueID`,
|
|
26
|
-
clearingFromThisLoan: `${paths.Liability}.@ClearingFromThisLoan`,
|
|
27
|
-
clearingFromOtherSource: `${paths.Liability}.@ClearingFromOtherSource`,
|
|
28
|
-
description: `${paths.Liability}.@Description`,
|
|
29
|
-
financialInstitution: `${paths.Liability}.AccountNumber.@FinancialInstitution`,
|
|
30
|
-
financialInstitutionAccountNumber: `${paths.Liability}.AccountNumber.@AccountNumber`,
|
|
31
|
-
financialInstitutionBsb: `${paths.Liability}.AccountNumber.@BSB`,
|
|
32
|
-
interestOnlyRemainingTerm: `${paths.Liability}.OriginalTerm.@PaymentTypeDuration`,
|
|
33
|
-
creditLimit: `${paths.Liability}.@CreditLimit`,
|
|
34
|
-
newLimit: `${paths.Liability}.@NewLimit`,
|
|
35
|
-
repaymentAmount: `${paths.Liability}.Repayment[0].@RepaymentAmount`,
|
|
36
|
-
repaymentFrequency: `${paths.Liability}.Repayment[0].@RepaymentFrequency`,
|
|
37
|
-
remainingTermDuration: `${paths.Liability}.RemainingTerm.@Duration`,
|
|
38
|
-
repaymentTypeDetails: `${paths.Liability}.Repayment[0].@PaymentType`,
|
|
39
|
-
outstandingBalance: `${paths.Liability}.@OutstandingBalance`,
|
|
40
|
-
type: `${paths.Liability}.@Type`,
|
|
41
|
-
percentOwned: `${paths.Liability}.PercentOwned`,
|
|
26
|
+
applicationId: application_paths_1.paths.ApplicationId,
|
|
27
|
+
annualInterestRate: `${application_paths_1.paths.Liability}.@AnnualInterestRate`,
|
|
28
|
+
id: `${application_paths_1.paths.Liability}.@UniqueID`,
|
|
29
|
+
clearingFromThisLoan: `${application_paths_1.paths.Liability}.@ClearingFromThisLoan`,
|
|
30
|
+
clearingFromOtherSource: `${application_paths_1.paths.Liability}.@ClearingFromOtherSource`,
|
|
31
|
+
description: `${application_paths_1.paths.Liability}.@Description`,
|
|
32
|
+
financialInstitution: `${application_paths_1.paths.Liability}.AccountNumber.@FinancialInstitution`,
|
|
33
|
+
financialInstitutionAccountNumber: `${application_paths_1.paths.Liability}.AccountNumber.@AccountNumber`,
|
|
34
|
+
financialInstitutionBsb: `${application_paths_1.paths.Liability}.AccountNumber.@BSB`,
|
|
35
|
+
interestOnlyRemainingTerm: `${application_paths_1.paths.Liability}.OriginalTerm.@PaymentTypeDuration`,
|
|
36
|
+
creditLimit: `${application_paths_1.paths.Liability}.@CreditLimit`,
|
|
37
|
+
newLimit: `${application_paths_1.paths.Liability}.@NewLimit`,
|
|
38
|
+
repaymentAmount: `${application_paths_1.paths.Liability}.Repayment[0].@RepaymentAmount`,
|
|
39
|
+
repaymentFrequency: `${application_paths_1.paths.Liability}.Repayment[0].@RepaymentFrequency`,
|
|
40
|
+
remainingTermDuration: `${application_paths_1.paths.Liability}.RemainingTerm.@Duration`,
|
|
41
|
+
repaymentTypeDetails: `${application_paths_1.paths.Liability}.Repayment[0].@PaymentType`,
|
|
42
|
+
outstandingBalance: `${application_paths_1.paths.Liability}.@OutstandingBalance`,
|
|
43
|
+
type: `${application_paths_1.paths.Liability}.@Type`,
|
|
44
|
+
percentOwned: `${application_paths_1.paths.Liability}.PercentOwned`,
|
|
42
45
|
};
|
|
43
|
-
set(partialApplication, liabilityMapping.applicationId, applicationId);
|
|
44
|
-
set(partialApplication, liabilityMapping.id, id);
|
|
46
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping.applicationId, applicationId);
|
|
47
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping.id, id);
|
|
45
48
|
// Default repayments to 0 and repaymentFrequency to weekly.
|
|
46
|
-
set(partialApplication, liabilityMapping.repaymentAmount, 0);
|
|
47
|
-
set(partialApplication, liabilityMapping.repaymentFrequency,
|
|
49
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping.repaymentAmount, 0);
|
|
50
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping.repaymentFrequency, lixi_internal_request_1.List.Weekly);
|
|
48
51
|
// Currently repayments is not captured for store cards and credit cards, default the monthly repayment amount to
|
|
49
52
|
// the credit limit with interest rate of 3%.
|
|
50
|
-
if ([LiabilityType.CreditCard, LiabilityType.StoreCard].includes(liability.type) && liability.creditLimit) {
|
|
51
|
-
set(partialApplication, liabilityMapping.repaymentAmount, roundDecimal(liability.creditLimit * 0.03));
|
|
52
|
-
set(partialApplication, liabilityMapping.repaymentFrequency,
|
|
53
|
+
if ([public_liability_1.LiabilityType.CreditCard, public_liability_1.LiabilityType.StoreCard].includes(liability.type) && liability.creditLimit) {
|
|
54
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping.repaymentAmount, (0, round_decimal_1.roundDecimal)(liability.creditLimit * 0.03));
|
|
55
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping.repaymentFrequency, lixi_internal_request_1.List.Monthly);
|
|
53
56
|
}
|
|
54
57
|
// Default clearingFromThisLoan to No if the value is not present in the event.
|
|
55
|
-
set(partialApplication, liabilityMapping.clearingFromThisLoan, YesNoList.No);
|
|
58
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping.clearingFromThisLoan, lixi_internal_request_1.YesNoList.No);
|
|
56
59
|
for (const [key, value] of Object.entries(liability)) {
|
|
57
60
|
if (liabilityMapping[key]) {
|
|
58
61
|
switch (key) {
|
|
@@ -60,48 +63,49 @@ export function transformLiability({ applicationId, id, liability }) {
|
|
|
60
63
|
case 'creditLimit':
|
|
61
64
|
case 'newLimit':
|
|
62
65
|
case 'repaymentAmount':
|
|
63
|
-
set(partialApplication, liabilityMapping[key], roundDecimal(value));
|
|
66
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], (0, round_decimal_1.roundDecimal)(value));
|
|
64
67
|
break;
|
|
65
68
|
case 'interestOnlyRemainingTerm':
|
|
66
|
-
set(partialApplication, liabilityMapping[key], roundDecimal(value));
|
|
67
|
-
set(partialApplication, `${paths.Liability}.OriginalTerm.@PaymentType`, PaymentTypeList.InterestOnly);
|
|
68
|
-
set(partialApplication, `${paths.Liability}.OriginalTerm.@PaymentTypeUnits`, LoanTermUnitsList.Years);
|
|
69
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], (0, round_decimal_1.roundDecimal)(value));
|
|
70
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Liability}.OriginalTerm.@PaymentType`, lixi_internal_request_1.PaymentTypeList.InterestOnly);
|
|
71
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Liability}.OriginalTerm.@PaymentTypeUnits`, lixi_internal_request_1.LoanTermUnitsList.Years);
|
|
69
72
|
break;
|
|
70
73
|
case 'type':
|
|
71
|
-
set(partialApplication, liabilityMapping[key], liabilityTypeMapping[value]);
|
|
74
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], enum_mappings_1.liabilityTypeMapping[value]);
|
|
72
75
|
break;
|
|
73
76
|
case 'clearingFromThisLoan':
|
|
74
|
-
set(partialApplication, liabilityMapping[key], value ? YesNoList.Yes : YesNoList.No);
|
|
77
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], value ? lixi_internal_request_1.YesNoList.Yes : lixi_internal_request_1.YesNoList.No);
|
|
75
78
|
break;
|
|
76
79
|
case 'clearingFromOtherSource':
|
|
77
|
-
if (value === ClearingFromOtherSource.PayingOut)
|
|
78
|
-
set(partialApplication, liabilityMapping[key], YesNoList.Yes);
|
|
80
|
+
if (value === public_liability_1.ClearingFromOtherSource.PayingOut)
|
|
81
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], lixi_internal_request_1.YesNoList.Yes);
|
|
79
82
|
break;
|
|
80
83
|
case 'repaymentFrequency':
|
|
81
|
-
set(partialApplication, liabilityMapping[key],
|
|
84
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], alieo_frequency_1.liabilityFrequencyMapping[value]);
|
|
82
85
|
break;
|
|
83
86
|
case 'repaymentTypeDetails':
|
|
84
|
-
set(partialApplication, liabilityMapping[key], liabilityPaymentTypeMapping[value]);
|
|
87
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], enum_mappings_1.liabilityPaymentTypeMapping[value]);
|
|
85
88
|
break;
|
|
86
89
|
case 'remainingTermDuration':
|
|
87
|
-
set(partialApplication, liabilityMapping[key], Math.round(value * 12));
|
|
88
|
-
set(partialApplication, `${paths.Liability}.RemainingTerm.@Units`, UnitsList.Months);
|
|
90
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], Math.round(value * 12));
|
|
91
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Liability}.RemainingTerm.@Units`, lixi_internal_request_2.UnitsList.Months);
|
|
89
92
|
break;
|
|
90
93
|
case 'financialInstitution':
|
|
91
|
-
const financialInstitution = getFinancialInstitution(value.toString()) || FinancialInstitutionList.Other;
|
|
92
|
-
set(partialApplication, liabilityMapping[key], financialInstitution);
|
|
94
|
+
const financialInstitution = (0, get_financial_institution_1.getFinancialInstitution)(value.toString()) || lixi_internal_request_2.FinancialInstitutionList.Other;
|
|
95
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], financialInstitution);
|
|
93
96
|
break;
|
|
94
97
|
case 'percentOwned':
|
|
95
|
-
const percentOwned = transformPercentOwned(value);
|
|
98
|
+
const percentOwned = (0, transform_percent_owned_1.transformPercentOwned)(value);
|
|
96
99
|
if (percentOwned) {
|
|
97
|
-
set(partialApplication, liabilityMapping[key], percentOwned);
|
|
100
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], percentOwned);
|
|
98
101
|
}
|
|
99
102
|
break;
|
|
100
103
|
default:
|
|
101
|
-
set(partialApplication, liabilityMapping[key], value);
|
|
104
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], value);
|
|
102
105
|
break;
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
return partialApplication;
|
|
107
110
|
}
|
|
111
|
+
exports.transformLiability = transformLiability;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformPercentOwned = void 0;
|
|
4
|
+
const round_decimal_1 = require("../utils/round-decimal");
|
|
2
5
|
/**
|
|
3
6
|
* Transform percentOwned to lixi's format.
|
|
4
7
|
*
|
|
@@ -6,13 +9,14 @@ import { roundDecimal } from '../utils/round-decimal';
|
|
|
6
9
|
* @param percentOwned.owners
|
|
7
10
|
* @returns {LIXIPercentOwned} transformed Lixi PercentOwned.
|
|
8
11
|
*/
|
|
9
|
-
|
|
12
|
+
function transformPercentOwned({ owners = [] }) {
|
|
10
13
|
if (owners.length === 0)
|
|
11
14
|
return null;
|
|
12
15
|
return {
|
|
13
16
|
Owner: owners.map(({ percent, applicantId }) => ({
|
|
14
|
-
'@Percent': roundDecimal(percent * 100),
|
|
17
|
+
'@Percent': (0, round_decimal_1.roundDecimal)(percent * 100),
|
|
15
18
|
'@x_Party': applicantId,
|
|
16
19
|
})),
|
|
17
20
|
};
|
|
18
21
|
}
|
|
22
|
+
exports.transformPercentOwned = transformPercentOwned;
|