@lendi/integrations-transform 1.1.8 → 1.2.2

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 (36) hide show
  1. package/lib/index.d.ts +3 -1
  2. package/lib/index.js +3 -1
  3. package/lib/schemas/public-asset-event.json +86 -93
  4. package/lib/transform-events/generate-liability.js +2 -2
  5. package/lib/transform-events/transform-applicant.js +5 -8
  6. package/lib/transform-events/transform-application.js +3 -4
  7. package/lib/transform-events/transform-asset-address.d.ts +19 -0
  8. package/lib/transform-events/transform-asset-address.js +83 -0
  9. package/lib/transform-events/transform-asset.d.ts +28 -0
  10. package/lib/transform-events/transform-asset.js +203 -0
  11. package/lib/transform-events/transform-expenses.js +3 -4
  12. package/lib/transform-events/{generate-income.d.ts → transform-income.d.ts} +1 -1
  13. package/lib/transform-events/{generate-income.js → transform-income.js} +14 -13
  14. package/lib/transform-events/{generate-lixi-percentowned.d.ts → transform-percent-owned.d.ts} +1 -1
  15. package/lib/transform-events/{generate-lixi-percentowned.js → transform-percent-owned.js} +5 -4
  16. package/lib/types/enum-mappings/asset-type.d.ts +3 -0
  17. package/lib/types/enum-mappings/asset-type.js +18 -0
  18. package/lib/types/enum-mappings/index.d.ts +26 -0
  19. package/lib/types/enum-mappings/index.js +38 -0
  20. package/lib/types/enum-mappings/to-be-purchased.d.ts +5 -0
  21. package/lib/types/enum-mappings/to-be-purchased.js +8 -0
  22. package/lib/types/enum-mappings/to-be-used-as-security.d.ts +5 -0
  23. package/lib/types/enum-mappings/to-be-used-as-security.js +8 -0
  24. package/lib/types/events/public-asset.d.ts +16 -17
  25. package/lib/types/events/public-asset.js +3 -0
  26. package/lib/update-application/merge-application.d.ts +8 -0
  27. package/lib/update-application/merge-application.js +132 -0
  28. package/lib/utils/address-tools.d.ts +14 -1
  29. package/lib/utils/address-tools.js +35 -3
  30. package/lib/utils/generate-address.d.ts +3 -4
  31. package/lib/utils/generate-address.js +8 -9
  32. package/lib/utils/is-asset-type.d.ts +25 -0
  33. package/lib/utils/is-asset-type.js +46 -0
  34. package/package.json +3 -3
  35. package/lib/transform-events/generate-asset.d.ts +0 -17
  36. package/lib/transform-events/generate-asset.js +0 -178
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ exports.__esModule = true;
14
+ exports.getAssetMapping = exports.getPropertyType = exports.transformAsset = exports.residentialTypeList = exports.propertyTypeNameList = void 0;
15
+ var lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
16
+ var application_paths_1 = require("@lendi/integrations-credit-protocol/utils/application-paths");
17
+ var lixi_internal_request_2 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
18
+ var lodash_1 = require("lodash");
19
+ var logger_1 = require("../logger");
20
+ var enum_mappings_1 = require("../types/enum-mappings");
21
+ var public_asset_1 = require("../types/events/public-asset");
22
+ var get_financial_institution_1 = require("../utils/get-financial-institution");
23
+ var is_asset_type_1 = require("../utils/is-asset-type");
24
+ var transform_asset_address_1 = require("./transform-asset-address");
25
+ var transform_percent_owned_1 = require("./transform-percent-owned");
26
+ exports.propertyTypeNameList = Object.values(lixi_internal_request_2.Custom2PropertyTypeNameList);
27
+ exports.residentialTypeList = Object.values(lixi_internal_request_1.ResidentialTypeList);
28
+ /**
29
+ * Generates a partial internal request from a partial public asset event.
30
+ *
31
+ * @param {Payload} asset - A partial public asset.
32
+ * @return {PartialApplication} A partial InternalRequest.
33
+ */
34
+ function transformAsset(_a) {
35
+ var asset = _a.asset, applicationId = _a.applicationId, id = _a.id;
36
+ var isPropertyAsset = (0, is_asset_type_1.isRealEstateAsset)(asset);
37
+ var idPath = isPropertyAsset ? "".concat(application_paths_1.paths.RealEstateAsset, ".@UniqueID") : "".concat(application_paths_1.paths.NonRealEstateAsset, ".@UniqueID");
38
+ var addressId = "".concat(id, "-address");
39
+ var assetMapping = getAssetMapping(asset);
40
+ var partialApplication = {};
41
+ (0, lodash_1.set)(partialApplication, application_paths_1.paths.ApplicationId, applicationId);
42
+ (0, lodash_1.set)(partialApplication, idPath, id);
43
+ if (isPropertyAsset) {
44
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.RealEstateAsset, ".@MultipleDwellings"), lixi_internal_request_1.YesNoList.No);
45
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.RealEstateAsset, ".@x_Address"), addressId);
46
+ }
47
+ else {
48
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".@Type"), enum_mappings_1.assetTypeMapping[asset.type]);
49
+ }
50
+ if ((0, is_asset_type_1.isFinancialAsset)(asset)) {
51
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".@Type"), lixi_internal_request_1.NonRealEstateAssetTypeList.FinancialAsset);
52
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".FinancialAsset.@Type"), enum_mappings_1.financialAssetMapping[asset.type]);
53
+ }
54
+ if ((0, is_asset_type_1.isOtherAsset)(asset)) {
55
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".@Type"), lixi_internal_request_1.NonRealEstateAssetTypeList.Other);
56
+ }
57
+ switch (asset.type) {
58
+ case public_asset_1.AssetType.Vehicle:
59
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".@Type"), lixi_internal_request_1.NonRealEstateAssetTypeList.MotorVehicleAndTransport);
60
+ break;
61
+ case public_asset_1.AssetType.HomeContents:
62
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".OtherAsset.@Type"), lixi_internal_request_1.OtherAssetTypeList.HomeContents);
63
+ break;
64
+ case public_asset_1.AssetType.Gifts:
65
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".OtherAsset.@Description"), asset.description || 'Asset Gifts');
66
+ break;
67
+ case public_asset_1.AssetType.OtherAsset:
68
+ if (asset.description) {
69
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".OtherAsset.@Description"), asset.description);
70
+ }
71
+ break;
72
+ }
73
+ for (var _i = 0, _b = Object.entries(asset); _i < _b.length; _i++) {
74
+ var _c = _b[_i], key = _c[0], value = _c[1];
75
+ if (assetMapping[key]) {
76
+ switch (key) {
77
+ case 'contractDetails':
78
+ var contractDate = value.contractDate;
79
+ if (contractDate)
80
+ (0, lodash_1.set)(partialApplication, assetMapping.contractDate, contractDate);
81
+ break;
82
+ case 'primaryPurpose':
83
+ (0, lodash_1.set)(partialApplication, assetMapping[key], enum_mappings_1.primaryPurposeMapping[value]);
84
+ break;
85
+ case 'toBePurchased':
86
+ (0, lodash_1.set)(partialApplication, assetMapping[key], enum_mappings_1.toBePurchasedMapping[value]);
87
+ break;
88
+ case 'propertyStatus':
89
+ (0, lodash_1.set)(partialApplication, assetMapping[key], enum_mappings_1.propertyStatusMapping[value]);
90
+ break;
91
+ case 'toBeUsedAsSecurity':
92
+ if (isPropertyAsset)
93
+ (0, lodash_1.set)(partialApplication, assetMapping[key], enum_mappings_1.toBeUsedAsSecurityMapping[value]);
94
+ break;
95
+ case 'propertyType':
96
+ var propertyTypeMapping_1 = getPropertyType(value);
97
+ if (!propertyTypeMapping_1) {
98
+ logger_1.logger.warn({ message: "Unknown propertyType ".concat(value, " for asset ").concat(id), applicationId: applicationId });
99
+ }
100
+ var path = propertyTypeMapping_1.path, mappedValue = propertyTypeMapping_1.value;
101
+ (0, lodash_1.set)(partialApplication, path, mappedValue);
102
+ break;
103
+ case 'zoneType':
104
+ if (asset.zoneType === public_asset_1.ZoneType.Commercial) {
105
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.RealEstateAsset, ".Commercial.@Type"), lixi_internal_request_1.OtherAssetTypeList.Other);
106
+ (0, lodash_1.set)(partialApplication, assetMapping[key], lixi_internal_request_1.Custom6TypeList.Commercial);
107
+ }
108
+ else {
109
+ (0, lodash_1.set)(partialApplication, assetMapping[key], lixi_internal_request_1.Custom6TypeList.Residential);
110
+ }
111
+ break;
112
+ case 'financialInstitution':
113
+ if ((0, is_asset_type_1.isFinancialAsset)(asset)) {
114
+ var financialInstitution = (0, get_financial_institution_1.getFinancialInstitution)(value.toString());
115
+ (0, lodash_1.set)(partialApplication, assetMapping[key], financialInstitution);
116
+ }
117
+ break;
118
+ case 'year':
119
+ (0, lodash_1.set)(partialApplication, assetMapping[key], value.toString());
120
+ break;
121
+ case 'address':
122
+ (0, lodash_1.set)(partialApplication, assetMapping[key], (0, transform_asset_address_1.transformAddress)(value, addressId));
123
+ break;
124
+ case 'percentOwned':
125
+ var percentOwned = (0, transform_percent_owned_1.transformPercentOwned)(value);
126
+ if (percentOwned) {
127
+ (0, lodash_1.set)(partialApplication, assetMapping[key], percentOwned);
128
+ }
129
+ break;
130
+ default:
131
+ (0, lodash_1.set)(partialApplication, assetMapping[key], value);
132
+ break;
133
+ }
134
+ }
135
+ }
136
+ return partialApplication;
137
+ }
138
+ exports.transformAsset = transformAsset;
139
+ /**
140
+ * @description Map the propertyType to a RealEstateAsset path and the value.
141
+ * @param {PropertyType} propertyType - A propertyType.
142
+ * @returns {PropertyTypeMapping | null} A path and value to be used for property type mapping.
143
+ */
144
+ function getPropertyType(propertyType) {
145
+ var value = enum_mappings_1.propertyTypeMapping[propertyType];
146
+ if (exports.residentialTypeList.includes(value)) {
147
+ return {
148
+ path: "".concat(application_paths_1.paths.RealEstateAsset, ".Residential"),
149
+ value: {
150
+ '@Type': value
151
+ }
152
+ };
153
+ }
154
+ if (exports.propertyTypeNameList.includes(value)) {
155
+ return {
156
+ path: "".concat(application_paths_1.paths.RealEstateAsset, ".PropertyType"),
157
+ value: {
158
+ '@PropertyTypeName': value,
159
+ '@CategoryTypeName': lixi_internal_request_2.Custom1CategoryTypeNameList.Residential
160
+ }
161
+ };
162
+ }
163
+ return null;
164
+ }
165
+ exports.getPropertyType = getPropertyType;
166
+ /**
167
+ * @description Get the asset transform mapping for various asset types.
168
+ * @param {Asset} asset An Asset
169
+ * @returns {Record<string, string>} Asset Transform Mapping.
170
+ */
171
+ function getAssetMapping(asset) {
172
+ var estimatedValue = "".concat(application_paths_1.paths.NonRealEstateAsset, ".EstimatedValue.@Value");
173
+ var percentOwned = "".concat(application_paths_1.paths.NonRealEstateAsset, ".PercentOwned");
174
+ var baseMapping = {
175
+ estimatedValue: estimatedValue,
176
+ percentOwned: percentOwned
177
+ };
178
+ if ((0, is_asset_type_1.isRealEstateAsset)(asset)) {
179
+ estimatedValue = "".concat(application_paths_1.paths.RealEstateAsset, ".EstimatedValue.@Value");
180
+ percentOwned = "".concat(application_paths_1.paths.RealEstateAsset, ".PercentOwned");
181
+ return {
182
+ address: application_paths_1.paths.Address,
183
+ contractDetails: 'contractDetails',
184
+ contractDate: "".concat(application_paths_1.paths.RealEstateAsset, ".ContractDetails.@ContractDate"),
185
+ estimatedValue: estimatedValue,
186
+ percentOwned: percentOwned,
187
+ primaryPurpose: "".concat(application_paths_1.paths.RealEstateAsset, ".@PrimaryPurpose"),
188
+ propertyStatus: "".concat(application_paths_1.paths.RealEstateAsset, ".@Status"),
189
+ propertyType: "".concat(application_paths_1.paths.RealEstateAsset, ".Residential"),
190
+ toBePurchased: "".concat(application_paths_1.paths.RealEstateAsset, ".@Transaction"),
191
+ toBeUsedAsSecurity: "".concat(application_paths_1.paths.RealEstateAsset, ".@ToBeUsedAsSecurity"),
192
+ zoneType: "".concat(application_paths_1.paths.RealEstateAsset, ".Zoning.@Type")
193
+ };
194
+ }
195
+ if ((0, is_asset_type_1.isMotorVehicle)(asset)) {
196
+ return __assign(__assign({}, baseMapping), { make: "".concat(application_paths_1.paths.NonRealEstateAsset, ".MotorVehicle.@Make"), model: "".concat(application_paths_1.paths.NonRealEstateAsset, ".MotorVehicle.@Model"), year: "".concat(application_paths_1.paths.NonRealEstateAsset, ".MotorVehicle.@Year") });
197
+ }
198
+ if ((0, is_asset_type_1.isFinancialAsset)(asset)) {
199
+ return __assign(__assign({}, baseMapping), { financialInstitution: "".concat(application_paths_1.paths.NonRealEstateAsset, ".FinancialAsset.AccountNumber.@FinancialInstitution"), financialInstitutionAccountNumber: "".concat(application_paths_1.paths.NonRealEstateAsset, ".FinancialAsset.AccountNumber.@AccountNumber"), financialInstitutionBsb: "".concat(application_paths_1.paths.NonRealEstateAsset, ".FinancialAsset.AccountNumber.@BSB") });
200
+ }
201
+ return baseMapping;
202
+ }
203
+ exports.getAssetMapping = getAssetMapping;
@@ -14,8 +14,7 @@ exports.__esModule = true;
14
14
  exports.isLivingExpenseEstimate = exports.isOtherCommitment = exports.normaliseExpenseAmount = exports.transformExpense = exports.transformExpenses = exports.otherCommitmentExpenseTypes = void 0;
