@lendi/integrations-transform 1.4.5 → 1.4.8

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.d.ts CHANGED
@@ -6,5 +6,5 @@ export * from './transform-events/transform-asset';
6
6
  export * from './transform-events/transform-expenses';
7
7
  export * from './transform-events/transform-liability';
8
8
  export * from './transform-events/generate-required-document';
9
- export * from './transform-events/generate-funding-position';
9
+ export * from './transform-events/transform-funding-position';
10
10
  export * from './update-application/merge-application';
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.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
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];
@@ -19,5 +23,5 @@ __exportStar(require("./transform-events/transform-asset"), exports);
19
23
  __exportStar(require("./transform-events/transform-expenses"), exports);
20
24
  __exportStar(require("./transform-events/transform-liability"), exports);
21
25
  __exportStar(require("./transform-events/generate-required-document"), exports);
22
- __exportStar(require("./transform-events/generate-funding-position"), exports);
26
+ __exportStar(require("./transform-events/transform-funding-position"), exports);
23
27
  __exportStar(require("./update-application/merge-application"), exports);
@@ -8,6 +8,7 @@
8
8
  },
9
9
  "brokerPrimaryPurpose": {
10
10
  "description": "Additional data point for broker to capture primary purpose, other than the preliminary primary purpose associated with current user journey for new purchase or refinance",
11
+ "_comment": "PURCHASE is deprecated (will migrated to NEW_PURCHASE), VARIATION is deprecated (domain variation/lendi variation brand will be migrated to VARIATION_NON_CREDIT_CRITICAL, domain/lendi brand will be migrated to VARIATION_CREDIT_CRITICAL) and both PURCHASE and VARIATION will be removed in the future",
11
12
  "enum": [
12
13
  "COMMERCIAL",
13
14
  "CONSTRUCTION",
@@ -21,7 +22,9 @@
21
22
  "REFINANCE",
22
23
  "SLR",
23
24
  "TOP_UP",
24
- "VARIATION"
25
+ "VARIATION",
26
+ "VARIATION_CREDIT_CRITICAL",
27
+ "VARIATION_NON_CREDIT_CRITICAL"
25
28
  ]
26
29
  },
27
30
  "customerId": {
@@ -83,10 +86,12 @@
83
86
  "type": "boolean"
84
87
  },
85
88
  "totalMonthlyExpenses": {
86
- "type": "number"
89
+ "type": "number",
90
+ "minimum": 0
87
91
  },
88
92
  "numberOfDependants": {
89
- "type": "number"
93
+ "type": "number",
94
+ "minimum": 0
90
95
  },
91
96
  "contributions": {
92
97
  "type": "array",
@@ -98,7 +103,8 @@
98
103
  "enum": ["DEPOSIT"]
99
104
  },
100
105
  "amount": {
101
- "type": "number"
106
+ "type": "number",
107
+ "minimum": 0
102
108
  }
103
109
  }
104
110
  }
@@ -109,6 +115,10 @@
109
115
  "enum": ["CONSOLIDATE_CASHOUT", "FASTER_PAYOFF", "DECREASE_REPAYMENTS", "CONSTRUCTION"]
110
116
  }
111
117
  },
118
+ "highIntent": {
119
+ "description": "Indication that this application carries high customer intent",
120
+ "type": "boolean"
121
+ },
112
122
  "payload": {
113
123
  "type": "object",
114
124
  "additionalProperties": false,
@@ -191,6 +201,9 @@
191
201
  "$ref": "#/definitions/contributions"
192
202
  }
193
203
  }
204
+ },
205
+ "highIntent": {
206
+ "$ref": "#/definitions/highIntent"
194
207
  }
195
208
  },
196
209
  "required": ["id", "preliminary"]
@@ -1,18 +1,20 @@
1
1
  import { Fee } from '@lendi/integrations-protocol/lib/types/lixi-internal-request';
2
- import { FundsRequiredBreakdown } from '../types/events/public-funding-position';
3
- import { Payload as FundingPositionPayload } from '../types/events/public-funding-position';
2
+ import { FundsRequiredBreakdown, Payload as FundingPositionPayload } from '../types/events/public-funding-position';
3
+ import { PartialApplication } from '../types/partial-application';
4
4
  /**
5
5
  * GenerateFundingPosition
6
6
  *
7
7
  * @param fundingPosition a partialFundingPosition.
8
8
  * @return partialApplication with fees, grants and borrowers contributions added.
9
9
  */
