Search in sources :

Example 56 with LoanOfferingBO

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

the class ClientBoTest method testIsDisbursalPreventedDueToAnyExistingActiveLoansForTheSameProductDoesNotFetchLoanOfferingIfNoActiveLoanAccounts.

@Test
public void testIsDisbursalPreventedDueToAnyExistingActiveLoansForTheSameProductDoesNotFetchLoanOfferingIfNoActiveLoanAccounts() throws Exception {
    // setup
    client = new ClientBuilder().active().buildForUnitTests();
    LoanOfferingBO loanProduct1 = new LoanProductBuilder().withGlobalProductNumber("xxxx-111").withoutLoanAmountSameForAllLoans().buildForUnitTests();
    client.addAccount(loanAccount);
    // stubbing
    when(loanAccount.isActiveLoanAccount()).thenReturn(false);
    // exercise
    boolean isDisbursalPrevented = client.isDisbursalPreventedDueToAnyExistingActiveLoansForTheSameProduct(loanProduct1);
    assertThat(isDisbursalPrevented, is(false));
}
Also used : LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) LoanProductBuilder(org.mifos.domain.builders.LoanProductBuilder) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Test(org.junit.Test)

Example 57 with LoanOfferingBO

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

the class ClientBoTest method testIsDisbursalPreventedDueToAnyExistingActiveLoansForTheSameProductReturnsFalseIfCustomerHasNoSuchAccountsForThatProduct.

@Test
public void testIsDisbursalPreventedDueToAnyExistingActiveLoansForTheSameProductReturnsFalseIfCustomerHasNoSuchAccountsForThatProduct() throws Exception {
    // setup
    client = new ClientBuilder().active().buildForUnitTests();
    LoanOfferingBO loanProduct1 = new LoanProductBuilder().withGlobalProductNumber("xxxx-111").withoutLoanAmountSameForAllLoans().buildForUnitTests();
    LoanOfferingBO loanProduct2 = new LoanProductBuilder().withGlobalProductNumber("xxxx-222").buildForUnitTests();
    client.addAccount(loanAccount);
    // stubbing
    when(loanAccount.isActiveLoanAccount()).thenReturn(true);
    when(loanAccount.getLoanOffering()).thenReturn(loanProduct2);
    // exercise
    boolean isDisbursalPrevented = client.isDisbursalPreventedDueToAnyExistingActiveLoansForTheSameProduct(loanProduct1);
    assertThat(isDisbursalPrevented, is(false));
}
Also used : LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) LoanProductBuilder(org.mifos.domain.builders.LoanProductBuilder) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Test(org.junit.Test)

Example 58 with LoanOfferingBO

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

the class LoanProductBuilder method buildForIntegrationTests.

public LoanOfferingBO buildForIntegrationTests() {
    category = (ProductCategoryBO) StaticHibernateUtil.getSessionTL().get(ProductCategoryBO.class, Short.valueOf("2"));
    productStatusEntity = (PrdStatusEntity) StaticHibernateUtil.getSessionTL().get(PrdStatusEntity.class, this.productStatus.getValue());
    LoanOfferingBO loanProduct = build();
    return loanProduct;
}
Also used : LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO)

Example 59 with LoanOfferingBO

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

the class LoanArrearsAgingHelperIntegrationTest method setUpLoan.

private LoanBO setUpLoan(DateTime dateTime, AccountState accountState) {
    Date startDate = dateTime.toDate();
    meeting = getNewMeeting(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING, WeekDay.MONDAY, startDate);
    center = TestObjectFactory.createWeeklyFeeCenter(this.getClass().getSimpleName() + " Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter(this.getClass().getSimpleName() + " Group", CustomerStatus.GROUP_ACTIVE, center);
    LoanOfferingBO product = TestObjectFactory.createLoanOffering("LoanProduct", "LP", startDate, meeting);
    LoanBO loan = createBasicLoanAccount(group, accountState, product, "" + loanAmount, numInstallments, interestRate);
    return loan;
}
Also used : LoanBO(org.mifos.accounts.loan.business.LoanBO) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) Date(java.util.Date) LocalDate(org.joda.time.LocalDate)

Example 60 with LoanOfferingBO

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

the class AuditInterceptorIntegrationTest method getLoanAccount.

private AccountBO getLoanAccount() {
    Date startDate = new Date(System.currentTimeMillis());
    createInitialCustomers();
    LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(startDate, center.getCustomerMeeting().getMeeting());
    return TestObjectFactory.createLoanAccount("42423142341", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, 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