@lendi/integrations-transform 1.2.0 → 1.2.1

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