Search in sources :

Example 1 with FeeBuilder

use of org.mifos.domain.builders.FeeBuilder in project head by mifos.

the class SavingsDaoHibernateIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    enableCustomWorkingDays();
    weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
    weeklyPeriodicFeeForCenterOnly = new FeeBuilder().appliesToCenterOnly().withFeeAmount("100.0").withName("Center Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForCenterOnly);
    center = new CenterBuilder().with(weeklyMeeting).withName("Center").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
    IntegrationTestObjectMother.createCenter((CenterBO) center, weeklyMeeting);
    weeklyPeriodicFeeForGroupOnly = new FeeBuilder().appliesToGroupsOnly().withFeeAmount("50.0").withName("Group Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForGroupOnly);
    group = new GroupBuilder().withMeeting(weeklyMeeting).withName("Group").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withFee(weeklyPeriodicFeeForGroupOnly).withParentCustomer(center).build();
    IntegrationTestObjectMother.createGroup(group, weeklyMeeting);
    weeklyPeriodicFeeForClientsOnly = new FeeBuilder().appliesToClientsOnly().withFeeAmount("10.0").withName("Client Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForClientsOnly);
    client = new ClientBuilder().withMeeting(weeklyMeeting).withName("Client 1").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
    IntegrationTestObjectMother.createClient(client, weeklyMeeting);
    customerHierarchyParams = new CustomerHierarchyParams(center.getCustomerId(), center.getOffice().getOfficeId(), center.getSearchId() + ".%", new LocalDate());
    baseDao = new GenericDaoHibernate();
    savingsDao = new SavingsDaoHibernate(baseDao);
}
Also used : FeeBuilder(org.mifos.domain.builders.FeeBuilder) GroupBuilder(org.mifos.domain.builders.GroupBuilder) CustomerHierarchyParams(org.mifos.application.servicefacade.CustomerHierarchyParams) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) LocalDate(org.joda.time.LocalDate) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Before(org.junit.Before)

Example 2 with FeeBuilder

use of org.mifos.domain.builders.FeeBuilder in project head by mifos.

the class FeeDaoHibernateIntegrationTest method cleanDatabaseTables.

@Before
public void cleanDatabaseTables() {
    databaseCleaner.clean();
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
    weeklyPeriodicFeeForCenterOnly = new FeeBuilder().appliesToCenterOnly().withFeeAmount("100.0").withName("Center Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForCenterOnly);
    weeklyOneTimeForLoans = new FeeBuilder().appliesToLoans().oneTime().withFeeAmount("100.0").withName("Center Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(weeklyOneTimeForLoans);
    StaticHibernateUtil.flushAndClearSession();
}
Also used : FeeBuilder(org.mifos.domain.builders.FeeBuilder) MeetingBO(org.mifos.application.meeting.business.MeetingBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) Before(org.junit.Before)

Example 3 with FeeBuilder

use of org.mifos.domain.builders.FeeBuilder in project head by mifos.

the class CenterActionStrutsTest method testSuccessfulCreate.

@Test
public void testSuccessfulCreate() throws Exception {
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    AmountFeeBO monthlyPeriodicFeeForFirstClients = new FeeBuilder().appliesToCenterOnly().withFeeAmount("200.0").withName("PeriodicAmountFee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(monthlyPeriodicFeeForFirstClients);
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "1");
    actionPerform();
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, weeklyMeeting, request);
    List<ApplicableAccountFeeDto> feeList = retrieveAdditionalFeesFromSession();
    ApplicableAccountFeeDto fee = feeList.get(0);
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("displayName", "center");
    addRequestParameter("loanOfficerId", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
    addRequestParameter("selectedFee[0].feeId", fee.getFeeId().toString());
    addRequestParameter("selectedFee[0].amount", fee.getAmount());
    actionPerform();
    verifyForward(ActionForwards.preview_success.toString());
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "create");
    addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.create_success.toString());
    CenterCustActionForm actionForm = (CenterCustActionForm) request.getSession().getAttribute("centerCustActionForm");
    center = TestObjectFactory.getCenter(actionForm.getCustomerIdAsInt());
}
Also used : FeeBuilder(org.mifos.domain.builders.FeeBuilder) CenterCustActionForm(org.mifos.customers.center.struts.actionforms.CenterCustActionForm) MeetingBO(org.mifos.application.meeting.business.MeetingBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) Test(org.junit.Test)

Example 4 with FeeBuilder

use of org.mifos.domain.builders.FeeBuilder in project head by mifos.

the class GenerateMeetingsForCustomerAndSavingsBatchJobIntegrationTest method cleanDatabaseTables.

@Before
public void cleanDatabaseTables() {
    databaseCleaner.clean();
    DateTime eightWeeksInPast = new DateTime().minusWeeks(8);
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).withStartDate(eightWeeksInPast).build();
    IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
    AmountFeeBO weeklyPeriodicFeeForCenterOnly = new FeeBuilder().appliesToCenterOnly().withFeeAmount("100.0").withName("Center Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForCenterOnly);
    center = new CenterBuilder().withNumberOfExistingCustomersInOffice(3).withName("Center1").with(weeklyMeeting).with(sampleBranchOffice()).withLoanOfficer(testUser()).withActivationDate(eightWeeksInPast).active().build();
    IntegrationTestObjectMother.createCenter(center, weeklyMeeting, weeklyPeriodicFeeForCenterOnly);
    generateMeetingsForCustomerAndSavingsHelper = new GenerateMeetingsForCustomerAndSavingsHelper();
}
Also used : FeeBuilder(org.mifos.domain.builders.FeeBuilder) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) DateTime(org.joda.time.DateTime) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) Before(org.junit.Before)

