@lendi/integrations-transform 1.5.7 → 1.5.10

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.
Files changed (107) hide show
  1. package/lib/index.js +10 -26
  2. package/lib/logger.d.ts +1 -2
  3. package/lib/logger.js +2 -5
  4. package/lib/schemas/application-workflow-event.json +1 -1
  5. package/lib/transform-events/generate-asset-liability-link.d.ts +3 -1
  6. package/lib/transform-events/generate-asset-liability-link.js +14 -18
  7. package/lib/transform-events/generate-credit-report-rebuilt.js +17 -21
  8. package/lib/transform-events/generate-employment.d.ts +1 -1
  9. package/lib/transform-events/generate-employment.js +51 -56
  10. package/lib/transform-events/generate-required-document.d.ts +1 -7
  11. package/lib/transform-events/generate-required-document.js +43 -69
  12. package/lib/transform-events/transform-applicant.d.ts +2 -1
  13. package/lib/transform-events/transform-applicant.js +78 -91
  14. package/lib/transform-events/transform-application-workflow.d.ts +0 -1
  15. package/lib/transform-events/transform-application-workflow.js +9 -14
  16. package/lib/transform-events/transform-application.d.ts +3 -1
  17. package/lib/transform-events/transform-application.js +28 -33
  18. package/lib/transform-events/transform-asset-address.d.ts +8 -2
  19. package/lib/transform-events/transform-asset-address.js +35 -37
  20. package/lib/transform-events/transform-asset.d.ts +7 -1
  21. package/lib/transform-events/transform-asset.js +164 -184
  22. package/lib/transform-events/transform-expenses.d.ts +4 -0
  23. package/lib/transform-events/transform-expenses.js +52 -58
  24. package/lib/transform-events/transform-funding-position.d.ts +2 -2
  25. package/lib/transform-events/transform-funding-position.js +38 -46
  26. package/lib/transform-events/transform-income.d.ts +8 -1
  27. package/lib/transform-events/transform-income.js +121 -139
  28. package/lib/transform-events/transform-liability.d.ts +4 -1
  29. package/lib/transform-events/transform-liability.js +62 -65
  30. package/lib/transform-events/transform-percent-owned.d.ts +1 -0
  31. package/lib/transform-events/transform-percent-owned.js +7 -14
  32. package/lib/types/enum-mappings/alieo-frequency.js +22 -26
  33. package/lib/types/enum-mappings/asset-type.js +14 -18
  34. package/lib/types/enum-mappings/builder-type.js +6 -10
  35. package/lib/types/enum-mappings/construction-type.js +7 -11
  36. package/lib/types/enum-mappings/country-code.js +243 -247
  37. package/lib/types/enum-mappings/employment-basis.js +9 -13
  38. package/lib/types/enum-mappings/expense-frequency.js +8 -12
  39. package/lib/types/enum-mappings/funding-position.js +29 -32
  40. package/lib/types/enum-mappings/government-benefits.js +7 -11
  41. package/lib/types/enum-mappings/housing-status.js +12 -16
  42. package/lib/types/enum-mappings/income-type.js +13 -17
  43. package/lib/types/enum-mappings/index.js +27 -43
  44. package/lib/types/enum-mappings/liability-payment-type.js +6 -10
  45. package/lib/types/enum-mappings/liability-type.js +18 -22
  46. package/lib/types/enum-mappings/living-expense.js +27 -31
  47. package/lib/types/enum-mappings/marital-status.js +9 -13
  48. package/lib/types/enum-mappings/postcode.js +11 -15
  49. package/lib/types/enum-mappings/preferred-repayment.js +7 -11
  50. package/lib/types/enum-mappings/proof-of-identity.js +7 -11
  51. package/lib/types/enum-mappings/property-expense-category.js +8 -12
  52. package/lib/types/enum-mappings/public-financial-asset.js +9 -13
  53. package/lib/types/enum-mappings/public-primary-purpose.js +6 -10
  54. package/lib/types/enum-mappings/public-property-status.js +8 -12
  55. package/lib/types/enum-mappings/public-property-type.js +20 -24
  56. package/lib/types/enum-mappings/residency-status.js +8 -12
  57. package/lib/types/enum-mappings/title-gender.js +10 -14
  58. package/lib/types/enum-mappings/title.js +10 -14
  59. package/lib/types/enum-mappings/to-be-purchased.js +4 -7
  60. package/lib/types/enum-mappings/to-be-used-as-security.js +4 -7
  61. package/lib/types/enum-mappings/transaction-type.js +6 -10
  62. package/lib/types/enum-mappings/verification.js +10 -14
  63. package/lib/types/events/applicant-delete.js +4 -7
  64. package/lib/types/events/application-workflow.js +10 -13
  65. package/lib/types/events/asset-delete.js +4 -7
  66. package/lib/types/events/asset-liability-relation-delete.js +4 -7
  67. package/lib/types/events/credit-report-retrieved.js +4 -7
  68. package/lib/types/events/employment-delete.js +2 -5
  69. package/lib/types/events/expense-delete.js +2 -5
  70. package/lib/types/events/funding-position.js +6 -9
  71. package/lib/types/events/income-delete.js +4 -7
  72. package/lib/types/events/liability-delete.js +2 -5
  73. package/lib/types/events/opportunity.js +6 -9
  74. package/lib/types/events/public-applicant.js +28 -31
  75. package/lib/types/events/public-application.js +26 -29
  76. package/lib/types/events/public-asset-liability-relation.js +4 -7
  77. package/lib/types/events/public-asset.js +26 -29
  78. package/lib/types/events/public-employment.js +18 -21
  79. package/lib/types/events/public-expense.js +8 -11
  80. package/lib/types/events/public-funding-position.js +2 -5
  81. package/lib/types/events/public-income.js +12 -15
  82. package/lib/types/events/public-liability.js +16 -19
  83. package/lib/types/events/public-required-document.js +14 -17
  84. package/lib/types/partial-application.js +1 -2
  85. package/lib/types/recursive-partial.js +1 -2
  86. package/lib/update-application/merge-application.d.ts +1 -1
  87. package/lib/update-application/merge-application.js +41 -38
  88. package/lib/update-application/update-primary-applicant.d.ts +1 -4
  89. package/lib/update-application/update-primary-applicant.js +14 -38
  90. package/lib/utils/address-tools.d.ts +3 -1
  91. package/lib/utils/address-tools.js +56 -68
  92. package/lib/utils/clean-up.d.ts +1 -1
  93. package/lib/utils/clean-up.js +6 -10
  94. package/lib/utils/formatYesNo.d.ts +0 -1
  95. package/lib/utils/formatYesNo.js +2 -7
  96. package/lib/utils/generate-address.d.ts +3 -2
  97. package/lib/utils/generate-address.js +33 -42
  98. package/lib/utils/get-financial-institution.d.ts +1 -0
  99. package/lib/utils/get-financial-institution.js +7 -10
  100. package/lib/utils/is-asset-type.js +13 -20
  101. package/lib/utils/is-income-type.d.ts +2 -0
  102. package/lib/utils/is-income-type.js +50 -69
  103. package/lib/utils/iso-date.d.ts +0 -1
  104. package/lib/utils/iso-date.js +2 -7
  105. package/lib/utils/normalise-date.js +6 -10
  106. package/lib/utils/round-decimal.js +1 -5
  107. package/package.json +15 -18
