@lendi/act-credit-decisions-transform 1.9.7 → 1.9.9

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.
@@ -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 (!propertyTypeMapping) {
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-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_status_updated_1 = require("../types/events/bcm-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_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,39 @@
1
+ export interface BcmStatusUpdatedEvent {
2
+ type: Type;
3
+ version: string;
4
+ payload: Payload;
5
+ }
6
+ export interface Payload {
7
+ applicationId: string;
8
+ description: string;
9
+ message: Message;
10
+ publishedAt: string;
11
+ sourceInternalId: string;
12
+ lenderAssignedId: string;
13
+ source: string;
14
+ type: string;
15
+ }
16
+ export declare enum Message {
17
+ ApplicationReceived = "Application Received",
18
+ ApplicationRegistered = "Application Registered",
19
+ ApplicationSettled = "Application Settled",
20
+ Cancelled = "Cancelled",
21
+ ConditionallyApproved = "Conditionally Approved",
22
+ Declined = "Declined",
23
+ DocsReceived = "Docs Received",
24
+ DocsSent = "Docs Sent",
25
+ ErrorOnSubmission = "Error On Submission",
26
+ LenderInformation = "Lender Information",
27
+ OutstandingItems = "Outstanding Items",
28
+ PreApproved = "Pre Approved",
29
+ Referred = "Referred",
30
+ SettlementBooked = "Settlement Booked",
31
+ SolicitorInstructed = "Solicitor Instructed",
32
+ UnconditionallyApproved = "Unconditionally Approved",
33
+ ValuationOrdered = "Valuation Ordered",
34
+ ValuationReceived = "Valuation Received",
35
+ Withdrawn = "Withdrawn"
36
+ }
37
+ export declare enum Type {
38
+ BcmApplicationStatusUpdated = "BcmApplicationStatusUpdated"
39
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Type = 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 Type;
27
+ (function (Type) {
28
+ Type["BcmApplicationStatusUpdated"] = "BcmApplicationStatusUpdated";
29
+ })(Type || (exports.Type = Type = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lendi/act-credit-decisions-transform",
3
- "version": "1.9.7",
3
+ "version": "1.9.9",
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.3",
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.20.36",
56
+ "typedoc": "^0.24.8",
57
57
  "typescript": "^5.0.4"
58
58
  },
59
59
  "scripts": {