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