@lendi/act-credit-decisions-transform 2.0.10 → 2.0.14

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.
@@ -58,6 +58,7 @@ function transformLiability({ applicationId, id, liability }) {
58
58
  }
59
59
  // Default clearingFromThisLoan to No if the value is not present in the event.
60
60
  (0, lodash_1.set)(partialApplication, liabilityMapping.clearingFromThisLoan, lixi_internal_request_1.YesNoList.No);
61
+ (0, lodash_1.set)(partialApplication, liabilityMapping.clearingFromOtherSource, lixi_internal_request_1.YesNoList.No);
61
62
  for (const [key, value] of Object.entries(liability)) {
62
63
  if (liabilityMapping[key]) {
63
64
  switch (key) {
@@ -83,8 +84,7 @@ function transformLiability({ applicationId, id, liability }) {
83
84
  (0, lodash_1.set)(partialApplication, liabilityMapping[key], value ? lixi_internal_request_1.YesNoList.Yes : lixi_internal_request_1.YesNoList.No);
84
85
  break;
85
86
  case 'clearingFromOtherSource':
86
- if (value === public_liability_1.ClearingFromOtherSource.PayingOut)
87
- (0, lodash_1.set)(partialApplication, liabilityMapping[key], lixi_internal_request_1.YesNoList.Yes);
87
+ (0, lodash_1.set)(partialApplication, liabilityMapping[key], value === public_liability_1.ClearingFromOtherSource.PayingOut ? lixi_internal_request_1.YesNoList.Yes : lixi_internal_request_1.YesNoList.No);
88
88
  break;
89
89
  case 'repaymentFrequency':
90
90
  (0, lodash_1.set)(partialApplication, liabilityMapping[key], alieo_frequency_1.liabilityFrequencyMapping[value]);
@@ -113,9 +113,16 @@ function transformLiability({ applicationId, id, liability }) {
113
113
  }
114
114
  }
115
115
  const newLimit = (0, lodash_1.get)(partialApplication, liabilityMapping.newLimit, 0);
116
+ // newLimit === 0, clearingFromOtherSource === 'PAYING_OUT'(clearing from other source == Yes), pay out using other funds
117
+ // newLimit === 0, clearingFromOtherSource is undefined, pay out using this application's funds
118
+ // newLimit !== 0, regardless what clearingFromOtherSource is(usually it is not present), continue to pay the liability
116
119
  if (!newLimit) {
117
- // set clearing from this loan to true if ongoing limit is reduced
118
- (0, lodash_1.set)(partialApplication, liabilityMapping.clearingFromThisLoan, lixi_internal_request_1.YesNoList.Yes);
120
+ const clearingFromOtherSource = (0, lodash_1.get)(partialApplication, liabilityMapping.clearingFromOtherSource);
121
+ const clearingFromThisLoan = clearingFromOtherSource === lixi_internal_request_1.YesNoList.Yes ? lixi_internal_request_1.YesNoList.No : lixi_internal_request_1.YesNoList.Yes;
122
+ (0, lodash_1.set)(partialApplication, liabilityMapping.clearingFromThisLoan, clearingFromThisLoan);
123
+ }
124
+ else {
125
+ (0, lodash_1.set)(partialApplication, liabilityMapping.clearingFromThisLoan, lixi_internal_request_1.YesNoList.No);
119
126
  }
120
127
  return partialApplication;
121
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lendi/act-credit-decisions-transform",
3
- "version": "2.0.10",
3
+ "version": "2.0.14",
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.8",
25
- "@lendi/act-eac-integrations-protocol": "3.1.0",
25
+ "@lendi/act-eac-integrations-protocol": "3.1.4",
26
26
  "clean-deep": "^3.4.0",
27
27
  "date-fns": "2.19.0",
28
28
  "lodash": "^4.17.15"