@lendi/integrations-transform 1.7.9 → 1.8.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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 1.8.1
2
+
3
+ Changes
4
+ * Update `transformApplicationWorkflow` to support `applicationStatus`
5
+ * Use `@lendi/integrations-protocol@2.7.2`
6
+
1
7
  # 1.7.3
2
8
 
3
9
  Fix
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformApplicationWorkflow = void 0;
4
4
  const application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
5
5
  const lodash_1 = require("lodash");
6
+ const application_workflow_1 = require("../types/events/application-workflow");
6
7
  /**
7
8
  * Generates a partial application from an ApplicationWorkflow event
8
9
  *
@@ -10,14 +11,20 @@ const lodash_1 = require("lodash");
10
11
  * @returns A partial application
11
12
  */
12
13
  function transformApplicationWorkflow(applicationWorkflowEventPayload) {
13
- const { stage, applicationStage, applicationId } = applicationWorkflowEventPayload, partialApplication = {};
14
+ const { stage, applicationStage, applicationId, applicationStatus, status } = applicationWorkflowEventPayload;
15
+ const partialApplication = {};
14
16
  (0, lodash_1.set)(partialApplication, application_paths_1.paths.ApplicationId, applicationId);
15
17
  // The stage being defaulted to Unknown caters for LGSF application workflow events having stage as an optional attribute in the future
16
- const instructionDetails = {
18
+ const stageInstructionDetails = {
17
19
  '@UniqueID': `${applicationId}-stage`,
18
20
  '@Details': applicationStage || stage || 'Unknown',
19
21
  };
20
- (0, lodash_1.set)(partialApplication, application_paths_1.paths.Instructions, instructionDetails);
22
+ const statusInstructionDetails = {
23
+ '@UniqueID': `${applicationId}-status`,
24
+ '@Details': applicationStatus || status || application_workflow_1.Status.Unknown,
25
+ };
26
+ (0, lodash_1.set)(partialApplication, application_paths_1.paths.Instructions, stageInstructionDetails);
27
+ (0, lodash_1.set)(partialApplication, application_paths_1.paths.InstructionsStatus, statusInstructionDetails);
21
28
  return partialApplication;
22
29
  }
23
30
  exports.transformApplicationWorkflow = transformApplicationWorkflow;
@@ -25,7 +25,7 @@ export interface PayloadClass {
25
25
  /**
26
26
  * Application status in Lendi Group Salesforce
27
27
  */
28
- applicationStatus?: string;
28
+ applicationStatus?: ApplicationStatus;
29
29
  brokerAuditReview: BrokerAuditReview[];
30
30
  /**
31
31
  * Intention for applying a loan
@@ -54,6 +54,37 @@ export declare enum ApplicationStage {
54
54
  SubmissionReview = "SUBMISSION_REVIEW",
55
55
  SubmittedToLender = "SUBMITTED_TO_LENDER"
56
56
  }
57
+ /**
58
+ * Application status in Lendi Group Salesforce
59
+ */
60
+ export declare enum ApplicationStatus {
61
+ PreContact = "PRE_CONTACT",
62
+ PostContact = "POST_CONTACT",
63
+ SelfSubmitted = "SELF_SUBMITTED",
64
+ UnderReview = "UNDER_REVIEW",
65
+ ReviewInComplete = "REVIEW_INCOMPLETE",
66
+ ProcessPending = "PROCESS_PENDING",
67
+ WaitingOnException = "WAITING_ON_EXCEPTION",
68
+ ApplicationError = "APPLICATION_ERROR",
69
+ OnHold = "ON_HOLD",
70
+ Lodgement = "LODGEMENT",
71
+ ApplicationReceived = "APPLICATION_RECEIVED",
72
+ Referred = "REFERRED",
73
+ MoreInformationRequested = "MORE_INFORMATION_REQUESTED",
74
+ InformationProvidedToLender = "INFORMATION_PROVIDED_TO_LENDER",
75
+ Declined = "DECLINED",
76
+ ConditionallyApproved = "CONDITIONALLY_APPROVED",
77
+ AmendmentInProgress = "AMENDMENT_IN_PROGRESS",
78
+ ApprovedInPrinciple = "APPROVED_IN_PRINCIPLE",
79
+ UnconditionallyApproved = "UNCONDITIONALLY_APPROVED",
80
+ DocumentsReceived = "DOCUMENTS_RECEIVED",
81
+ DocumentsIssued = "DOCUMENTS_ISSUED",
82
+ ReadyForSettlement = "READY_FOR_SETTLEMENT",
83
+ SettlementBooked = "SETTLEMENT_BOOKED",
84
+ Lost = "LOST",
85
+ Settled = "SETTLED",
86
+ Discharged = "DISCHARGED"
87
+ }
57
88
  export interface BrokerAuditReview {
58
89
  /**
59
90
  * ISO date time when Broker Audit Review was completed
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Type = exports.Status = exports.Stage = exports.ConfirmedPrimaryPurpose = exports.ApplicationStage = void 0;
3
+ exports.Type = exports.Status = exports.Stage = exports.ConfirmedPrimaryPurpose = exports.ApplicationStatus = exports.ApplicationStage = void 0;
4
4
  /**
5
5
  * Application stage in Lendi Group Salesforce
6
6
  */
@@ -14,6 +14,38 @@ var ApplicationStage;
14
14
  ApplicationStage["SubmissionReview"] = "SUBMISSION_REVIEW";
15
15
  ApplicationStage["SubmittedToLender"] = "SUBMITTED_TO_LENDER";
16
16
  })(ApplicationStage = exports.ApplicationStage || (exports.ApplicationStage = {}));
17
+ /**
18
+ * Application status in Lendi Group Salesforce
19
+ */
20
+ var ApplicationStatus;
21
+ (function (ApplicationStatus) {
22
+ ApplicationStatus["PreContact"] = "PRE_CONTACT";
23
+ ApplicationStatus["PostContact"] = "POST_CONTACT";
24
+ ApplicationStatus["SelfSubmitted"] = "SELF_SUBMITTED";
25
+ ApplicationStatus["UnderReview"] = "UNDER_REVIEW";
26
+ ApplicationStatus["ReviewInComplete"] = "REVIEW_INCOMPLETE";
27
+ ApplicationStatus["ProcessPending"] = "PROCESS_PENDING";
28
+ ApplicationStatus["WaitingOnException"] = "WAITING_ON_EXCEPTION";
29
+ ApplicationStatus["ApplicationError"] = "APPLICATION_ERROR";
30
+ ApplicationStatus["OnHold"] = "ON_HOLD";
31
+ ApplicationStatus["Lodgement"] = "LODGEMENT";
32
+ ApplicationStatus["ApplicationReceived"] = "APPLICATION_RECEIVED";
33
+ ApplicationStatus["Referred"] = "REFERRED";
34
+ ApplicationStatus["MoreInformationRequested"] = "MORE_INFORMATION_REQUESTED";
35
+ ApplicationStatus["InformationProvidedToLender"] = "INFORMATION_PROVIDED_TO_LENDER";
36
+ ApplicationStatus["Declined"] = "DECLINED";
37
+ ApplicationStatus["ConditionallyApproved"] = "CONDITIONALLY_APPROVED";
38
+ ApplicationStatus["AmendmentInProgress"] = "AMENDMENT_IN_PROGRESS";
39
+ ApplicationStatus["ApprovedInPrinciple"] = "APPROVED_IN_PRINCIPLE";
40
+ ApplicationStatus["UnconditionallyApproved"] = "UNCONDITIONALLY_APPROVED";
41
+ ApplicationStatus["DocumentsReceived"] = "DOCUMENTS_RECEIVED";
42
+ ApplicationStatus["DocumentsIssued"] = "DOCUMENTS_ISSUED";
43
+ ApplicationStatus["ReadyForSettlement"] = "READY_FOR_SETTLEMENT";
44
+ ApplicationStatus["SettlementBooked"] = "SETTLEMENT_BOOKED";
45
+ ApplicationStatus["Lost"] = "LOST";
46
+ ApplicationStatus["Settled"] = "SETTLED";
47
+ ApplicationStatus["Discharged"] = "DISCHARGED";
48
+ })(ApplicationStatus = exports.ApplicationStatus || (exports.ApplicationStatus = {}));
17
49
  /**
18
50
  * Intention for applying a loan
19
51
  */
@@ -33,6 +33,7 @@ function deepMergeApplication(existingApplication, newApplication, options = {})
33
33
  'RealEstateAsset',
34
34
  'RelatedCompany',
35
35
  'RelatedPerson',
36
+ 'TrustApplicant',
36
37
  ];
