Search in sources :

Example 1 with CustomerService

use of org.mifos.customers.business.service.CustomerService in project head by mifos.

the class AccountRegenerateScheduleIntegrationTestCase method testChangeInMeetingScheduleForDates.

public void testChangeInMeetingScheduleForDates(MeetingBO customerMeeting, MeetingBO loanMeeting, MeetingBO newMeeting, LocalDate startDate, LocalDate dateWhenMeetingWillBeChanged, boolean useClosedAndCancelled) throws Exception {
    log("Start: " + startDate + ", Test: " + dateWhenMeetingWillBeChanged);
    accountBO = createLoanAccount(customerMeeting, loanMeeting);
    savingsBO = createSavingsAccount(customerMeeting);
    // center initially set up with meeting today
    center = TestObjectFactory.getCenter(center.getCustomerId());
    accountBO = TestObjectFactory.getObject(LoanBO.class, accountBO.getAccountId());
    if (useClosedAndCancelled) {
        PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
        accountBO.changeStatus(AccountState.LOAN_CANCELLED, null, "", loggedInUser);
        savingsBO.changeStatus(AccountState.SAVINGS_CANCELLED.getValue(), null, "", loggedInUser);
        CustomerStatusEntity customerStatusEntity = new CustomerStatusEntity(CustomerStatus.GROUP_CLOSED);
        CustomerBOTestUtils.setCustomerStatus(group, customerStatusEntity);
        StaticHibernateUtil.flushSession();
    }
    new DateTimeService().setCurrentDateTime(dateWhenMeetingWillBeChanged.toDateTimeAtStartOfDay());
    CustomerService customerService = ApplicationContextProvider.getBean(CustomerService.class);
    newMeeting.updateDetails(TestUtils.makeUser());
    customerService.updateCustomerMeetingSchedule(newMeeting, center);
    TestObjectFactory.updateObject(center);
    List<Days> workingDays = new FiscalCalendarRules().getWorkingDaysAsJodaTimeDays();
    List<Holiday> holidays = new ArrayList<Holiday>();
    boolean isTopOfHierarchy = center.isTopOfHierarchy();
    center.getCustomerAccount().handleChangeInMeetingSchedule(workingDays, holidays, isTopOfHierarchy);
    accountBO.handleChangeInMeetingSchedule(workingDays, holidays, isTopOfHierarchy);
    savingsBO.handleChangeInMeetingSchedule(workingDays, holidays, isTopOfHierarchy);
    StaticHibernateUtil.flushSession();
}
Also used : CustomerService(org.mifos.customers.business.service.CustomerService) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) Holiday(org.mifos.application.holiday.business.Holiday) LoanBO(org.mifos.accounts.loan.business.LoanBO) Days(org.joda.time.Days) ArrayList(java.util.ArrayList) CustomerStatusEntity(org.mifos.customers.business.CustomerStatusEntity) DateTimeService(org.mifos.framework.util.DateTimeService) FiscalCalendarRules(org.mifos.config.FiscalCalendarRules)

Example 2 with CustomerService

use of org.mifos.customers.business.service.CustomerService in project head by mifos.

the class CustomerPersistenceIntegrationTest method ignore_testFindCustomerWithNoAssocationsLoadedDoesntReturnInactiveCenter.

public void ignore_testFindCustomerWithNoAssocationsLoadedDoesntReturnInactiveCenter() throws Exception {
    meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Inactive Center", meeting);
    StaticHibernateUtil.flushSession();
    CustomerStatusFlag customerStatusFlag = CustomerStatusFlag.GROUP_CANCEL_BLACKLISTED;
    CustomerNoteEntity customerNote = new CustomerNoteEntity("Made Inactive", new java.util.Date(), center.getPersonnel(), center);
    CustomerService customerService = ApplicationContextProvider.getBean(CustomerService.class);
    customerService.updateCenterStatus((CenterBO) center, CustomerStatus.CENTER_INACTIVE, customerStatusFlag, customerNote);
    CustomerDao customerDao = ApplicationContextProvider.getBean(CustomerDao.class);
    center = customerDao.findCenterBySystemId(center.getGlobalCustNum());
    verifyCustomerNotLoaded(center.getCustomerId(), center.getDisplayName());
}
Also used : CustomerNoteEntity(org.mifos.customers.business.CustomerNoteEntity) CustomerService(org.mifos.customers.business.service.CustomerService) CustomerStatusFlag(org.mifos.customers.util.helpers.CustomerStatusFlag)

Example 3 with CustomerService

use of org.mifos.customers.business.service.CustomerService in project head by mifos.

the class EditCustomerStatusActionStrutsTest method testUpdateStatusFailureWhenGroupHasActiveClientsWhenCenterIsInactiveWhileChangingStatusCancelToPartial.

@Test
public void testUpdateStatusFailureWhenGroupHasActiveClientsWhenCenterIsInactiveWhileChangingStatusCancelToPartial() throws Exception {
    // setup
    createInitialObjects(CustomerStatus.CENTER_ACTIVE, CustomerStatus.GROUP_CANCELLED, CustomerStatus.CLIENT_CLOSED);
    CustomerService customerService = ApplicationContextProvider.getBean(CustomerService.class);
    CustomerStatusFlag customerStatusFlag = CustomerStatusFlag.GROUP_CANCEL_BLACKLISTED;
    CustomerNoteEntity customerNote = new CustomerNoteEntity("Made Inactive", new java.util.Date(), center.getPersonnel(), center);
    customerService.updateCenterStatus((CenterBO) center, CustomerStatus.CENTER_INACTIVE, customerStatusFlag, customerNote);
    invokeLoadAndPreviewSuccessfully(CustomerStatus.GROUP_PARTIAL, null);
    setRequestPathInfo("/editCustomerStatusAction.do");
    addRequestParameter("method", Methods.updateStatus.toString());
    addRequestParameter("input", "group");
    // exercise
    actionPerform();
    // verification
    Assert.assertNotNull(request.getAttribute(Constants.CURRENTFLOWKEY));
    verifyActionErrors(new String[] { GroupConstants.CENTER_INACTIVE });
    cleanInitialObjects();
}
Also used : CustomerNoteEntity(org.mifos.customers.business.CustomerNoteEntity) CustomerService(org.mifos.customers.business.service.CustomerService) CustomerStatusFlag(org.mifos.customers.util.helpers.CustomerStatusFlag) Test(org.junit.Test)

Aggregations

CustomerService (org.mifos.customers.business.service.CustomerService)3 CustomerNoteEntity (org.mifos.customers.business.CustomerNoteEntity)2 CustomerStatusFlag (org.mifos.customers.util.helpers.CustomerStatusFlag)2 ArrayList (java.util.ArrayList)1 Days (org.joda.time.Days)1 Test (org.junit.Test)1 LoanBO (org.mifos.accounts.loan.business.LoanBO)1 Holiday (org.mifos.application.holiday.business.Holiday)1 FiscalCalendarRules (org.mifos.config.FiscalCalendarRules)1 CustomerStatusEntity (org.mifos.customers.business.CustomerStatusEntity)1 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)1 DateTimeService (org.mifos.framework.util.DateTimeService)1