You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by my...@apache.org on 2018/01/22 15:49:35 UTC
[fineract-cn-deposit-account-management] 13/26: accrued interest
will be payed even if product is not active
This is an automated email from the ASF dual-hosted git repository.
myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-deposit-account-management.git
commit 3c848f005f510e026d1d9cfadb3505f93f42a8d0
Author: mgeiss <mg...@mifos.org>
AuthorDate: Wed Sep 27 07:41:42 2017 +0200
accrued interest will be payed even if product is not active
---
.../command/handler/InterestCalculator.java | 74 +++++++++++-----------
1 file changed, 36 insertions(+), 38 deletions(-)
diff --git a/service/src/main/java/io/mifos/deposit/service/internal/command/handler/InterestCalculator.java b/service/src/main/java/io/mifos/deposit/service/internal/command/handler/InterestCalculator.java
index 4ac279d..8f8ffd4 100644
--- a/service/src/main/java/io/mifos/deposit/service/internal/command/handler/InterestCalculator.java
+++ b/service/src/main/java/io/mifos/deposit/service/internal/command/handler/InterestCalculator.java
@@ -210,44 +210,42 @@ public class InterestCalculator {
this.productInstanceRepository.findByProductDefinition(productDefinitionEntity);
productInstanceEntities.forEach(productInstanceEntity -> {
- if (productInstanceEntity.getState().equals(ACTIVE)) {
- final Optional<AccruedInterestEntity> optionalAccruedInterestEntity =
- this.accruedInterestRepository.findByCustomerAccountIdentifier(productInstanceEntity.getAccountIdentifier());
-
- if (optionalAccruedInterestEntity.isPresent()) {
- final AccruedInterestEntity accruedInterestEntity = optionalAccruedInterestEntity.get();
-
- final String roundedAmount =
- BigDecimal.valueOf(accruedInterestEntity.getAmount())
- .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString();
-
- final JournalEntry accrueToExpenseJournalEntry = new JournalEntry();
- accrueToExpenseJournalEntry.setTransactionIdentifier(RandomStringUtils.randomAlphanumeric(32));
- accrueToExpenseJournalEntry.setTransactionDate(DateConverter.toIsoString(LocalDateTime.now(Clock.systemUTC())));
- accrueToExpenseJournalEntry.setTransactionType("INTR");
- accrueToExpenseJournalEntry.setClerk(UserContextHolder.checkedGetUser());
- accrueToExpenseJournalEntry.setNote("Interest paid.");
-
- final Debtor accrueDebtor = new Debtor();
- accrueDebtor.setAccountNumber(accruedInterestEntity.getAccrueAccountIdentifier());
- accrueDebtor.setAmount(roundedAmount);
- accrueToExpenseJournalEntry.setDebtors(Sets.newHashSet(accrueDebtor));
-
- final Creditor expenseCreditor = new Creditor();
- expenseCreditor.setAccountNumber(productDefinitionEntity.getExpenseAccountIdentifier());
- expenseCreditor.setAmount(roundedAmount);
- accrueToExpenseJournalEntry.setCreditors(Sets.newHashSet(expenseCreditor));
-
- this.accruedInterestRepository.delete(accruedInterestEntity);
-
- this.accountingService.post(accrueToExpenseJournalEntry);
-
- this.payoutInterest(
- productDefinitionEntity.getExpenseAccountIdentifier(),
- accruedInterestEntity.getCustomerAccountIdentifier(),
- roundedAmount
- );
- }
+ final Optional<AccruedInterestEntity> optionalAccruedInterestEntity =
+ this.accruedInterestRepository.findByCustomerAccountIdentifier(productInstanceEntity.getAccountIdentifier());
+
+ if (optionalAccruedInterestEntity.isPresent()) {
+ final AccruedInterestEntity accruedInterestEntity = optionalAccruedInterestEntity.get();
+
+ final String roundedAmount =
+ BigDecimal.valueOf(accruedInterestEntity.getAmount())
+ .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString();
+
+ final JournalEntry accrueToExpenseJournalEntry = new JournalEntry();
+ accrueToExpenseJournalEntry.setTransactionIdentifier(RandomStringUtils.randomAlphanumeric(32));
+ accrueToExpenseJournalEntry.setTransactionDate(DateConverter.toIsoString(LocalDateTime.now(Clock.systemUTC())));
+ accrueToExpenseJournalEntry.setTransactionType("INTR");
+ accrueToExpenseJournalEntry.setClerk(UserContextHolder.checkedGetUser());
+ accrueToExpenseJournalEntry.setNote("Interest paid.");
+
+ final Debtor accrueDebtor = new Debtor();
+ accrueDebtor.setAccountNumber(accruedInterestEntity.getAccrueAccountIdentifier());
+ accrueDebtor.setAmount(roundedAmount);
+ accrueToExpenseJournalEntry.setDebtors(Sets.newHashSet(accrueDebtor));
+
+ final Creditor expenseCreditor = new Creditor();
+ expenseCreditor.setAccountNumber(productDefinitionEntity.getExpenseAccountIdentifier());
+ expenseCreditor.setAmount(roundedAmount);
+ accrueToExpenseJournalEntry.setCreditors(Sets.newHashSet(expenseCreditor));
+
+ this.accruedInterestRepository.delete(accruedInterestEntity);
+
+ this.accountingService.post(accrueToExpenseJournalEntry);
+
+ this.payoutInterest(
+ productDefinitionEntity.getExpenseAccountIdentifier(),
+ accruedInterestEntity.getCustomerAccountIdentifier(),
+ roundedAmount
+ );
}
});
}
--
To stop receiving notification emails like this one, please contact
myrle@apache.org.