@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.
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/schemas/public-asset-event.json +86 -93
- package/lib/transform-events/generate-asset-liability-link.js +2 -2
- package/lib/transform-events/generate-credit-report-rebuilt.js +1 -1
- package/lib/transform-events/generate-employment.js +17 -17
- package/lib/transform-events/generate-funding-position.js +6 -6
- package/lib/transform-events/generate-liability.js +15 -15
- package/lib/transform-events/generate-opportunity.js +2 -2
- package/lib/transform-events/generate-required-document.js +7 -7
- package/lib/transform-events/transform-applicant.js +26 -29
- package/lib/transform-events/transform-application.js +7 -8
- package/lib/transform-events/transform-asset.d.ts +44 -0
- package/lib/transform-events/transform-asset.js +271 -0
- package/lib/transform-events/transform-expenses.js +6 -7
- package/lib/transform-events/{generate-income.d.ts → transform-income.d.ts} +8 -4
- package/lib/transform-events/{generate-income.js → transform-income.js} +54 -31
- package/lib/transform-events/{generate-lixi-percentowned.d.ts → transform-percent-owned.d.ts} +1 -1
- package/lib/transform-events/{generate-lixi-percentowned.js → transform-percent-owned.js} +3 -3
- package/lib/types/enum-mappings/asset-type.d.ts +3 -0
- package/lib/types/enum-mappings/asset-type.js +18 -0
- package/lib/types/enum-mappings/funding-position.d.ts +1 -1
- package/lib/types/enum-mappings/funding-position.js +2 -2
- package/lib/types/enum-mappings/income-type.d.ts +2 -2
- package/lib/types/enum-mappings/income-type.js +2 -2
- package/lib/types/enum-mappings/index.d.ts +26 -0
- package/lib/types/enum-mappings/index.js +38 -0
- package/lib/types/enum-mappings/public-property-type.d.ts +2 -2
- package/lib/types/enum-mappings/public-property-type.js +2 -2
- package/lib/types/enum-mappings/to-be-purchased.d.ts +5 -0
- package/lib/types/enum-mappings/to-be-purchased.js +8 -0
- package/lib/types/enum-mappings/to-be-used-as-security.d.ts +5 -0
- package/lib/types/enum-mappings/to-be-used-as-security.js +8 -0
- package/lib/types/events/public-asset.d.ts +16 -17
- package/lib/types/events/public-asset.js +3 -0
- package/lib/utils/address-tools.d.ts +14 -1
- package/lib/utils/address-tools.js +35 -3
- package/lib/utils/generate-address.d.ts +3 -4
- package/lib/utils/generate-address.js +8 -9
- package/lib/utils/is-asset-type.d.ts +25 -0
- package/lib/utils/is-asset-type.js +46 -0
- package/lib/utils/normalise-date.js +1 -1
- package/package.json +4 -4
- package/lib/transform-events/generate-asset.d.ts +0 -17
- package/lib/transform-events/generate-asset.js +0 -178
|
@@ -4,10 +4,9 @@ export declare const StreetNumberMaxLength = 16;
|
|
|
4
4
|
export declare const StreetTypeArray: StreetTypeList[];
|
|
5
5
|
/**
|
|
6
6
|
* Generates an address for an asset.
|
|
7
|
-
|
|
8
|
-
* @param
|
|
9
|
-
* @
|
|
10
|
-
* @return A transformed address object.
|
|
7
|
+
* @param {Address} address - An address object.
|
|
8
|
+
* @param {string} id - Id of asset object.
|
|
9
|
+
* @return {Partial<AddressType>} A transformed address object.
|
|
11
10
|
*/
|
|
12
11
|
export declare function generateAddress(address: Address, id: string): Partial<AddressType>;
|
|
13
12
|
/**
|
|
@@ -6,7 +6,9 @@ var lodash_1 = require("lodash");
|
|
|
6
6
|
var country_code_1 = require("..//types/enum-mappings/country-code");
|
|
7
7
|
var postcode_1 = require("../types/enum-mappings/postcode");
|
|
8
8
|
var public_asset_1 = require("../types/events/public-asset");
|
|
9
|
+
var address_tools_1 = require("./address-tools");
|
|
9
10
|
exports.StreetNumberMaxLength = 16;
|
|
11
|
+
exports.StreetTypeArray = Object.values(lixi_internal_request_1.StreetTypeList);
|
|
10
12
|
var addressMapping = {
|
|
11
13
|
country: '@Country',
|
|
12
14
|
city: '@Suburb',
|
|
@@ -21,21 +23,18 @@ var standardMapping = {
|
|
|
21
23
|
level: '@Level',
|
|
22
24
|
unit: '@Unit'
|
|
23
25
|
};
|
|
24
|
-
exports.StreetTypeArray = Object.values(lixi_internal_request_1.StreetTypeList);
|
|
25
26
|
/**
|
|
26
27
|
* Generates an address for an asset.
|
|
27
|
-
|
|
28
|
-
* @param
|
|
29
|
-
* @
|
|
30
|
-
* @return A transformed address object.
|
|
28
|
+
* @param {Address} address - An address object.
|
|
29
|
+
* @param {string} id - Id of asset object.
|
|
30
|
+
* @return {Partial<AddressType>} A transformed address object.
|
|
31
31
|
*/
|
|
32
32
|
function generateAddress(address, id) {
|
|
33
|
-
var _a;
|
|
34
33
|
var transformedAddress = {
|
|
35
34
|
'@Country': lixi_internal_request_1.CountryCodeList.Au,
|
|
36
35
|
'@UniqueID': id
|
|
37
36
|
};
|
|
38
|
-
var country = (
|
|
37
|
+
var country = (0, address_tools_1.extractCountryFromFormatted)(address.formatted);
|
|
39
38
|
if (!address.country && country.length > 0) {
|
|
40
39
|
address.country = country;
|
|
41
40
|
}
|
|
@@ -50,8 +49,8 @@ function generateAddress(address, id) {
|
|
|
50
49
|
transformedAddress['@AustralianPostCode'] = postcode_1.postcodeMapping[address.state];
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
|
-
for (var _i = 0,
|
|
54
|
-
var
|
|
52
|
+
for (var _i = 0, _a = Object.entries(address); _i < _a.length; _i++) {
|
|
53
|
+
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
55
54
|
if (addressMapping[key]) {
|
|
56
55
|
switch (key) {
|
|
57
56
|
case 'standard':
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Asset } from '../types/events/public-asset';
|
|
2
|
+
/**
|
|
3
|
+
* @description Checks if the asset is of financial type.
|
|
4
|
+
* @param {Asset} asset asset payload.
|
|
5
|
+
* @returns {boolean} returns true if asset is a financial asset.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isFinancialAsset(asset: Asset): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @description Is Asset a Real Estate Asset.
|
|
10
|
+
* @param {Asset} asset An Asset.
|
|
11
|
+
* @returns {boolean} returns true if Asset is a Real Estate Asset.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isRealEstateAsset(asset: Asset): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* @description Is Asset a Motor Vehicle.
|
|
16
|
+
* @param {Asset} asset An Asset.
|
|
17
|
+
* @returns {boolean} returns true if an Asset is a vehicle.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isMotorVehicle(asset: Asset): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @description Is Asset of LIXI type `OtherAsset`.
|
|
22
|
+
* @param {Asset} asset An Asset.
|
|
23
|
+
* @returns {boolean} returns true if asset is `OtherAsset`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isOtherAsset(asset: Asset): boolean;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.isOtherAsset = exports.isMotorVehicle = exports.isRealEstateAsset = exports.isFinancialAsset = void 0;
|
|
4
|
+
var public_asset_1 = require("../types/events/public-asset");
|
|
5
|
+
/**
|
|
6
|
+
* @description Checks if the asset is of financial type.
|
|
7
|
+
* @param {Asset} asset asset payload.
|
|
8
|
+
* @returns {boolean} returns true if asset is a financial asset.
|
|
9
|
+
*/
|
|
10
|
+
function isFinancialAsset(asset) {
|
|
11
|
+
return [
|
|
12
|
+
public_asset_1.AssetType.Shares,
|
|
13
|
+
public_asset_1.AssetType.Superannuation,
|
|
14
|
+
public_asset_1.AssetType.TermDeposit,
|
|
15
|
+
public_asset_1.AssetType.SavingCheckAccount,
|
|
16
|
+
public_asset_1.AssetType.ManagedFunds,
|
|
17
|
+
].includes(asset.type);
|
|
18
|
+
}
|
|
19
|
+
exports.isFinancialAsset = isFinancialAsset;
|
|
20
|
+
/**
|
|
21
|
+
* @description Is Asset a Real Estate Asset.
|
|
22
|
+
* @param {Asset} asset An Asset.
|
|
23
|
+
* @returns {boolean} returns true if Asset is a Real Estate Asset.
|
|
24
|
+
*/
|
|
25
|
+
function isRealEstateAsset(asset) {
|
|
26
|
+
return asset.type === public_asset_1.AssetType.Property;
|
|
27
|
+
}
|
|
28
|
+
exports.isRealEstateAsset = isRealEstateAsset;
|
|
29
|
+
/**
|
|
30
|
+
* @description Is Asset a Motor Vehicle.
|
|
31
|
+
* @param {Asset} asset An Asset.
|
|
32
|
+
* @returns {boolean} returns true if an Asset is a vehicle.
|
|
33
|
+
*/
|
|
34
|
+
function isMotorVehicle(asset) {
|
|
35
|
+
return asset.type === public_asset_1.AssetType.Vehicle;
|
|
36
|
+
}
|
|
37
|
+
exports.isMotorVehicle = isMotorVehicle;
|
|
38
|
+
/**
|
|
39
|
+
* @description Is Asset of LIXI type `OtherAsset`.
|
|
40
|
+
* @param {Asset} asset An Asset.
|
|
41
|
+
* @returns {boolean} returns true if asset is `OtherAsset`.
|
|
42
|
+
*/
|
|
43
|
+
function isOtherAsset(asset) {
|
|
44
|
+
return [public_asset_1.AssetType.HomeContents, public_asset_1.AssetType.Gifts, public_asset_1.AssetType.OtherAsset].includes(asset.type);
|
|
45
|
+
}
|
|
46
|
+
exports.isOtherAsset = isOtherAsset;
|
|
@@ -12,6 +12,6 @@ function normaliseDate(dateOfBirth) {
|
|
|
12
12
|
var year = date.getFullYear();
|
|
13
13
|
var month = ('0' + (date.getMonth() + 1)).slice(-2);
|
|
14
14
|
var day = ('0' + date.getDate()).slice(-2);
|
|
15
|
-
return
|
|
15
|
+
return year + "-" + month + "-" + day;
|
|
16
16
|
}
|
|
17
17
|
exports.normaliseDate = normaliseDate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lendi/integrations-transform",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Library for kafka event data transforming",
|
|
5
5
|
"author": "Integrations <integrations@lendi.com.au>",
|
|
6
6
|
"homepage": "https://bitbucket.org/lendi-dev/integrations-shared-packages#readme",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"url": "git+ssh://git@bitbucket.org/lendi-dev/integrations-shared-packages.git"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@lendi/integrations-credit-protocol": "1.14.
|
|
25
|
-
"@lendi/integrations-protocol": "2.3
|
|
24
|
+
"@lendi/integrations-credit-protocol": "1.14.9",
|
|
25
|
+
"@lendi/integrations-protocol": "2.5.3",
|
|
26
26
|
"clean-deep": "^3.4.0",
|
|
27
27
|
"date-fns": "2.19.0",
|
|
28
28
|
"dd-trace": "^0.28.1",
|
|
@@ -89,4 +89,4 @@
|
|
|
89
89
|
"semver:major": "npm version major",
|
|
90
90
|
"current:version": "echo $npm_package_version"
|
|
91
91
|
}
|
|
92
|
-
}
|
|
92
|
+
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Asset, AssetDefinition as Payload } from '../types/events/public-asset';
|
|
2
|
-
export declare const residentialTypeList: string[];
|
|
3
|
-
export declare const propertyTypeNameList: string[];
|
|
4
|
-
/**
|
|
5
|
-
* Generates a partial internal request from a partial public asset event.
|
|
6
|
-
*
|
|
7
|
-
* @param asset: A partial public asset.
|
|
8
|
-
* @param applicationId: Id of application.
|
|
9
|
-
* @param id: Id of asset entity.
|
|
10
|
-
* @return A partial InternalRequest.
|
|
11
|
-
*/
|
|
12
|
-
export declare function generateAsset({ asset, applicationId, id }: Payload): {};
|
|
13
|
-
/**
|
|
14
|
-
* Checks if the asset is of financial type.
|
|
15
|
-
* @param asset asset payload
|
|
16
|
-
*/
|
|
17
|
-
export declare function isFinancialAsset(asset: Asset): boolean;
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.isFinancialAsset = exports.generateAsset = exports.propertyTypeNameList = exports.residentialTypeList = void 0;
|
|
4
|
-
var lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
|
|
5
|
-
var application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
|
|
6
|
-
var lodash_1 = require("lodash");
|
|
7
|
-
var logger_1 = require("../logger");
|
|
8
|
-
var public_financial_asset_1 = require("../types/enum-mappings/public-financial-asset");
|
|
9
|
-
var public_primary_purpose_1 = require("../types/enum-mappings/public-primary-purpose");
|
|
10
|
-
var public_property_status_1 = require("../types/enum-mappings/public-property-status");
|
|
11
|
-
var public_property_type_1 = require("../types/enum-mappings/public-property-type");
|
|
12
|
-
var public_asset_1 = require("../types/events/public-asset");
|
|
13
|
-
var generate_address_1 = require("../utils/generate-address");
|
|
14
|
-
var get_financial_institution_1 = require("../utils/get-financial-institution");
|
|
15
|
-
var generate_lixi_percentowned_1 = require("./generate-lixi-percentowned");
|
|
16
|
-
var toBeUsedAsSecurityMapping = {
|
|
17
|
-
"true": lixi_internal_request_1.YesNoList.Yes,
|
|
18
|
-
"false": lixi_internal_request_1.YesNoList.No
|
|
19
|
-
};
|
|
20
|
-
var toBePurchasedMapping = {
|
|
21
|
-
"true": lixi_internal_request_1.AssetTransactionList.Purchasing,
|
|
22
|
-
"false": lixi_internal_request_1.AssetTransactionList.Owns
|
|
23
|
-
};
|
|
24
|
-
var assetMapping = {
|
|
25
|
-
make: "".concat(application_paths_1.paths.NonRealEstateAsset, ".MotorVehicle.@Make"),
|
|
26
|
-
year: "".concat(application_paths_1.paths.NonRealEstateAsset, ".MotorVehicle.@Year"),
|
|
27
|
-
model: "".concat(application_paths_1.paths.NonRealEstateAsset, ".MotorVehicle.@Model"),
|
|
28
|
-
estimatedValue: "".concat(application_paths_1.paths.NonRealEstateAsset, ".EstimatedValue.@Value"),
|
|
29
|
-
zoneType: "".concat(application_paths_1.paths.RealEstateAsset, ".Zoning.@Type"),
|
|
30
|
-
toBeUsedAsSecurity: "".concat(application_paths_1.paths.RealEstateAsset, ".@ToBeUsedAsSecurity"),
|
|
31
|
-
toBePurchased: "".concat(application_paths_1.paths.RealEstateAsset, ".@Transaction"),
|
|
32
|
-
primaryPurpose: "".concat(application_paths_1.paths.RealEstateAsset, ".@PrimaryPurpose"),
|
|
33
|
-
propertyStatus: "".concat(application_paths_1.paths.RealEstateAsset, ".@Status"),
|
|
34
|
-
financialInstitution: "".concat(application_paths_1.paths.NonRealEstateAsset, ".FinancialAsset.AccountNumber.@FinancialInstitution"),
|
|
35
|
-
propertyType: "".concat(application_paths_1.paths.RealEstateAsset, ".Residential.@Type"),
|
|
36
|
-
address: application_paths_1.paths.Address
|
|
37
|
-
};
|
|
38
|
-
exports.residentialTypeList = Object.values(lixi_internal_request_1.ResidentialTypeList);
|
|
39
|
-
exports.propertyTypeNameList = Object.values(lixi_internal_request_1.Custom3PropertyTypeNameList);
|
|
40
|
-
/**
|
|
41
|
-
* Generates a partial internal request from a partial public asset event.
|
|
42
|
-
*
|
|
43
|
-
* @param asset: A partial public asset.
|
|
44
|
-
* @param applicationId: Id of application.
|
|
45
|
-
* @param id: Id of asset entity.
|
|
46
|
-
* @return A partial InternalRequest.
|
|
47
|
-
*/
|
|
48
|
-
function generateAsset(_a) {
|
|
49
|
-
var asset = _a.asset, applicationId = _a.applicationId, id = _a.id;
|
|
50
|
-
var partialApplication = {};
|
|
51
|
-
(0, lodash_1.set)(partialApplication, application_paths_1.paths.ApplicationId, applicationId);
|
|
52
|
-
var isPropertyAsset = asset.type === public_asset_1.AssetType.Property;
|
|
53
|
-
switch (asset.type) {
|
|
54
|
-
case public_asset_1.AssetType.Vehicle:
|
|
55
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".@Type"), lixi_internal_request_1.NonRealEstateAssetTypeList.MotorVehicleAndTransport);
|
|
56
|
-
break;
|
|
57
|
-
case public_asset_1.AssetType.Property:
|
|
58
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.RealEstateAsset, ".@MultipleDwellings"), lixi_internal_request_1.YesNoList.No);
|
|
59
|
-
break;
|
|
60
|
-
case public_asset_1.AssetType.HomeContents:
|
|
61
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".@Type"), lixi_internal_request_1.NonRealEstateAssetTypeList.Other);
|
|
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
|
-
case public_asset_1.AssetType.OtherAsset:
|
|
66
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".@Type"), lixi_internal_request_1.NonRealEstateAssetTypeList.Other);
|
|
67
|
-
if (asset.description)
|
|
68
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".OtherAsset.@Description"), asset.description);
|
|
69
|
-
break;
|
|
70
|
-
case public_asset_1.AssetType.Shares:
|
|
71
|
-
case public_asset_1.AssetType.Superannuation:
|
|
72
|
-
case public_asset_1.AssetType.TermDeposit:
|
|
73
|
-
case public_asset_1.AssetType.SavingCheckAccount:
|
|
74
|
-
case public_asset_1.AssetType.ManagedFunds:
|
|
75
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".@Type"), lixi_internal_request_1.NonRealEstateAssetTypeList.FinancialAsset);
|
|
76
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".FinancialAsset.@Type"), public_financial_asset_1.financialAssetMapping[asset.type]);
|
|
77
|
-
break;
|
|
78
|
-
default:
|
|
79
|
-
logger_1.logger.warn({ message: "Unhandled asset type: ".concat(asset.type), applicationId: applicationId });
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
if (isPropertyAsset) {
|
|
83
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.RealEstateAsset, ".@UniqueID"), id);
|
|
84
|
-
assetMapping.percentOwned = "".concat(application_paths_1.paths.RealEstateAsset, ".PercentOwned");
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.NonRealEstateAsset, ".@UniqueID"), id);
|
|
88
|
-
assetMapping.percentOwned = "".concat(application_paths_1.paths.NonRealEstateAsset, ".PercentOwned");
|
|
89
|
-
}
|
|
90
|
-
for (var _i = 0, _b = Object.entries(asset); _i < _b.length; _i++) {
|
|
91
|
-
var _c = _b[_i], key = _c[0], value = _c[1];
|
|
92
|
-
if (assetMapping[key]) {
|
|
93
|
-
switch (key) {
|
|
94
|
-
case 'primaryPurpose':
|
|
95
|
-
(0, lodash_1.set)(partialApplication, assetMapping[key], public_primary_purpose_1.primaryPurposeMapping[value]);
|
|
96
|
-
break;
|
|
97
|
-
case 'toBePurchased':
|
|
98
|
-
(0, lodash_1.set)(partialApplication, assetMapping[key], toBePurchasedMapping[value]);
|
|
99
|
-
break;
|
|
100
|
-
case 'propertyStatus':
|
|
101
|
-
(0, lodash_1.set)(partialApplication, assetMapping[key], public_property_status_1.propertyStatusMapping[value]);
|
|
102
|
-
break;
|
|
103
|
-
case 'toBeUsedAsSecurity':
|
|
104
|
-
if (isPropertyAsset)
|
|
105
|
-
(0, lodash_1.set)(partialApplication, assetMapping[key], toBeUsedAsSecurityMapping[value]);
|
|
106
|
-
break;
|
|
107
|
-
case 'estimatedValue':
|
|
108
|
-
if (isPropertyAsset) {
|
|
109
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.RealEstateAsset, ".EstimatedValue.@Value"), value);
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
(0, lodash_1.set)(partialApplication, assetMapping[key], value);
|
|
113
|
-
}
|
|
114
|
-
break;
|
|
115
|
-
case 'propertyType':
|
|
116
|
-
var mappedValue = public_property_type_1.propertyTypeMapping[value];
|
|
117
|
-
if (exports.residentialTypeList.includes(mappedValue)) {
|
|
118
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.RealEstateAsset, ".Residential.@Type"), mappedValue);
|
|
119
|
-
}
|
|
120
|
-
else if (exports.propertyTypeNameList.includes(mappedValue)) {
|
|
121
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.RealEstateAsset, ".PropertyType.@PropertyTypeName"), mappedValue);
|
|
122
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.RealEstateAsset, ".PropertyType.@CategoryTypeName"), lixi_internal_request_1.Custom2CategoryTypeNameList.Residential);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
logger_1.logger.warn({ message: "Unknown propertyType ".concat(value, " for asset ").concat(id), applicationId: applicationId });
|
|
126
|
-
}
|
|
127
|
-
break;
|
|
128
|
-
case 'zoneType':
|
|
129
|
-
if (asset.zoneType === public_asset_1.ZoneType.Commercial) {
|
|
130
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.RealEstateAsset, ".Commercial.@Type"), lixi_internal_request_1.OtherAssetTypeList.Other);
|
|
131
|
-
(0, lodash_1.set)(partialApplication, assetMapping[key], lixi_internal_request_1.Custom4TypeList.Commercial);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
(0, lodash_1.set)(partialApplication, assetMapping[key], lixi_internal_request_1.Custom4TypeList.Residential);
|
|
135
|
-
}
|
|
136
|
-
break;
|
|
137
|
-
case 'financialInstitution':
|
|
138
|
-
if (isFinancialAsset(asset)) {
|
|
139
|
-
var financialInstitution = (0, get_financial_institution_1.getFinancialInstitution)(value.toString());
|
|
140
|
-
(0, lodash_1.set)(partialApplication, assetMapping[key], financialInstitution);
|
|
141
|
-
}
|
|
142
|
-
break;
|
|
143
|
-
case 'year':
|
|
144
|
-
(0, lodash_1.set)(partialApplication, assetMapping[key], value.toString());
|
|
145
|
-
break;
|
|
146
|
-
case 'address':
|
|
147
|
-
var addressId = "".concat(id, "-address");
|
|
148
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.RealEstateAsset, ".@x_Address"), addressId);
|
|
149
|
-
(0, lodash_1.set)(partialApplication, assetMapping[key], (0, generate_address_1.generateAddress)(value, addressId));
|
|
150
|
-
break;
|
|
151
|
-
case 'percentOwned':
|
|
152
|
-
var percentOwned = (0, generate_lixi_percentowned_1.generateLIXIPercentOwned)(value);
|
|
153
|
-
if (percentOwned) {
|
|
154
|
-
(0, lodash_1.set)(partialApplication, assetMapping[key], percentOwned);
|
|
155
|
-
}
|
|
156
|
-
break;
|
|
157
|
-
default:
|
|
158
|
-
(0, lodash_1.set)(partialApplication, assetMapping[key], value);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return partialApplication;
|
|
163
|
-
}
|
|
164
|
-
exports.generateAsset = generateAsset;
|
|
165
|
-
/**
|
|
166
|
-
* Checks if the asset is of financial type.
|
|
167
|
-
* @param asset asset payload
|
|
168
|
-
*/
|
|
169
|
-
function isFinancialAsset(asset) {
|
|
170
|
-
return [
|
|
171
|
-
public_asset_1.AssetType.Shares,
|
|
172
|
-
public_asset_1.AssetType.Superannuation,
|
|
173
|
-
public_asset_1.AssetType.TermDeposit,
|
|
174
|
-
public_asset_1.AssetType.SavingCheckAccount,
|
|
175
|
-
public_asset_1.AssetType.ManagedFunds,
|
|
176
|
-
].includes(asset.type);
|
|
177
|
-
}
|
|
178
|
-
exports.isFinancialAsset = isFinancialAsset;
|