gemcap-be-common 1.3.183 → 1.3.185

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.3.183",
3
+ "version": "1.3.185",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -152,7 +152,7 @@ class LoanStatementService {
152
152
  await Promise.all(periods.map(async (period) => {
153
153
  const days = this.getDays(period);
154
154
  for (const day of days) {
155
- await this.calculateStatement(productId, period, new Date(day));
155
+ await this.calculateStatement(productId, period, dayjs_1.default.utc(day).toDate());
156
156
  }
157
157
  const statementDate = this.loanStatementStatusService.getStatementDateFromPeriod(period);
158
158
  await this.loanStatementStatusService.updateStatementStatus(productId, statementDate, true);
@@ -166,14 +166,14 @@ class LoanStatementService {
166
166
  }
167
167
  async calculateStatement(productId, period, statementDate) {
168
168
  if (!statementDate) {
169
- statementDate = (0, dayjs_1.default)(new Date()).startOf('day').toDate();
169
+ statementDate = (0, 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) {
173
173
  return;
174
174
  }
175
175
  await this.cleanProductStatement(productId, statementDate);
176
- const balance = await this.loanChargesService.getLoanProductBalance(productId, statementDate);
176
+ const balance = await this.loanChargesService.getLoanProductBalance(productId, dayjs_1.default.utc(statementDate).add(1, 'day').toDate());
177
177
  const loanStatementEffectsService = this.getLoanStatementEffectsService();
178
178
  await loanStatementEffectsService.saveMonthData(productId, statementDate);
179
179
  const charges = await this.loanChargesService.getLoanChargeForProduct(productId);
@@ -332,7 +332,7 @@ class LoanStatementService {
332
332
  async getBalancesDaily(productId, period) {
333
333
  const days = this.getDays({ start: (0, dayjs_1.default)(period.start).utcOffset(0), end: (0, dayjs_1.default)(period.end).utcOffset(0) });
334
334
  return Promise.all(days.map(async (day) => {
335
- const balance = await this.loanChargesService.getLoanProductBalance(productId, new Date(day));
335
+ const balance = await this.loanChargesService.getLoanProductBalance(productId, dayjs_1.default.utc(day).toDate());
336
336
  return { day, ...balance };
337
337
  }));
338
338
  }
@@ -185,7 +185,7 @@ export class LoanStatementService {
185
185
  await Promise.all(periods.map(async (period) => {
186
186
  const days = this.getDays(period);
187
187
  for (const day of days) {
188
- await this.calculateStatement(productId, period, new Date(day));
188
+ await this.calculateStatement(productId, period, dayjs.utc(day).toDate());
189
189
  }
190
190
  const statementDate = this.loanStatementStatusService.getStatementDateFromPeriod(period);
191
191
  await this.loanStatementStatusService.updateStatementStatus(productId, statementDate, true);
@@ -201,14 +201,14 @@ export class LoanStatementService {
201
201
 
202
202
  async calculateStatement(productId: string, period: IStatementPeriod, statementDate?: Date) {
203
203
  if (!statementDate) {
204
- statementDate = dayjs(new Date()).startOf('day').toDate();
204
+ statementDate = dayjs().utc().startOf('day').toDate();
205
205
  }
206
206
  const primeRate = await this.financialIndexesService.getFinancialIndexValue(EFinancialIndex.PRIME_RATE, statementDate);
207
207
  if (!primeRate) {
208
208
  return;
209
209
  }
210
210
  await this.cleanProductStatement(productId, statementDate);
211
- const balance = await this.loanChargesService.getLoanProductBalance(productId, statementDate);
211
+ const balance = await this.loanChargesService.getLoanProductBalance(productId, dayjs.utc(statementDate).add(1, 'day').toDate());
212
212
 
213
213
  const loanStatementEffectsService = this.getLoanStatementEffectsService();
214
214
  await loanStatementEffectsService.saveMonthData(productId, statementDate);
@@ -379,7 +379,7 @@ export class LoanStatementService {
379
379
  async getBalancesDaily(productId: string, period: { start: Date, end: Date }) {
380
380
  const days = this.getDays({ start: dayjs(period.start).utcOffset(0), end: dayjs(period.end).utcOffset(0) });
381
381
  return Promise.all(days.map(async (day) => {
382
- const balance = await this.loanChargesService.getLoanProductBalance(productId, new Date(day));
382
+ const balance = await this.loanChargesService.getLoanProductBalance(productId, dayjs.utc(day).toDate());
383
383
  return { day, ...balance };
384
384
  }));
385
385
  }