Search in sources :

Example 46 with LoanOfferingBO

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

the class FinancialBusinessServiceIntegrationTest method getLoanAccount.

private LoanBO getLoanAccount() {
    Date startDate = new Date(System.currentTimeMillis());
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
    center = TestObjectFactory.createWeeklyFeeCenter(this.getClass().getSimpleName() + " Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter(this.getClass().getSimpleName() + " Group", CustomerStatus.GROUP_ACTIVE, center);
    LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(this.getClass().getSimpleName() + "", "FL", startDate, meeting);
    return TestObjectFactory.createLoanAccount("42423142341", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) Date(java.sql.Date)

Example 47 with LoanOfferingBO

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

the class AccountFeesEntityIntegrationTest method getLoanAccount.

private AccountBO getLoanAccount() {
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
    LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering("Loan", ApplicableTo.GROUPS, new Date(System.currentTimeMillis()), PrdStatus.LOAN_ACTIVE, 300.0, 1.2, 3, InterestType.FLAT, meeting);
    return TestObjectFactory.createLoanAccount("42423142341", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, new Date(System.currentTimeMillis()), loanOffering);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) Date(java.util.Date)

Example 48 with LoanOfferingBO

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

the class LoanBOForReversalIntegrationTest method createLoanAccount.

private void createLoanAccount() {
    long transactionCount = getStatisticsService().getSuccessfulTransactionCount();
    Date startDate = new Date(System.currentTimeMillis());
    createInitialCustomers();
    LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(startDate, center.getCustomerMeeting().getMeeting());
    loan = TestObjectFactory.createLoanAccount("42423142341", group, AccountState.LOAN_APPROVED, startDate, loanOffering);
    long numberOfTransactions = getStatisticsService().getSuccessfulTransactionCount() - transactionCount;
    // TODO: numberOfTransactions needs to be 0, but is 8
    Assert.assertTrue("numberOfTransactions=" + numberOfTransactions + " should be less than: " + 8, numberOfTransactions <= 8);
}
Also used : LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) Date(java.util.Date)

Example 49 with LoanOfferingBO

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

the class AccountServiceIntegrationTest method getLoanAccount.

private AccountBO getLoanAccount() {
    Date startDate = new Date(System.currentTimeMillis());
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
    LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(startDate, meeting);
    return TestObjectFactory.createLoanAccount("42423142341", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) Date(java.sql.Date)

Example 50 with LoanOfferingBO

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

the class LoanPrdActionStrutsTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    FeeBO fee = TestObjectFactory.createPeriodicAmountFee("Loan Periodic", FeeCategory.LOAN, "100.0", RecurrenceType.MONTHLY, (short) 1);
    LoanOfferingBO product = createLoanOfferingBO("Loan Offering", "LOAN");
    setRequestPathInfo("/loanproductaction.do");
    addRequestParameter("method", "manage");
    addRequestParameter("prdOfferingId", product.getPrdOfferingId().toString());
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
    setRequestPathInfo("/loanproductaction.do");
    addRequestParameter("method", "editPreview");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("prdOfferingName", "Loan Product");
    addRequestParameter("prdOfferingShortName", "LOAP");
    addRequestParameter("prdCategory", "1");
    addRequestParameter("startDate", offSetCurrentDate(0, userContext.getPreferredLocale()));
    addRequestParameter("endDate", offSetCurrentDate(1, userContext.getPreferredLocale()));
    addRequestParameter("prdApplicableMaster", "1");
    addRequestParameter("minLoanAmount", "2000");
    addRequestParameter("maxLoanAmount", "11000");
    addRequestParameter("defaultLoanAmount", "5000");
    addRequestParameter("interestTypes", "1");
    addRequestParameter("maxInterestRate", "12");
    addRequestParameter("minInterestRate", "1");
    addRequestParameter("defInterestRate", "4");
    addRequestParameter("freqOfInstallments", "2");
    addRequestParameter("prdOfferinFees", new String[] { fee.getFeeId().toString() });
    addRequestParameter("loanOfferingFunds", new String[] { "1" });
    addRequestParameter("recurAfter", "1");
    addRequestParameter("maxNoInstallments", "14");
    addRequestParameter("minNoInstallments", "2");
    addRequestParameter("defNoInstallments", "11");
    addRequestParameter("intDedDisbursementFlag", "1");
    addRequestParameter("prdStatus", "2");
    addRequestParameter("loanAmtCalcType", "1");
    addRequestParameter("calcInstallmentType", "1");
    actionPerform();
    setRequestPathInfo("/loanproductaction.do");
    addRequestParameter("method", "update");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.update_success.toString());
    StaticHibernateUtil.flushSession();
    product = (LoanOfferingBO) TestObjectFactory.getObject(LoanOfferingBO.class, product.getPrdOfferingId());
    Assert.assertEquals("Loan Product", product.getPrdOfferingName());
    Assert.assertEquals("LOAP", product.getPrdOfferingShortName());
    Assert.assertEquals(PrdStatus.SAVINGS_ACTIVE, product.getStatus());
    for (LoanAmountSameForAllLoanBO loanAmountSameForAllLoanBO : product.getLoanAmountSameForAllLoan()) {
        Assert.assertEquals(new Double("11000"), loanAmountSameForAllLoanBO.getMaxLoanAmount());
        Assert.assertEquals(new Double("2000"), loanAmountSameForAllLoanBO.getMinLoanAmount());
        Assert.assertEquals(new Double("5000"), loanAmountSameForAllLoanBO.getDefaultLoanAmount());
    }
    Assert.assertEquals(Short.valueOf("1"), product.getLoanOfferingMeeting().getMeeting().getMeetingDetails().getRecurAfter());
    Assert.assertEquals(Short.valueOf("2"), product.getLoanOfferingMeeting().getMeeting().getMeetingDetails().getRecurrenceType().getRecurrenceId());
    Assert.assertEquals(1, product.getLoanOfferingFees().size());
    Assert.assertNull(((FlowManager) request.getSession().getAttribute(Constants.FLOWMANAGER)).getFlow(flowKey));
    TestObjectFactory.removeObject(product);
    fee = null;
}
Also used : LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) FeeBO(org.mifos.accounts.fees.business.FeeBO) LoanAmountSameForAllLoanBO(org.mifos.accounts.productdefinition.business.LoanAmountSameForAllLoanBO) Test(org.junit.Test)

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