Search in sources :

Example 36 with LoanOfferingBO

use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.

the class LoanAccountActionStrutsTest method testUpdateSuccessWithoutRegeneratingNewRepaymentSchedule.

@Test
public void testUpdateSuccessWithoutRegeneratingNewRepaymentSchedule() throws Exception {
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    accountBO = getLoanAccount();
    LoanBO loan = (LoanBO) accountBO;
    LoanOfferingBO loanOffering = loan.getLoanOffering();
    Date firstInstallmentDate = loan.getDetailsOfNextInstallment().getActionDate();
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, loan, request);
    Date newDate = DateUtils.addWeeks(loan.getDisbursementDate(), 1);
    Date originalDate = loan.getDisbursementDate();
    setRequestPathInfo("/loanAccountAction.do");
    addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
    addRequestParameter("method", "update");
    addRequestParameter("loanAmount", loanOffering.getEligibleLoanAmountSameForAllLoan().getDefaultLoanAmount().toString());
    addRequestParameter("interestRate", loan.getLoanOffering().getDefInterestRate().toString());
    addRequestParameter("noOfInstallments", loanOffering.getDefaultNumOfEligibleInstallmentsSameForAllLoan().toString());
    addRequestParameter("disbursementDate", DateUtils.format(newDate));
    addRequestParameter("businessActivityId", "1");
    addRequestParameter("intDedDisbursement", "0");
    addRequestParameter("gracePeriodDuration", "1");
    addRequestParameter("collateralNote", "test");
    actionPerform();
    verifyForward(ActionForwards.update_success.toString());
    loan = TestObjectFactory.getObject(LoanBO.class, loan.getAccountId());
    Assert.assertEquals("test", loan.getCollateralNote());
    Assert.assertEquals(300.0, loan.getLoanAmount().getAmount().doubleValue(), DELTA);
    Assert.assertEquals(1, loan.getGracePeriodDuration().intValue());
    Assert.assertEquals(DateUtils.format(originalDate), DateUtils.getUserLocaleDate(TestObjectFactory.getContext().getPreferredLocale(), DateUtils.toDatabaseFormat(loan.getDisbursementDate())));
    Assert.assertEquals(firstInstallmentDate, loan.getAccountActionDate(Short.valueOf("1")).getActionDate());
}
Also used : LoanBO(org.mifos.accounts.loan.business.LoanBO) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) Date(java.util.Date) Test(org.junit.Test)

Example 37 with LoanOfferingBO

use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.

the class LegacyLoanDaoIntegrationTest method getBadAccount.

private LoanBO getBadAccount() {
    Date startDate = new Date(System.currentTimeMillis());
    LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering("Loanabcd", "abcd", ApplicableTo.CLIENTS, startDate, PrdStatus.LOAN_ACTIVE, 300.0, 1.2, (short) 3, InterestType.FLAT, meeting);
    return TestObjectFactory.createLoanAccount("42423142323", group, AccountState.LOAN_ACTIVE_IN_BAD_STANDING, startDate, loanOffering);
}
Also used : LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) Date(java.sql.Date)

Example 38 with LoanOfferingBO

use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.

the class LegacyLoanDaoIntegrationTest method getLoanAccount.

private AccountBO getLoanAccount(final AccountState state, final Date startDate) {
    LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering("Loanvcfg", "bhgf", ApplicableTo.GROUPS, startDate, PrdStatus.LOAN_ACTIVE, 300.0, 1.2, (short) 3, InterestType.FLAT, meeting);
    final int disbursalType = 1;
    return TestObjectFactory.createLoanAccountWithDisbursement("99999999999", group, state, startDate, loanOffering, disbursalType);
}
Also used : LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO)

Example 39 with LoanOfferingBO

use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.

the class LegacyLoanDaoIntegrationTest method getGoodAccount.

private LoanBO getGoodAccount() {
    Date startDate = new Date(System.currentTimeMillis());
    LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering("Loanabf", "abf", ApplicableTo.CLIENTS, startDate, PrdStatus.LOAN_ACTIVE, 300.0, 1.2, (short) 3, InterestType.FLAT, meeting);
    return TestObjectFactory.createLoanAccount("42423142342", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering);
}
Also used : LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) Date(java.sql.Date)

Example 40 with LoanOfferingBO

use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.

the class AccountStatusActionStrutsTest method getLoanAccount.

private LoanBO getLoanAccount(CustomerBO customerBO) {
    Date startDate = new Date(System.currentTimeMillis());
    LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(startDate, meeting);
    return TestObjectFactory.createLoanAccount("42423142341", customerBO, AccountState.LOAN_PENDING_APPROVAL, startDate, loanOffering);
}
Also used : LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) Date(java.util.Date)

Aggregations

LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)135 MeetingBO (org.mifos.application.meeting.business.MeetingBO)44 Date (java.util.Date)37 Test (org.junit.Test)37 ArrayList (java.util.ArrayList)26 Date (java.sql.Date)21 LoanBO (org.mifos.accounts.loan.business.LoanBO)18 LocalDate (org.joda.time.LocalDate)17 CustomerBO (org.mifos.customers.business.CustomerBO)12 LoanProductBuilder (org.mifos.domain.builders.LoanProductBuilder)11 UserContext (org.mifos.security.util.UserContext)9 ClientBuilder (org.mifos.domain.builders.ClientBuilder)8 Money (org.mifos.framework.util.helpers.Money)8 MifosUser (org.mifos.security.MifosUser)8 BusinessRuleException (org.mifos.service.BusinessRuleException)8 ProductCategoryBO (org.mifos.accounts.productdefinition.business.ProductCategoryBO)7 MifosRuntimeException (org.mifos.core.MifosRuntimeException)7 BigDecimal (java.math.BigDecimal)6 AccountException (org.mifos.accounts.exceptions.AccountException)6 FeeBO (org.mifos.accounts.fees.business.FeeBO)6