15
15
  var application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
16
16
  var lodash_1 = require("lodash");
17
- var expense_frequency_1 = require("../types/enum-mappings/expense-frequency");
18
- var living_expense_1 = require("../types/enum-mappings/living-expense");
17
+ var enum_mappings_1 = require("../types/enum-mappings/");
19
18
  var public_expense_1 = require("../types/events/public-expense");
20
19
  exports.otherCommitmentExpenseTypes = [
21
20
  public_expense_1.ExpenseType.Board,
@@ -72,10 +71,10 @@ exports.transformExpenses = transformExpenses;
72
71
  function transformExpense(expense, applicantId, index, id) {
73
72
  return {
74
73
  '@Amount': expense.amount,
75
- '@Category': living_expense_1.livingExpenseMapping[expense.type],
74
+ '@Category': enum_mappings_1.livingExpenseMapping[expense.type],
76
75
  '@Description': expense.type,
77
76
  '@UniqueID': isOtherCommitment(expense) ? "".concat(id, "-commitment-").concat(index) : "".concat(id, "-living-expense-").concat(index),
78
- '@Frequency': expense_frequency_1.frequencyMapping[expense.frequency],
77
+ '@Frequency': enum_mappings_1.frequencyMapping[expense.frequency],
79
78
  PercentResponsible: {
80
79
  Owner: [
81
80
  {
@@ -15,7 +15,7 @@ export declare function getIncomeMapping(incomeType: IncomeType): Record<string,
15
15
  * @param applicantId PersonApplicant uniqueId on the application.
16
16
  * @return partialApplication an incomplete application.
17
17
  */
18
- export declare function generateIncome(payload: IncomePayload, applicantId?: string): PartialApplication;
18
+ export declare function transformIncome(payload: IncomePayload, applicantId?: string): PartialApplication;
19
19
  /**
20
20
  * Creates Rental Income array.
21
21
  * @param amount Amount
@@ -23,17 +23,15 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  };
24
24
  var _a;
25
25
  exports.__esModule = true;
26
- exports.generateBAS = exports.generateIncomeBusinessDetails = exports.createRentalIncome = exports.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,6 +68,9 @@ 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;
@@ -118,7 +119,7 @@ exports.getIncomeMapping = getIncomeMapping;
118
119
  * @param applicantId PersonApplicant uniqueId on the application.
119
120
  * @return partialApplication an incomplete application.
120
121
  */
121
- function generateIncome(payload, applicantId) {
122
+ function transformIncome(payload, applicantId) {
122
123
  var applicationId = payload.applicationId, id = payload.id, income = payload.income;
123
124
  var incomeAmount = income.amount, incomeType = income.type, incomeFrequency = income.frequency;
124
125
  var partialApplication = {};
@@ -144,11 +145,11 @@ function generateIncome(payload, applicantId) {
144
145
  (0, lodash_1.set)(partialApplication, incomeMapping[key], generateBAS(basWithAmount));
145
146
  break;
146
147
  case 'frequency':
147
- (0, lodash_1.set)(partialApplication, incomeMapping[key], alieo_frequency_1.incomeExpenseFrequencyMapping[value]);
148
+ (0, lodash_1.set)(partialApplication, incomeMapping[key], enum_mappings_1.incomeExpenseFrequencyMapping[value]);
148
149
  break;
149
150
  case 'percentOwned':
150
151
  var ownership = value;
151
- var percentOwned = (0, generate_lixi_percentowned_1.generateLIXIPercentOwned)(ownership);
152
+ var percentOwned = (0, transform_percent_owned_1.transformPercentOwned)(ownership);
152
153
  if ((0, is_income_type_1.isRentalIncome)(incomeType)) {
153
154
  percentOwned = createRentalIncome(incomeAmount, incomeFrequency, ownership.owners);
154
155
  }
@@ -158,7 +159,7 @@ function generateIncome(payload, applicantId) {
158
159
  break;
159
160
  case 'type':
160
161
  if (!(0, is_income_type_1.isRentalIncome)(incomeType)) {
161
- var mappedType = income_type_1.otherIncomeMapping[value];
162
+ var mappedType = enum_mappings_1.otherIncomeMapping[value];
162
163
  if ((0, is_income_type_1.isOtherIncomeWithDesc)(value)) {
163
164
  (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.OtherIncome, ".@Description"), mappedType);
164
165
  (0, lodash_1.set)(partialApplication, incomeMapping[key], lixi_internal_request_1.OtherIncomeTypeList.OtherIncome);
@@ -169,7 +170,7 @@ function generateIncome(payload, applicantId) {
169
170
  }
170
171
  break;
171
172
  case 'benefitType':
172
- (0, lodash_1.set)(partialApplication, incomeMapping[key], government_benefits_1.governmentBenefitsMapping[value]);
173
+ (0, lodash_1.set)(partialApplication, incomeMapping[key], enum_mappings_1.governmentBenefitsMapping[value]);
173
174
  break;
174
175
  case 'incomes':
175
176
  var sortedIncomeList = value
@@ -185,7 +186,7 @@ function generateIncome(payload, applicantId) {
185
186
  }
186
187
  return partialApplication;
187
188
  }
188
- exports.generateIncome = generateIncome;
189
+ exports.transformIncome = transformIncome;
189
190
  /**
190
191
  * Creates Rental Income array.
191
192
  * @param amount Amount
@@ -203,7 +204,7 @@ function createRentalIncome(amount, frequency, ownership) {
203
204
  var percent = owner.percent, applicantId = owner.applicantId;
204
205
  var ownerAmount = amount * percent;
205
206
  rentalIncome.push({
206
- '@Frequency': alieo_frequency_1.rentalIncomeFrequencyMapping[frequency],
207
+ '@Frequency': enum_mappings_1.rentalIncomeFrequencyMapping[frequency],
207
208
  '@RentalAmount': ownerAmount,
208
209
  '@x_Owner': applicantId
209
210
  });
@@ -246,7 +247,7 @@ function generateIncomeBusinessDetails(data) {
246
247
  }
247
248
  }
248
249
  else if (key === 'year') {
249
- (0, lodash_1.set)(income, dateAndIncomeMapping[key], value.toString());
250
+ (0, lodash_1.set)(income, dateAndIncomeMapping[key], "".concat(value, "-01-01"));
250
251
  }
251
252
  else {
252
253
  (0, lodash_1.set)(income, dateAndIncomeMapping[key], value);
@@ -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,14 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
- exports.generateLIXIPercentOwned = void 0;
3
+ exports.transformPercentOwned = void 0;
4
+ var round_decimal_1 = require("../utils/round-decimal");
4
5
  /**
5
6
  * Transform percentOwned to lixi's format.
6
7
  *
7
8
  * @param percentOwned PercentOwned for an asset or liability on public liability event.
8
9
  * @returns {LIXIPercentOwned} transformed Lixi PercentOwned.
9
10
  */
10
- function generateLIXIPercentOwned(_a) {
11
+ function transformPercentOwned(_a) {
11
12
  var _b = _a.owners, owners = _b === void 0 ? [] : _b;
12
13
  if (owners.length === 0)
13
14
  return null;
@@ -15,10 +16,10 @@ function generateLIXIPercentOwned(_a) {
15
16
  Owner: owners.map(function (_a) {
16
17
  var percent = _a.percent, applicantId = _a.applicantId;
17
18
  return ({
18
- '@Percent': percent * 100,
19
+ '@Percent': (0, round_decimal_1.roundDecimal)(percent * 100),
19
20
  '@x_Party': applicantId
20
21
  });
21
22
  })
22
23
  };
23
24
  }
24
- exports.generateLIXIPercentOwned = generateLIXIPercentOwned;
25
+ 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);
@@ -0,0 +1,26 @@
1
+ export * from './alieo-frequency';
2
+ export * from './asset-type';
3
+ export * from './country-code';
4
+ export * from './employment-basis';
5
+ export * from './expense-frequency';
6
+ export * from './funding-position';
7
+ export * from './government-benefits';
8
+ export * from './housing-status';
9
+ export * from './income-type';
10
+ export * from './liability-payment-type';
11
+ export * from './liability-type';
12
+ export * from './living-expense';
13
+ export * from './marital-status';
14
+ export * from './postcode';
15
+ export * from './preferred-repayment';
16
+ export * from './proof-of-identity';
17
+ export * from './public-financial-asset';
18
+ export * from './public-primary-purpose';
19
+ export * from './public-property-status';
20
+ export * from './public-property-type';
21
+ export * from './residency-status';
22
+ export * from './title-gender';
23
+ export * from './title';
24
+ export * from './to-be-purchased';
25
+ export * from './to-be-used-as-security';
26
+ export * from './transaction-type';
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ exports.__esModule = true;
13
+ __exportStar(require("./alieo-frequency"), exports);
14
+ __exportStar(require("./asset-type"), exports);
15
+ __exportStar(require("./country-code"), exports);
16
+ __exportStar(require("./employment-basis"), exports);
17
+ __exportStar(require("./expense-frequency"), exports);
18
+ __exportStar(require("./funding-position"), exports);
19
+ __exportStar(require("./government-benefits"), exports);
20
+ __exportStar(require("./housing-status"), exports);
21
+ __exportStar(require("./income-type"), exports);
22
+ __exportStar(require("./liability-payment-type"), exports);
23
+ __exportStar(require("./liability-type"), exports);
24
+ __exportStar(require("./living-expense"), exports);
25
+ __exportStar(require("./marital-status"), exports);
26
+ __exportStar(require("./postcode"), exports);
27
+ __exportStar(require("./preferred-repayment"), exports);
28
+ __exportStar(require("./proof-of-identity"), exports);
29
+ __exportStar(require("./public-financial-asset"), exports);
30
+ __exportStar(require("./public-primary-purpose"), exports);
31
+ __exportStar(require("./public-property-status"), exports);
32
+ __exportStar(require("./public-property-type"), exports);
33
+ __exportStar(require("./residency-status"), exports);
34
+ __exportStar(require("./title-gender"), exports);
35
+ __exportStar(require("./title"), exports);
36
+ __exportStar(require("./to-be-purchased"), exports);
37
+ __exportStar(require("./to-be-used-as-security"), exports);
38
+ __exportStar(require("./transaction-type"), exports);
@@ -0,0 +1,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";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Deep merges the application and custom handles specific arrays
3
+ *
4
+ * @param newApplication new application coming from events.
5
+ * @param existingApplication a saved dynamo application.
6
+ * @return merged application.
7
+ */
8
+ export declare function deepMergeApplication(existingApplication: object | undefined, newApplication: object): any;