10
- export declare function generateFundingPosition(fundingPosition: FundingPositionPayload): {};
10
+ export declare function transformFundingPosition(fundingPosition: FundingPositionPayload): PartialApplication;
11
11
  /**
12
12
  * getFee
13
13
  *
14
14
  * @param fundsRequiredBreakDown a FundsRequiredBreakdown.
15
+ * @param lmi
16
+ * @param lmiIncluded
15
17
  * @param id
16
18
  * @return Array of fees
17
19
  */
18
- export declare function getFees(fundsRequiredBreakDown: FundsRequiredBreakdown, id: string): Fee[];
20
+ export declare function getFees(fundsRequiredBreakDown: FundsRequiredBreakdown, lmi: number, lmiIncluded: boolean, id: string): Fee[];
@@ -1,19 +1,20 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
- exports.getFees = exports.generateFundingPosition = void 0;
4
- var lodash_1 = require("lodash");
3
+ exports.getFees = exports.transformFundingPosition = void 0;
4
+ var lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
5
5
  var application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
6
- var funding_position_1 = require("../types/enum-mappings/funding-position");
6
+ var lodash_1 = require("lodash");
7
+ var enum_mappings_1 = require("../types/enum-mappings");
7
8
  /**
8
9
  * GenerateFundingPosition
9
10
  *
10
11
  * @param fundingPosition a partialFundingPosition.
11
12
  * @return partialApplication with fees, grants and borrowers contributions added.
12
13
  */
