gemcap-be-common 1.5.21 → 1.5.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.5.21",
3
+ "version": "1.5.22",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -166,7 +166,7 @@ class LoanStatementService {
166
166
  }
167
167
  async calculateStatement(productId, period, statementDate) {
168
168
  if (!statementDate) {
169
- statementDate = (0, dayjs_1.default)().utc().startOf('day').toDate();
169
+ statementDate = dayjs_1.default.utc().startOf('day').toDate();
170
170
  }
171
171
  const primeRate = await this.financialIndexesService.getFinancialIndexValue(financial_indexes_service_1.EFinancialIndex.PRIME_RATE, statementDate);
172
172
  if (!primeRate) {
@@ -201,7 +201,7 @@ export class LoanStatementService {
201
201
 
202
202
  async calculateStatement(productId: string, period: IStatementPeriod, statementDate?: Date) {
203
203
  if (!statementDate) {
204
- statementDate = dayjs().utc().startOf('day').toDate();
204
+ statementDate = dayjs.utc().startOf('day').toDate();
205
205
  }
206
206
 
207
207
  const primeRate = await this.financialIndexesService.getFinancialIndexValue(EFinancialIndex.PRIME_RATE, statementDate);
@@ -176,8 +176,10 @@ class LoanTransactionsService {
176
176
  }));
177
177
  }
178
178
  async getDisbursementTransactions(productId, date) {
179
+ const startOfDay = dayjs_1.default.utc(date).startOf('day').toDate();
180
+ const endOfDay = dayjs_1.default.utc(date).endOf('day').toDate();
179
181
  return LoanTransaction_model_1.LoanTransaction.countDocuments({
180
- date: date,
182
+ date: { $gte: startOfDay, $lte: endOfDay },
181
183
  productId: new mongoose_1.default.Types.ObjectId(productId),
182
184
  transactionType: LoanTransaction_model_1.ELoanTransactionTypes.DISBURSEMENT,
183
185
  bankId: { $ne: null },
@@ -218,9 +218,11 @@ export class LoanTransactionsService {
218
218
  }
219
219
 
220
220
  async getDisbursementTransactions(productId: string, date: Date) {
221
+ const startOfDay = dayjs.utc(date).startOf('day').toDate();
222
+ const endOfDay = dayjs.utc(date).endOf('day').toDate();
221
223
  return LoanTransaction.countDocuments(
222
224
  {
223
- date: date,
225
+ date: { $gte: startOfDay, $lte: endOfDay },
224
226
  productId: new mongoose.Types.ObjectId(productId),
225
227
  transactionType: ELoanTransactionTypes.DISBURSEMENT,
226
228
  bankId: { $ne: null },