gemcap-be-common 1.4.201 → 1.4.202
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/models/LoanTransaction.model.d.ts +2 -1
- package/models/LoanTransaction.model.js +1 -0
- package/models/LoanTransaction.model.ts +2 -1
- package/models/_index.d.ts +3 -3
- package/package.json +1 -1
- package/services/borrowers.service.d.ts +2 -2
- package/services/brokers.service.d.ts +2 -2
- package/services/loan-transactions.service.js +8 -10
- package/services/loan-transactions.service.ts +8 -10
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -28,7 +28,8 @@ import { IBankDoc } from './Banks.model';
|
|
|
28
28
|
export declare enum ELoanTransactionTypes {
|
|
29
29
|
COLLECTION = "COLLECTION",
|
|
30
30
|
DISBURSEMENT = "DISBURSEMENT",
|
|
31
|
-
ADJUSTMENT = "ADJUSTMENT"
|
|
31
|
+
ADJUSTMENT = "ADJUSTMENT",
|
|
32
|
+
FEE = "FEE"
|
|
32
33
|
}
|
|
33
34
|
export declare const LOAN_TRANSACTION_DOWNLOAD_FIELDS: string[];
|
|
34
35
|
export declare const LOAN_TRANSACTION_FIELDS: string[];
|
|
@@ -14,6 +14,7 @@ var ELoanTransactionTypes;
|
|
|
14
14
|
ELoanTransactionTypes["COLLECTION"] = "COLLECTION";
|
|
15
15
|
ELoanTransactionTypes["DISBURSEMENT"] = "DISBURSEMENT";
|
|
16
16
|
ELoanTransactionTypes["ADJUSTMENT"] = "ADJUSTMENT";
|
|
17
|
+
ELoanTransactionTypes["FEE"] = "FEE";
|
|
17
18
|
})(ELoanTransactionTypes || (exports.ELoanTransactionTypes = ELoanTransactionTypes = {}));
|
|
18
19
|
exports.LOAN_TRANSACTION_DOWNLOAD_FIELDS = [
|
|
19
20
|
'date',
|
|
@@ -10,7 +10,8 @@ import { createLog, getLogChanges } from '../db/user-logs.db';
|
|
|
10
10
|
export enum ELoanTransactionTypes {
|
|
11
11
|
COLLECTION = 'COLLECTION',
|
|
12
12
|
DISBURSEMENT = 'DISBURSEMENT',
|
|
13
|
-
ADJUSTMENT = 'ADJUSTMENT'
|
|
13
|
+
ADJUSTMENT = 'ADJUSTMENT',
|
|
14
|
+
FEE = 'FEE',
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export const LOAN_TRANSACTION_DOWNLOAD_FIELDS = [
|
package/models/_index.d.ts
CHANGED
|
@@ -31,10 +31,10 @@ export declare const allSchemas: {
|
|
|
31
31
|
createdAt: NativeDate;
|
|
32
32
|
updatedAt: NativeDate;
|
|
33
33
|
} & {
|
|
34
|
+
amount: number;
|
|
34
35
|
order: number;
|
|
35
36
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
36
37
|
apDate: Date;
|
|
37
|
-
amount: number;
|
|
38
38
|
__v?: number;
|
|
39
39
|
poNumber?: string;
|
|
40
40
|
customerName?: string;
|
|
@@ -45,10 +45,10 @@ export declare const allSchemas: {
|
|
|
45
45
|
createdAt: NativeDate;
|
|
46
46
|
updatedAt: NativeDate;
|
|
47
47
|
} & {
|
|
48
|
+
amount: number;
|
|
48
49
|
order: number;
|
|
49
50
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
50
51
|
apDate: Date;
|
|
51
|
-
amount: number;
|
|
52
52
|
__v?: number;
|
|
53
53
|
poNumber?: string;
|
|
54
54
|
customerName?: string;
|
|
@@ -59,10 +59,10 @@ export declare const allSchemas: {
|
|
|
59
59
|
createdAt: NativeDate;
|
|
60
60
|
updatedAt: NativeDate;
|
|
61
61
|
} & {
|
|
62
|
+
amount: number;
|
|
62
63
|
order: number;
|
|
63
64
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
64
65
|
apDate: Date;
|
|
65
|
-
amount: number;
|
|
66
66
|
__v?: number;
|
|
67
67
|
poNumber?: string;
|
|
68
68
|
customerName?: string;
|
package/package.json
CHANGED
|
@@ -84,10 +84,10 @@ export declare class BorrowerService {
|
|
|
84
84
|
getBorrowerCodesMap(): Promise<Map<string, string>>;
|
|
85
85
|
getBorrowerStatementDetails(borrowers: IBorrowerDoc[]): Promise<{
|
|
86
86
|
[x: string]: {
|
|
87
|
-
LAST_MONTH?: boolean;
|
|
88
|
-
CURRENT_MONTH?: boolean;
|
|
89
87
|
ENTIRE_LOAN?: boolean;
|
|
90
88
|
SELECTED_PERIOD?: boolean;
|
|
89
|
+
CURRENT_MONTH?: boolean;
|
|
90
|
+
LAST_MONTH?: boolean;
|
|
91
91
|
TERM_LOAN?: boolean;
|
|
92
92
|
};
|
|
93
93
|
}>;
|
|
@@ -46,9 +46,9 @@ export declare class BrokersService {
|
|
|
46
46
|
getAllProductBrokers(): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
|
|
47
47
|
_id: import("mongoose").Types.ObjectId;
|
|
48
48
|
})[]>;
|
|
49
|
-
getBorrowerBrokers(borrowerId: string): Promise<
|
|
49
|
+
getBorrowerBrokers(borrowerId: string): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
|
|
50
50
|
_id: import("mongoose").Types.ObjectId;
|
|
51
|
-
})[]>;
|
|
51
|
+
})[] | BrokerView[]>;
|
|
52
52
|
getProductBrokers(productId: string): Promise<import("../models/ProductBroker.model").IProductBrokerDocWithBroker[]>;
|
|
53
53
|
getTotalShares(borrowerId: string, brokers: IProductBrokerView[], replaceNames?: boolean): Promise<ProductTotal>;
|
|
54
54
|
getTotals(borrowerId: string): Promise<BrokerTotalView[]>;
|
|
@@ -452,17 +452,15 @@ class LoanTransactionsService {
|
|
|
452
452
|
for (const transaction of recalculatedTransactions) {
|
|
453
453
|
const totalPostponed = await (0, loan_products_db_1.getPostponedTransactions)(transaction.date, transaction.productId.toString(), true);
|
|
454
454
|
switch (transaction.transactionType) {
|
|
455
|
-
case LoanTransaction_model_1.ELoanTransactionTypes.COLLECTION:
|
|
455
|
+
case LoanTransaction_model_1.ELoanTransactionTypes.COLLECTION: {
|
|
456
456
|
await this.postponedTransactionsService.cleanRecalculated(transaction._id.toString());
|
|
457
457
|
await this.postponedTransactionsService.createPostponedTransaction(transaction);
|
|
458
458
|
currentFloatedBalance = new decimal_js_1.default(currentFloatedBalance).add(totalPostponed).toNumber();
|
|
459
459
|
break;
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
break;
|
|
463
|
-
case LoanTransaction_model_1.ELoanTransactionTypes.ADJUSTMENT:
|
|
460
|
+
}
|
|
461
|
+
default: {
|
|
464
462
|
currentFloatedBalance = new decimal_js_1.default(currentFloatedBalance).add(transaction.amount).add(totalPostponed).toNumber();
|
|
465
|
-
|
|
463
|
+
}
|
|
466
464
|
}
|
|
467
465
|
await LoanTransaction_model_1.LoanTransaction.findByIdAndUpdate(transaction._id, { floatedBalance: currentFloatedBalance });
|
|
468
466
|
}
|
|
@@ -527,15 +525,15 @@ class LoanTransactionsService {
|
|
|
527
525
|
// floatedBalance recalculation
|
|
528
526
|
const totalPostponed = await (0, loan_products_db_1.getPostponedTransactions)(tr.date, tr.productId.toString(), true);
|
|
529
527
|
switch (tr.transactionType) {
|
|
530
|
-
case LoanTransaction_model_1.ELoanTransactionTypes.COLLECTION:
|
|
528
|
+
case LoanTransaction_model_1.ELoanTransactionTypes.COLLECTION: {
|
|
531
529
|
await this.postponedTransactionsService.cleanRecalculated(tr._id.toString());
|
|
532
530
|
await this.postponedTransactionsService.createPostponedTransaction(tr);
|
|
533
531
|
floatedBalance = new decimal_js_1.default(floatedBalance).add(totalPostponed).toNumber();
|
|
534
532
|
break;
|
|
535
|
-
|
|
536
|
-
|
|
533
|
+
}
|
|
534
|
+
default: {
|
|
537
535
|
floatedBalance = new decimal_js_1.default(floatedBalance).add(tr.amount).add(totalPostponed).toNumber();
|
|
538
|
-
|
|
536
|
+
}
|
|
539
537
|
}
|
|
540
538
|
await LoanTransaction_model_1.LoanTransaction.updateOne({ _id: tr._id }, { balance, floatedBalance });
|
|
541
539
|
}
|
|
@@ -515,17 +515,15 @@ export class LoanTransactionsService {
|
|
|
515
515
|
for (const transaction of recalculatedTransactions) {
|
|
516
516
|
const totalPostponed = await getPostponedTransactions(transaction.date, transaction.productId.toString(), true);
|
|
517
517
|
switch (transaction.transactionType) {
|
|
518
|
-
case ELoanTransactionTypes.COLLECTION:
|
|
518
|
+
case ELoanTransactionTypes.COLLECTION: {
|
|
519
519
|
await this.postponedTransactionsService.cleanRecalculated(transaction._id.toString());
|
|
520
520
|
await this.postponedTransactionsService.createPostponedTransaction(transaction);
|
|
521
521
|
currentFloatedBalance = new Decimal(currentFloatedBalance).add(totalPostponed).toNumber();
|
|
522
522
|
break;
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
break;
|
|
526
|
-
case ELoanTransactionTypes.ADJUSTMENT:
|
|
523
|
+
}
|
|
524
|
+
default: {
|
|
527
525
|
currentFloatedBalance = new Decimal(currentFloatedBalance).add(transaction.amount).add(totalPostponed).toNumber();
|
|
528
|
-
|
|
526
|
+
}
|
|
529
527
|
}
|
|
530
528
|
await LoanTransaction.findByIdAndUpdate(transaction._id, { floatedBalance: currentFloatedBalance });
|
|
531
529
|
}
|
|
@@ -601,15 +599,15 @@ export class LoanTransactionsService {
|
|
|
601
599
|
// floatedBalance recalculation
|
|
602
600
|
const totalPostponed = await getPostponedTransactions(tr.date, tr.productId.toString(), true);
|
|
603
601
|
switch (tr.transactionType) {
|
|
604
|
-
case ELoanTransactionTypes.COLLECTION:
|
|
602
|
+
case ELoanTransactionTypes.COLLECTION: {
|
|
605
603
|
await this.postponedTransactionsService.cleanRecalculated(tr._id.toString());
|
|
606
604
|
await this.postponedTransactionsService.createPostponedTransaction(tr);
|
|
607
605
|
floatedBalance = new Decimal(floatedBalance).add(totalPostponed).toNumber();
|
|
608
606
|
break;
|
|
609
|
-
|
|
610
|
-
|
|
607
|
+
}
|
|
608
|
+
default: {
|
|
611
609
|
floatedBalance = new Decimal(floatedBalance).add(tr.amount).add(totalPostponed).toNumber();
|
|
612
|
-
|
|
610
|
+
}
|
|
613
611
|
}
|
|
614
612
|
|
|
615
613
|
await LoanTransaction.updateOne(
|