gemcap-be-common 1.5.181 → 1.5.183

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(
@@ -23,8 +23,7 @@ export interface IDataRoomAccessLean extends IDataRoomAccess {
23
23
  updatedAt: Date;
24
24
  }
25
25
 
26
- export interface IDataRoomAccessPlain
27
- extends Omit<IDataRoomAccess, 'dataRoomId' | 'contactId'> {
26
+ export interface IDataRoomAccessPlain extends Omit<IDataRoomAccess, 'dataRoomId' | 'contactId'> {
28
27
  _id: string;
29
28
  dataRoomId: string;
30
29
  contactId: string;
@@ -25,7 +25,7 @@
25
25
  import mongoose from 'mongoose';
26
26
  export declare const DATA_ROOM_PERMISSIONS: readonly ["read", "read_upload"];
27
27
  export type TDataRoomPermission = (typeof DATA_ROOM_PERMISSIONS)[number];
28
- interface IDataRoomContact {
28
+ export interface IDataRoomContact {
29
29
  uiId: string;
30
30
  name: string;
31
31
  email: string;
@@ -50,4 +50,3 @@ export declare const DataRoomContactSchema: mongoose.Schema<IDataRoomContact, TD
50
50
  _id: mongoose.Types.ObjectId;
51
51
  }>;
52
52
  export declare const DataRoomContact: TDataRoomContactModel;
53
- export {};
@@ -6,7 +6,7 @@ export const DATA_ROOM_PERMISSIONS = ['read', 'read_upload'] as const;
6
6
 
7
7
  export type TDataRoomPermission = (typeof DATA_ROOM_PERMISSIONS)[number];
8
8
 
9
- interface IDataRoomContact {
9
+ export interface IDataRoomContact {
10
10
  uiId: string;
11
11
  name: string;
12
12
  email: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.5.181",
3
+ "version": "1.5.183",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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))) {