gemcap-be-common 1.5.181 → 1.5.182
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.
|
@@ -37,10 +37,6 @@ export interface IBorrowerFinanceSettingsPlain extends Omit<IBorrowerFinanceSett
|
|
|
37
37
|
|
|
38
38
|
export type TBorrowerFinanceSettingsModel = mongoose.Model<TBorrowerFinanceSettingsDoc>;
|
|
39
39
|
|
|
40
|
-
type TBorrowerFinanceSettingsReadonlyFields = 'borrowerId';
|
|
41
|
-
|
|
42
|
-
type TBorrowerFinanceSettingsUpdateFields = Omit<IBorrowerFinanceSettings, TBorrowerFinanceSettingsReadonlyFields>;
|
|
43
|
-
|
|
44
40
|
export type TUpdateBorrowerFinanceSettings = TUpdatePayload<IBorrowerFinanceSettings, 'borrowerId'>;
|
|
45
41
|
|
|
46
42
|
export const BorrowerFinanceSettingsSchema = new mongoose.Schema(
|
package/package.json
CHANGED
|
@@ -22,6 +22,7 @@ const TermLoan_model_1 = require("../models/TermLoan.model");
|
|
|
22
22
|
const loan_statement_db_1 = require("../db/loan-statement.db");
|
|
23
23
|
const BBCDate_model_1 = require("../models/BBCDate.model");
|
|
24
24
|
const financial_indexes_service_1 = require("./financial-indexes.service");
|
|
25
|
+
const BorrowerFinanceSettings_model_1 = require("../models/BorrowerFinanceSettings.model");
|
|
25
26
|
dayjs_1.default.extend(utc_1.default);
|
|
26
27
|
dayjs_1.default.extend(timezone_1.default);
|
|
27
28
|
class LoanStatementService {
|
|
@@ -179,6 +180,11 @@ class LoanStatementService {
|
|
|
179
180
|
await loanStatementEffectsService.saveMonthData(productId, statementDate);
|
|
180
181
|
const charges = await this.loanChargesService.getLoanChargeForProduct(productId);
|
|
181
182
|
const product = await this.loanChargesService.getLoanProductById(productId);
|
|
183
|
+
const borrowerFinanceSettings = await BorrowerFinanceSettings_model_1.BorrowerFinanceSettings.findOne({ borrowerId: product.borrowerId }).lean().exec();
|
|
184
|
+
// If borrower accrual is enabled, skip everything early
|
|
185
|
+
if (borrowerFinanceSettings && borrowerFinanceSettings.accrualEnabled && (0, dayjs_1.default)(statementDate).isSameOrAfter((0, dayjs_1.default)(borrowerFinanceSettings.accrualAppliedFrom))) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
182
188
|
// If product is already deactivated for this statement date (inclusive) — skip everything early
|
|
183
189
|
if (product.deactivationDate && (0, dayjs_1.default)(statementDate).isSameOrAfter((0, dayjs_1.default)(product.deactivationDate))) {
|
|
184
190
|
return;
|
|
@@ -38,6 +38,7 @@ import { LoanStatementBalanceService } from './loan-statement-balance.service';
|
|
|
38
38
|
import { TermLoanService } from './term-loan.service';
|
|
39
39
|
import { UploadsService } from './uploads.service';
|
|
40
40
|
import { LoanStatementEffectsService } from './loan-statement-effects.service';
|
|
41
|
+
import { BorrowerFinanceSettings } from '../models/BorrowerFinanceSettings.model';
|
|
41
42
|
|
|
42
43
|
dayjs.extend(utc);
|
|
43
44
|
dayjs.extend(timezone);
|
|
@@ -218,6 +219,12 @@ export class LoanStatementService {
|
|
|
218
219
|
|
|
219
220
|
const charges = await this.loanChargesService.getLoanChargeForProduct(productId);
|
|
220
221
|
const product = await this.loanChargesService.getLoanProductById(productId);
|
|
222
|
+
const borrowerFinanceSettings = await BorrowerFinanceSettings.findOne({ borrowerId: product.borrowerId }).lean().exec();
|
|
223
|
+
|
|
224
|
+
// If borrower accrual is enabled, skip everything early
|
|
225
|
+
if (borrowerFinanceSettings && borrowerFinanceSettings.accrualEnabled && dayjs(statementDate).isSameOrAfter(dayjs(borrowerFinanceSettings.accrualAppliedFrom))) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
221
228
|
|
|
222
229
|
// If product is already deactivated for this statement date (inclusive) — skip everything early
|
|
223
230
|
if (product.deactivationDate && dayjs(statementDate).isSameOrAfter(dayjs(product.deactivationDate))) {
|