gemcap-be-common 1.5.16 → 1.5.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.
- package/helpers/date.helper.d.ts +1 -1
- package/helpers/date.helper.js +9 -5
- package/helpers/date.helper.ts +15 -5
- package/models/ReceivableAvailability.model.d.ts +12 -12
- package/models/TermLoanCalculated.model.d.ts +18 -9
- package/models/TermLoanCalculated.model.js +4 -6
- package/models/TermLoanCalculated.model.ts +12 -14
- package/models/_index.d.ts +6 -6
- package/package.json +1 -1
- package/services/borrower-summary.service.js +1 -1
- package/services/borrower-summary.service.ts +1 -1
- package/services/borrowers.service.d.ts +2 -2
- package/services/brokers.service.d.ts +2 -2
- package/services/loan-payments.service.js +1 -1
- package/services/loan-payments.service.ts +1 -1
- package/services/loan-transactions.service.js +1 -1
- package/services/loan-transactions.service.ts +1 -1
- package/services/quickbooks.service.js +1 -1
- package/services/quickbooks.service.ts +1 -1
- package/services/reports.service.js +1 -1
- package/services/reports.service.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/helpers/date.helper.d.ts
CHANGED
|
@@ -26,4 +26,4 @@ export declare const getShiftedMonth: (month: ISelectedMonth, shift: number) =>
|
|
|
26
26
|
year: number;
|
|
27
27
|
month: number;
|
|
28
28
|
};
|
|
29
|
-
export declare const isProductActive: (deactivationDate: Date | null | undefined, checkDate: Date) => boolean;
|
|
29
|
+
export declare const isProductActive: (startDate: Date | null | undefined, deactivationDate: Date | null | undefined, checkDate: Date) => boolean;
|
package/helpers/date.helper.js
CHANGED
|
@@ -97,14 +97,18 @@ const getShiftedMonth = (month, shift) => {
|
|
|
97
97
|
return { year: nextMonth.year(), month: nextMonth.month() + 1 };
|
|
98
98
|
};
|
|
99
99
|
exports.getShiftedMonth = getShiftedMonth;
|
|
100
|
-
const isProductActive = (deactivationDate, checkDate) => {
|
|
101
|
-
|
|
100
|
+
const isProductActive = (startDate, deactivationDate, checkDate) => {
|
|
101
|
+
const check = (0, dayjs_1.default)(checkDate);
|
|
102
|
+
// If startDate exists and is in the future → not active yet
|
|
103
|
+
if (startDate && (0, dayjs_1.default)(startDate).isAfter(check)) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
// If no deactivation date → active (and already started)
|
|
102
107
|
if (!deactivationDate) {
|
|
103
108
|
return true;
|
|
104
109
|
}
|
|
105
110
|
const deactivation = (0, dayjs_1.default)(deactivationDate);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return !deactivation.isBefore(check);
|
|
111
|
+
// Active if checkDate is before deactivationDate
|
|
112
|
+
return check.isBefore(deactivation);
|
|
109
113
|
};
|
|
110
114
|
exports.isProductActive = isProductActive;
|
package/helpers/date.helper.ts
CHANGED
|
@@ -103,15 +103,25 @@ export const getShiftedMonth = (month: ISelectedMonth, shift: number) => {
|
|
|
103
103
|
return { year: nextMonth.year(), month: nextMonth.month() + 1 };
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
export const isProductActive = (
|
|
107
|
-
|
|
106
|
+
export const isProductActive = (
|
|
107
|
+
startDate: Date | null | undefined,
|
|
108
|
+
deactivationDate: Date | null | undefined,
|
|
109
|
+
checkDate: Date
|
|
110
|
+
) => {
|
|
111
|
+
const check = dayjs(checkDate);
|
|
112
|
+
|
|
113
|
+
// If startDate exists and is in the future → not active yet
|
|
114
|
+
if (startDate && dayjs(startDate).isAfter(check)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// If no deactivation date → active (and already started)
|
|
108
119
|
if (!deactivationDate) {
|
|
109
120
|
return true;
|
|
110
121
|
}
|
|
111
122
|
|
|
112
123
|
const deactivation = dayjs(deactivationDate);
|
|
113
|
-
const check = dayjs(checkDate);
|
|
114
124
|
|
|
115
|
-
// Active if
|
|
116
|
-
return
|
|
125
|
+
// Active if checkDate is before deactivationDate
|
|
126
|
+
return check.isBefore(deactivation);
|
|
117
127
|
};
|
|
@@ -206,9 +206,9 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
206
206
|
insuredComponent: number;
|
|
207
207
|
preliminaryEligibleBalance: number;
|
|
208
208
|
uninsuredComponent: number;
|
|
209
|
-
creditNotesNegative: number;
|
|
210
209
|
insuredAvailability: number;
|
|
211
210
|
uninsuredAvailability: number;
|
|
211
|
+
creditNotesNegative: number;
|
|
212
212
|
ARAvailability: number;
|
|
213
213
|
};
|
|
214
214
|
userCalculatedId?: string;
|
|
@@ -218,15 +218,15 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
218
218
|
limit?: number;
|
|
219
219
|
customer?: string;
|
|
220
220
|
}>;
|
|
221
|
-
|
|
221
|
+
permittedConcentration: mongoose.Types.DocumentArray<{
|
|
222
222
|
limit?: number;
|
|
223
223
|
customer?: string;
|
|
224
224
|
}>;
|
|
225
|
-
|
|
225
|
+
permittedExtendedARDays: mongoose.Types.DocumentArray<{
|
|
226
226
|
limit?: number;
|
|
227
227
|
customer?: string;
|
|
228
228
|
}>;
|
|
229
|
-
|
|
229
|
+
insuredCustomers: mongoose.Types.DocumentArray<{
|
|
230
230
|
limit?: number;
|
|
231
231
|
customer?: string;
|
|
232
232
|
}>;
|
|
@@ -266,9 +266,9 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
266
266
|
insuredComponent: number;
|
|
267
267
|
preliminaryEligibleBalance: number;
|
|
268
268
|
uninsuredComponent: number;
|
|
269
|
-
creditNotesNegative: number;
|
|
270
269
|
insuredAvailability: number;
|
|
271
270
|
uninsuredAvailability: number;
|
|
271
|
+
creditNotesNegative: number;
|
|
272
272
|
ARAvailability: number;
|
|
273
273
|
};
|
|
274
274
|
userCalculatedId?: string;
|
|
@@ -278,15 +278,15 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
278
278
|
limit?: number;
|
|
279
279
|
customer?: string;
|
|
280
280
|
}>;
|
|
281
|
-
|
|
281
|
+
permittedConcentration: mongoose.Types.DocumentArray<{
|
|
282
282
|
limit?: number;
|
|
283
283
|
customer?: string;
|
|
284
284
|
}>;
|
|
285
|
-
|
|
285
|
+
permittedExtendedARDays: mongoose.Types.DocumentArray<{
|
|
286
286
|
limit?: number;
|
|
287
287
|
customer?: string;
|
|
288
288
|
}>;
|
|
289
|
-
|
|
289
|
+
insuredCustomers: mongoose.Types.DocumentArray<{
|
|
290
290
|
limit?: number;
|
|
291
291
|
customer?: string;
|
|
292
292
|
}>;
|
|
@@ -326,9 +326,9 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
326
326
|
insuredComponent: number;
|
|
327
327
|
preliminaryEligibleBalance: number;
|
|
328
328
|
uninsuredComponent: number;
|
|
329
|
-
creditNotesNegative: number;
|
|
330
329
|
insuredAvailability: number;
|
|
331
330
|
uninsuredAvailability: number;
|
|
331
|
+
creditNotesNegative: number;
|
|
332
332
|
ARAvailability: number;
|
|
333
333
|
};
|
|
334
334
|
userCalculatedId?: string;
|
|
@@ -338,15 +338,15 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
338
338
|
limit?: number;
|
|
339
339
|
customer?: string;
|
|
340
340
|
}>;
|
|
341
|
-
|
|
341
|
+
permittedConcentration: mongoose.Types.DocumentArray<{
|
|
342
342
|
limit?: number;
|
|
343
343
|
customer?: string;
|
|
344
344
|
}>;
|
|
345
|
-
|
|
345
|
+
permittedExtendedARDays: mongoose.Types.DocumentArray<{
|
|
346
346
|
limit?: number;
|
|
347
347
|
customer?: string;
|
|
348
348
|
}>;
|
|
349
|
-
|
|
349
|
+
insuredCustomers: mongoose.Types.DocumentArray<{
|
|
350
350
|
limit?: number;
|
|
351
351
|
customer?: string;
|
|
352
352
|
}>;
|
|
@@ -74,18 +74,21 @@ export declare const TermLoanCalculatedSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
74
74
|
createdAt: NativeDate;
|
|
75
75
|
updatedAt: NativeDate;
|
|
76
76
|
} & {
|
|
77
|
-
interestRate: number;
|
|
78
77
|
termLoanId: mongoose.Types.ObjectId;
|
|
78
|
+
payments: mongoose.Types.DocumentArray<{
|
|
79
|
+
amount: number;
|
|
80
|
+
paymentId: mongoose.Types.ObjectId;
|
|
81
|
+
}>;
|
|
79
82
|
relevantStatement: string;
|
|
80
83
|
openingBalance: number;
|
|
81
84
|
monthlyInterest: number;
|
|
82
85
|
monthlyPrincipal: number;
|
|
83
86
|
closingBalance: number;
|
|
84
87
|
adminFee: number;
|
|
88
|
+
interestRate: number;
|
|
85
89
|
interestDaily: number;
|
|
86
90
|
gracePeriod: boolean;
|
|
87
91
|
amortization: boolean;
|
|
88
|
-
payments: any[];
|
|
89
92
|
disbursements: number;
|
|
90
93
|
dailyResults: mongoose.Types.DocumentArray<{
|
|
91
94
|
interestRate: number;
|
|
@@ -93,24 +96,27 @@ export declare const TermLoanCalculatedSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
93
96
|
interest: number;
|
|
94
97
|
paymentDate: boolean;
|
|
95
98
|
}>;
|
|
96
|
-
__v?: number;
|
|
97
99
|
paymentDueDate?: Date;
|
|
100
|
+
__v?: number;
|
|
98
101
|
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
99
102
|
createdAt: NativeDate;
|
|
100
103
|
updatedAt: NativeDate;
|
|
101
104
|
} & {
|
|
102
|
-
interestRate: number;
|
|
103
105
|
termLoanId: mongoose.Types.ObjectId;
|
|
106
|
+
payments: mongoose.Types.DocumentArray<{
|
|
107
|
+
amount: number;
|
|
108
|
+
paymentId: mongoose.Types.ObjectId;
|
|
109
|
+
}>;
|
|
104
110
|
relevantStatement: string;
|
|
105
111
|
openingBalance: number;
|
|
106
112
|
monthlyInterest: number;
|
|
107
113
|
monthlyPrincipal: number;
|
|
108
114
|
closingBalance: number;
|
|
109
115
|
adminFee: number;
|
|
116
|
+
interestRate: number;
|
|
110
117
|
interestDaily: number;
|
|
111
118
|
gracePeriod: boolean;
|
|
112
119
|
amortization: boolean;
|
|
113
|
-
payments: any[];
|
|
114
120
|
disbursements: number;
|
|
115
121
|
dailyResults: mongoose.Types.DocumentArray<{
|
|
116
122
|
interestRate: number;
|
|
@@ -118,24 +124,27 @@ export declare const TermLoanCalculatedSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
118
124
|
interest: number;
|
|
119
125
|
paymentDate: boolean;
|
|
120
126
|
}>;
|
|
121
|
-
__v?: number;
|
|
122
127
|
paymentDueDate?: Date;
|
|
128
|
+
__v?: number;
|
|
123
129
|
}>> & mongoose.FlatRecord<{
|
|
124
130
|
createdAt: NativeDate;
|
|
125
131
|
updatedAt: NativeDate;
|
|
126
132
|
} & {
|
|
127
|
-
interestRate: number;
|
|
128
133
|
termLoanId: mongoose.Types.ObjectId;
|
|
134
|
+
payments: mongoose.Types.DocumentArray<{
|
|
135
|
+
amount: number;
|
|
136
|
+
paymentId: mongoose.Types.ObjectId;
|
|
137
|
+
}>;
|
|
129
138
|
relevantStatement: string;
|
|
130
139
|
openingBalance: number;
|
|
131
140
|
monthlyInterest: number;
|
|
132
141
|
monthlyPrincipal: number;
|
|
133
142
|
closingBalance: number;
|
|
134
143
|
adminFee: number;
|
|
144
|
+
interestRate: number;
|
|
135
145
|
interestDaily: number;
|
|
136
146
|
gracePeriod: boolean;
|
|
137
147
|
amortization: boolean;
|
|
138
|
-
payments: any[];
|
|
139
148
|
disbursements: number;
|
|
140
149
|
dailyResults: mongoose.Types.DocumentArray<{
|
|
141
150
|
interestRate: number;
|
|
@@ -143,8 +152,8 @@ export declare const TermLoanCalculatedSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
143
152
|
interest: number;
|
|
144
153
|
paymentDate: boolean;
|
|
145
154
|
}>;
|
|
146
|
-
__v?: number;
|
|
147
155
|
paymentDueDate?: Date;
|
|
156
|
+
__v?: number;
|
|
148
157
|
}> & {
|
|
149
158
|
_id: mongoose.Types.ObjectId;
|
|
150
159
|
}>;
|
|
@@ -56,11 +56,8 @@ exports.TermLoanCalculatedSchema = new mongoose_1.default.Schema({
|
|
|
56
56
|
type: Date,
|
|
57
57
|
required: false,
|
|
58
58
|
},
|
|
59
|
-
payments: [
|
|
60
|
-
|
|
61
|
-
required: function () {
|
|
62
|
-
return this.payment && this.payment.amount && this.payment.paymentId;
|
|
63
|
-
},
|
|
59
|
+
payments: [
|
|
60
|
+
{
|
|
64
61
|
amount: {
|
|
65
62
|
type: Number,
|
|
66
63
|
required: true,
|
|
@@ -70,7 +67,8 @@ exports.TermLoanCalculatedSchema = new mongoose_1.default.Schema({
|
|
|
70
67
|
ref: _models_1.MODEL_NAMES.loanTransactions,
|
|
71
68
|
required: true,
|
|
72
69
|
},
|
|
73
|
-
}
|
|
70
|
+
},
|
|
71
|
+
],
|
|
74
72
|
disbursements: {
|
|
75
73
|
type: Number,
|
|
76
74
|
required: true,
|
|
@@ -104,21 +104,19 @@ export const TermLoanCalculatedSchema = new mongoose.Schema(
|
|
|
104
104
|
type: Date,
|
|
105
105
|
required: false,
|
|
106
106
|
},
|
|
107
|
-
payments: [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
payments: [
|
|
108
|
+
{
|
|
109
|
+
amount: {
|
|
110
|
+
type: Number,
|
|
111
|
+
required: true,
|
|
112
|
+
},
|
|
113
|
+
paymentId: {
|
|
114
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
115
|
+
ref: MODEL_NAMES.loanTransactions,
|
|
116
|
+
required: true,
|
|
117
|
+
},
|
|
111
118
|
},
|
|
112
|
-
|
|
113
|
-
type: Number,
|
|
114
|
-
required: true,
|
|
115
|
-
},
|
|
116
|
-
paymentId: {
|
|
117
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
118
|
-
ref: MODEL_NAMES.loanTransactions,
|
|
119
|
-
required: true,
|
|
120
|
-
},
|
|
121
|
-
}],
|
|
119
|
+
],
|
|
122
120
|
disbursements: {
|
|
123
121
|
type: Number,
|
|
124
122
|
required: true,
|
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
|
-
|
|
34
|
+
amount: number;
|
|
35
35
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
36
|
+
order: number;
|
|
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
|
-
|
|
48
|
+
amount: number;
|
|
49
49
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
50
|
+
order: number;
|
|
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
|
-
|
|
62
|
+
amount: number;
|
|
63
63
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
64
|
+
order: number;
|
|
64
65
|
apDate: Date;
|
|
65
|
-
amount: number;
|
|
66
66
|
__v?: number;
|
|
67
67
|
poNumber?: string;
|
|
68
68
|
customerName?: string;
|
package/package.json
CHANGED
|
@@ -213,7 +213,7 @@ class BorrowerSummaryService {
|
|
|
213
213
|
}
|
|
214
214
|
async getChartData(borrowerId) {
|
|
215
215
|
const products = await this.loanChargesService.getLoanProducts(borrowerId);
|
|
216
|
-
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, date_helper_1.isProductActive)(product.deactivationDate, new Date()));
|
|
216
|
+
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, date_helper_1.isProductActive)(product.startDate, product.deactivationDate, new Date()));
|
|
217
217
|
const chartData = [];
|
|
218
218
|
if (revolverProduct) {
|
|
219
219
|
const lastSignedBBC = await (0, bbcDates_db_1.getLatestSignedBBCDateDoc)(borrowerId);
|
|
@@ -236,7 +236,7 @@ export class BorrowerSummaryService {
|
|
|
236
236
|
|
|
237
237
|
private async getChartData(borrowerId: string) {
|
|
238
238
|
const products = await this.loanChargesService.getLoanProducts(borrowerId);
|
|
239
|
-
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER && isProductActive(product.deactivationDate, new Date()));
|
|
239
|
+
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER && isProductActive(product.startDate, product.deactivationDate, new Date()));
|
|
240
240
|
const chartData = [];
|
|
241
241
|
if (revolverProduct) {
|
|
242
242
|
const lastSignedBBC = await getLatestSignedBBCDateDoc(borrowerId);
|
|
@@ -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
|
+
SELECTED_PERIOD?: boolean;
|
|
88
|
+
ENTIRE_LOAN?: boolean;
|
|
87
89
|
LAST_MONTH?: boolean;
|
|
88
90
|
CURRENT_MONTH?: boolean;
|
|
89
|
-
ENTIRE_LOAN?: boolean;
|
|
90
|
-
SELECTED_PERIOD?: 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> & Required<{
|
|
47
47
|
_id: import("mongoose").Types.ObjectId;
|
|
48
48
|
}>)[]>;
|
|
49
|
-
getBorrowerBrokers(borrowerId: string): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
|
|
49
|
+
getBorrowerBrokers(borrowerId: string): Promise<BrokerView[] | (import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
|
|
50
50
|
_id: import("mongoose").Types.ObjectId;
|
|
51
|
-
}>)[]
|
|
51
|
+
}>)[]>;
|
|
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[]>;
|
|
@@ -440,7 +440,7 @@ class LoanPaymentsService {
|
|
|
440
440
|
if (borrowerIds.includes(borrower._id.toString())) {
|
|
441
441
|
try {
|
|
442
442
|
const borrowerProducts = await this.loanChargesService.getLoanProducts(borrower._id.toString());
|
|
443
|
-
const revolverProduct = borrowerProducts.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, date_helper_1.isProductActive)(product.deactivationDate, selectedDate));
|
|
443
|
+
const revolverProduct = borrowerProducts.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, date_helper_1.isProductActive)(product.startDate, product.deactivationDate, selectedDate));
|
|
444
444
|
const loanStatementService = this.getLoanStatementService();
|
|
445
445
|
const dueAmounts = await loanStatementService.getBorrowerProductTotals(borrower._id.toString());
|
|
446
446
|
if (dueAmounts.total === 0) {
|
|
@@ -491,7 +491,7 @@ export class LoanPaymentsService {
|
|
|
491
491
|
if (borrowerIds.includes(borrower._id.toString())) {
|
|
492
492
|
try {
|
|
493
493
|
const borrowerProducts = await this.loanChargesService.getLoanProducts(borrower._id.toString());
|
|
494
|
-
const revolverProduct = borrowerProducts.find((product) => product.type === ELoanTypes.REVOLVER && isProductActive(product.deactivationDate, selectedDate));
|
|
494
|
+
const revolverProduct = borrowerProducts.find((product) => product.type === ELoanTypes.REVOLVER && isProductActive(product.startDate, product.deactivationDate, selectedDate));
|
|
495
495
|
const loanStatementService = this.getLoanStatementService();
|
|
496
496
|
const dueAmounts = await loanStatementService.getBorrowerProductTotals(borrower._id.toString());
|
|
497
497
|
if (dueAmounts.total === 0) {
|
|
@@ -677,7 +677,7 @@ class LoanTransactionsService {
|
|
|
677
677
|
[loan_types_enum_1.ELoanTypes.REVOLVER]: 0,
|
|
678
678
|
};
|
|
679
679
|
await Promise.all(loanProducts
|
|
680
|
-
.filter((product) => (0, date_helper_1.isProductActive)(product.deactivationDate, bbcDate.bbcDate))
|
|
680
|
+
.filter((product) => (0, date_helper_1.isProductActive)(product.startDate, product.deactivationDate, bbcDate.bbcDate))
|
|
681
681
|
.map(async (product) => {
|
|
682
682
|
const lastTransaction = await this.getLastTransactionForDate(product._id.toString(), (0, dayjs_1.default)(bbcDate.bbcDate).utcOffset(0).endOf('day').toDate());
|
|
683
683
|
if (lastTransaction) {
|
|
@@ -766,7 +766,7 @@ export class LoanTransactionsService {
|
|
|
766
766
|
[ELoanTypes.REVOLVER]: 0,
|
|
767
767
|
};
|
|
768
768
|
await Promise.all(loanProducts
|
|
769
|
-
.filter((product) => isProductActive(product.deactivationDate, bbcDate.bbcDate))
|
|
769
|
+
.filter((product) => isProductActive(product.startDate, product.deactivationDate, bbcDate.bbcDate))
|
|
770
770
|
.map(async (product) => {
|
|
771
771
|
const lastTransaction = await this.getLastTransactionForDate(product._id.toString(), dayjs(bbcDate.bbcDate).utcOffset(0).endOf('day').toDate());
|
|
772
772
|
if (lastTransaction) {
|
|
@@ -434,7 +434,7 @@ class QuickbooksService {
|
|
|
434
434
|
};
|
|
435
435
|
if (settlementCode === 'null') {
|
|
436
436
|
const products = await this.loanChargesService.getLoanProducts(borrower._id.toString());
|
|
437
|
-
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, date_helper_1.isProductActive)(product.deactivationDate, reportDate));
|
|
437
|
+
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, date_helper_1.isProductActive)(product.startDate, product.deactivationDate, reportDate));
|
|
438
438
|
if (revolverProduct) {
|
|
439
439
|
settlementCode = revolverProduct.code;
|
|
440
440
|
}
|
|
@@ -506,7 +506,7 @@ export class QuickbooksService {
|
|
|
506
506
|
|
|
507
507
|
if (settlementCode === 'null') {
|
|
508
508
|
const products = await this.loanChargesService.getLoanProducts(borrower._id.toString());
|
|
509
|
-
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER && isProductActive(product.deactivationDate, reportDate));
|
|
509
|
+
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER && isProductActive(product.startDate, product.deactivationDate, reportDate));
|
|
510
510
|
if (revolverProduct) {
|
|
511
511
|
settlementCode = revolverProduct.code;
|
|
512
512
|
}
|
|
@@ -231,7 +231,7 @@ class ReportsService {
|
|
|
231
231
|
if (!borrower) {
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
|
-
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, date_helper_1.isProductActive)(product.deactivationDate, date));
|
|
234
|
+
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, date_helper_1.isProductActive)(product.startDate, product.deactivationDate, date));
|
|
235
235
|
const termProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.TERM);
|
|
236
236
|
let revolverDataGroup = null;
|
|
237
237
|
if (revolverProduct) {
|
|
@@ -314,7 +314,7 @@ export class ReportsService {
|
|
|
314
314
|
if (!borrower) {
|
|
315
315
|
return;
|
|
316
316
|
}
|
|
317
|
-
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER && isProductActive(product.deactivationDate, date));
|
|
317
|
+
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER && isProductActive(product.startDate, product.deactivationDate, date));
|
|
318
318
|
const termProduct = products.find((product) => product.type === ELoanTypes.TERM);
|
|
319
319
|
|
|
320
320
|
let revolverDataGroup: ISummaryReportDataGroup = null;
|