@lendi/integrations-transform 1.6.1 → 1.6.2
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 +7 -0
- package/lib/schemas/public-application-event.json +7 -0
- package/lib/transform-events/generate-required-document.d.ts +1 -2
- package/lib/transform-events/generate-required-document.js +1 -1
- package/lib/transform-events/transform-application.d.ts +6 -8
- package/lib/transform-events/transform-application.js +8 -7
- package/lib/types/events/public-application.d.ts +1 -0
- package/package.json +3 -3
- package/lib/types/enum-mappings/guarantor-relationship-type.d.ts +0 -3
- package/lib/types/enum-mappings/guarantor-relationship-type.js +0 -16
package/CHANGELOG.md
ADDED
|
@@ -122,6 +122,10 @@
|
|
|
122
122
|
"hasOptedInRateLock": {
|
|
123
123
|
"type": "boolean"
|
|
124
124
|
},
|
|
125
|
+
"isFastRefi": {
|
|
126
|
+
"description": "Indication that this application is a FASTRefi product, for quicker settlements on applicable refinance applications",
|
|
127
|
+
"type": "boolean"
|
|
128
|
+
},
|
|
125
129
|
"payload": {
|
|
126
130
|
"type": "object",
|
|
127
131
|
"additionalProperties": false,
|
|
@@ -153,6 +157,9 @@
|
|
|
153
157
|
"hasOptedInRateLock": {
|
|
154
158
|
"$ref": "#/definitions/hasOptedInRateLock"
|
|
155
159
|
},
|
|
160
|
+
"isFastRefi": {
|
|
161
|
+
"$ref": "#/definitions/isFastRefi"
|
|
162
|
+
},
|
|
156
163
|
"preliminary": {
|
|
157
164
|
"type": "object",
|
|
158
165
|
"additionalProperties": false,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { PersonApplicantPrivacy } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
|
|
2
|
-
import { ProofOfIdentity } from '@lendi/integrations-protocol/lib/types/lixi-internal-request';
|
|
1
|
+
import { PersonApplicantPrivacy, ProofOfIdentity } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
|
|
3
2
|
import { EConsent, Identification, Payload as RequiredDocumentPayload } from '../types/events/public-required-document';
|
|
4
3
|
/**
|
|
5
4
|
* Gets the applicant gender from the identification data
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformRequiredDocument = exports.generatePersonApplicantPrivacy = exports.generateProofOfIdentity = exports.transformIdentification = exports.getNameOnDocument = exports.getApplicantGenderFromIdentification = void 0;
|
|
4
|
-
const lixi_internal_request_1 = require("@lendi/integrations-protocol/
|
|
4
|
+
const lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
5
5
|
const application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
|
|
6
6
|
const lodash_1 = require("lodash");
|
|
7
7
|
const enum_mappings_1 = require("../types/enum-mappings");
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { Payload as ApplicationPayload } from '../types/events/public-application';
|
|
2
|
-
interface
|
|
2
|
+
export interface TransformApplicationOptions {
|
|
3
3
|
uniqueIdSuffix?: string;
|
|
4
4
|
enableRateLock?: boolean;
|
|
5
|
+
enableFastRefi?: boolean;
|
|
5
6
|
}
|
|
6
7
|
/**
|
|
7
8
|
* Transforms a partial opportunity event to a partial internal request.
|
|
8
9
|
*
|
|
9
|
-
* @param opportunity
|
|
10
|
-
* @param
|
|
11
|
-
* @
|
|
12
|
-
* @param options
|
|
13
|
-
* @returns partialApplication: A partial internal request.
|
|
10
|
+
* @param {ApplicationPayload} opportunity Public application event payload
|
|
11
|
+
* @param {TransformApplicationOptions} options Options for transforming the public application event
|
|
12
|
+
* @returns Partial application
|
|
14
13
|
*/
|
|
15
|
-
export declare function transformApplication(opportunity: ApplicationPayload, options?:
|
|
16
|
-
export {};
|
|
14
|
+
export declare function transformApplication(opportunity: ApplicationPayload, options?: TransformApplicationOptions): {};
|
|
@@ -10,14 +10,12 @@ const transform_applicant_1 = require("./transform-applicant");
|
|
|
10
10
|
/**
|
|
11
11
|
* Transforms a partial opportunity event to a partial internal request.
|
|
12
12
|
*
|
|
13
|
-
* @param opportunity
|
|
14
|
-
* @param
|
|
15
|
-
* @
|
|
16
|
-
* @param options
|
|
17
|
-
* @returns partialApplication: A partial internal request.
|
|
13
|
+
* @param {ApplicationPayload} opportunity Public application event payload
|
|
14
|
+
* @param {TransformApplicationOptions} options Options for transforming the public application event
|
|
15
|
+
* @returns Partial application
|
|
18
16
|
*/
|
|
19
17
|
function transformApplication(opportunity, options = {}) {
|
|
20
|
-
const { uniqueIdSuffix = 'loanDetails', enableRateLock = false } = options;
|
|
18
|
+
const { uniqueIdSuffix = 'loanDetails', enableRateLock = false, enableFastRefi = false } = options;
|
|
21
19
|
const partialApplication = {};
|
|
22
20
|
const opportunityMapping = {
|
|
23
21
|
brand: application_paths_2.paths.BusinessName,
|
|
@@ -30,10 +28,13 @@ function transformApplication(opportunity, options = {}) {
|
|
|
30
28
|
(0, lodash_1.set)(partialApplication, `${application_paths_2.paths.LoanDetail}.@UniqueID`, `${opportunity.id}-${uniqueIdSuffix}`);
|
|
31
29
|
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Instructions}.@UniqueID`, `${opportunity.id}-stage`);
|
|
32
30
|
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Instructions}.@Name`, lixi_internal_request_1.EventNameApplicationInstructionsList.ApplicationReceived);
|
|
31
|
+
const { hasOptedInRateLock = false, isFastRefi = false } = opportunity;
|
|
33
32
|
if (enableRateLock) {
|
|
34
|
-
const { hasOptedInRateLock = false } = opportunity;
|
|
35
33
|
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.FeaturesSelected}.@RateLock`, (0, transform_applicant_1.booleanMapping)(hasOptedInRateLock));
|
|
36
34
|
}
|
|
35
|
+
if (enableFastRefi) {
|
|
36
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Overview}.@FastRefinance`, (0, transform_applicant_1.booleanMapping)(isFastRefi));
|
|
37
|
+
}
|
|
37
38
|
for (const [opportunityKey, opportunityValue] of Object.entries(opportunity)) {
|
|
38
39
|
if (opportunityMapping[opportunityKey]) {
|
|
39
40
|
if (opportunityKey === 'preliminary') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lendi/integrations-transform",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
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.17.3",
|
|
25
|
-
"@lendi/integrations-protocol": "2.6.
|
|
25
|
+
"@lendi/integrations-protocol": "^2.6.4",
|
|
26
26
|
"@lendi/logging": "^1.0.0",
|
|
27
27
|
"clean-deep": "^3.4.0",
|
|
28
28
|
"date-fns": "2.19.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"jest-buildkite-reporter": "^0.2.8",
|
|
49
49
|
"jest-sonar-reporter": "^2.0.0",
|
|
50
50
|
"path": "^0.12.7",
|
|
51
|
-
"quicktype": "15.0.
|
|
51
|
+
"quicktype": "^15.0.261",
|
|
52
52
|
"sinon": "^7.4.2",
|
|
53
53
|
"ts-jest": "^28.0.5",
|
|
54
54
|
"ts-node": "^8.4.1",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { KinRelationshipList } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
|
|
2
|
-
import { GuarantorRelationshipToBorrowerType } from '../events/public-applicant';
|
|
3
|
-
export declare const guarantorRelationshipTypeMappings: Record<GuarantorRelationshipToBorrowerType, KinRelationshipList>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.guarantorRelationshipTypeMappings = void 0;
|
|
4
|
-
const lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
5
|
-
const public_applicant_1 = require("../events/public-applicant");
|
|
6
|
-
exports.guarantorRelationshipTypeMappings = {
|
|
7
|
-
[public_applicant_1.GuarantorRelationshipToBorrowerType.Brother]: lixi_internal_request_1.KinRelationshipList.Sibling,
|
|
8
|
-
[public_applicant_1.GuarantorRelationshipToBorrowerType.Daughter]: lixi_internal_request_1.KinRelationshipList.Child,
|
|
9
|
-
[public_applicant_1.GuarantorRelationshipToBorrowerType.Father]: lixi_internal_request_1.KinRelationshipList.Parent,
|
|
10
|
-
[public_applicant_1.GuarantorRelationshipToBorrowerType.Mother]: lixi_internal_request_1.KinRelationshipList.Parent,
|
|
11
|
-
[public_applicant_1.GuarantorRelationshipToBorrowerType.Other]: lixi_internal_request_1.KinRelationshipList.OtherRelative,
|
|
12
|
-
[public_applicant_1.GuarantorRelationshipToBorrowerType.OtherRelative]: lixi_internal_request_1.KinRelationshipList.OtherRelative,
|
|
13
|
-
[public_applicant_1.GuarantorRelationshipToBorrowerType.Sister]: lixi_internal_request_1.KinRelationshipList.Sibling,
|
|
14
|
-
[public_applicant_1.GuarantorRelationshipToBorrowerType.Son]: lixi_internal_request_1.KinRelationshipList.Child,
|
|
15
|
-
[public_applicant_1.GuarantorRelationshipToBorrowerType.Spouse]: lixi_internal_request_1.KinRelationshipList.Spouse,
|
|
16
|
-
};
|