@lendi/integrations-transform 1.5.2 → 1.5.5
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.js +5 -1
- package/lib/transform-events/transform-application-workflow.d.ts +6 -5
- package/lib/transform-events/transform-application-workflow.js +12 -20
- package/lib/transform-events/transform-application.d.ts +2 -1
- package/lib/transform-events/transform-application.js +9 -2
- package/lib/types/enum-mappings/index.js +5 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { PayloadClass as
|
|
1
|
+
import { PayloadClass as ApplicationWorkflowEventPayload } from '../types/events/application-workflow';
|
|
2
2
|
/**
|
|
3
|
-
* Generates a partial
|
|
3
|
+
* Generates a partial application from an ApplicationWorkflow event
|
|
4
4
|
*
|
|
5
|
-
* @
|
|
6
|
-
*
|
|
5
|
+
* @param applicationWorkflowEventPayload ApplicationWorkflow event payload
|
|
6
|
+
*
|
|
7
|
+
* @returns A partial application
|
|
7
8
|
*/
|
|
8
|
-
export declare function transformApplicationWorkflow(
|
|
9
|
+
export declare function transformApplicationWorkflow(applicationWorkflowEventPayload: ApplicationWorkflowEventPayload): {};
|
|
@@ -4,29 +4,21 @@ 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
|
|
7
|
+
* Generates a partial application from an ApplicationWorkflow event
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
10
|
-
*
|
|
9
|
+
* @param applicationWorkflowEventPayload ApplicationWorkflow event payload
|
|
10
|
+
*
|
|
11
|
+
* @returns A partial application
|
|
11
12
|
*/
|
|
12
|
-
function transformApplicationWorkflow(
|
|
13
|
-
var partialApplication = {};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
function transformApplicationWorkflow(applicationWorkflowEventPayload) {
|
|
14
|
+
var stage = applicationWorkflowEventPayload.stage, applicationStage = applicationWorkflowEventPayload.applicationStage, applicationId = applicationWorkflowEventPayload.applicationId, partialApplication = {};
|
|
15
|
+
(0, lodash_1.set)(partialApplication, application_paths_1.paths.ApplicationId, applicationId);
|
|
16
|
+
// The stage being defaulted to Unknown caters for LGSF application workflow events having stage as an optional attribute in the future
|
|
17
|
+
var instructionDetails = {
|
|
18
|
+
'@UniqueID': "".concat(applicationId, "-stage"),
|
|
19
|
+
'@Details': applicationStage || stage || 'Unknown'
|
|
17
20
|
};
|
|
18
|
-
|
|
19
|
-
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
20
|
-
if (opportunityMapping[key]) {
|
|
21
|
-
if (key === 'stage') {
|
|
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"), value || 'Unknown');
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
(0, lodash_1.set)(partialApplication, opportunityMapping[key], value);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
21
|
+
(0, lodash_1.set)(partialApplication, application_paths_1.paths.Instructions, instructionDetails);
|
|
30
22
|
return partialApplication;
|
|
31
23
|
}
|
|
32
24
|
exports.transformApplicationWorkflow = transformApplicationWorkflow;
|
|
@@ -3,6 +3,7 @@ import { Payload as ApplicationPayload } from '../types/events/public-applicatio
|
|
|
3
3
|
* Transforms a partial opportunity event to a partial internal request.
|
|
4
4
|
*
|
|
5
5
|
* @param opportunity: Partial opportunity event.
|
|
6
|
+
* @param uniqueIdSuffix: Suffix for uniquerId
|
|
6
7
|
* @return partialApplication: A partial internal request.
|
|
7
8
|
*/
|
|
8
|
-
export declare function transformApplication(opportunity: ApplicationPayload): {};
|
|
9
|
+
export declare function transformApplication(opportunity: ApplicationPayload, uniqueIdSuffix?: string): {};
|
|
@@ -6,13 +6,16 @@ var application_paths_1 = require("@lendi/integrations-credit-protocol/utils/app
|
|
|
6
6
|
var application_paths_2 = require("@lendi/integrations-protocol/lib/utils/application-paths");
|
|
7
7
|
var lodash_1 = require("lodash");
|
|
8
8
|
var enum_mappings_1 = require("../types/enum-mappings/");
|
|
9
|
+
var transform_applicant_1 = require("./transform-applicant");
|
|
9
10
|
/**
|
|
10
11
|
* Transforms a partial opportunity event to a partial internal request.
|
|
11
12
|
*
|
|
12
13
|
* @param opportunity: Partial opportunity event.
|
|
14
|
+
* @param uniqueIdSuffix: Suffix for uniquerId
|
|
13
15
|
* @return partialApplication: A partial internal request.
|
|
14
16
|
*/
|
|
15
|
-
function transformApplication(opportunity) {
|
|
17
|
+
function transformApplication(opportunity, uniqueIdSuffix) {
|
|
18
|
+
if (uniqueIdSuffix === void 0) { uniqueIdSuffix = 'loanDetails'; }
|
|
16
19
|
var partialApplication = {};
|
|
17
20
|
var opportunityMapping = {
|
|
18
21
|
brand: application_paths_2.paths.BusinessName,
|
|
@@ -23,9 +26,10 @@ function transformApplication(opportunity) {
|
|
|
23
26
|
brokerPrimaryPurpose: 'Package.Content.NeedsAnalysis.PurposeOfApplication[0].@Description',
|
|
24
27
|
hasOptedInRateLock: "".concat(application_paths_1.paths.FeaturesSelected, ".@RateLock")
|
|
25
28
|
};
|
|
26
|
-
(0, lodash_1.set)(partialApplication, "".concat(application_paths_2.paths.LoanDetail, ".@UniqueID"), "".concat(opportunity.id, "-
|
|
29
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_2.paths.LoanDetail, ".@UniqueID"), "".concat(opportunity.id, "-").concat(uniqueIdSuffix));
|
|
27
30
|
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Instructions, ".@UniqueID"), "".concat(opportunity.id, "-stage"));
|
|
28
31
|
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Instructions, ".@Name"), lixi_internal_request_1.EventNameApplicationInstructionsList.ApplicationReceived);
|
|
32
|
+
(0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.FeaturesSelected, ".@RateLock"), lixi_internal_request_1.YesNoList.No);
|
|
29
33
|
for (var _i = 0, _a = Object.entries(opportunity); _i < _a.length; _i++) {
|
|
30
34
|
var _b = _a[_i], opportunityKey = _b[0], opportunityValue = _b[1];
|
|
31
35
|
if (opportunityMapping[opportunityKey]) {
|
|
@@ -44,6 +48,9 @@ function transformApplication(opportunity) {
|
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
}
|
|
51
|
+
else if (opportunityKey === 'hasOptedInRateLock') {
|
|
52
|
+
(0, lodash_1.set)(partialApplication, opportunityMapping[opportunityKey], (0, transform_applicant_1.booleanMapping)(opportunityValue));
|
|
53
|
+
}
|
|
47
54
|
else {
|
|
48
55
|
(0, lodash_1.set)(partialApplication, opportunityMapping[opportunityKey], opportunityValue);
|
|
49
56
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lendi/integrations-transform",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
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",
|