Search in sources :

Example 1 with BaseFinancialActivity

use of org.mifos.accounts.financial.business.service.activity.BaseFinancialActivity in project head by mifos.

the class SavingsBO method doPostInterest.

private void doPostInterest(LocalDate currentPostingDate, Money actualInterestToBePosted, PersonnelBO loggedInUser) {
    this.savingsBalance = this.savingsBalance.add(actualInterestToBePosted);
    this.savingsPerformance.setTotalInterestDetails(actualInterestToBePosted);
    SavingsActivityEntity savingsActivity = SavingsActivityEntity.savingsInterestPosting(this, personnel, this.savingsBalance, actualInterestToBePosted, currentPostingDate.toDateMidnight().toDate());
    savingsActivityDetails.add(savingsActivity);
    AccountPaymentEntity interestPayment = AccountPaymentEntity.savingsInterestPosting(this, actualInterestToBePosted, currentPostingDate.toDateMidnight().toDate(), loggedInUser);
    DateTime dueDate = new DateTime();
    SavingsTrxnDetailEntity interestPostingTransaction = SavingsTrxnDetailEntity.savingsInterestPosting(interestPayment, this.customer, this.savingsBalance, currentPostingDate.toDateMidnight().toDate(), dueDate, loggedInUser);
    interestPayment.addAccountTrxn(interestPostingTransaction);
    this.addAccountPayment(interestPayment);
    // NOTE: financial Transaction Processing should be decoupled from application domain model.
    try {
        BaseFinancialActivity baseFinancialActivity = new SavingsInterestPostingFinancialActivity(interestPostingTransaction);
        baseFinancialActivity.buildAccountEntries();
    } catch (FinancialException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : BaseFinancialActivity(org.mifos.accounts.financial.business.service.activity.BaseFinancialActivity) AccountPaymentEntity(org.mifos.accounts.business.AccountPaymentEntity) SavingsInterestPostingFinancialActivity(org.mifos.accounts.financial.business.service.activity.SavingsInterestPostingFinancialActivity) FinancialException(org.mifos.accounts.financial.exceptions.FinancialException) DateTime(org.joda.time.DateTime) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Aggregations

DateTime (org.joda.time.DateTime)1 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)1 BaseFinancialActivity (org.mifos.accounts.financial.business.service.activity.BaseFinancialActivity)1 SavingsInterestPostingFinancialActivity (org.mifos.accounts.financial.business.service.activity.SavingsInterestPostingFinancialActivity)1 FinancialException (org.mifos.accounts.financial.exceptions.FinancialException)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1