gemcap-be-common 1.5.7 → 1.5.8

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.7",
3
+ "version": "1.5.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -289,19 +289,21 @@ class LoanStatementService {
289
289
  };
290
290
  fee = checkMinAmount(fee);
291
291
  if (fee !== null && fee > 0) {
292
- const newStatement = {
293
- order: orderIndex,
294
- date: statementDate,
295
- chargeId: charge._id,
296
- amount: fee,
297
- amountPaid: 0,
298
- isSystem: true,
299
- memo: 'System Generated',
300
- balance: 0,
301
- };
302
- const newStatementDoc = await LoanStatementTransaction_model_1.LoanStatementTransactionModel.create(newStatement);
303
- await newStatementDoc.save();
304
- orderIndex = orderIndex + 1;
292
+ 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))) {
293
+ const newStatement = {
294
+ order: orderIndex,
295
+ date: statementDate,
296
+ chargeId: charge._id,
297
+ amount: fee,
298
+ amountPaid: 0,
299
+ isSystem: true,
300
+ memo: 'System Generated',
301
+ balance: 0,
302
+ };
303
+ const newStatementDoc = await LoanStatementTransaction_model_1.LoanStatementTransactionModel.create(newStatement);
304
+ await newStatementDoc.save();
305
+ orderIndex = orderIndex + 1;
306
+ }
305
307
  }
306
308
  }
307
309
  }
@@ -333,19 +333,21 @@ export class LoanStatementService {
333
333
  fee = checkMinAmount(fee);
334
334
 
335
335
  if (fee !== null && fee > 0) {
336
- const newStatement: ILoanStatementTransaction = {
337
- order: orderIndex,
338
- date: statementDate,
339
- chargeId: charge._id,
340
- amount: fee,
341
- amountPaid: 0,
342
- isSystem: true,
343
- memo: 'System Generated',
344
- balance: 0,
345
- };
346
- const newStatementDoc = await LoanStatementTransactionModel.create(newStatement);
347
- await newStatementDoc.save();
348
- orderIndex = orderIndex + 1;
336
+ if (dayjs(statementDate).isSame(dayjs(charge.applyFrom)) || dayjs(statementDate).isAfter(dayjs(charge.applyFrom))) {
337
+ const newStatement: ILoanStatementTransaction = {
338
+ order: orderIndex,
339
+ date: statementDate,
340
+ chargeId: charge._id,
341
+ amount: fee,
342
+ amountPaid: 0,
343
+ isSystem: true,
344
+ memo: 'System Generated',
345
+ balance: 0,
346
+ };
347
+ const newStatementDoc = await LoanStatementTransactionModel.create(newStatement);
348
+ await newStatementDoc.save();
349
+ orderIndex = orderIndex + 1;
350
+ }
349
351
  }
350
352
  }
351
353
  }