@lendi/integrations-transform 1.2.0 → 1.2.4

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 (42) 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} +9 -5
  13. package/lib/transform-events/{generate-income.js → transform-income.js} +39 -15
  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/funding-position.d.ts +1 -1
  19. package/lib/types/enum-mappings/funding-position.js +2 -2
  20. package/lib/types/enum-mappings/income-type.d.ts +2 -2
  21. package/lib/types/enum-mappings/income-type.js +2 -2
  22. package/lib/types/enum-mappings/index.d.ts +26 -0
  23. package/lib/types/enum-mappings/index.js +38 -0
  24. package/lib/types/enum-mappings/public-property-type.d.ts +2 -2
  25. package/lib/types/enum-mappings/public-property-type.js +2 -2
  26. package/lib/types/enum-mappings/to-be-purchased.d.ts +5 -0
  27. package/lib/types/enum-mappings/to-be-purchased.js +8 -0
  28. package/lib/types/enum-mappings/to-be-used-as-security.d.ts +5 -0
  29. package/lib/types/enum-mappings/to-be-used-as-security.js +8 -0
  30. package/lib/types/events/public-asset.d.ts +16 -17
  31. package/lib/types/events/public-asset.js +3 -0
  32. package/lib/update-application/merge-application.d.ts +8 -0
  33. package/lib/update-application/merge-application.js +132 -0
  34. package/lib/utils/address-tools.d.ts +14 -1
  35. package/lib/utils/address-tools.js +35 -3
  36. package/lib/utils/generate-address.d.ts +3 -4
  37. package/lib/utils/generate-address.js +8 -9
  38. package/lib/utils/is-asset-type.d.ts +25 -0
  39. package/lib/utils/is-asset-type.js +46 -0
  40. package/package.json +3 -3
  41. package/lib/transform-events/generate-asset.d.ts +0 -17
  42. 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
  {
@@ -1,6 +1,6 @@
1
- import { IncomeElement } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
1
+ import { IncomeBusinessActivityStatement, IncomeElement } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
2
2
  import { RentalIncome } from '@lendi/integrations-protocol/lib/types/lixi-internal-request';
3
- import { Frequency, IncomeBusinessDetails, IncomeDefinition as IncomePayload, IncomeType, Ownership } from '../types/events/public-income';
3
+ import { BASDefinition, Frequency, IncomeBusinessDetails, IncomeDefinition as IncomePayload, IncomeType, Ownership } from '../types/events/public-income';
4
4
  import { PartialApplication } from '../types/partial-application';
5
5
  export interface AmountFrequency {
6
6
  amount: string;
@@ -12,17 +12,17 @@ export declare function getIncomeMapping(incomeType: IncomeType): Record<string,
12
12
  * Generates an partial application from a partial income event.
13
13
  *
14
14
  * @param payload a partial income event.
15
- * @param storedApplication: Current state of the application.
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
22
22
  * @param frequency Frequency
23
23
  * @param ownership Owners.
24
24
  */
25
- export declare function createRentalIncome(amount: number, frequency: Frequency, ownership: Ownership[]): RentalIncome[];
25
+ export declare function createRentalIncome(amount: number, frequency: Frequency, ownership?: Ownership[]): RentalIncome[];
26
26
  export interface SelfEmploymentIncomeMapping {
27
27
  year: string;
28
28
  companyProfitBeforeTax: string;
@@ -35,3 +35,7 @@ export interface SelfEmploymentIncomeMapping {
35
35
  * @returns {IncomeElement} LIXI Income for the Self Employed.
36
36
  */
37
37
  export declare function generateIncomeBusinessDetails(data: IncomeBusinessDetails): IncomeElement;
38
+ /**
39
+ * Generates the BAS array from the bas definition on the event.
40
+ */
41
+ export declare function generateBAS(bas: BASDefinition[]): IncomeBusinessActivityStatement[];
@@ -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,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;
@@ -83,6 +84,7 @@ function getIncomeMapping(incomeType) {
83
84
  if ((0, is_income_type_1.isFullDocOrLowDocIncome)(incomeType)) {
84
85
  basePath = application_paths_1.paths.CompanyApplicant;
85
86
  return {
87
+ bas: "".concat(basePath, ".Income[0].BusinessActivityStatement"),
86
88
  companyId: "".concat(basePath, ".@UniqueID"),
87
89
  incomes: "".concat(basePath, ".Income"),
88
90
  gross: "".concat(basePath, ".DeclaredIncome.@IncomeAmount")
@@ -114,10 +116,10 @@ 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 = {};
@@ -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,7 +159,7 @@ 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
164
  (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.OtherIncome, ".@Description"), mappedType);
158
165
  (0, lodash_1.set)(partialApplication, incomeMapping[key], lixi_internal_request_1.OtherIncomeTypeList.OtherIncome);
@@ -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
@@ -187,6 +194,7 @@ exports.generateIncome = generateIncome;
187
194
  * @param ownership Owners.
188
195
  */
189
196
  function createRentalIncome(amount, frequency, ownership) {
197
+ if (ownership === void 0) { ownership = []; }
190
198
  if (frequency === public_income_1.Frequency.Quarterly) {
191
199
  amount = Math.ceil(amount / 3);
192
200
  frequency = public_income_1.Frequency.Monthly;
@@ -197,7 +205,7 @@ function createRentalIncome(amount, frequency, ownership) {
197
205
  var percent = owner.percent, applicantId = owner.applicantId;
198
206
  var ownerAmount = amount * percent;
199
207
  rentalIncome.push({
200
- '@Frequency': alieo_frequency_1.rentalIncomeFrequencyMapping[frequency],
208
+ '@Frequency': enum_mappings_1.rentalIncomeFrequencyMapping[frequency],
201
209
  '@RentalAmount': ownerAmount,
202
210
  '@x_Owner': applicantId
203
211
  });
@@ -213,7 +221,7 @@ var selfEmploymentIncomeMapping = {
213
221
  interest: 'Addback.@Interest',
214
222
  lease: 'Addback.@Lease',
215
223
  nonRecurringExpenses: 'Addback.@NonRecurringExpenses',
216
- other: 'Addback.@Other',
224
+ other: 'Addback.OtherAddback[0].@Amount',
217
225
  salary: 'Addback.@Salary',
218
226
  superannuationExcess: 'Addback.@SuperannuationExcess'
219
227
  },
@@ -229,13 +237,19 @@ function generateIncomeBusinessDetails(data) {
229
237
  var addbackMapping = selfEmploymentIncomeMapping.addback, dateAndIncomeMapping = __rest(selfEmploymentIncomeMapping, ["addback"]);
230
238
  for (var _i = 0, _a = Object.entries(data); _i < _a.length; _i++) {
231
239
  var _b = _a[_i], key = _b[0], value = _b[1];
232
- if (selfEmploymentIncomeMapping[key] != null) {
240
+ if (selfEmploymentIncomeMapping[key] !== null) {
233
241
  if (key === 'addback') {
234
242
  for (var _c = 0, _d = Object.entries(value); _c < _d.length; _c++) {
235
243
  var _e = _d[_c], addbackKey = _e[0], addbackValue = _e[1];
244
+ if (addbackKey === 'other') {
245
+ (0, lodash_1.set)(income, 'Addback.OtherAddback[0].@Description', 'other');
246
+ }
236
247
  (0, lodash_1.set)(income, addbackMapping[addbackKey], addbackValue);
237
248
  }
238
249
  }
250
+ else if (key === 'year') {
251
+ (0, lodash_1.set)(income, dateAndIncomeMapping[key], "".concat(value, "-01-01"));
252
+ }
239
253
  else {
240
254
  (0, lodash_1.set)(income, dateAndIncomeMapping[key], value);
241
255
  }
@@ -244,3 +258,13 @@ function generateIncomeBusinessDetails(data) {
244
258
  return income;
245
259
  }
246
260
  exports.generateIncomeBusinessDetails = generateIncomeBusinessDetails;
261
+ /**
262
+ * Generates the BAS array from the bas definition on the event.
263
+ */
264
+ function generateBAS(bas) {
265
+ return bas.map(function (bas) { return ({
266
+ '@Quarter': bas.quarter,
267
+ '@SalesAmount': bas.salesAmount
268
+ }); });
269
+ }
270
+ 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,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);
@@ -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
+ };