Search in sources :

Example 16 with ApplicableAccountFeeDto

use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.

the class GroupActionStrutsTest method testFailurePreview_WithDuplicateFee.

@Test
public void testFailurePreview_WithDuplicateFee() throws Exception {
    List<FeeDto> feesToRemove = getFees(RecurrenceType.WEEKLY);
    createParentCustomer();
    StaticHibernateUtil.flushAndClearSession();
    setRequestPathInfo("/groupCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("centerSystemId", center.getGlobalCustNum());
    actionPerform();
    List<ApplicableAccountFeeDto> feeList = getFeesFromSession();
    ApplicableAccountFeeDto fee = feeList.get(0);
    setRequestPathInfo("/groupCustAction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("selectedFee[0].feeId", fee.getFeeId().toString());
    addRequestParameter("selectedFee[0].amount", "100");
    addRequestParameter("selectedFee[1].feeId", fee.getFeeId().toString());
    addRequestParameter("selectedFee[1].amount", "150");
    addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
    actionPerform();
    Assert.assertEquals("Fee", 1, getErrorSize(CustomerConstants.FEE));
    verifyInputForward();
    removeFees(feesToRemove);
    center = TestObjectFactory.getCenter(center.getCustomerId());
}
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 17 with ApplicableAccountFeeDto

use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.

the class GroupActionStrutsTest method testFailurePreview_WithFee_WithoutFeeAmount.

@Test
public void testFailurePreview_WithFee_WithoutFeeAmount() throws Exception {
    List<FeeDto> feesToRemove = getFees(RecurrenceType.WEEKLY);
    createParentCustomer();
    StaticHibernateUtil.flushAndClearSession();
    setRequestPathInfo("/groupCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("centerSystemId", center.getGlobalCustNum());
    actionPerform();
    List<ApplicableAccountFeeDto> feeList = getFeesFromSession();
    ApplicableAccountFeeDto fee = feeList.get(0);
    setRequestPathInfo("/groupCustAction.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));
    verifyInputForward();
    removeFees(feesToRemove);
    center = TestObjectFactory.getCenter(center.getCustomerId());
}
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 18 with ApplicableAccountFeeDto

use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.

the class PictureFormFile method load.

@TransactionDemarcate(saveToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ClientCustActionForm actionForm = (ClientCustActionForm) form;
    UserContext userContext = getUserContext(request);
    actionForm.clearMostButNotAllFieldsOnActionForm();
    SessionUtils.removeAttribute(CustomerConstants.CUSTOMER_MEETING, request);
    Short officeId = actionForm.getOfficeIdValue();
    String officeName = actionForm.getOfficeName();
    Short groupFlag = actionForm.getGroupFlagValue();
    String parentGroupId = actionForm.getParentGroupId();
    ClientFormCreationDto clientFormCreationDto = this.clientServiceFacade.retrieveClientFormCreationData(groupFlag, officeId, parentGroupId);
    if (clientFormCreationDto.getFormedByPersonnelId() != null) {
        actionForm.setFormedByPersonnel(clientFormCreationDto.getFormedByPersonnelId().toString());
        MeetingBO groupMeeting = customerDao.findCustomerById(Integer.valueOf(parentGroupId)).getCustomerMeetingValue();
        clientFormCreationDto.getParentCustomerMeeting().setMeetingSchedule(CustomerUIHelperFn.getMeetingSchedule(groupMeeting, userContext));
        SessionUtils.setAttribute("meeting", clientFormCreationDto.getParentCustomerMeeting(), request);
    }
    actionForm.setCenterDisplayName(clientFormCreationDto.getCenterDisplayName());
    actionForm.setGroupDisplayName(clientFormCreationDto.getGroupDisplayName());
    actionForm.setOfficeId(clientFormCreationDto.getOfficeId().toString());
    actionForm.setOfficeName(officeName);
    if (clientFormCreationDto.getFormedByPersonnelId() != null) {
        actionForm.setLoanOfficerId(clientFormCreationDto.getFormedByPersonnelId().toString());
    }
    actionForm.setLoanOfficerName(clientFormCreationDto.getFormedByPersonnelName());
    actionForm.setCustomFields(new ArrayList<CustomFieldDto>());
    List<ApplicableAccountFeeDto> defaultFees = clientFormCreationDto.getDefaultFees();
    actionForm.setDefaultFees(defaultFees);
    List<ApplicableAccountFeeDto> additionalFees = clientFormCreationDto.getAdditionalFees();
    SessionUtils.setCollectionAttribute(CustomerConstants.ADDITIONAL_FEES_LIST, additionalFees, request);
    List<SpouseFatherLookupEntity> spouseFather = legacyMasterDao.findMasterDataEntitiesWithLocale(SpouseFatherLookupEntity.class);
    SessionUtils.setCollectionAttribute(ClientConstants.SPOUSE_FATHER_ENTITY, spouseFather, request);
    SessionUtils.setCollectionAttribute(ClientConstants.SALUTATION_ENTITY, clientFormCreationDto.getClientDropdowns().getSalutations(), request);
    SessionUtils.setCollectionAttribute(ClientConstants.GENDER_ENTITY, clientFormCreationDto.getClientDropdowns().getGenders(), request);
    SessionUtils.setCollectionAttribute(ClientConstants.MARITAL_STATUS_ENTITY, clientFormCreationDto.getClientDropdowns().getMaritalStatuses(), request);
    SessionUtils.setCollectionAttribute(ClientConstants.CITIZENSHIP_ENTITY, clientFormCreationDto.getClientDropdowns().getCitizenship(), request);
    SessionUtils.setCollectionAttribute(ClientConstants.ETHNICITY_ENTITY, clientFormCreationDto.getClientDropdowns().getEthnicity(), request);
    SessionUtils.setCollectionAttribute(ClientConstants.EDUCATION_LEVEL_ENTITY, clientFormCreationDto.getClientDropdowns().getEducationLevels(), request);
    SessionUtils.setCollectionAttribute(ClientConstants.BUSINESS_ACTIVITIES_ENTITY, clientFormCreationDto.getClientDropdowns().getBusinessActivity(), request);
    SessionUtils.setCollectionAttribute(ClientConstants.POVERTY_STATUS, clientFormCreationDto.getClientDropdowns().getPoverty(), request);
    SessionUtils.setCollectionAttribute(ClientConstants.HANDICAPPED_ENTITY, clientFormCreationDto.getClientDropdowns().getHandicapped(), request);
    SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, new ArrayList<CustomFieldDto>(), request);
    SessionUtils.setCollectionAttribute(CustomerConstants.LOAN_OFFICER_LIST, clientFormCreationDto.getPersonnelList(), request);
    SessionUtils.setCollectionAttribute(CustomerConstants.FORMEDBY_LOAN_OFFICER_LIST, clientFormCreationDto.getFormedByPersonnelList(), request);
    SessionUtils.setCollectionAttribute(ClientConstants.SAVINGS_OFFERING_LIST, clientFormCreationDto.getSavingsOfferings(), request);
    SessionUtils.setAttribute(GroupConstants.CENTER_HIERARCHY_EXIST, ClientRules.getCenterHierarchyExists(), request);
    SessionUtils.setAttribute(ClientConstants.MAXIMUM_NUMBER_OF_FAMILY_MEMBERS, ClientRules.getMaximumNumberOfFamilyMembers(), request);
    InformationOrderServiceFacade informationOrderServiceFacade = ApplicationContextProvider.getBean(InformationOrderServiceFacade.class);
    SessionUtils.setCollectionAttribute("personalInformationOrder", informationOrderServiceFacade.getInformationOrder("CreateClient"), request);
    boolean isFamilyDetailsRequired = ClientRules.isFamilyDetailsRequired();
    SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_REQUIRED, isFamilyDetailsRequired, request);
    if (isFamilyDetailsRequired) {
        boolean isFamilyDetailsMandatory = isFamilyDetailsMandatory();
        if (!isFamilyDetailsMandatory) {
            actionForm.removeFamilyMember(0);
        }
        SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_MANDATORY, isFamilyDetailsMandatory, request);
        SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_HIDDEN, false, request);
    } else {
        SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_MANDATORY, isSpouseFatherInformationMandatory(), request);
        SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_HIDDEN, isSpouseFatherInformationHidden(), request);
    }
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) UserContext(org.mifos.security.util.UserContext) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) InformationOrderServiceFacade(org.mifos.platform.questionnaire.service.InformationOrderServiceFacade) SpouseFatherLookupEntity(org.mifos.application.master.business.SpouseFatherLookupEntity) ClientFormCreationDto(org.mifos.dto.screen.ClientFormCreationDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 19 with ApplicableAccountFeeDto

use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.

the class GroupServiceFacadeWebTier method convertFeeViewsToAccountFeeEntities.

private List<AccountFeesEntity> convertFeeViewsToAccountFeeEntities(List<ApplicableAccountFeeDto> feesToApply) {
    List<AccountFeesEntity> feesForCustomerAccount = new ArrayList<AccountFeesEntity>();
    for (ApplicableAccountFeeDto feeDto : feesToApply) {
        FeeBO fee = feeDao.findById(feeDto.getFeeId().shortValue());
        Double feeAmount = new LocalizationConverter().getDoubleValueForCurrentLocale(feeDto.getAmount());
        AccountBO nullReferenceForNow = null;
        AccountFeesEntity accountFee = new AccountFeesEntity(nullReferenceForNow, fee, feeAmount);
        feesForCustomerAccount.add(accountFee);
    }
    return feesForCustomerAccount;
}
Also used : AccountBO(org.mifos.accounts.business.AccountBO) LocalizationConverter(org.mifos.framework.util.LocalizationConverter) ArrayList(java.util.ArrayList) FeeBO(org.mifos.accounts.fees.business.FeeBO) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto)

