@lendi/integrations-transform 1.2.7 → 1.3.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/application-workflow-event.json +4 -9
- package/lib/schemas/public-liability-event.json +25 -1
- package/lib/transform-events/transform-application-workflow.d.ts +3 -3
- package/lib/transform-events/transform-application-workflow.js +2 -2
- package/lib/transform-events/{generate-liability.d.ts → transform-liability.d.ts} +2 -1
- package/lib/transform-events/{generate-liability.js → transform-liability.js} +29 -6
- package/lib/types/events/application-workflow.d.ts +2 -2
- package/lib/types/events/public-liability.d.ts +4 -1
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export * from './transform-events/transform-applicant';
|
|
2
2
|
export * from './transform-events/transform-application';
|
|
3
|
+
export * from './transform-events/transform-application-workflow';
|
|
3
4
|
export * from './transform-events/transform-income';
|
|
4
5
|
export * from './transform-events/transform-asset';
|
|
5
6
|
export * from './transform-events/transform-expenses';
|
|
6
|
-
export * from './transform-events/
|
|
7
|
+
export * from './transform-events/transform-liability';
|
|
7
8
|
export * from './transform-events/generate-required-document';
|
|
8
9
|
export * from './transform-events/generate-funding-position';
|
|
9
10
|
export * from './update-application/merge-application';
|
package/lib/index.js
CHANGED
|
@@ -13,10 +13,11 @@ exports.__esModule = true;
|
|
|
13
13
|
/* istanbul ignore file */
|
|
14
14
|
__exportStar(require("./transform-events/transform-applicant"), exports);
|
|
15
15
|
__exportStar(require("./transform-events/transform-application"), exports);
|
|
16
|
+
__exportStar(require("./transform-events/transform-application-workflow"), exports);
|
|
16
17
|
__exportStar(require("./transform-events/transform-income"), exports);
|
|
17
18
|
__exportStar(require("./transform-events/transform-asset"), exports);
|
|
18
19
|
__exportStar(require("./transform-events/transform-expenses"), exports);
|
|
19
|
-
__exportStar(require("./transform-events/
|
|
20
|
+
__exportStar(require("./transform-events/transform-liability"), exports);
|
|
20
21
|
__exportStar(require("./transform-events/generate-required-document"), exports);
|
|
21
22
|
__exportStar(require("./transform-events/generate-funding-position"), exports);
|
|
22
23
|
__exportStar(require("./update-application/merge-application"), exports);
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
},
|
|
12
12
|
"reviewType": {
|
|
13
13
|
"type": "string",
|
|
14
|
-
"description": "The Broker Audit Review record type"
|
|
14
|
+
"description": "The Broker Audit Review record type"
|
|
15
15
|
},
|
|
16
16
|
"status": {
|
|
17
17
|
"type": "string",
|
|
18
|
-
"description": "The Broker Audit Review status"
|
|
18
|
+
"description": "The Broker Audit Review status"
|
|
19
19
|
},
|
|
20
20
|
"outcome": {
|
|
21
21
|
"type": "string",
|
|
22
|
-
"description": "The Broker Audit Review outcome"
|
|
22
|
+
"description": "The Broker Audit Review outcome"
|
|
23
23
|
},
|
|
24
24
|
"completedBy": {
|
|
25
25
|
"type": "string",
|
|
@@ -218,12 +218,7 @@
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
},
|
|
221
|
-
"
|
|
222
|
-
{ "required": ["applicationId", "stage", "status", "brokerAuditReview"] },
|
|
223
|
-
{
|
|
224
|
-
"required": ["applicationId", "stage", "status", "applicationStage", "applicationStatus", "brokerAuditReview"]
|
|
225
|
-
}
|
|
226
|
-
]
|
|
221
|
+
"required": ["applicationId", "stage", "status", "brokerAuditReview"]
|
|
227
222
|
}
|
|
228
223
|
},
|
|
229
224
|
"type": "object",
|
|
@@ -61,6 +61,21 @@
|
|
|
61
61
|
"financialInstitution": {
|
|
62
62
|
"type": "string"
|
|
63
63
|
},
|
|
64
|
+
"financialInstitutionShortName": {
|
|
65
|
+
"type": "string"
|
|
66
|
+
},
|
|
67
|
+
"FinancialInstitutionBsb": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"pattern": "^\\d{6}$",
|
|
70
|
+
"description": "The BSB number identifying where the account is held within the Financial Institution",
|
|
71
|
+
"example": "123456"
|
|
72
|
+
},
|
|
73
|
+
"FinancialInstitutionAccountNumber": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"pattern": "^\\d{0,10}$",
|
|
76
|
+
"description": "The unique number assigned to the Financial Institution account",
|
|
77
|
+
"example": "999994"
|
|
78
|
+
},
|
|
64
79
|
"repaymentAmount": {
|
|
65
80
|
"type": "number"
|
|
66
81
|
},
|
|
@@ -145,6 +160,15 @@
|
|
|
145
160
|
"financialInstitution": {
|
|
146
161
|
"$ref": "#/definitions/financialInstitution"
|
|
147
162
|
},
|
|
163
|
+
"financialInstitutionShortName": {
|
|
164
|
+
"$ref": "#/definitions/financialInstitutionShortName"
|
|
165
|
+
},
|
|
166
|
+
"financialInstitutionBsb": {
|
|
167
|
+
"$ref": "#/definitions/FinancialInstitutionBsb"
|
|
168
|
+
},
|
|
169
|
+
"financialInstitutionAccountNumber": {
|
|
170
|
+
"$ref": "#/definitions/FinancialInstitutionAccountNumber"
|
|
171
|
+
},
|
|
148
172
|
"repaymentAmount": {
|
|
149
173
|
"$ref": "#/definitions/repaymentAmount"
|
|
150
174
|
},
|
|
@@ -191,7 +215,7 @@
|
|
|
191
215
|
"$ref": "#/definitions/description"
|
|
192
216
|
}
|
|
193
217
|
},
|
|
194
|
-
"required": ["
|
|
218
|
+
"required": ["type", "outstandingBalance"]
|
|
195
219
|
},
|
|
196
220
|
"LiabilityPayload": {
|
|
197
221
|
"type": "object",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PayloadClass as ApplicationWorkflow } from '../types/events/application-workflow';
|
|
2
2
|
/**
|
|
3
|
-
* Generates a partial internal request from a partial
|
|
3
|
+
* Generates a partial internal request from a partial application workflow event.
|
|
4
4
|
*
|
|
5
5
|
* @return partialApplication: A partial internal request.
|
|
6
6
|
* @param applicationWorkflow: ApplicationWorkflow object.
|
|
7
7
|
*/
|
|
8
|
-
export declare function transformApplicationWorkflow(applicationWorkflow:
|
|
8
|
+
export declare function transformApplicationWorkflow(applicationWorkflow: ApplicationWorkflow): {};
|
|
@@ -4,7 +4,7 @@ exports.transformApplicationWorkflow = void 0;
|
|
|
4
4
|
var application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
|
|
5
5
|
var lodash_1 = require("lodash");
|
|
6
6
|
/**
|
|
7
|
-
* Generates a partial internal request from a partial
|
|
7
|
+
* Generates a partial internal request from a partial application workflow event.
|
|
8
8
|
*
|
|
9
9
|
* @return partialApplication: A partial internal request.
|
|
10
10
|
* @param applicationWorkflow: ApplicationWorkflow object.
|
|
@@ -20,7 +20,7 @@ function transformApplicationWorkflow(applicationWorkflow) {
|
|
|
20
20
|
if (opportunityMapping[key]) {
|
|
21
21
|
if (key === 'stage') {
|
|
22
22
|
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Instructions, ".@UniqueID"), "".concat(applicationWorkflow.applicationId, "-stage"));
|
|
23
|
-
(0, lodash_1.set)(partialApplication, "".concat(opportunityMapping[key], ".@Details"),
|
|
23
|
+
(0, lodash_1.set)(partialApplication, "".concat(opportunityMapping[key], ".@Details"), value || 'Unknown');
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
26
|
(0, lodash_1.set)(partialApplication, opportunityMapping[key], value);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { LiabilityPayload } from '../types/events/public-liability';
|
|
2
|
+
import { PartialApplication } from '../types/partial-application';
|
|
2
3
|
/**
|
|
3
4
|
* Generates a partial internal request from a liability event payload.
|
|
4
5
|
*
|
|
5
6
|
* @param liabilityPayload: A liability event payload.
|
|
6
7
|
* @return A partial InternalRequest.
|
|
7
8
|
*/
|
|
8
|
-
export declare function
|
|
9
|
+
export declare function transformLiability({ applicationId, id, liability }: LiabilityPayload): PartialApplication;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformLiability = void 0;
|
|
4
4
|
var application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
|
|
5
5
|
var lodash_1 = require("lodash");
|
|
6
6
|
var alieo_frequency_1 = require("../types/enum-mappings/alieo-frequency");
|
|
7
7
|
var liability_payment_type_1 = require("../types/enum-mappings/liability-payment-type");
|
|
8
8
|
var liability_type_1 = require("../types/enum-mappings/liability-type");
|
|
9
|
+
var public_liability_1 = require("../types/events/public-liability");
|
|
9
10
|
var get_financial_institution_1 = require("../utils/get-financial-institution");
|
|
10
11
|
var round_decimal_1 = require("../utils/round-decimal");
|
|
11
12
|
var transform_percent_owned_1 = require("./transform-percent-owned");
|
|
12
13
|
var lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
|
|
14
|
+
var lixi_internal_request_2 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
13
15
|
/**
|
|
14
16
|
* Generates a partial internal request from a liability event payload.
|
|
15
17
|
*
|
|
16
18
|
* @param liabilityPayload: A liability event payload.
|
|
17
19
|
* @return A partial InternalRequest.
|
|
18
20
|
*/
|
|
19
|
-
function
|
|
21
|
+
function transformLiability(_a) {
|
|
20
22
|
var applicationId = _a.applicationId, id = _a.id, liability = _a.liability;
|
|
21
23
|
var partialApplication = {};
|
|
22
24
|
var liabilityMapping = {
|
|
@@ -26,7 +28,11 @@ function generateLiability(_a) {
|
|
|
26
28
|
clearingFromThisLoan: "".concat(application_paths_1.paths.Liability, ".@ClearingFromThisLoan"),
|
|
27
29
|
description: "".concat(application_paths_1.paths.Liability, ".@Description"),
|
|
28
30
|
financialInstitution: "".concat(application_paths_1.paths.Liability, ".AccountNumber.@FinancialInstitution"),
|
|
29
|
-
|
|
31
|
+
financialInstitutionAccountNumber: "".concat(application_paths_1.paths.Liability, ".AccountNumber.@AccountNumber"),
|
|
32
|
+
financialInstitutionBsb: "".concat(application_paths_1.paths.Liability, ".AccountNumber.@BSB"),
|
|
33
|
+
interestOnlyRemainingTerm: "".concat(application_paths_1.paths.Liability, ".OriginalTerm.@PaymentTypeDuration"),
|
|
34
|
+
creditLimit: "".concat(application_paths_1.paths.Liability, ".@CreditLimit"),
|
|
35
|
+
newLimit: "".concat(application_paths_1.paths.Liability, ".@NewLimit"),
|
|
30
36
|
repaymentAmount: "".concat(application_paths_1.paths.Liability, ".Repayment[0].@RepaymentAmount"),
|
|
31
37
|
repaymentFrequency: "".concat(application_paths_1.paths.Liability, ".Repayment[0].@RepaymentFrequency"),
|
|
32
38
|
remainingTermDuration: "".concat(application_paths_1.paths.Liability, ".RemainingTerm.@Duration"),
|
|
@@ -40,6 +46,12 @@ function generateLiability(_a) {
|
|
|
40
46
|
// Default repayments to 0 and repaymentFrequency to weekly.
|
|
41
47
|
(0, lodash_1.set)(partialApplication, liabilityMapping.repaymentAmount, 0);
|
|
42
48
|
(0, lodash_1.set)(partialApplication, liabilityMapping.repaymentFrequency, lixi_internal_request_1.List.Weekly);
|
|
49
|
+
// Currently repayments is not captured for store cards and credit cards, default the monthly repayment amount to
|
|
50
|
+
// the credit limit with interest rate of 3%.
|
|
51
|
+
if ([public_liability_1.LiabilityType.CreditCard, public_liability_1.LiabilityType.StoreCard].includes(liability.type) && liability.creditLimit) {
|
|
52
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping.repaymentAmount, liability.creditLimit * 0.03);
|
|
53
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping.repaymentFrequency, lixi_internal_request_1.List.Monthly);
|
|
54
|
+
}
|
|
43
55
|
// Default clearingFromThisLoan to No if the value is not present in the event.
|
|
44
56
|
(0, lodash_1.set)(partialApplication, liabilityMapping.clearingFromThisLoan, lixi_internal_request_1.YesNoList.No);
|
|
45
57
|
for (var _i = 0, _b = Object.entries(liability); _i < _b.length; _i++) {
|
|
@@ -47,16 +59,26 @@ function generateLiability(_a) {
|
|
|
47
59
|
if (liabilityMapping[key]) {
|
|
48
60
|
switch (key) {
|
|
49
61
|
case 'outstandingBalance':
|
|
62
|
+
case 'creditLimit':
|
|
50
63
|
case 'newLimit':
|
|
51
64
|
case 'repaymentAmount':
|
|
52
65
|
(0, lodash_1.set)(partialApplication, liabilityMapping[key], (0, round_decimal_1.roundDecimal)(value));
|
|
53
66
|
break;
|
|
67
|
+
case 'interestOnlyRemainingTerm':
|
|
68
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], (0, round_decimal_1.roundDecimal)(value));
|
|
69
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Liability, ".OriginalTerm.@PaymentType"), lixi_internal_request_1.PaymentTypeList.InterestOnly);
|
|
70
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Liability, ".OriginalTerm.@PaymentTypeUnits"), lixi_internal_request_1.LoanTermUnitsList.Years);
|
|
71
|
+
break;
|
|
54
72
|
case 'type':
|
|
55
73
|
(0, lodash_1.set)(partialApplication, liabilityMapping[key], liability_type_1.liabilityTypeMapping[value]);
|
|
56
74
|
break;
|
|
57
75
|
case 'clearingFromThisLoan':
|
|
58
76
|
(0, lodash_1.set)(partialApplication, liabilityMapping[key], value ? lixi_internal_request_1.YesNoList.Yes : lixi_internal_request_1.YesNoList.No);
|
|
59
77
|
break;
|
|
78
|
+
case 'clearingFromOtherSource':
|
|
79
|
+
if (value === public_liability_1.ClearingFromOtherSource.PayingOut)
|
|
80
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], lixi_internal_request_1.YesNoList.Yes);
|
|
81
|
+
break;
|
|
60
82
|
case 'repaymentFrequency':
|
|
61
83
|
(0, lodash_1.set)(partialApplication, liabilityMapping[key], alieo_frequency_1.liabilityFrequencyMapping[value]);
|
|
62
84
|
break;
|
|
@@ -64,10 +86,11 @@ function generateLiability(_a) {
|
|
|
64
86
|
(0, lodash_1.set)(partialApplication, liabilityMapping[key], liability_payment_type_1.liabilityPaymentTypeMapping[value]);
|
|
65
87
|
break;
|
|
66
88
|
case 'remainingTermDuration':
|
|
67
|
-
(0, lodash_1.set)(partialApplication, liabilityMapping[key], Math.round(
|
|
89
|
+
(0, lodash_1.set)(partialApplication, liabilityMapping[key], Math.round(value * 12));
|
|
90
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Liability, ".RemainingTerm.@Units"), lixi_internal_request_2.UnitsList.Months);
|
|
68
91
|
break;
|
|
69
92
|
case 'financialInstitution':
|
|
70
|
-
var financialInstitution = (0, get_financial_institution_1.getFinancialInstitution)(value.toString());
|
|
93
|
+
var financialInstitution = (0, get_financial_institution_1.getFinancialInstitution)(value.toString()) || lixi_internal_request_2.FinancialInstitutionList.Other;
|
|
71
94
|
(0, lodash_1.set)(partialApplication, liabilityMapping[key], financialInstitution);
|
|
72
95
|
break;
|
|
73
96
|
case 'percentOwned':
|
|
@@ -84,4 +107,4 @@ function generateLiability(_a) {
|
|
|
84
107
|
}
|
|
85
108
|
return partialApplication;
|
|
86
109
|
}
|
|
87
|
-
exports.
|
|
110
|
+
exports.transformLiability = transformLiability;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Application workflow
|
|
3
3
|
*/
|
|
4
4
|
export interface ApplicationWorkflow {
|
|
5
|
-
payload:
|
|
5
|
+
payload: PayloadClass;
|
|
6
6
|
type: Type;
|
|
7
7
|
/**
|
|
8
8
|
* schema version
|
|
9
9
|
*/
|
|
10
10
|
version: string;
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
12
|
+
export interface PayloadClass {
|
|
13
13
|
/**
|
|
14
14
|
* UUID of the Application
|
|
15
15
|
*/
|
|
@@ -29,13 +29,16 @@ export interface Liability {
|
|
|
29
29
|
creditLimit?: number;
|
|
30
30
|
description?: string;
|
|
31
31
|
financialInstitution?: string;
|
|
32
|
+
financialInstitutionAccountNumber?: string;
|
|
33
|
+
financialInstitutionBsb?: string;
|
|
34
|
+
financialInstitutionShortName?: string;
|
|
32
35
|
interestOnlyDuration?: number;
|
|
33
36
|
interestOnlyRemainingTerm?: number;
|
|
34
37
|
interestType?: InterestType;
|
|
35
38
|
newLimit?: number;
|
|
36
39
|
originalBalance?: number;
|
|
37
40
|
outstandingBalance: number;
|
|
38
|
-
percentOwned
|
|
41
|
+
percentOwned?: PercentOwned;
|
|
39
42
|
remainingTermDuration?: number;
|
|
40
43
|
repaymentAmount?: number;
|
|
41
44
|
repaymentFrequency?: RepaymentFrequency;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lendi/integrations-transform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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,7 +21,7 @@
|
|
|
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.15.
|
|
24
|
+
"@lendi/integrations-credit-protocol": "1.15.6",
|
|
25
25
|
"@lendi/integrations-protocol": "2.5.4",
|
|
26
26
|
"clean-deep": "^3.4.0",
|
|
27
27
|
"date-fns": "2.19.0",
|