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;
}
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();
}
}
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);
}
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);
}
Aggregations