gemcap-be-common 1.3.182 → 1.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.3.182",
3
+ "version": "1.3.183",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -241,12 +241,12 @@ class LoanStatementService {
241
241
  const dailyPercent = new decimal_js_1.default(percentFee).div(daysPerYear).toNumber();
242
242
  switch (charge.calculationBasis) {
243
243
  case loan_types_enum_1.EChargeCalculationBasis.DAILY_BALANCE:
244
- if ((0, dayjs_1.default)(statementDate).isAfter((0, dayjs_1.default)(charge.applyFrom))) {
244
+ if ((0, dayjs_1.default)(statementDate).isAfter((0, dayjs_1.default)(charge.applyFrom)) || (0, dayjs_1.default)(statementDate).isSame((0, dayjs_1.default)(charge.applyFrom))) {
245
245
  fee = new decimal_js_1.default(getBalance()).mul(dailyPercent).toDP(2).toNumber();
246
246
  }
247
247
  break;
248
248
  case loan_types_enum_1.EChargeCalculationBasis.AVERAGE_MONTHLY_BALANCE:
249
- if ((0, dayjs_1.default)(statementDate).isAfter((0, dayjs_1.default)(charge.applyFrom))) {
249
+ if ((0, dayjs_1.default)(statementDate).isAfter((0, dayjs_1.default)(charge.applyFrom)) || (0, dayjs_1.default)(statementDate).isSame((0, dayjs_1.default)(charge.applyFrom))) {
250
250
  fee = new decimal_js_1.default(getBalance()).mul(percentFee).div(dayInMonth).toDP(2).toNumber();
251
251
  }
252
252
  if (!percentFee && charge.minimumAmount) {
@@ -254,7 +254,7 @@ class LoanStatementService {
254
254
  }
255
255
  break;
256
256
  case loan_types_enum_1.EChargeCalculationBasis.UNUSED_AMOUNT:
257
- if ((0, dayjs_1.default)(statementDate).isAfter((0, dayjs_1.default)(charge.applyFrom))) {
257
+ if ((0, dayjs_1.default)(statementDate).isAfter((0, dayjs_1.default)(charge.applyFrom)) || (0, dayjs_1.default)(statementDate).isSame((0, dayjs_1.default)(charge.applyFrom))) {
258
258
  calculatedFee = new decimal_js_1.default(product.commitment).sub(getBalance()).mul(charge.percent).div(daysPerYear).toDP(2).toNumber();
259
259
  fee = Math.max(calculatedFee, 0);
260
260
  }
@@ -263,12 +263,12 @@ class LoanStatementService {
263
263
  fee = new decimal_js_1.default(product.commitment).mul(charge.percent).toDP(2).toNumber();
264
264
  break;
265
265
  case loan_types_enum_1.EChargeCalculationBasis.DISBURSEMENT_AMOUNT:
266
- if ((0, dayjs_1.default)(statementDate).isAfter((0, dayjs_1.default)(charge.applyFrom))) {
266
+ if ((0, dayjs_1.default)(statementDate).isAfter((0, dayjs_1.default)(charge.applyFrom)) || (0, dayjs_1.default)(statementDate).isSame((0, dayjs_1.default)(charge.applyFrom))) {
267
267
  fee = await this.calculateDisbursementFee(product._id.toString(), charge, statementDate);
268
268
  }
269
269
  break;
270
270
  case loan_types_enum_1.EChargeCalculationBasis.FIXED:
271
- if ((0, dayjs_1.default)(statementDate).isAfter((0, dayjs_1.default)(charge.applyFrom))) {
271
+ if ((0, dayjs_1.default)(statementDate).isAfter((0, dayjs_1.default)(charge.applyFrom)) || (0, dayjs_1.default)(statementDate).isSame((0, dayjs_1.default)(charge.applyFrom))) {
272
272
  calculatedFee = new decimal_js_1.default(getBalance()).mul(dailyPercent).toDP(2).toNumber();
273
273
  fee = Math.max(calculatedFee, charge.minimumAmount);
274
274
  }
@@ -282,12 +282,12 @@ export class LoanStatementService {
282
282
  const dailyPercent = new Decimal(percentFee).div(daysPerYear).toNumber();
283
283
  switch (charge.calculationBasis) {
284
284
  case EChargeCalculationBasis.DAILY_BALANCE:
285
- if (dayjs(statementDate).isAfter(dayjs(charge.applyFrom))) {
285
+ if (dayjs(statementDate).isAfter(dayjs(charge.applyFrom)) || dayjs(statementDate).isSame(dayjs(charge.applyFrom))) {
286
286
  fee = new Decimal(getBalance()).mul(dailyPercent).toDP(2).toNumber();
287
287
  }
288
288
  break;
289
289
  case EChargeCalculationBasis.AVERAGE_MONTHLY_BALANCE:
290
- if (dayjs(statementDate).isAfter(dayjs(charge.applyFrom))) {
290
+ if (dayjs(statementDate).isAfter(dayjs(charge.applyFrom)) || dayjs(statementDate).isSame(dayjs(charge.applyFrom))) {
291
291
  fee = new Decimal(getBalance()).mul(percentFee).div(dayInMonth).toDP(2).toNumber();
292
292
  }
293
293
  if (!percentFee && charge.minimumAmount) {
@@ -295,7 +295,7 @@ export class LoanStatementService {
295
295
  }
296
296
  break;
297
297
  case EChargeCalculationBasis.UNUSED_AMOUNT:
298
- if (dayjs(statementDate).isAfter(dayjs(charge.applyFrom))) {
298
+ if (dayjs(statementDate).isAfter(dayjs(charge.applyFrom)) || dayjs(statementDate).isSame(dayjs(charge.applyFrom))) {
299
299
  calculatedFee = new Decimal(product.commitment).sub(getBalance()).mul(charge.percent).div(daysPerYear).toDP(2).toNumber();
300
300
  fee = Math.max(calculatedFee, 0);
301
301
  }
@@ -304,12 +304,12 @@ export class LoanStatementService {
304
304
  fee = new Decimal(product.commitment).mul(charge.percent).toDP(2).toNumber();
305
305
  break;
306
306
  case EChargeCalculationBasis.DISBURSEMENT_AMOUNT:
307
- if (dayjs(statementDate).isAfter(dayjs(charge.applyFrom))) {
307
+ if (dayjs(statementDate).isAfter(dayjs(charge.applyFrom)) || dayjs(statementDate).isSame(dayjs(charge.applyFrom))) {
308
308
  fee = await this.calculateDisbursementFee(product._id.toString(), charge, statementDate);
309
309
  }
310
310
  break;
311
311
  case EChargeCalculationBasis.FIXED:
312
- if (dayjs(statementDate).isAfter(dayjs(charge.applyFrom))) {
312
+ if (dayjs(statementDate).isAfter(dayjs(charge.applyFrom)) || dayjs(statementDate).isSame(dayjs(charge.applyFrom))) {
313
313
  calculatedFee = new Decimal(getBalance()).mul(dailyPercent).toDP(2).toNumber();
314
314
  fee = Math.max(calculatedFee, charge.minimumAmount);
315
315
  }