Search in sources :

Example 1 with AccountOverpaymentEntity

use of org.mifos.accounts.business.AccountOverpaymentEntity in project head by mifos.

the class LoanBO method makePayment.

/*
     * PaymentData is the payment information entered in the UI An AccountPaymentEntity is created from the PaymentData
     * passed in.
     */
@Override
protected AccountPaymentEntity makePayment(final PaymentData paymentData) throws AccountException {
    AccountPaymentEntity accountPaymentEntity = prePayment(paymentData);
    LoanPaymentTypes loanPaymentType = getLoanPaymentType(paymentData.getTotalAmount());
    ApplicationContextProvider.getBean(LoanBusinessService.class).applyPayment(paymentData, this, accountPaymentEntity);
    postPayment(paymentData, accountPaymentEntity, loanPaymentType);
    if (paymentData.getOverpaymentAmount() != null) {
        AccountOverpaymentEntity overpaymentEntity = new AccountOverpaymentEntity(this, accountPaymentEntity, paymentData.getOverpaymentAmount(), OverpaymentStatus.UNCLEARED.getValue());
        addAccountOverpayment(overpaymentEntity);
    }
    // GLIM
    BigDecimal installmentsPaid = findNumberOfPaidInstallments();
    applyPaymentToMemberAccounts(paymentData, installmentsPaid);
    return accountPaymentEntity;
}
Also used : LoanBusinessService(org.mifos.accounts.loan.business.service.LoanBusinessService) AccountPaymentEntity(org.mifos.accounts.business.AccountPaymentEntity) LoanPaymentTypes(org.mifos.accounts.loan.util.helpers.LoanPaymentTypes) BigDecimal(java.math.BigDecimal) AccountOverpaymentEntity(org.mifos.accounts.business.AccountOverpaymentEntity)

Example 2 with AccountOverpaymentEntity

use of org.mifos.accounts.business.AccountOverpaymentEntity in project head by mifos.

the class LoanAccountServiceFacadeWebTier method applyOverpaymentClear.

@Override
public void applyOverpaymentClear(String overpaymentId, BigDecimal overpaymentAmount) {
    try {
        this.transactionHelper.startTransaction();
        AccountOverpaymentEntity overpaymentEntity = legacyAccountDao.findOverpaymentById(Integer.valueOf(overpaymentId));
        overpaymentEntity.clearOverpayment(overpaymentAmount);
        legacyAccountDao.save(overpaymentEntity);
        this.transactionHelper.commitTransaction();
    } catch (BusinessRuleException e) {
        this.transactionHelper.rollbackTransaction();
        throw new BusinessRuleException(e.getMessageKey(), e);
    } catch (PersistenceException e) {
        this.transactionHelper.rollbackTransaction();
        throw new MifosRuntimeException(e);
    } finally {
        this.transactionHelper.closeSession();
    }
}
Also used : BusinessRuleException(org.mifos.service.BusinessRuleException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) AccountOverpaymentEntity(org.mifos.accounts.business.AccountOverpaymentEntity) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 3 with AccountOverpaymentEntity

use of org.mifos.accounts.business.AccountOverpaymentEntity in project head by mifos.

the class LoanAccountAction method setOverpayments.

private void setOverpayments(HttpServletRequest request, LoanBO loan) throws PageExpiredException {
    List<AccountOverpaymentEntity> overpayments = new ArrayList<AccountOverpaymentEntity>();
    // filter cleared overpayments
    for (AccountOverpaymentEntity overpayment : loan.getAccountOverpayments()) {
        if (overpayment.isNotCleared()) {
            overpayments.add(overpayment);
        }
    }
    SessionUtils.setCollectionAttribute("overpayments", overpayments, request);
}
Also used : ArrayList(java.util.ArrayList) AccountOverpaymentEntity(org.mifos.accounts.business.AccountOverpaymentEntity)

Example 4 with AccountOverpaymentEntity

use of org.mifos.accounts.business.AccountOverpaymentEntity in project head by mifos.

the class GroupIndividualLoanAccountAction method setOverpayments.

private void setOverpayments(HttpServletRequest request, LoanBO loan) throws PageExpiredException {
    List<AccountOverpaymentEntity> overpayments = new ArrayList<AccountOverpaymentEntity>();
    // filter cleared overpayments
    for (AccountOverpaymentEntity overpayment : loan.getAccountOverpayments()) {
        if (overpayment.isNotCleared()) {
            overpayments.add(overpayment);
        }
    }
    SessionUtils.setCollectionAttribute("overpayments", overpayments, request);
}
Also used : ArrayList(java.util.ArrayList) AccountOverpaymentEntity(org.mifos.accounts.business.AccountOverpaymentEntity)

Aggregations

AccountOverpaymentEntity (org.mifos.accounts.business.AccountOverpaymentEntity)4 ArrayList (java.util.ArrayList)2 BigDecimal (java.math.BigDecimal)1 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)1 LoanBusinessService (org.mifos.accounts.loan.business.service.LoanBusinessService)1 LoanPaymentTypes (org.mifos.accounts.loan.util.helpers.LoanPaymentTypes)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1 BusinessRuleException (org.mifos.service.BusinessRuleException)1