@lendi/act-credit-decisions-transform 1.9.7 → 1.9.11
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/CHANGELOG.md +64 -0
- package/lib/schemas/bcm-application-status-updated.json +91 -0
- package/lib/transform-events/transform-asset.js +5 -3
- package/lib/transform-events/transform-bcm-status-updated.d.ts +8 -0
- package/lib/transform-events/transform-bcm-status-updated.js +44 -0
- package/lib/types/events/bcm-application-status-updated.d.ts +63 -0
- package/lib/types/events/bcm-application-status-updated.js +39 -0
- package/package.json +3 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# 1.9.0
|
|
2
|
+
|
|
3
|
+
Changes
|
|
4
|
+
|
|
5
|
+
- Clone from https://bitbucket.org/lendi-dev/integrations-shared-packages/commits/f1ac57093b49cc53f872cb3986d006ad90d49b10
|
|
6
|
+
|
|
7
|
+
# 1.8.6
|
|
8
|
+
|
|
9
|
+
Changes
|
|
10
|
+
|
|
11
|
+
- Update `merge-application` to merge the company applicant directors
|
|
12
|
+
|
|
13
|
+
# 1.8.5
|
|
14
|
+
|
|
15
|
+
Changes
|
|
16
|
+
|
|
17
|
+
- Update `transfrom-funding-position` to set pledge amount on application if it exists in property
|
|
18
|
+
|
|
19
|
+
# 1.8.4
|
|
20
|
+
|
|
21
|
+
Changes
|
|
22
|
+
|
|
23
|
+
- Update `applicant-event` to include SIMPLE_OR_BARE trust type and update mapping in transform
|
|
24
|
+
|
|
25
|
+
# 1.8.3
|
|
26
|
+
|
|
27
|
+
Changes
|
|
28
|
+
|
|
29
|
+
- Update `@lendi/transform-events` to support company applicant mappings
|
|
30
|
+
|
|
31
|
+
# 1.8.2
|
|
32
|
+
|
|
33
|
+
Changes
|
|
34
|
+
|
|
35
|
+
- Use `@lendi/integrations-protocol@2.7.4`
|
|
36
|
+
|
|
37
|
+
# 1.8.1
|
|
38
|
+
|
|
39
|
+
Changes
|
|
40
|
+
|
|
41
|
+
- Update `transformApplicationWorkflow` to support `applicationStatus`
|
|
42
|
+
- Use `@lendi/integrations-protocol@2.7.2`
|
|
43
|
+
|
|
44
|
+
# 1.7.3
|
|
45
|
+
|
|
46
|
+
Fix
|
|
47
|
+
|
|
48
|
+
- Remove some unnecessary `additionalProperties` from event schema to void AJV warning msg
|
|
49
|
+
|
|
50
|
+
# 1.7.0
|
|
51
|
+
|
|
52
|
+
BREAKING CHANGES
|
|
53
|
+
|
|
54
|
+
- Change to use `@lendi/integration-protocols@2.7.0` for better Identification fields support
|
|
55
|
+
|
|
56
|
+
# 1.6.0
|
|
57
|
+
|
|
58
|
+
BREAKING CHANGES
|
|
59
|
+
|
|
60
|
+
- Change to module `commonjs` to make it compatible with existing codebase
|
|
61
|
+
|
|
62
|
+
Changes
|
|
63
|
+
|
|
64
|
+
- Upgrade `@lendi/integrations-protocol` to `v2.6.4`
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Back Channel Message Event",
|
|
3
|
+
"description": "Event produced to update status of application from an external party.",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"definitions": {
|
|
6
|
+
"payload": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"additionalInformation": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "json stringified string of a json object that captures any additional information from upstream."
|
|
13
|
+
},
|
|
14
|
+
"applicationId": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"format": "uuid"
|
|
17
|
+
},
|
|
18
|
+
"description": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"message": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"enum": [
|
|
24
|
+
"Application Received",
|
|
25
|
+
"Application Registered",
|
|
26
|
+
"Application Settled",
|
|
27
|
+
"Cancelled",
|
|
28
|
+
"Conditionally Approved",
|
|
29
|
+
"Declined",
|
|
30
|
+
"Docs Received",
|
|
31
|
+
"Docs Sent",
|
|
32
|
+
"Error On Submission",
|
|
33
|
+
"Lender Information",
|
|
34
|
+
"Outstanding Items",
|
|
35
|
+
"Pre Approved",
|
|
36
|
+
"Referred",
|
|
37
|
+
"Settlement Booked",
|
|
38
|
+
"Solicitor Instructed",
|
|
39
|
+
"Unconditionally Approved",
|
|
40
|
+
"Valuation Ordered",
|
|
41
|
+
"Valuation Received",
|
|
42
|
+
"Withdrawn"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"publishedAt": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"format": "date-time"
|
|
48
|
+
},
|
|
49
|
+
"sourceInternalId": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"lenderAssignedId": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"description": "The internal reference id assigned by the lender after it is submitted to them by the gateway. This identifier is required by team members to reference a specific application when communicating with a lender."
|
|
55
|
+
},
|
|
56
|
+
"source": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"enum": ["Nextgen", "Simpology"]
|
|
59
|
+
},
|
|
60
|
+
"type": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"enum": ["event", "status"]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"required": [
|
|
66
|
+
"applicationId",
|
|
67
|
+
"description",
|
|
68
|
+
"message",
|
|
69
|
+
"publishedAt",
|
|
70
|
+
"sourceInternalId",
|
|
71
|
+
"lenderAssignedId",
|
|
72
|
+
"source",
|
|
73
|
+
"type"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"properties": {
|
|
78
|
+
"version": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"description": "Current schema version."
|
|
81
|
+
},
|
|
82
|
+
"type": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"enum": ["BcmApplicationStatusUpdated"]
|
|
85
|
+
},
|
|
86
|
+
"payload": {
|
|
87
|
+
"$ref": "#/definitions/payload"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"required": ["version", "type", "payload"]
|
|
91
|
+
}
|
|
@@ -111,11 +111,13 @@ function transformAsset({ asset, applicationId, id }) {
|
|
|
111
111
|
break;
|
|
112
112
|
case 'propertyType':
|
|
113
113
|
const propertyTypeMapping = getPropertyType(value);
|
|
114
|
-
if (
|
|
114
|
+
if (propertyTypeMapping) {
|
|
115
|
+
const { path, value: mappedValue } = propertyTypeMapping;
|
|
116
|
+
(0, lodash_1.set)(partialApplication, path, mappedValue);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
115
119
|
logger_1.logger.warn({ message: `Unknown propertyType ${value} for asset ${id}`, applicationId });
|
|
116
120
|
}
|
|
117
|
-
const { path, value: mappedValue } = propertyTypeMapping;
|
|
118
|
-
(0, lodash_1.set)(partialApplication, path, mappedValue);
|
|
119
121
|
break;
|
|
120
122
|
case 'zoneType':
|
|
121
123
|
if (asset.zoneType === public_asset_1.ZoneType.Commercial) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Payload as BCMStatusUpdatedPayload } from '../types/events/bcm-application-status-updated';
|
|
2
|
+
/**
|
|
3
|
+
* Generates a partial application from an BCMStatusUpdated event
|
|
4
|
+
*
|
|
5
|
+
* @param bcmStatusUpdatedPayload BCMStatusUpdated event payload
|
|
6
|
+
* @returns A partial application
|
|
7
|
+
*/
|
|
8
|
+
export declare function transformBcmStatusUpdated(bcmStatusUpdatedPayload: BCMStatusUpdatedPayload): Promise<any>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.transformBcmStatusUpdated = void 0;
|
|
13
|
+
const application_paths_1 = require("@lendi/act-eac-integrations-protocol/lib/utils/application-paths");
|
|
14
|
+
const lodash_1 = require("lodash");
|
|
15
|
+
const bcm_application_status_updated_1 = require("../types/events/bcm-application-status-updated");
|
|
16
|
+
const launch_darkly_1 = require("worker/src/services/launch-darkly");
|
|
17
|
+
const application_workflow_1 = require("../types/events/application-workflow");
|
|
18
|
+
/**
|
|
19
|
+
* Generates a partial application from an BCMStatusUpdated event
|
|
20
|
+
*
|
|
21
|
+
* @param bcmStatusUpdatedPayload BCMStatusUpdated event payload
|
|
22
|
+
* @returns A partial application
|
|
23
|
+
*/
|
|
24
|
+
function transformBcmStatusUpdated(bcmStatusUpdatedPayload) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const bcmForDeclinedStatusEnabled = yield launch_darkly_1.ldServiceClient.getFeatureFlag(launch_darkly_1.FeatureFlags.BCM_FOR_DECLINED_STATUS);
|
|
27
|
+
const partialApplication = {};
|
|
28
|
+
if (!bcmForDeclinedStatusEnabled) {
|
|
29
|
+
return partialApplication;
|
|
30
|
+
}
|
|
31
|
+
const { applicationId, message } = bcmStatusUpdatedPayload;
|
|
32
|
+
if (message !== bcm_application_status_updated_1.Message.Declined) {
|
|
33
|
+
return partialApplication;
|
|
34
|
+
}
|
|
35
|
+
(0, lodash_1.set)(partialApplication, application_paths_1.paths.ApplicationId, applicationId);
|
|
36
|
+
const statusInstructionDetails = {
|
|
37
|
+
'@UniqueID': `${applicationId}-status`,
|
|
38
|
+
'@Details': application_workflow_1.ApplicationStatus.Declined,
|
|
39
|
+
};
|
|
40
|
+
(0, lodash_1.set)(partialApplication, application_paths_1.paths.InstructionsStatus, statusInstructionDetails);
|
|
41
|
+
return partialApplication;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
exports.transformBcmStatusUpdated = transformBcmStatusUpdated;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event produced to update status of application from an external party.
|
|
3
|
+
*/
|
|
4
|
+
export interface BcmApplicationStatusUpdated {
|
|
5
|
+
payload: Payload;
|
|
6
|
+
type: BcmApplicationStatusUpdatedType;
|
|
7
|
+
/**
|
|
8
|
+
* Current schema version.
|
|
9
|
+
*/
|
|
10
|
+
version: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Payload {
|
|
13
|
+
/**
|
|
14
|
+
* json stringified string of a json object that captures any additional information from
|
|
15
|
+
* upstream.
|
|
16
|
+
*/
|
|
17
|
+
additionalInformation?: string;
|
|
18
|
+
applicationId: string;
|
|
19
|
+
description: string;
|
|
20
|
+
/**
|
|
21
|
+
* The internal reference id assigned by the lender after it is submitted to them by the
|
|
22
|
+
* gateway. This identifier is required by team members to reference a specific application
|
|
23
|
+
* when communicating with a lender.
|
|
24
|
+
*/
|
|
25
|
+
lenderAssignedId: string;
|
|
26
|
+
message: Message;
|
|
27
|
+
publishedAt: string;
|
|
28
|
+
source: Source;
|
|
29
|
+
sourceInternalId: string;
|
|
30
|
+
type: PayloadType;
|
|
31
|
+
}
|
|
32
|
+
export declare enum Message {
|
|
33
|
+
ApplicationReceived = "Application Received",
|
|
34
|
+
ApplicationRegistered = "Application Registered",
|
|
35
|
+
ApplicationSettled = "Application Settled",
|
|
36
|
+
Cancelled = "Cancelled",
|
|
37
|
+
ConditionallyApproved = "Conditionally Approved",
|
|
38
|
+
Declined = "Declined",
|
|
39
|
+
DocsReceived = "Docs Received",
|
|
40
|
+
DocsSent = "Docs Sent",
|
|
41
|
+
ErrorOnSubmission = "Error On Submission",
|
|
42
|
+
LenderInformation = "Lender Information",
|
|
43
|
+
OutstandingItems = "Outstanding Items",
|
|
44
|
+
PreApproved = "Pre Approved",
|
|
45
|
+
Referred = "Referred",
|
|
46
|
+
SettlementBooked = "Settlement Booked",
|
|
47
|
+
SolicitorInstructed = "Solicitor Instructed",
|
|
48
|
+
UnconditionallyApproved = "Unconditionally Approved",
|
|
49
|
+
ValuationOrdered = "Valuation Ordered",
|
|
50
|
+
ValuationReceived = "Valuation Received",
|
|
51
|
+
Withdrawn = "Withdrawn"
|
|
52
|
+
}
|
|
53
|
+
export declare enum Source {
|
|
54
|
+
Nextgen = "Nextgen",
|
|
55
|
+
Simpology = "Simpology"
|
|
56
|
+
}
|
|
57
|
+
export declare enum PayloadType {
|
|
58
|
+
Event = "event",
|
|
59
|
+
Status = "status"
|
|
60
|
+
}
|
|
61
|
+
export declare enum BcmApplicationStatusUpdatedType {
|
|
62
|
+
BcmApplicationStatusUpdated = "BcmApplicationStatusUpdated"
|
|
63
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BcmApplicationStatusUpdatedType = exports.PayloadType = exports.Source = exports.Message = void 0;
|
|
4
|
+
var Message;
|
|
5
|
+
(function (Message) {
|
|
6
|
+
Message["ApplicationReceived"] = "Application Received";
|
|
7
|
+
Message["ApplicationRegistered"] = "Application Registered";
|
|
8
|
+
Message["ApplicationSettled"] = "Application Settled";
|
|
9
|
+
Message["Cancelled"] = "Cancelled";
|
|
10
|
+
Message["ConditionallyApproved"] = "Conditionally Approved";
|
|
11
|
+
Message["Declined"] = "Declined";
|
|
12
|
+
Message["DocsReceived"] = "Docs Received";
|
|
13
|
+
Message["DocsSent"] = "Docs Sent";
|
|
14
|
+
Message["ErrorOnSubmission"] = "Error On Submission";
|
|
15
|
+
Message["LenderInformation"] = "Lender Information";
|
|
16
|
+
Message["OutstandingItems"] = "Outstanding Items";
|
|
17
|
+
Message["PreApproved"] = "Pre Approved";
|
|
18
|
+
Message["Referred"] = "Referred";
|
|
19
|
+
Message["SettlementBooked"] = "Settlement Booked";
|
|
20
|
+
Message["SolicitorInstructed"] = "Solicitor Instructed";
|
|
21
|
+
Message["UnconditionallyApproved"] = "Unconditionally Approved";
|
|
22
|
+
Message["ValuationOrdered"] = "Valuation Ordered";
|
|
23
|
+
Message["ValuationReceived"] = "Valuation Received";
|
|
24
|
+
Message["Withdrawn"] = "Withdrawn";
|
|
25
|
+
})(Message || (exports.Message = Message = {}));
|
|
26
|
+
var Source;
|
|
27
|
+
(function (Source) {
|
|
28
|
+
Source["Nextgen"] = "Nextgen";
|
|
29
|
+
Source["Simpology"] = "Simpology";
|
|
30
|
+
})(Source || (exports.Source = Source = {}));
|
|
31
|
+
var PayloadType;
|
|
32
|
+
(function (PayloadType) {
|
|
33
|
+
PayloadType["Event"] = "event";
|
|
34
|
+
PayloadType["Status"] = "status";
|
|
35
|
+
})(PayloadType || (exports.PayloadType = PayloadType = {}));
|
|
36
|
+
var BcmApplicationStatusUpdatedType;
|
|
37
|
+
(function (BcmApplicationStatusUpdatedType) {
|
|
38
|
+
BcmApplicationStatusUpdatedType["BcmApplicationStatusUpdated"] = "BcmApplicationStatusUpdated";
|
|
39
|
+
})(BcmApplicationStatusUpdatedType || (exports.BcmApplicationStatusUpdatedType = BcmApplicationStatusUpdatedType = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lendi/act-credit-decisions-transform",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.11",
|
|
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",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@lendi/integrations-credit-protocol": "1.18.8",
|
|
25
|
-
"@lendi/act-eac-integrations-protocol": "3.0
|
|
25
|
+
"@lendi/act-eac-integrations-protocol": "3.1.0",
|
|
26
26
|
"clean-deep": "^3.4.0",
|
|
27
27
|
"date-fns": "2.19.0",
|
|
28
28
|
"lodash": "^4.17.15"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"sinon": "^7.4.2",
|
|
54
54
|
"ts-jest": "^28.0.5",
|
|
55
55
|
"ts-node": "^10.9.1",
|
|
56
|
-
"typedoc": "^0.
|
|
56
|
+
"typedoc": "^0.24.8",
|
|
57
57
|
"typescript": "^5.0.4"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|