gemcap-be-common 1.4.232 → 1.4.233
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.
|
@@ -21,12 +21,17 @@ const extractReferenceValue = (reference, key) => {
|
|
|
21
21
|
return value;
|
|
22
22
|
};
|
|
23
23
|
const convertBankReferenceToTransactionReference = (rawReference) => {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// If reference is empty/null → return empty string
|
|
25
|
+
if (!rawReference || !rawReference.trim()) {
|
|
26
|
+
return '';
|
|
26
27
|
}
|
|
27
28
|
const org = extractReferenceValue(rawReference, 'ORG');
|
|
28
29
|
const bnf = extractReferenceValue(rawReference, 'BNF');
|
|
29
30
|
const obi = extractReferenceValue(rawReference, 'OBI');
|
|
31
|
+
// If none of the required keys were found → return original reference as-is
|
|
32
|
+
if (!org && !bnf && !obi) {
|
|
33
|
+
return rawReference;
|
|
34
|
+
}
|
|
30
35
|
return `${org || ''} : ${bnf || ''} : ${obi || ''}`;
|
|
31
36
|
};
|
|
32
37
|
exports.convertBankReferenceToTransactionReference = convertBankReferenceToTransactionReference;
|
|
@@ -27,13 +27,19 @@ const extractReferenceValue = (reference: string, key: string): string => {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const convertBankReferenceToTransactionReference = (rawReference: string) => {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
// If reference is empty/null → return empty string
|
|
31
|
+
if (!rawReference || !rawReference.trim()) {
|
|
32
|
+
return '';
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
const org = extractReferenceValue(rawReference, 'ORG');
|
|
35
36
|
const bnf = extractReferenceValue(rawReference, 'BNF');
|
|
36
37
|
const obi = extractReferenceValue(rawReference, 'OBI');
|
|
37
38
|
|
|
39
|
+
// If none of the required keys were found → return original reference as-is
|
|
40
|
+
if (!org && !bnf && !obi) {
|
|
41
|
+
return rawReference;
|
|
42
|
+
}
|
|
43
|
+
|
|
38
44
|
return `${org || ''} : ${bnf || ''} : ${obi || ''}`;
|
|
39
45
|
};
|
package/package.json
CHANGED
|
@@ -322,7 +322,6 @@ class BankUploadedTransactionsService {
|
|
|
322
322
|
});
|
|
323
323
|
const loanTransactionsService = this.getLoanTransactionsService();
|
|
324
324
|
const normalizedTransaction = await loanTransactionsService.normalizeLoanTransaction(getLoanTransaction(), userId);
|
|
325
|
-
console.log({ normalizedTransaction });
|
|
326
325
|
const createdLoanTransaction = await loanTransactionsService.createLoanTransaction(normalizedTransaction);
|
|
327
326
|
loanTransactionsMap[String(transaction._id)] = [...loanTransactionsMap[String(transaction._id)], new mongoose_1.default.Types.ObjectId(String(createdLoanTransaction._id))];
|
|
328
327
|
productIds.add(String(foundCashAllocationProduct.productId));
|
|
@@ -360,7 +360,6 @@ export class BankUploadedTransactionsService {
|
|
|
360
360
|
});
|
|
361
361
|
const loanTransactionsService = this.getLoanTransactionsService();
|
|
362
362
|
const normalizedTransaction = await loanTransactionsService.normalizeLoanTransaction(getLoanTransaction() as ILoanTransactionDoc, userId);
|
|
363
|
-
console.log({ normalizedTransaction });
|
|
364
363
|
const createdLoanTransaction = await loanTransactionsService.createLoanTransaction(normalizedTransaction as Partial<ILoanTransactionWithId>);
|
|
365
364
|
loanTransactionsMap[String(transaction._id)] = [...loanTransactionsMap[String(transaction._id)], new mongoose.Types.ObjectId(String(createdLoanTransaction._id))];
|
|
366
365
|
productIds.add(String(foundCashAllocationProduct.productId));
|