@lendi/act-credit-decisions-transform 2.0.17 → 2.0.18
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.
|
@@ -6,6 +6,7 @@ const application_paths_1 = require("@lendi/act-eac-integrations-protocol/lib/ut
|
|
|
6
6
|
const lodash_1 = require("lodash");
|
|
7
7
|
const enum_mappings_1 = require("../types/enum-mappings/");
|
|
8
8
|
const public_expense_1 = require("../types/events/public-expense");
|
|
9
|
+
const uniqueid_tools_1 = require("../utils/uniqueid-tools");
|
|
9
10
|
exports.otherCommitmentExpenseTypes = [
|
|
10
11
|
public_expense_1.ExpenseType.Board,
|
|
11
12
|
public_expense_1.ExpenseType.ChildAndSpousalMaintenance,
|
|
@@ -76,7 +77,7 @@ function transformExpense(expense, applicantId, index, id) {
|
|
|
76
77
|
'@Category': enum_mappings_1.livingExpenseMapping[expense.type],
|
|
77
78
|
'@Description': expense.type,
|
|
78
79
|
// '@UniqueID': isOtherCommitment(expense) ? `${id}-commitment-${index}` : `${id}-living-expense-${index}`,
|
|
79
|
-
'@UniqueID':
|
|
80
|
+
'@UniqueID': (0, uniqueid_tools_1.truncateUniqueId)(id + '-' + applicantId + '-' + expense.type),
|
|
80
81
|
'@Frequency': enum_mappings_1.frequencyMapping[expense.frequency],
|
|
81
82
|
PercentResponsible: {
|
|
82
83
|
Owner: [
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.truncateUniqueId = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Guarantee that the uniqueId is no more than maxLength length
|
|
6
|
+
*
|
|
7
|
+
* @param id
|
|
8
|
+
* @param maxLength Maximum length limit. For ANZ it should be 100.
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
const truncateUniqueId = (id, maxLength = 100) => {
|
|
12
|
+
return id.length > maxLength ? id.substring(0, maxLength - 1) : id;
|
|
13
|
+
};
|
|
14
|
+
exports.truncateUniqueId = truncateUniqueId;
|