37
38
  if (secondIDEnabled) {
38
39
  listsWithUniqueIds.push('ProofOfIdentity');
@@ -47,6 +48,12 @@ function deepMergeApplication(existingApplication, newApplication, options = {})
47
48
  const listsWithXResidentialAddress = ['PriorAddress'];
48
49
  // Array fields with @x_Guarantor
49
50
  const listsWithXGuarantor = ['Guarantor'];
51
+ // Array fields with @x_Trustee
52
+ const listsWithXTrustee = ['Trustee'];
53
+ // Array fields with @x_Beneficiary
54
+ const listsWithXBeneficiary = ['Beneficiary'];
55
+ // Array fields with @x_BeneficialOwner
56
+ const listsWithXBeneficialOwner = ['BeneficialOwner'];
50
57
  // Curried function which takes a uniqueKey and returns a function which will either replace
51
58
  // or merge the item in the array based on the uniqueKey
52
59
  const mergeItems = (uniqueKey) => {
@@ -78,6 +85,15 @@ function deepMergeApplication(existingApplication, newApplication, options = {})
78
85
  if (listsWithXGuarantor.find((item) => item === key)) {
79
86
  return mergeItems('@x_Guarantor');
80
87
  }
88
+ if (listsWithXTrustee.find((item) => item === key)) {
89
+ return mergeItems('@x_Trustee');
90
+ }
91
+ if (listsWithXBeneficiary.find((item) => item === key)) {
92
+ return mergeItems('@x_Beneficiary');
93
+ }
94
+ if (listsWithXBeneficialOwner.find((item) => item === key)) {
95
+ return mergeItems('@x_BeneficialOwner');
96
+ }
81
97
  return mergeItems(key);
82
98
  },
83
99
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lendi/integrations-transform",
3
- "version": "1.7.9",
3
+ "version": "1.8.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",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@lendi/integrations-credit-protocol": "1.18.5",
25
- "@lendi/integrations-protocol": "2.7.0",
25
+ "@lendi/integrations-protocol": "2.7.2",
26
26
  "@lendi/logging": "^1.0.0",
27
27
  "clean-deep": "^3.4.0",
28
28
  "date-fns": "2.19.0",