@@ -1,61 +1,55 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- exports.isLivingExpenseEstimate = exports.isOtherCommitment = exports.normaliseExpenseAmount = exports.transformExpense = exports.transformExpenses = exports.otherCommitmentExpenseTypes = void 0;
4
- var application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
5
- var lodash_1 = require("lodash");
6
- var enum_mappings_1 = require("../types/enum-mappings/");
7
- var public_expense_1 = require("../types/events/public-expense");
8
- exports.otherCommitmentExpenseTypes = [
9
- public_expense_1.ExpenseType.Board,
10
- public_expense_1.ExpenseType.ChildAndSpousalMaintenance,
11
- public_expense_1.ExpenseType.Rent,
1
+ import { paths } from '@lendi/integrations-protocol/lib/utils/application-paths';
2
+ import { get, set, sumBy } from 'lodash';
3
+ import { frequencyMapping, livingExpenseMapping } from '../types/enum-mappings/';
4
+ import { ExpenseType, Frequency } from '../types/events/public-expense';
5
+ export const otherCommitmentExpenseTypes = [
6
+ ExpenseType.Board,
7
+ ExpenseType.ChildAndSpousalMaintenance,
8
+ ExpenseType.Rent,
12
9
  ];
13
- var propertyExpenseCategories = [
14
- public_expense_1.ExpenseType.InvestmentPropertyRunningCosts,
15
- public_expense_1.ExpenseType.BodyCorporateFeesStrataFeesAndLandTax,
16
- public_expense_1.ExpenseType.SecondaryResidenceRunningCosts,
17
- public_expense_1.ExpenseType.PrimaryResidenceRunningCosts,
10
+ const propertyExpenseCategories = [
11
+ ExpenseType.InvestmentPropertyRunningCosts,
12
+ ExpenseType.BodyCorporateFeesStrataFeesAndLandTax,
13
+ ExpenseType.SecondaryResidenceRunningCosts,
14
+ ExpenseType.PrimaryResidenceRunningCosts,
18
15
  ];
19
16
  /**
20
17
  * @description Transforms expense items on the application from the event.
21
18
  * @returns {PartialApplication} A PartialApplication returned by transforming the expense event.
22
19
  * @param expense
23
20
  */
24
- function transformExpenses(expense) {
25
- var partialApplication = {};
26
- var applicantId = expense.applicantId, applicationId = expense.applicationId, _a = expense.expenses, expenses = _a === void 0 ? [] : _a, id = expense.id;
27
- if (expenses.every(function (expense) { return expense.amount === undefined || expense.amount === null; })) {
21
+ export function transformExpenses(expense) {
22
+ const partialApplication = {};
23
+ const { applicantId, applicationId, expenses = [], id } = expense;
24
+ if (expenses.every((expense) => expense.amount === undefined || expense.amount === null)) {
28
25
  return partialApplication;
29
26
  }
30
- var normalisedExpenses = expenses.map(normaliseExpenseAmount);
31
- var filteredLivingExpensesWithAmount = normalisedExpenses.filter(function (expense) { return expense.amount || !propertyExpenseCategories.includes(expense.type); });
32
- var livingExpenseEstimate = filteredLivingExpensesWithAmount.find(isLivingExpenseEstimate);
33
- var otherCommitments = filteredLivingExpensesWithAmount.filter(isOtherCommitment);
34
- var expenseBreakdown = filteredLivingExpensesWithAmount.filter(function (item) { return !(isOtherCommitment(item) || isLivingExpenseEstimate(item)); });
35
- var livingExpenseEstimateExists = (0, lodash_1.get)(livingExpenseEstimate || {}, 'amount', 0) > 0;
36
- var expenseBreakdownAmountSum = (0, lodash_1.sumBy)(expenseBreakdown, 'amount');
37
- var lixiLivingExpenses;
27
+ const normalisedExpenses = expenses.map(normaliseExpenseAmount);
28
+ const filteredLivingExpensesWithAmount = normalisedExpenses.filter((expense) => expense.amount || !propertyExpenseCategories.includes(expense.type));
29
+ const livingExpenseEstimate = filteredLivingExpensesWithAmount.find(isLivingExpenseEstimate);
30
+ const otherCommitments = filteredLivingExpensesWithAmount.filter(isOtherCommitment);
31
+ const expenseBreakdown = filteredLivingExpensesWithAmount.filter((item) => !(isOtherCommitment(item) || isLivingExpenseEstimate(item)));
32
+ const livingExpenseEstimateExists = get(livingExpenseEstimate || {}, 'amount', 0) > 0;
33
+ const expenseBreakdownAmountSum = sumBy(expenseBreakdown, 'amount');
34
+ let lixiLivingExpenses;
38
35
  // unless all individual expenses have a value of 0 and a living estimate exists, transform them without question.
39
36
  if (expenseBreakdownAmountSum === 0 && livingExpenseEstimateExists) {
40
- var estimate = transformExpense(livingExpenseEstimate, applicantId, 0, id);
37
+ const estimate = transformExpense(livingExpenseEstimate, applicantId, 0, id);
41
38
  lixiLivingExpenses = [estimate];
42
39
  }
43
40
  else {
44
- lixiLivingExpenses = expenseBreakdown.map(function (expense, index) {
45
- return transformExpense(expense, applicantId, index, id);
46
- });
41
+ lixiLivingExpenses = expenseBreakdown.map((expense, index) => transformExpense(expense, applicantId, index, id));
47
42
  }
48
- var lixiCommitmentExpenses = otherCommitments.map(function (expense, index) { return transformExpense(expense, applicantId, index, id); });
49
- (0, lodash_1.set)(partialApplication, application_paths_1.paths.ApplicationId, applicationId);
50
- (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Household, ".@UniqueID"), "".concat(applicationId, "-household"));
51
- (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.PersonApplicant, ".@UniqueID"), applicantId);
52
- (0, lodash_1.set)(partialApplication, application_paths_1.paths.OtherCommitments, lixiCommitmentExpenses);
43
+ const lixiCommitmentExpenses = otherCommitments.map((expense, index) => transformExpense(expense, applicantId, index, id));
44
+ set(partialApplication, paths.ApplicationId, applicationId);
45
+ set(partialApplication, `${paths.Household}.@UniqueID`, `${applicationId}-household`);
46
+ set(partialApplication, `${paths.PersonApplicant}.@UniqueID`, applicantId);
47
+ set(partialApplication, paths.OtherCommitments, lixiCommitmentExpenses);
53
48
  if (lixiLivingExpenses.length > 0) {
54
- (0, lodash_1.set)(partialApplication, application_paths_1.paths.LivingExpenses, lixiLivingExpenses);
49
+ set(partialApplication, paths.LivingExpenses, lixiLivingExpenses);
55
50
  }
56
51
  return partialApplication;
57
52
  }
58
- exports.transformExpenses = transformExpenses;
59
53
  /**
60
54
  * transforms the living expense from the expense array on the event.
61
55
  *
@@ -63,34 +57,37 @@ exports.transformExpenses = transformExpenses;
63
57
  * @param applicantId: Event applicantId.
64
58
  * @param index: Index of the map.
65
59
  * @param id: Id of the event.
60
+ * @param expense
61
+ * @param applicantId
62
+ * @param index
63
+ * @param id
66
64
  */
67
- function transformExpense(expense, applicantId, index, id) {
65
+ export function transformExpense(expense, applicantId, index, id) {
68
66
  return {
69
67
  '@Amount': expense.amount,
70
- '@Category': enum_mappings_1.livingExpenseMapping[expense.type],
68
+ '@Category': livingExpenseMapping[expense.type],
71
69
  '@Description': expense.type,
72
- '@UniqueID': isOtherCommitment(expense) ? "".concat(id, "-commitment-").concat(index) : "".concat(id, "-living-expense-").concat(index),
73
- '@Frequency': enum_mappings_1.frequencyMapping[expense.frequency],
70
+ '@UniqueID': isOtherCommitment(expense) ? `${id}-commitment-${index}` : `${id}-living-expense-${index}`,
71
+ '@Frequency': frequencyMapping[expense.frequency],
74
72
  PercentResponsible: {
75
73
  Owner: [
76
74
  {
77
75
  '@Percent': 100,
78
- '@x_Party': applicantId
76
+ '@x_Party': applicantId,
79
77
  },
80
- ]
81
- }
78
+ ],
79
+ },
82
80
  };
83
81
  }
84
- exports.transformExpense = transformExpense;
85
82
  /**
86
83
  * @description Normalises expense by amount to 0 if not provided and scales quarterly spending up to yearly.
87
84
  * @param {Expense} expense An expense
88
85
  * @returns {Expense} An normalised expense.
89
86
  */
90
- function normaliseExpenseAmount(expense) {
91
- var amount = expense.amount, _a = expense.frequency, frequency = _a === void 0 ? public_expense_1.Frequency.Yearly : _a, expenseType = expense.type;
92
- if (frequency === public_expense_1.Frequency.Quarterly) {
93
- expense.frequency = public_expense_1.Frequency.Yearly;
87
+ export function normaliseExpenseAmount(expense) {
88
+ const { amount, frequency = Frequency.Yearly, type: expenseType } = expense;
89
+ if (frequency === Frequency.Quarterly) {
90
+ expense.frequency = Frequency.Yearly;
94
91
  expense.amount *= 4;
95
92
  }
96
93
  if (!amount && !propertyExpenseCategories.includes(expenseType)) {
@@ -98,22 +95,19 @@ function normaliseExpenseAmount(expense) {
98
95
  }
99
96
  return expense;
100
97
  }
101
- exports.normaliseExpenseAmount = normaliseExpenseAmount;
102
98
  /**
103
99
  * @description Verify if expense is an OtherCommitment.
104
100
  * @param {Expense} expense Any Expense item.
105
101
  * @returns {boolean} Returns true if an expense type is one of other commitment expenses.
106
102
  */
107
- function isOtherCommitment(expense) {
108
- return exports.otherCommitmentExpenseTypes.includes(expense.type);
103
+ export function isOtherCommitment(expense) {
104
+ return otherCommitmentExpenseTypes.includes(expense.type);
109
105
  }
110
- exports.isOtherCommitment = isOtherCommitment;
111
106
  /**
112
107
  * @description Check if expense type is LivingExpenseEstimate.
113
108
  * @param {Expense} expense An Expense item.
114
109
  * @returns {boolean} Returns true if an expense type is LivingExpenseEstimate
115
110
  */
116
- function isLivingExpenseEstimate(expense) {
117
- return expense.type === public_expense_1.ExpenseType.LivingExpensesEstimate;
111
+ export function isLivingExpenseEstimate(expense) {
112
+ return expense.type === ExpenseType.LivingExpensesEstimate;
118
113
  }
119
- exports.isLivingExpenseEstimate = isLivingExpenseEstimate;
@@ -6,7 +6,7 @@ import { PartialApplication } from '../types/partial-application';
6
6
  *
7
7
  * @param fundingPosition a partialFundingPosition.
8
8
  * @param uniqueIdSuffix
9
- * @return partialApplication with fees, grants and borrowers contributions added.
9
+ * @returns partialApplication with fees, grants and borrowers contributions added.
10
10
  */
11
11
  export declare function transformFundingPosition(fundingPosition: FundingPositionPayload, uniqueIdSuffix?: string): PartialApplication;
12
12
  /**
@@ -16,6 +16,6 @@ export declare function transformFundingPosition(fundingPosition: FundingPositio
16
16
  * @param lmi
17
17
  * @param lmiIncluded
18
18
  * @param id
19
- * @return Array of fees
19
+ * @returns Array of fees
20
20
  */
21
21
  export declare function getFees(fundsRequiredBreakDown: FundsRequiredBreakdown, lmi: number, lmiIncluded: boolean, id: string): Fee[];
@@ -1,63 +1,57 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- exports.getFees = exports.transformFundingPosition = void 0;
4
- var lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
5
- var application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
6
- var lodash_1 = require("lodash");
7
- var enum_mappings_1 = require("../types/enum-mappings");
1
+ import { YesNoList } from '@lendi/integrations-protocol/lib/types/lixi-internal-request';
2
+ import { paths } from '@lendi/integrations-protocol/lib/utils/application-paths';
3
+ import { set, omit } from 'lodash';
4
+ import { categoryMapping, typeMapping, descriptionMapping, contributionMapping } from '../types/enum-mappings';
8
5
  /**
9
6
  * GenerateFundingPosition
10
7
  *
11
8
  * @param fundingPosition a partialFundingPosition.
12
9
  * @param uniqueIdSuffix
13
- * @return partialApplication with fees, grants and borrowers contributions added.
10
+ * @returns partialApplication with fees, grants and borrowers contributions added.
14
11
  */
15
- function transformFundingPosition(fundingPosition, uniqueIdSuffix) {
16
- if (uniqueIdSuffix === void 0) { uniqueIdSuffix = 'loanDetails'; }
17
- var partialApplication = {};
18
- var contributionFunds = [];
19
- var applicationId = fundingPosition.applicationId, id = fundingPosition.id, _a = fundingPosition.lmi, lmi = _a === void 0 ? 0 : _a, _b = fundingPosition.lmiIncluded, lmiIncluded = _b === void 0 ? false : _b;
20
- var fundingPositionMapping = {
21
- applicationId: application_paths_1.paths.ApplicationId,
22
- fundsRequested: "".concat(application_paths_1.paths.RolledUpAmounts, ".@TotalNewFunds"),
23
- lvr: "".concat(application_paths_1.paths.Summary, ".LoanToValuationRatio.@ApplicationLVR"),
24
- totalGovernmentContributions: application_paths_1.paths.ContributionFunds,
25
- totalDeposit: application_paths_1.paths.ContributionFunds,
26
- totalCashOut: "".concat(application_paths_1.paths.EquityRelease, ".Amount.@LumpSum"),
27
- fundsRequiredBreakdown: application_paths_1.paths.SummaryFee
12
+ export function transformFundingPosition(fundingPosition, uniqueIdSuffix = 'loanDetails') {
13
+ const partialApplication = {};
14
+ const contributionFunds = [];
15
+ const { applicationId, id, lmi = 0, lmiIncluded = false } = fundingPosition;
16
+ 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,
28
24
  };
29
- for (var _i = 0, _c = Object.entries(fundingPosition); _i < _c.length; _i++) {
30
- var _d = _c[_i], key = _d[0], value = _d[1];
25
+ for (const [key, value] of Object.entries(fundingPosition)) {
31
26
  if (fundingPositionMapping[key]) {
32
27
  switch (key) {
33
28
  case 'totalGovernmentContributions':
34
29
  case 'totalDeposit':
35
30
  contributionFunds.push({
36
31
  '@Amount': value,
37
- '@Type': enum_mappings_1.contributionMapping[key],
38
- '@UniqueID': "".concat(id, "-").concat(key)
32
+ '@Type': contributionMapping[key],
33
+ '@UniqueID': `${id}-${key}`,
39
34
  });
40
35
  break;
41
36
  case 'fundsRequiredBreakdown':
42
- (0, lodash_1.set)(partialApplication, application_paths_1.paths.SummaryFee, getFees(value, lmi, lmiIncluded, id));
37
+ set(partialApplication, paths.SummaryFee, getFees(value, lmi, lmiIncluded, id));
43
38
  break;
44
39
  case 'totalCashOut':
45
- (0, lodash_1.set)(partialApplication, fundingPositionMapping[key], value);
46
- (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.LoanDetail, ".@UniqueID"), "".concat(applicationId, "-").concat(uniqueIdSuffix));
40
+ set(partialApplication, fundingPositionMapping[key], value);
41
+ set(partialApplication, `${paths.LoanDetail}.@UniqueID`, `${applicationId}-${uniqueIdSuffix}`);
47
42
  break;
48
43
  case 'fundsRequested':
49
- (0, lodash_1.set)(partialApplication, fundingPositionMapping[key], Math.round(value));
44
+ set(partialApplication, fundingPositionMapping[key], Math.round(value));
50
45
  break;
51
46
  default:
52
- (0, lodash_1.set)(partialApplication, fundingPositionMapping[key], value);
47
+ set(partialApplication, fundingPositionMapping[key], value);
53
48
  break;
54
49
  }
55
50
  }
56
51
  }
57
- (0, lodash_1.set)(partialApplication, application_paths_1.paths.ContributionFunds, contributionFunds);
52
+ set(partialApplication, paths.ContributionFunds, contributionFunds);
58
53
  return partialApplication;
59
54
  }
60
- exports.transformFundingPosition = transformFundingPosition;
61
55
  /**
62
56
  * getFee
63
57
  *
@@ -65,33 +59,31 @@ exports.transformFundingPosition = transformFundingPosition;
65
59
  * @param lmi
66
60
  * @param lmiIncluded
67
61
  * @param id
68
- * @return Array of fees
62
+ * @returns Array of fees
69
63
  */
70
- function getFees(fundsRequiredBreakDown, lmi, lmiIncluded, id) {
64
+ export function getFees(fundsRequiredBreakDown, lmi, lmiIncluded, id) {
71
65
  // Adding lmi to fees to be transformed.
72
- (0, lodash_1.set)(fundsRequiredBreakDown, 'lmi', lmi);
66
+ set(fundsRequiredBreakDown, 'lmi', lmi);
73
67
  // Omitting constructionCosts as they don't belong in fees.
74
- return Object.entries((0, lodash_1.omit)(fundsRequiredBreakDown, 'constructionCosts')).map(function (_a) {
75
- var key = _a[0], value = _a[1];
76
- var descriptionList = ['accruedInterest', 'otherSundries'];
77
- var fee = {
68
+ return Object.entries(omit(fundsRequiredBreakDown, 'constructionCosts')).map(([key, value]) => {
69
+ const descriptionList = ['accruedInterest', 'otherSundries'];
70
+ const fee = {
78
71
  '@Amount': value,
79
- '@Category': enum_mappings_1.categoryMapping[key],
80
- '@Type': enum_mappings_1.typeMapping[key],
81
- '@UniqueID': "".concat(id, "-").concat(key)
72
+ '@Category': categoryMapping[key],
73
+ '@Type': typeMapping[key],
74
+ '@UniqueID': `${id}-${key}`,
82
75
  };
83
76
  if (descriptionList.includes(key)) {
84
- fee['@Description'] = enum_mappings_1.descriptionMapping[key];
77
+ fee['@Description'] = descriptionMapping[key];
85
78
  }
86
79
  if (key === 'lmi') {
87
80
  if (lmiIncluded)
88
- fee['@CapitaliseFee'] = lixi_internal_request_1.YesNoList.Yes;
81
+ fee['@CapitaliseFee'] = YesNoList.Yes;
89
82
  // If lmiIncluded is undefined we do not want to set '@CapitaliseFee'
90
83
  // only if it is false as this will affect how we handle migration.
91
84
  if (lmiIncluded === false)
92
- fee['@CapitaliseFee'] = lixi_internal_request_1.YesNoList.No;
85
+ fee['@CapitaliseFee'] = YesNoList.No;
93
86
  }
94
87
  return fee;
95
88
  });
96
89
  }
97
- exports.getFees = getFees;
@@ -7,17 +7,22 @@ export interface AmountFrequency {
7
7
  frequency?: string;
8
8
  }
9
9
  export declare const EmploymentIncomeTypeMapping: Record<string, AmountFrequency>;
10
+ /**
11
+ *
12
+ * @param incomeType
13
+ */
10
14
  export declare function getIncomeMapping(incomeType: IncomeType): Record<string, string>;
11
15
  /**
12
16
  * Generates an partial application from a partial income event.
13
17
  *
14
18
  * @param payload a partial income event.
15
19
  * @param applicantId PersonApplicant uniqueId on the application.
16
- * @return partialApplication an incomplete application.
20
+ * @returns partialApplication an incomplete application.
17
21
  */
18
22
  export declare function transformIncome(payload: IncomePayload, applicantId?: string): PartialApplication;
19
23
  /**
20
24
  * Creates Rental Income array.
25
+ *
21
26
  * @param amount Amount
22
27
  * @param frequency Frequency
23
28
  * @param ownership Owners.
@@ -37,5 +42,7 @@ export interface SelfEmploymentIncomeMapping {
37
42
  export declare function generateIncomeBusinessDetails(data: IncomeBusinessDetails): IncomeElement;
38
43
  /**
39
44
  * Generates the BAS array from the bas definition on the event.
45
+ *
46
+ * @param bas
40
47
  */
41
48
  export declare function generateBAS(bas: BASDefinition[]): IncomeBusinessActivityStatement[];