gemcap-be-common 1.5.11 → 1.5.13

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.11",
3
+ "version": "1.5.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -179,6 +179,7 @@ class LoanStatementService {
179
179
  await loanStatementEffectsService.saveMonthData(productId, statementDate);
180
180
  const charges = await this.loanChargesService.getLoanChargeForProduct(productId);
181
181
  const product = await this.loanChargesService.getLoanProductById(productId);
182
+ console.debug({ charges });
182
183
  // If product is already deactivated for this statement date (inclusive) — skip everything early
183
184
  if (product.deactivationDate && (0, dayjs_1.default)(statementDate).isSameOrAfter((0, dayjs_1.default)(product.deactivationDate))) {
184
185
  return;
@@ -292,8 +293,11 @@ class LoanStatementService {
292
293
  return fee;
293
294
  };
294
295
  fee = checkMinAmount(fee);
296
+ if (charge.chargeType === loan_charge_type_enum_1.ELoanChargeType.ADMIN_FEE) {
297
+ console.debug({ charge, statementDate, fee, isAfter: (0, dayjs_1.default)(statementDate).isSameOrAfter((0, dayjs_1.default)(charge.applyFrom)) });
298
+ }
295
299
  if (fee !== null && fee > 0) {
296
- if ((0, dayjs_1.default)(statementDate).isSame((0, dayjs_1.default)(charge.applyFrom)) || (0, dayjs_1.default)(statementDate).isAfter((0, dayjs_1.default)(charge.applyFrom))) {
300
+ if ((0, dayjs_1.default)(statementDate).isSameOrAfter((0, dayjs_1.default)(charge.applyFrom))) {
297
301
  const newStatement = {
298
302
  order: orderIndex,
299
303
  date: statementDate,
@@ -204,7 +204,6 @@ export class LoanStatementService {
204
204
  statementDate = dayjs().utc().startOf('day').toDate();
205
205
  }
206
206
 
207
-
208
207
  const primeRate = await this.financialIndexesService.getFinancialIndexValue(EFinancialIndex.PRIME_RATE, statementDate);
209
208
  if (!primeRate) {
210
209
  return;
@@ -220,6 +219,8 @@ export class LoanStatementService {
220
219
  const charges = await this.loanChargesService.getLoanChargeForProduct(productId);
221
220
  const product = await this.loanChargesService.getLoanProductById(productId);
222
221
 
222
+ console.debug({ charges });
223
+
223
224
  // If product is already deactivated for this statement date (inclusive) — skip everything early
224
225
  if (product.deactivationDate && dayjs(statementDate).isSameOrAfter(dayjs(product.deactivationDate))) {
225
226
  return;
@@ -340,8 +341,12 @@ export class LoanStatementService {
340
341
 
341
342
  fee = checkMinAmount(fee);
342
343
 
344
+ if (charge.chargeType === ELoanChargeType.ADMIN_FEE) {
345
+ console.debug({ charge, statementDate, fee, isAfter: dayjs(statementDate).isSameOrAfter(dayjs(charge.applyFrom)) });
346
+ }
347
+
343
348
  if (fee !== null && fee > 0) {
344
- if (dayjs(statementDate).isSame(dayjs(charge.applyFrom)) || dayjs(statementDate).isAfter(dayjs(charge.applyFrom))) {
349
+ if (dayjs(statementDate).isSameOrAfter(dayjs(charge.applyFrom))) {
345
350
  const newStatement: ILoanStatementTransaction = {
346
351
  order: orderIndex,
347
352
  date: statementDate,