@lendi/integrations-transform 1.6.6 → 1.6.7

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.
@@ -152,7 +152,7 @@
152
152
  "$ref": "#/definitions/hidden"
153
153
  },
154
154
  "brand": {
155
- "enum": ["lendi", "domain", "domain variation", "lendi variation"]
155
+ "enum": ["lendi", "domain", "domain variation", "lendi variation", "aussie"]
156
156
  },
157
157
  "hasOptedInRateLock": {
158
158
  "$ref": "#/definitions/hasOptedInRateLock"
@@ -1,7 +1,13 @@
1
1
  import { Payload as ApplicationPayload } from '../types/events/public-application';
2
2
  export interface TransformApplicationOptions {
3
3
  uniqueIdSuffix?: string;
4
+ /**
5
+ * Enables/disables the rate lock mapping (Used to enable the mapping in AW and disable in DW simulatenously due to having to notify integrated approval confidence lenders of schema changes if the attribute is added to schema)
6
+ */
4
7
  enableRateLock?: boolean;
8
+ /**
9
+ * Enables/disables the fast refi mapping (Used to enable the mapping in AW and disable in DW simulatenously due to having to notify integrated approval confidence lenders of schema changes if the attribute is added to schema)
10
+ */
5
11
  enableFastRefi?: boolean;
6
12
  }
7
13
  /**
@@ -32,6 +32,12 @@ function transformApplication(opportunity, options = {}) {
32
32
  if (enableRateLock) {
33
33
  (0, lodash_1.set)(partialApplication, `${application_paths_1.paths.FeaturesSelected}.@RateLock`, (0, transform_applicant_1.booleanMapping)(hasOptedInRateLock));
34
34
  }
35
+ /**
36
+ * Please note that fast refinance is only applicable to applications where the primary purpose of the application is Refinance
37
+ * Hence there is logic in the fixApplicationInconsistencies method used by the updateApplication middleware in AW that removes or defaults the value of the FastRefinance attribute
38
+ * based on the primary purpose of the application. This logic was placed in the fixApplicationInconsistencies method in the updateApplication middleware as this is where we know the correct primary purpose of the
39
+ * application.
40
+ */
35
41
  if (enableFastRefi) {
36
42
  (0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Overview}.@FastRefinance`, (0, transform_applicant_1.booleanMapping)(isFastRefi));
37
43
  }
@@ -24,6 +24,7 @@ export interface Payload {
24
24
  preliminary: Preliminary;
25
25
  }
26
26
  export declare enum Brand {
27
+ Aussie = "aussie",
27
28
  Domain = "domain",
28
29
  DomainVariation = "domain variation",
29
30
  Lendi = "lendi",
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PublicApplicationType = exports.Urgency = exports.RefinancingReason = exports.PurchaseSituation = exports.PurchaseReason = exports.PrimaryPurpose = exports.PaymentType = exports.EligibleForFHOG = exports.DesiredFeature = exports.ContributionType = exports.ActionedByRole = exports.BrokerPrimaryPurpose = exports.Brand = void 0;
4
4
  var Brand;
5
5
  (function (Brand) {
6
+ Brand["Aussie"] = "aussie";
6
7
  Brand["Domain"] = "domain";
7
8
  Brand["DomainVariation"] = "domain variation";
8
9
  Brand["Lendi"] = "lendi";
@@ -1,21 +1,11 @@
1
- import { InternalRequest, PersonApplicant } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
1
+ import { InternalRequest } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
2
2
  import { Payload as RequiredDocEventPayload } from '../types/events/public-required-document';
3
3
  import { RecursivePartial } from '../types/recursive-partial';
4
- /**
5
- * Remove proof of identity document from a person applicant
6
- *
7
- * @param {PersonApplicant} personApplicant Person applicant to remove the id document from
8
- * @param {string} id Proof of identity document
9
- *
10
- * @returns {PersonApplicant} Updated person applicant
11
- */
12
- export declare const removeIDDocumentFromApplicant: (personApplicant: PersonApplicant, id: string) => PersonApplicant;
13
4
  /**
14
5
  * Removes ProofOfIdentity ID document that is in status Not Required
15
6
  *
16
7
  * @param {RecursivePartial<InternalRequest>} application - Partial LIXI CAL application
17
8
  * @param {RequiredDocEventPayload} eventPayload - Required Document event payload
18
- *
19
9
  * @returns {RecursivePartial<InternalRequest>} Updated application
20
10
  */
21
11
  export declare const removeIdsNotRequired: (application: RecursivePartial<InternalRequest>, eventPayload: RequiredDocEventPayload) => RecursivePartial<InternalRequest>;
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.removeIdsNotRequired = exports.removeIDDocumentFromApplicant = void 0;
14
+ exports.removeIdsNotRequired = void 0;
15
15
  const application_paths_1 = require("@lendi/integrations-credit-protocol/utils/application-paths");
16
16
  const lodash_1 = require("lodash");
17
17
  const public_required_document_1 = require("../types/events/public-required-document");
@@ -20,32 +20,41 @@ const public_required_document_1 = require("../types/events/public-required-docu
20
20
  *
21
21
  * @param {PersonApplicant} personApplicant Person applicant to remove the id document from
22
22
  * @param {string} id Proof of identity document
23
- *
23
+ * @param {identification} identification Identification data in RequiredDocument event
24
24
  * @returns {PersonApplicant} Updated person applicant
25
25
  */
26
- const removeIDDocumentFromApplicant = (personApplicant, id) => {
26
+ const removeIDDocumentFromApplicant = (personApplicant, id, identification) => {
27
27
  const { ProofOfIdentity = [] } = personApplicant, rest = __rest(personApplicant, ["ProofOfIdentity"]);
28
- const updatedProofOfIdentity = ProofOfIdentity.filter((proofOfId) => proofOfId['@UniqueID'] !== id);
28
+ const updatedProofOfIdentity = ProofOfIdentity.filter((proofOfId) => {
29
+ let shouldKeepProofOfId = true;
30
+ if (proofOfId['@UniqueID']) {
31
+ shouldKeepProofOfId = proofOfId['@UniqueID'] !== id;
32
+ }
33
+ else {
34
+ if (identification === null || identification === void 0 ? void 0 : identification.idNumber) {
35
+ shouldKeepProofOfId = proofOfId['@DocumentNumber'] !== identification.idNumber;
36
+ }
37
+ }
38
+ return shouldKeepProofOfId;
39
+ });
29
40
  // If the updateProofOfIdentity is an empty array then we remove the ProofOfIdentity attribute from the person applicant
30
41
  return Object.assign(Object.assign({}, rest), (updatedProofOfIdentity.length && { ProofOfIdentity: updatedProofOfIdentity }));
31
42
  };
32
- exports.removeIDDocumentFromApplicant = removeIDDocumentFromApplicant;
33
43
  /**
34
44
  * Removes ProofOfIdentity ID document that is in status Not Required
35
45
  *
36
46
  * @param {RecursivePartial<InternalRequest>} application - Partial LIXI CAL application
37
47
  * @param {RequiredDocEventPayload} eventPayload - Required Document event payload
38
- *
39
48
  * @returns {RecursivePartial<InternalRequest>} Updated application
40
49
  */
41
50
  const removeIdsNotRequired = (application, eventPayload) => {
42
- const { status: verificationStatus, id, applicantId } = eventPayload;
51
+ const { status: verificationStatus, identification, applicantId, id } = eventPayload;
43
52
  const personApplicants = (0, lodash_1.get)(application, application_paths_1.paths.PersonApplicants, []);
44
- const updatedApplication = application;
53
+ const updatedApplication = (0, lodash_1.cloneDeep)(application);
45
54
  if (verificationStatus === public_required_document_1.Status.NotRequired && personApplicants.length) {
46
55
  const personApplicantIndex = personApplicants.findIndex((personApplicant) => personApplicant['@UniqueID'] === applicantId);
47
56
  if (personApplicantIndex !== -1) {
48
- const updatedPersonApplicant = (0, exports.removeIDDocumentFromApplicant)(personApplicants[personApplicantIndex], id);
57
+ const updatedPersonApplicant = removeIDDocumentFromApplicant(personApplicants[personApplicantIndex], id, identification);
49
58
  (0, lodash_1.set)(updatedApplication, `${application_paths_1.paths.PersonApplicants}.[${personApplicantIndex}]`, updatedPersonApplicant);
50
59
  }
51
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lendi/integrations-transform",
3
- "version": "1.6.6",
3
+ "version": "1.6.7",
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.5",
25
- "@lendi/integrations-protocol": "^2.6.4",
25
+ "@lendi/integrations-protocol": "^2.6.7",
26
26
  "@lendi/logging": "^1.0.0",
27
27
  "clean-deep": "^3.4.0",
28
28
  "date-fns": "2.19.0",