gemcap-be-common 1.5.28 → 1.5.30

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.
@@ -306,6 +306,7 @@ class ReportsService {
306
306
  return await this.uploadsService.convertDataToFile([{ portfolio: reportToCovert }]);
307
307
  }
308
308
  async generateBankPortfolioSummary(borrowerIds, date, { useSignedBBC, useStoredBalance, } = { useSignedBBC: true, useStoredBalance: false }) {
309
+ const dateForBalance = dayjs_1.default.utc(date).endOf('day').toDate();
309
310
  const productsGrouped = await Promise.all(borrowerIds.map(async (borrowerId) => {
310
311
  const borrowerData = await this.getBorrowerAndProducts(borrowerId, date, useSignedBBC, false);
311
312
  if (!borrowerData) {
@@ -341,7 +342,7 @@ class ReportsService {
341
342
  startDate: product.startDate,
342
343
  maturityDate: product.maturityDate,
343
344
  NAISC: NAISCCode,
344
- ...(await this.getProductBalances(product._id.toString(), isRevolver, date)),
345
+ ...(await this.getProductBalances(product._id.toString(), isRevolver, dateForBalance)),
345
346
  };
346
347
  if (!summaries) {
347
348
  return {
@@ -366,12 +367,12 @@ class ReportsService {
366
367
  loanTermBalance: 0,
367
368
  netTermAvailability: 0,
368
369
  participantBalance: 0,
369
- ...(await this.getProductBalances(product._id.toString(), isRevolver, date)),
370
+ ...(await this.getProductBalances(product._id.toString(), isRevolver, dateForBalance)),
370
371
  ...productMainData,
371
372
  };
372
373
  }
373
374
  else {
374
- const balances = await this.getProductBalances(product._id.toString(), isRevolver, date);
375
+ const balances = await this.getProductBalances(product._id.toString(), isRevolver, dateForBalance);
375
376
  if (useStoredBalance) {
376
377
  const bbc = await this.collateralsService.getLatestBBC(borrowerId, date);
377
378
  if (bbc) {
@@ -405,6 +405,7 @@ export class ReportsService {
405
405
  useSignedBBC,
406
406
  useStoredBalance,
407
407
  } = { useSignedBBC: true, useStoredBalance: false }) {
408
+ const dateForBalance = dayjs.utc(date).endOf('day').toDate();
408
409
  const productsGrouped = await Promise.all(borrowerIds.map(async (borrowerId) => {
409
410
  const borrowerData = await this.getBorrowerAndProducts(borrowerId, date, useSignedBBC, false);
410
411
  if (!borrowerData) {
@@ -444,7 +445,7 @@ export class ReportsService {
444
445
  startDate: product.startDate,
445
446
  maturityDate: product.maturityDate,
446
447
  NAISC: NAISCCode,
447
- ...(await this.getProductBalances(product._id.toString(), isRevolver, date)),
448
+ ...(await this.getProductBalances(product._id.toString(), isRevolver, dateForBalance)),
448
449
  };
449
450
  if (!summaries) {
450
451
  return {
@@ -470,12 +471,12 @@ export class ReportsService {
470
471
  loanTermBalance: 0,
471
472
  netTermAvailability: 0,
472
473
  participantBalance: 0,
473
- ...(await this.getProductBalances(product._id.toString(), isRevolver, date)),
474
+ ...(await this.getProductBalances(product._id.toString(), isRevolver, dateForBalance)),
474
475
  ...productMainData,
475
476
  } as IBankReportData;
476
477
  } else {
477
478
 
478
- const balances = await this.getProductBalances(product._id.toString(), isRevolver, date);
479
+ const balances = await this.getProductBalances(product._id.toString(), isRevolver, dateForBalance);
479
480
  if (useStoredBalance) {
480
481
  const bbc = await this.collateralsService.getLatestBBC(borrowerId, date);
481
482
  if (bbc) {