Example 20 with ApplicableAccountFeeDto

use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.

the class CreateClientCreationDetail method feeAsAccountFeeDto.

public List<ApplicableAccountFeeDto> feeAsAccountFeeDto(List<CreationFeeDto> feesToApply) {
    List<ApplicableAccountFeeDto> feeDto = new ArrayList<ApplicableAccountFeeDto>();
    for (CreationFeeDto f : feesToApply) {
        ApplicableAccountFeeDto accFee = new ApplicableAccountFeeDto();
        accFee.setFeeId(f.getFeeId());
        accFee.setAmount(f.getAmount());
        feeDto.add(accFee);
    }
    return feeDto;
}
Also used : ArrayList(java.util.ArrayList) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto)

Aggregations

ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)32 ArrayList (java.util.ArrayList)19 Test (org.junit.Test)15 FeeDto (org.mifos.accounts.fees.business.FeeDto)15 MeetingBO (org.mifos.application.meeting.business.MeetingBO)14 Date (java.util.Date)7 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)7 MeetingDto (org.mifos.dto.domain.MeetingDto)7 List (java.util.List)6 AddressDto (org.mifos.dto.domain.AddressDto)6 LocalDate (org.joda.time.LocalDate)5 FeeBO (org.mifos.accounts.fees.business.FeeBO)5 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)5 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)5 CustomerDetailsDto (org.mifos.dto.domain.CustomerDetailsDto)5 Address (org.mifos.framework.business.util.Address)5 DateTime (org.joda.time.DateTime)4 ClientFamilyDetailDto (org.mifos.dto.screen.ClientFamilyDetailDto)4 ClientNameDetailDto (org.mifos.dto.screen.ClientNameDetailDto)4 ClientPersonalDetailDto (org.mifos.dto.screen.ClientPersonalDetailDto)4