Example 5 with FeeBuilder

use of org.mifos.domain.builders.FeeBuilder in project head by mifos.

the class CustomerAccountCreationTest method customerAccountCanBeCreatedWithAccountFees.

@Test
public void customerAccountCanBeCreatedWithAccountFees() throws Exception {
    // setup
    FeeBO fee = new FeeBuilder().appliesToAllCustomers().periodic().with(new MeetingBuilder().periodicFeeMeeting().weekly().every(1)).build();
    AccountFeesEntity accountFee = new AccountFeesEntity(null, fee, Double.valueOf("25.0"));
    accountFees = new ArrayList<AccountFeesEntity>();
    accountFees.add(accountFee);
    customer = new CenterBuilder().inActive().build();
    // exercise test
    customerAccount = CustomerAccountBO.createNew(customer, accountFees, customerMeeting, applicableCalendarEvents);
    // verification
    assertThat(customerAccount.getAccountFees(), hasItem(accountFee));
    assertThat(accountFee.getAccount(), is((AccountBO) customerAccount));
}
Also used : CustomerAccountBO(org.mifos.customers.business.CustomerAccountBO) AccountBO(org.mifos.accounts.business.AccountBO) FeeBuilder(org.mifos.domain.builders.FeeBuilder) CenterBuilder(org.mifos.domain.builders.CenterBuilder) FeeBO(org.mifos.accounts.fees.business.FeeBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) Test(org.junit.Test)

Aggregations

FeeBuilder (org.mifos.domain.builders.FeeBuilder)20 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)20 CenterBuilder (org.mifos.domain.builders.CenterBuilder)18 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)13 DateTime (org.joda.time.DateTime)12 Test (org.junit.Test)12 MeetingBO (org.mifos.application.meeting.business.MeetingBO)12 CenterBO (org.mifos.customers.center.business.CenterBO)8 ArrayList (java.util.ArrayList)7 Before (org.junit.Before)6 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)6 ClientBuilder (org.mifos.domain.builders.ClientBuilder)5 GroupBuilder (org.mifos.domain.builders.GroupBuilder)5 LocalDate (org.joda.time.LocalDate)3 BigDecimal (java.math.BigDecimal)2 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)2 RecurringSchedule (org.mifos.clientportfolio.loan.service.RecurringSchedule)2 CreateLoanAccount (org.mifos.clientportfolio.newloan.applicationservice.CreateLoanAccount)2 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)2 OfficeBO (org.mifos.customers.office.business.OfficeBO)2