gemcap-be-common 1.5.128 → 1.5.130

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.
@@ -261,14 +261,14 @@ class QuickbooksService {
261
261
  }
262
262
  const transactionsFilter = {
263
263
  productIds: productIds,
264
- start: (0, dayjs_1.default)(reportDate).utcOffset(0).startOf('month').toDate(),
265
- end: (0, dayjs_1.default)(reportDate).utcOffset(0).endOf('month').toDate(),
264
+ start: dayjs_1.default.utc(reportDate).startOf('month').toDate(),
265
+ end: dayjs_1.default.utc(reportDate).endOf('month').toDate(),
266
266
  };
267
267
  return await this.loanChargesService.getLoanStatementsForProduct(transactionsFilter);
268
268
  }
269
269
  async getChargeTransactionsForPayments(productIds, reportDate) {
270
- const start = (0, dayjs_1.default)(reportDate).utcOffset(0).startOf('day').toDate();
271
- const end = (0, dayjs_1.default)(reportDate).utcOffset(0).endOf('day').toDate();
270
+ const start = dayjs_1.default.utc(reportDate).startOf('day').toDate();
271
+ const end = dayjs_1.default.utc(reportDate).endOf('day').toDate();
272
272
  const payments = await this.loanPaymentsService.getPaymentsForPeriod(productIds, start, end);
273
273
  if (!payments.length) {
274
274
  return [];
@@ -278,8 +278,8 @@ class QuickbooksService {
278
278
  return await this.loanChargesService.getLoanStatementsForIdsAndCharge(transactionsFilter);
279
279
  }
280
280
  async getPrincipalTransactionsForPayments(productId, reportDate) {
281
- const start = (0, dayjs_1.default)(reportDate).utcOffset(0).startOf('day').toDate();
282
- const end = (0, dayjs_1.default)(reportDate).utcOffset(0).endOf('day').toDate();
281
+ const start = dayjs_1.default.utc(reportDate).startOf('day').toDate();
282
+ const end = dayjs_1.default.utc(reportDate).endOf('day').toDate();
283
283
  const payments = await this.loanPaymentsService.getPaymentsForPeriod([productId], start, end);
284
284
  if (!payments.length) {
285
285
  return {};
@@ -309,9 +309,9 @@ class QuickbooksService {
309
309
  }
310
310
  const companyFilter = { companyId: { $in: params.companyIds.map((id) => new mongoose_1.default.Types.ObjectId(id)) } };
311
311
  const { reportType, productIds, chargeTypes, reportDate } = params;
312
- const reportDateFormatted = (0, dayjs_1.default)(reportDate).utcOffset(0).format('MM/DD/YYYY').toUpperCase();
313
- const reportDateTrFormatted = (0, dayjs_1.default)(reportDate).utcOffset(0).format(transactionsDateFormat).toUpperCase();
314
- const currentDateTrFormatted = (0, dayjs_1.default)(new Date).utcOffset(0).format(transactionsDateFormat).toUpperCase();
312
+ const reportDateFormatted = dayjs_1.default.utc(reportDate).format('MM/DD/YYYY').toUpperCase();
313
+ const reportDateTrFormatted = dayjs_1.default.utc(reportDate).format(transactionsDateFormat).toUpperCase();
314
+ const currentDateTrFormatted = dayjs_1.default.utc(new Date).format(transactionsDateFormat).toUpperCase();
315
315
  const isAccrual = reportType === 'accrual';
316
316
  const mainData = [];
317
317
  const trTemplate = {
@@ -483,10 +483,10 @@ class QuickbooksService {
483
483
  async getQuickbooksCashReport(params) {
484
484
  const reportErrorsSet = new Set();
485
485
  const { reportType, productIds, chargeTypes, reportDate } = params;
486
- const reportDateFormatted = (0, dayjs_1.default)(reportDate).utcOffset(0).format('MM/DD/YYYY').toUpperCase();
487
- const reportDateTrFormatted = (0, dayjs_1.default)(reportDate).utcOffset(0).format(transactionsDateFormat).toUpperCase();
488
- const startDate = (0, dayjs_1.default)(reportDate).utcOffset(0).startOf('day').toDate();
489
- const endDate = (0, dayjs_1.default)(reportDate).utcOffset(0).endOf('day').toDate();
486
+ const reportDateFormatted = dayjs_1.default.utc(reportDate).format('MM/DD/YYYY').toUpperCase();
487
+ const reportDateTrFormatted = dayjs_1.default.utc(reportDate).format(transactionsDateFormat).toUpperCase();
488
+ const startDate = dayjs_1.default.utc(reportDate).startOf('day').toDate();
489
+ const endDate = dayjs_1.default.utc(reportDate).endOf('day').toDate();
490
490
  const transactions = await this.bankUploadedTransactionsService.getUploadedBankTransactions(startDate, endDate);
491
491
  const { references, products } = await this.cashAllocationService.getAllCashAllocations();
492
492
  const allAccounts = await this.getAllAccounts();
@@ -3,7 +3,7 @@ import dayjs from 'dayjs';
3
3
  import Decimal from 'decimal.js';
4
4
  import _ from 'lodash';
5
5
 
6
- import { IProductBrokerDocWithBroker } from '../models/ProductBroker.model';
6
+ import { IProductBrokerDocWithLoanBroker } from '../models/ProductBroker.model';
7
7
  import { ELoanChargeType } from '../enums/loan-charge-type.enum';
8
8
  import { ELoanTypes } from '../enums/loan-types.enum';
9
9
  import { LoanProduct } from '../models/LoanProducts.model';
@@ -302,15 +302,15 @@ export class QuickbooksService {
302
302
  }
303
303
  const transactionsFilter = {
304
304
  productIds: productIds,
305
- start: dayjs(reportDate).utcOffset(0).startOf('month').toDate(),
306
- end: dayjs(reportDate).utcOffset(0).endOf('month').toDate(),
305
+ start: dayjs.utc(reportDate).startOf('month').toDate(),
306
+ end: dayjs.utc(reportDate).endOf('month').toDate(),
307
307
  };
308
308
  return await this.loanChargesService.getLoanStatementsForProduct(transactionsFilter);
309
309
  }
310
310
 
311
311
  async getChargeTransactionsForPayments(productIds: string[], reportDate: Date) {
312
- const start = dayjs(reportDate).utcOffset(0).startOf('day').toDate();
313
- const end = dayjs(reportDate).utcOffset(0).endOf('day').toDate();
312
+ const start = dayjs.utc(reportDate).startOf('day').toDate();
313
+ const end = dayjs.utc(reportDate).endOf('day').toDate();
314
314
  const payments = await this.loanPaymentsService.getPaymentsForPeriod(productIds, start, end);
315
315
  if (!payments.length) {
316
316
  return [];
@@ -321,8 +321,8 @@ export class QuickbooksService {
321
321
  }
322
322
 
323
323
  async getPrincipalTransactionsForPayments(productId: string, reportDate: Date) {
324
- const start = dayjs(reportDate).utcOffset(0).startOf('day').toDate();
325
- const end = dayjs(reportDate).utcOffset(0).endOf('day').toDate();
324
+ const start = dayjs.utc(reportDate).startOf('day').toDate();
325
+ const end = dayjs.utc(reportDate).endOf('day').toDate();
326
326
  const payments = await this.loanPaymentsService.getPaymentsForPeriod([productId], start, end);
327
327
  if (!payments.length) {
328
328
  return <{ [settlementCode: string]: number }>{};
@@ -362,9 +362,9 @@ export class QuickbooksService {
362
362
  const companyFilter = { companyId: { $in: params.companyIds.map((id) => new mongoose.Types.ObjectId(id)) } };
363
363
 
364
364
  const { reportType, productIds, chargeTypes, reportDate } = params;
365
- const reportDateFormatted = dayjs(reportDate).utcOffset(0).format('MM/DD/YYYY').toUpperCase();
366
- const reportDateTrFormatted = dayjs(reportDate).utcOffset(0).format(transactionsDateFormat).toUpperCase();
367
- const currentDateTrFormatted = dayjs(new Date).utcOffset(0).format(transactionsDateFormat).toUpperCase();
365
+ const reportDateFormatted = dayjs.utc(reportDate).format('MM/DD/YYYY').toUpperCase();
366
+ const reportDateTrFormatted = dayjs.utc(reportDate).format(transactionsDateFormat).toUpperCase();
367
+ const currentDateTrFormatted = dayjs.utc(new Date).format(transactionsDateFormat).toUpperCase();
368
368
  const isAccrual = reportType === 'accrual';
369
369
  const mainData: IQBReportTransaction[] = [];
370
370
 
@@ -446,7 +446,7 @@ export class QuickbooksService {
446
446
 
447
447
  if (chargeTypes.includes('BROKERS') && isAccrual) {
448
448
 
449
- const handleFee = async (broker: IProductBrokerDocWithBroker, shareName: 'adminShare' | 'interestShare' | 'otherShare') => {
449
+ const handleFee = async (broker: IProductBrokerDocWithLoanBroker, shareName: 'adminShare' | 'interestShare' | 'otherShare') => {
450
450
 
451
451
  const quickbooksAccountBrokerBS = await QuickbooksAccount.findOne({ accountCode: broker.BSCode, ...companyFilter }).lean();
452
452
  const quickbooksAccountBrokerPL = await QuickbooksAccount.findOne({ accountCode: broker.PLCode, ...companyFilter }).lean();
@@ -477,9 +477,9 @@ export class QuickbooksService {
477
477
  };
478
478
 
479
479
  const handlers = {
480
- [ELoanChargeType.ADMIN_FEE]: async (broker: IProductBrokerDocWithBroker) => await handleFee(broker, 'adminShare'),
481
- [ELoanChargeType.INTEREST_FEE]: async (broker: IProductBrokerDocWithBroker) => await handleFee(broker, 'interestShare'),
482
- [ELoanChargeType.OTHER]: async (broker: IProductBrokerDocWithBroker) => await handleFee(broker, 'otherShare'),
480
+ [ELoanChargeType.ADMIN_FEE]: async (broker: IProductBrokerDocWithLoanBroker) => await handleFee(broker, 'adminShare'),
481
+ [ELoanChargeType.INTEREST_FEE]: async (broker: IProductBrokerDocWithLoanBroker) => await handleFee(broker, 'interestShare'),
482
+ [ELoanChargeType.OTHER]: async (broker: IProductBrokerDocWithLoanBroker) => await handleFee(broker, 'otherShare'),
483
483
  };
484
484
  await Promise.all(productBrokers.map(async (broker) => {
485
485
  if (handlers[charge.chargeType]) {
@@ -569,11 +569,11 @@ export class QuickbooksService {
569
569
  }) {
570
570
  const reportErrorsSet = new Set<string>();
571
571
  const { reportType, productIds, chargeTypes, reportDate } = params;
572
- const reportDateFormatted = dayjs(reportDate).utcOffset(0).format('MM/DD/YYYY').toUpperCase();
573
- const reportDateTrFormatted = dayjs(reportDate).utcOffset(0).format(transactionsDateFormat).toUpperCase();
572
+ const reportDateFormatted = dayjs.utc(reportDate).format('MM/DD/YYYY').toUpperCase();
573
+ const reportDateTrFormatted = dayjs.utc(reportDate).format(transactionsDateFormat).toUpperCase();
574
574
 
575
- const startDate = dayjs(reportDate).utcOffset(0).startOf('day').toDate();
576
- const endDate = dayjs(reportDate).utcOffset(0).endOf('day').toDate();
575
+ const startDate = dayjs.utc(reportDate).startOf('day').toDate();
576
+ const endDate = dayjs.utc(reportDate).endOf('day').toDate();
577
577
  const transactions = await this.bankUploadedTransactionsService.getUploadedBankTransactions(startDate, endDate);
578
578
  const { references, products } = await this.cashAllocationService.getAllCashAllocations();
579
579
  const allAccounts = await this.getAllAccounts();