Search in sources :

Example 16 with FeeDto

use of org.mifos.accounts.fees.business.FeeDto in project head by mifos.

the class ClientCustActionStrutsTest method testLoadClientUnderGroup_FeeSameFrequecny.

@Test
public void testLoadClientUnderGroup_FeeSameFrequecny() throws Exception {
    createGroupWithoutFee();
    List<FeeDto> fees = getFees(RecurrenceType.WEEKLY);
    StaticHibernateUtil.flushAndClearSession();
    setRequestPathInfo("/clientCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("parentGroupId", group.getCustomerId().toString());
    addRequestParameter("groupFlag", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.load_success.toString());
    ClientCustActionForm actionForm = (ClientCustActionForm) request.getSession().getAttribute("clientCustActionForm");
    Assert.assertEquals(actionForm.getFormedByPersonnelValue(), group.getCustomerFormedByPersonnel().getPersonnelId());
    List<FeeDto> additionalFees = (List<FeeDto>) SessionUtils.getAttribute(CustomerConstants.ADDITIONAL_FEES_LIST, request);
    Assert.assertNotNull(additionalFees);
    Assert.assertEquals(1, additionalFees.size());
    group = (GroupBO) StaticHibernateUtil.getSessionTL().get(GroupBO.class, group.getCustomerId());
    removeFees(fees);
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 17 with FeeDto

use of org.mifos.accounts.fees.business.FeeDto in project head by mifos.

the class ClientCustActionStrutsTest method getFees.

private List<FeeDto> getFees(RecurrenceType frequency) {
    List<FeeDto> fees = new ArrayList<FeeDto>();
    AmountFeeBO fee1 = (AmountFeeBO) TestObjectFactory.createPeriodicAmountFee("PeriodicAmountFee", FeeCategory.CLIENT, "200", frequency, Short.valueOf("2"));
    fees.add(new FeeDto(TestObjectFactory.getContext(), fee1));
    StaticHibernateUtil.flushAndClearSession();
    return fees;
}
Also used : ArrayList(java.util.ArrayList) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO)

Example 18 with FeeDto

use of org.mifos.accounts.fees.business.FeeDto in project head by mifos.

the class ClientIntegrationTest method getFees.

private List<FeeDto> getFees() {
    List<FeeDto> fees = new ArrayList<FeeDto>();
    AmountFeeBO fee1 = (AmountFeeBO) TestObjectFactory.createPeriodicAmountFee("PeriodicAmountFee", FeeCategory.CENTER, "200", RecurrenceType.WEEKLY, Short.valueOf("2"));
    AmountFeeBO fee2 = (AmountFeeBO) TestObjectFactory.createOneTimeAmountFee("OneTimeAmountFee", FeeCategory.ALLCUSTOMERS, "100", FeePayment.UPFRONT);
    fees.add(new FeeDto(TestObjectFactory.getContext(), fee1));
    fees.add(new FeeDto(TestObjectFactory.getContext(), fee2));
    StaticHibernateUtil.flushSession();
    return fees;
}
Also used : ArrayList(java.util.ArrayList) FeeDto(org.mifos.accounts.fees.business.FeeDto) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO)

Example 19 with FeeDto

use of org.mifos.accounts.fees.business.FeeDto in project head by mifos.

the class CenterActionStrutsTest method testFailurePreview_FeeFrequencyMismatch.

@Test
public void testFailurePreview_FeeFrequencyMismatch() throws Exception {
    List<FeeDto> feesToRemove = getFees(RecurrenceType.WEEKLY);
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    actionPerform();
    List<ApplicableAccountFeeDto> feeList = retrieveAdditionalFeesFromSession();
    ApplicableAccountFeeDto fee = feeList.get(0);
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, getMeeting(), request);
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("selectedFee[0].feeId", fee.getFeeId().toString());
    addRequestParameter("selectedFee[0].amount", "200");
    actionPerform();
    Assert.assertEquals("Fee", 1, getErrorSize(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH));
}
Also used : ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) Test(org.junit.Test)

Example 20 with FeeDto

use of org.mifos.accounts.fees.business.FeeDto in project head by mifos.

the class CenterActionStrutsTest method testFailurePreview_WithFee_WithoutFeeAmount.

@Test
public void testFailurePreview_WithFee_WithoutFeeAmount() throws Exception {
    List<FeeDto> feesToRemove = getFees(RecurrenceType.MONTHLY);
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    List<ApplicableAccountFeeDto> feeList = retrieveAdditionalFeesFromSession();
    ApplicableAccountFeeDto fee = feeList.get(0);
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("selectedFee[0].feeId", fee.getFeeId().toString());
    addRequestParameter("selectedFee[0].amount", "");
    addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
    actionPerform();
    Assert.assertEquals("Fee", 1, getErrorSize(CustomerConstants.FEE));
}
Also used : ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) Test(org.junit.Test)

Aggregations

FeeDto (org.mifos.accounts.fees.business.FeeDto)44 ArrayList (java.util.ArrayList)29 Test (org.junit.Test)22 ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)21 FeeBO (org.mifos.accounts.fees.business.FeeBO)13 List (java.util.List)12 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)11 MeetingBO (org.mifos.application.meeting.business.MeetingBO)10 Date (java.util.Date)7 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)5 UserContext (org.mifos.security.util.UserContext)5 RateFeeBO (org.mifos.accounts.fees.business.RateFeeBO)4 MifosUser (org.mifos.security.MifosUser)4 FundBO (org.mifos.accounts.fund.business.FundBO)3 BusinessActivityEntity (org.mifos.application.master.business.BusinessActivityEntity)3 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)3 PersonnelDto (org.mifos.dto.domain.PersonnelDto)3 PageExpiredException (org.mifos.framework.exceptions.PageExpiredException)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 DateTime (org.joda.time.DateTime)2