@lendi/integrations-transform 1.5.5 → 1.5.6

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 CHANGED
@@ -1,11 +1,7 @@
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
- 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);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
@@ -1,4 +1,8 @@
1
1
  import { Payload as ApplicationPayload } from '../types/events/public-application';
2
+ interface transformApplicationOptions {
3
+ uniqueIdSuffix?: string;
4
+ enableRateLock?: boolean;
5
+ }
2
6
  /**
3
7
  * Transforms a partial opportunity event to a partial internal request.
4
8
  *
@@ -6,4 +10,5 @@ import { Payload as ApplicationPayload } from '../types/events/public-applicatio
6
10
  * @param uniqueIdSuffix: Suffix for uniquerId
7
11
  * @return partialApplication: A partial internal request.
8
12
  */
9
- export declare function transformApplication(opportunity: ApplicationPayload, uniqueIdSuffix?: string): {};
13
+ export declare function transformApplication(opportunity: ApplicationPayload, options?: transformApplicationOptions): {};
14
+ export {};
@@ -14,8 +14,9 @@ var transform_applicant_1 = require("./transform-applicant");
14
14
  * @param uniqueIdSuffix: Suffix for uniquerId
15
15
  * @return partialApplication: A partial internal request.
16
16
  */
17
- function transformApplication(opportunity, uniqueIdSuffix) {
18
- if (uniqueIdSuffix === void 0) { uniqueIdSuffix = 'loanDetails'; }
17
+ function transformApplication(opportunity, options) {
18
+ if (options === void 0) { options = {}; }
19
+ var _a = options.uniqueIdSuffix, uniqueIdSuffix = _a === void 0 ? 'loanDetails' : _a, _b = options.enableRateLock, enableRateLock = _b === void 0 ? false : _b;
19
20
  var partialApplication = {};
20
21
  var opportunityMapping = {
21
22
  brand: application_paths_2.paths.BusinessName,
@@ -23,19 +24,21 @@ function transformApplication(opportunity, uniqueIdSuffix) {
23
24
  paymentType: "".concat(application_paths_2.paths.LoanTerm, ".@PaymentType"),
24
25
  preliminary: 'preliminary',
25
26
  primaryPurpose: application_paths_2.paths.PurposeOfApplication,
26
- brokerPrimaryPurpose: 'Package.Content.NeedsAnalysis.PurposeOfApplication[0].@Description',
27
- hasOptedInRateLock: "".concat(application_paths_1.paths.FeaturesSelected, ".@RateLock")
27
+ brokerPrimaryPurpose: 'Package.Content.NeedsAnalysis.PurposeOfApplication[0].@Description'
28
28
  };
29
29
  (0, lodash_1.set)(partialApplication, "".concat(application_paths_2.paths.LoanDetail, ".@UniqueID"), "".concat(opportunity.id, "-").concat(uniqueIdSuffix));
30
30
  (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.Instructions, ".@UniqueID"), "".concat(opportunity.id, "-stage"));
31
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);
33
- for (var _i = 0, _a = Object.entries(opportunity); _i < _a.length; _i++) {
34
- var _b = _a[_i], opportunityKey = _b[0], opportunityValue = _b[1];
32
+ if (enableRateLock) {
33
+ var _c = opportunity.hasOptedInRateLock, hasOptedInRateLock = _c === void 0 ? false : _c;
34
+ (0, lodash_1.set)(partialApplication, "".concat(application_paths_1.paths.FeaturesSelected, ".@RateLock"), (0, transform_applicant_1.booleanMapping)(hasOptedInRateLock));
35
+ }
36
+ for (var _i = 0, _d = Object.entries(opportunity); _i < _d.length; _i++) {
37
+ var _e = _d[_i], opportunityKey = _e[0], opportunityValue = _e[1];
35
38
  if (opportunityMapping[opportunityKey]) {
36
39
  if (opportunityKey === 'preliminary') {
37
- for (var _c = 0, _d = Object.entries(opportunityValue); _c < _d.length; _c++) {
38
- var _e = _d[_c], key = _e[0], value = _e[1];
40
+ for (var _f = 0, _g = Object.entries(opportunityValue); _f < _g.length; _f++) {
41
+ var _h = _g[_f], key = _h[0], value = _h[1];
39
42
  if (opportunityMapping[key]) {
40
43
  switch (key) {
41
44
  case 'paymentType':
@@ -48,9 +51,6 @@ function transformApplication(opportunity, uniqueIdSuffix) {
48
51
  }
49
52
  }
50
53
  }
51
- else if (opportunityKey === 'hasOptedInRateLock') {
52
- (0, lodash_1.set)(partialApplication, opportunityMapping[opportunityKey], (0, transform_applicant_1.booleanMapping)(opportunityValue));
53
- }
54
54
  else {
55
55
  (0, lodash_1.set)(partialApplication, opportunityMapping[opportunityKey], opportunityValue);
56
56
  }
@@ -1,11 +1,7 @@
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
- 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);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lendi/integrations-transform",
3
- "version": "1.5.5",
3
+ "version": "1.5.6",
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",