13
- function generateFundingPosition(fundingPosition) {
14
+ function transformFundingPosition(fundingPosition) {
14
15
  var partialApplication = {};
15
16
  var contributionFunds = [];
16
- var applicationId = fundingPosition.applicationId, id = fundingPosition.id;
17
+ var applicationId = fundingPosition.applicationId, id = fundingPosition.id, _a = fundingPosition.lmi, lmi = _a === void 0 ? 0 : _a, _b = fundingPosition.lmiIncluded, lmiIncluded = _b === void 0 ? false : _b;
17
18
  var fundingPositionMapping = {
18
19
  applicationId: application_paths_1.paths.ApplicationId,
19
20
  fundsRequested: "".concat(application_paths_1.paths.RolledUpAmounts, ".@TotalNewFunds"),
@@ -23,24 +24,24 @@ function generateFundingPosition(fundingPosition) {
23
24
  totalCashOut: "".concat(application_paths_1.paths.EquityRelease, ".Amount.@LumpSum"),
24
25
  fundsRequiredBreakdown: application_paths_1.paths.SummaryFee
25
26
  };
26
- for (var _i = 0, _a = Object.entries(fundingPosition); _i < _a.length; _i++) {
27
- var _b = _a[_i], key = _b[0], value = _b[1];
27
+ for (var _i = 0, _c = Object.entries(fundingPosition); _i < _c.length; _i++) {
28
+ var _d = _c[_i], key = _d[0], value = _d[1];
28
29
  if (fundingPositionMapping[key]) {
29
30
  switch (key) {
30
31
  case 'totalGovernmentContributions':
31
32
  case 'totalDeposit':
32
33
  contributionFunds.push({
33
34
  '@Amount': value,
34
- '@Type': funding_position_1.contributionMapping[key],
35
+ '@Type': enum_mappings_1.contributionMapping[key],
35
36
  '@UniqueID': "".concat(id, "-").concat(key)
36
37
  });
37
38
  break;
38
39
  case 'fundsRequiredBreakdown':
39
- (0, lodash_1.set)(partialApplication, application_paths_1.paths.SummaryFee, getFees(value, id));
40
+ (0, lodash_1.set)(partialApplication, application_paths_1.paths.SummaryFee, getFees(value, lmi, lmiIncluded, id));
40
41
  break;
41
42
  case 'totalCashOut':
42
43
  (0, lodash_1.set)(partialApplication, fundingPositionMapping[key], value);
43
- (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.LoanDetail, ".@UniqueID"), "".concat(applicationId, "-loanDetails"));
44
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.LoanDetail, ".@UniqueID"), "".concat(applicationId, "-0"));
44
45
  break;
45
46
  case 'fundsRequested':
46
47
  (0, lodash_1.set)(partialApplication, fundingPositionMapping[key], Math.round(value));
@@ -54,27 +55,39 @@ function generateFundingPosition(fundingPosition) {
54
55
  (0, lodash_1.set)(partialApplication, application_paths_1.paths.ContributionFunds, contributionFunds);
55
56
  return partialApplication;
56
57
  }
57
- exports.generateFundingPosition = generateFundingPosition;
58
+ exports.transformFundingPosition = transformFundingPosition;
58
59
  /**
59
60
  * getFee
60
61
  *
61
62
  * @param fundsRequiredBreakDown a FundsRequiredBreakdown.
63
+ * @param lmi
64
+ * @param lmiIncluded
62
65
  * @param id
63
66
  * @return Array of fees
64
67
  */
65
- function getFees(fundsRequiredBreakDown, id) {
68
+ function getFees(fundsRequiredBreakDown, lmi, lmiIncluded, id) {
69
+ // Adding lmi to fees to be transformed.
70
+ (0, lodash_1.set)(fundsRequiredBreakDown, 'lmi', lmi);
66
71
  // Omitting constructionCosts as they don't belong in fees.
67
72
  return Object.entries((0, lodash_1.omit)(fundsRequiredBreakDown, 'constructionCosts')).map(function (_a) {
68
73
  var key = _a[0], value = _a[1];
69
74
  var descriptionList = ['accruedInterest', 'otherSundries'];
70
75
  var fee = {
71
76
  '@Amount': value,
72
- '@Category': funding_position_1.categoryMapping[key],
73
- '@Type': funding_position_1.typeMapping[key],
77
+ '@Category': enum_mappings_1.categoryMapping[key],
78
+ '@Type': enum_mappings_1.typeMapping[key],
74
79
  '@UniqueID': "".concat(id, "-").concat(key)
75
80
  };
76
81
  if (descriptionList.includes(key)) {
77
- fee['@Description'] = funding_position_1.descriptionMapping[key];
82
+ fee['@Description'] = enum_mappings_1.descriptionMapping[key];
83
+ }
84
+ if (key === 'lmi') {
85
+ if (lmiIncluded)
86
+ fee['@CapitaliseFee'] = lixi_internal_request_1.YesNoList.Yes;
87
+ // If lmiIncluded is undefined we do not want to set '@CapitaliseFee'
88
+ // only if it is false as this will affect how we handle migration.
89
+ if (lmiIncluded === false)
90
+ fee['@CapitaliseFee'] = lixi_internal_request_1.YesNoList.No;
78
91
  }
79
92
  return fee;
80
93
  });
@@ -11,7 +11,8 @@ exports.categoryMapping = {
11
11
  otherSundries: lixi_internal_request_1.FeeCategoryList.Other,
12
12
  stampDuty: lixi_internal_request_1.FeeCategoryList.Government,
13
13
  transferFee: lixi_internal_request_1.FeeCategoryList.Government,
14
- foreignBuyerSurcharge: lixi_internal_request_1.FeeCategoryList.Government
14
+ foreignBuyerSurcharge: lixi_internal_request_1.FeeCategoryList.Government,
15
+ lmi: lixi_internal_request_1.FeeCategoryList.Bank
15
16
  };
16
17
  exports.typeMapping = {
17
18
  accruedInterest: lixi_internal_request_1.FeeTypeList.Other,
@@ -22,7 +23,8 @@ exports.typeMapping = {
22
23
  otherSundries: lixi_internal_request_1.FeeTypeList.Other,
23
24
  stampDuty: lixi_internal_request_1.FeeTypeList.StampDutyOnMortgage,
24
25
  transferFee: lixi_internal_request_1.FeeTypeList.TitleTransferFee,
25
- foreignBuyerSurcharge: lixi_internal_request_1.FeeTypeList.Other
26
+ foreignBuyerSurcharge: lixi_internal_request_1.FeeTypeList.Other,
27
+ lmi: lixi_internal_request_1.FeeTypeList.Lmi
26
28
  };
27
29
  exports.descriptionMapping = {
28
30
  accruedInterest: lixi_internal_request_1.Custom4DescriptionList.PotentialAccruedInterest,
@@ -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.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
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];
@@ -15,6 +15,7 @@ export interface Payload {
15
15
  clonedFromApplicationId?: string;
16
16
  customerId?: string;
17
17
  hidden?: boolean;
18
+ highIntent?: boolean;
18
19
  id: string;
19
20
  meta?: ApplicationMeta;
20
21
  name?: string;
@@ -43,7 +44,9 @@ export declare enum BrokerPrimaryPurpose {
43
44
  Refinance = "REFINANCE",
44
45
  Slr = "SLR",
45
46
  TopUp = "TOP_UP",
46
- Variation = "VARIATION"
47
+ Variation = "VARIATION",
48
+ VariationCreditCritical = "VARIATION_CREDIT_CRITICAL",
49
+ VariationNonCreditCritical = "VARIATION_NON_CREDIT_CRITICAL"
47
50
  }
48
51
  /**
49
52
  * The metadata of the application
@@ -27,6 +27,8 @@ var BrokerPrimaryPurpose;
27
27
  BrokerPrimaryPurpose["Slr"] = "SLR";
28
28
  BrokerPrimaryPurpose["TopUp"] = "TOP_UP";
29
29
  BrokerPrimaryPurpose["Variation"] = "VARIATION";
30
+ BrokerPrimaryPurpose["VariationCreditCritical"] = "VARIATION_CREDIT_CRITICAL";
31
+ BrokerPrimaryPurpose["VariationNonCreditCritical"] = "VARIATION_NON_CREDIT_CRITICAL";
30
32
  })(BrokerPrimaryPurpose = exports.BrokerPrimaryPurpose || (exports.BrokerPrimaryPurpose = {}));
31
33
  /**
32
34
  * role of the user that made the action
@@ -36,6 +36,8 @@ function deepMergeApplication(existingApplication, newApplication) {
36
36
  var listsWithXApplicant = ['Applicant'];
37
37
  // Array fields with @x_ResidentialAddress
38
38
  var listsWithXResidentialAddress = ['PriorAddress'];
39
+ // Array fields with @x_Guarantor
40
+ var listsWithXGuarantor = ['Guarantor'];
39
41
  // Curried function which takes a uniqueKey and returns a function which will either replace
40
42
  // or merge the item in the array based on the uniqueKey
41
43
  if (!existingApplication) {
@@ -67,6 +69,9 @@ function deepMergeApplication(existingApplication, newApplication) {
67
69
  if (listsWithXApplicant.find(function (item) { return item === key; })) {
68
70
  return mergeItems('@x_Applicant');
69
71
  }
72
+ if (listsWithXGuarantor.find(function (item) { return item === key; })) {
73
+ return mergeItems('@x_Guarantor');
74
+ }
70
75
  return mergeItems(key);
71
76
  }
72
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lendi/integrations-transform",
3
- "version": "1.4.5",
3
+ "version": "1.4.8",
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",
@@ -31,7 +31,7 @@
31
31
  "devDependencies": {
32
32
  "@lendi/prettier-config": "^1.0.0",
33
33
  "@lendi/typescript-config": "^2.0.0",
34
- "@types/jest": "^26.0.14",
34
+ "@types/jest": "^27.4.1",
35
35
  "@types/lodash": "^4.14.141",
36
36
  "@types/node": "^12.12.5",
37
37
  "@types/pino": "^6.3.3",
@@ -44,7 +44,7 @@
44
44
  "eslint-plugin-prettier": "^3.3.1",
45
45
  "eslint-plugin-sonarjs": "^0.5.0",
46
46
  "husky": "^3.0.8",
47
- "jest": "^26.6.3",
47
+ "jest": "^27.5.1",
48
48
  "jest-buildkite-reporter": "^0.2.8",
49
49
  "jest-sonar-reporter": "^2.0.0",
50
50
  "path": "^0.12.7",
@@ -53,7 +53,7 @@
53
53
  "prettier-eslint": "^12.0.0",
54
54
  "quicktype": "15.0.207",
55
55
  "sinon": "^7.4.2",
56
- "ts-jest": "^26.5.0",
56
+ "ts-jest": "^27.1.4",
57
57
  "ts-node": "^8.4.1",
58
58
  "typedoc": "^0.20.36",
59
59
  "typescript": "^4.1.3"