use of org.mifos.accounts.fees.business.FeeDto in project head by mifos.
the class GroupActionStrutsTest method getFees.
private List<FeeDto> getFees(RecurrenceType frequency) {
List<FeeDto> fees = new ArrayList<FeeDto>();
AmountFeeBO fee1 = (AmountFeeBO) TestObjectFactory.createPeriodicAmountFee("PeriodicAmountFee", FeeCategory.GROUP, "200", frequency, Short.valueOf("2"));
fees.add(new FeeDto(TestObjectFactory.getContext(), fee1));
StaticHibernateUtil.flushAndClearSession();
return fees;
}
use of org.mifos.accounts.fees.business.FeeDto in project head by mifos.
the class LoanAccountActionFormTest method createDefaultFees.
private ArrayList<FeeDto> createDefaultFees() {
AmountFeeBO amountFee = createMock(AmountFeeBO.class);
expect(amountFee.getFeeId()).andReturn(Short.valueOf("1"));
expect(amountFee.getFeeType()).andReturn(RateAmountFlag.AMOUNT).times(2);
expect(amountFee.getFeeName()).andReturn("TestAmountFee");
expect(amountFee.getFeeAmount()).andReturn(new Money(TestUtils.RUPEE, "5000.0")).times(2);
expect(amountFee.isPeriodic()).andReturn(false).times(2);
replay(amountFee);
RateFeeBO rateFee = createMock(RateFeeBO.class);
expect(rateFee.getFeeId()).andReturn(Short.valueOf("1"));
expect(rateFee.getFeeType()).andReturn(RateAmountFlag.RATE).times(2);
expect(rateFee.getFeeName()).andReturn("TestRateFee");
expect(rateFee.getRate()).andReturn(2.12345);
expect(rateFee.getFeeFormula()).andReturn(createFeeFormulaEntityMock());
expect(rateFee.isPeriodic()).andReturn(false).times(2);
replay(rateFee);
UserContext userContext = createMock(UserContext.class);
expect(userContext.getLocaleId()).andReturn(Short.valueOf("1")).times(2);
replay(userContext);
ArrayList<FeeDto> defaultFees = new ArrayList<FeeDto>();
defaultFees.add(new FeeDto(userContext, amountFee));
defaultFees.add(new FeeDto(userContext, rateFee));
return defaultFees;
}
use of org.mifos.accounts.fees.business.FeeDto in project head by mifos.
the class LoanAccountActionFormTest method testValidateAdditionalFeesWithMultipleInstancesOfTheSameOneTimeFee.
public void testValidateAdditionalFeesWithMultipleInstancesOfTheSameOneTimeFee() throws Exception {
List<FeeDto> additionalFeeList = createDefaultFees();
List<FeeDto> additionalFeeList2 = createDefaultFees();
additionalFeeList2.add(additionalFeeList.get(0));
FlowManager flowMgrMock = createMock(FlowManager.class);
HttpSession sessionMock = createMock(HttpSession.class);
HttpServletRequest requestMock = createMock(HttpServletRequest.class);
expect(requestMock.getSession()).andReturn(sessionMock);
expect(requestMock.getAttribute(Constants.CURRENTFLOWKEY)).andReturn("currentFlowKey");
expect(sessionMock.getAttribute(Constants.FLOWMANAGER)).andReturn(flowMgrMock);
expect(flowMgrMock.getFromFlow("currentFlowKey", LoanConstants.ADDITIONAL_FEES_LIST)).andReturn(additionalFeeList);
ActionErrors errors = new ActionErrors();
form.validateAdditionalFee(errors, Locale.ENGLISH, TestUtils.RUPEE, requestMock);
Assert.assertEquals("There should be a 'Multiple instances of the same one-time fee are not allowed' error", 1, errors.size());
ActionMessage actionMessage = (ActionMessage) errors.get().next();
Assert.assertEquals("There should be a 'Multiple instances of the same one-time fee are not allowed' error", ProductDefinitionConstants.MULTIPLE_ONE_TIME_FEES_NOT_ALLOWED, actionMessage.getKey());
}
use of org.mifos.accounts.fees.business.FeeDto in project head by mifos.
the class CustomerApplicableFeesDto method toDto.
public static CustomerApplicableFeesDto toDto(List<FeeBO> fees, UserContext userContext) {
List<FeeDto> additionalFees = new ArrayList<FeeDto>();
List<FeeDto> defaultFees = new ArrayList<FeeDto>();
for (FeeBO fee : fees) {
if (fee.isCustomerDefaultFee()) {
defaultFees.add(new FeeDto(userContext, fee));
} else {
additionalFees.add(new FeeDto(userContext, fee));
}
}
return new CustomerApplicableFeesDto(defaultFees, additionalFees);
}
use of org.mifos.accounts.fees.business.FeeDto in project head by mifos.
the class ClientServiceFacadeWebTier method retrieveClientFormCreationData.
@Override
public ClientFormCreationDto retrieveClientFormCreationData(Short groupFlag, Short officeId, String parentGroupId) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
List<PersonnelDto> personnelList = new ArrayList<PersonnelDto>();
MeetingBO parentCustomerMeeting = null;
Short formedByPersonnelId = null;
String formedByPersonnelName = "";
String centerDisplayName = "";
String groupDisplayName = "";
String officeName = "";
List<FeeBO> fees = new ArrayList<FeeBO>();
Short applicableOfficeId = officeId;
if (YesNoFlag.YES.getValue().equals(groupFlag)) {
Integer parentCustomerId = Integer.valueOf(parentGroupId);
CustomerBO parentCustomer = this.customerDao.findCustomerById(parentCustomerId);
groupDisplayName = parentCustomer.getDisplayName();
if (parentCustomer.getPersonnel() != null) {
formedByPersonnelId = parentCustomer.getPersonnel().getPersonnelId();
formedByPersonnelName = parentCustomer.getPersonnel().getDisplayName();
}
if (parentCustomer.getParentCustomer() != null) {
centerDisplayName = parentCustomer.getParentCustomer().getDisplayName();
}
applicableOfficeId = parentCustomer.getOffice().getOfficeId();
officeName = parentCustomer.getOffice().getOfficeName();
if (parentCustomer.getCustomerMeeting() != null) {
parentCustomerMeeting = parentCustomer.getCustomerMeetingValue();
fees = this.customerDao.retrieveFeesApplicableToClientsRefinedBy(parentCustomer.getCustomerMeetingValue());
} else {
fees = this.customerDao.retrieveFeesApplicableToClients();
}
} else if (YesNoFlag.NO.getValue().equals(groupFlag)) {
CenterCreation centerCreation = new CenterCreation(applicableOfficeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
personnelList = this.personnelDao.findActiveLoanOfficersForOffice(centerCreation);
fees = this.customerDao.retrieveFeesApplicableToClients();
}
CustomerApplicableFeesDto applicableFees = CustomerApplicableFeesDto.toDto(fees, userContext);
List<ApplicableAccountFeeDto> defaultFees = new ArrayList<ApplicableAccountFeeDto>();
for (FeeDto fee : applicableFees.getDefaultFees()) {
defaultFees.add(new ApplicableAccountFeeDto(fee.getFeeIdValue().intValue(), fee.getFeeName(), fee.getAmount(), fee.isRemoved(), fee.isWeekly(), fee.isMonthly(), fee.isPeriodic(), fee.getFeeSchedule()));
}
List<ApplicableAccountFeeDto> additionalFees = new ArrayList<ApplicableAccountFeeDto>();
for (FeeDto fee : applicableFees.getAdditionalFees()) {
additionalFees.add(new ApplicableAccountFeeDto(fee.getFeeIdValue().intValue(), fee.getFeeName(), fee.getAmount(), fee.isRemoved(), fee.isWeekly(), fee.isMonthly(), fee.isPeriodic(), fee.getFeeSchedule()));
}
List<SavingsDetailDto> savingsOfferings = this.customerDao.retrieveSavingOfferingsApplicableToClient();
ClientRulesDto clientRules = retrieveClientRules();
ClientDropdownsDto clientDropdowns = retrieveClientDropdownData();
List<PersonnelDto> formedByPersonnel = this.customerDao.findLoanOfficerThatFormedOffice(applicableOfficeId);
MeetingDto parentMeeting = null;
if (parentCustomerMeeting != null) {
parentMeeting = parentCustomerMeeting.toDto();
}
return new ClientFormCreationDto(clientDropdowns, clientRules, applicableOfficeId, officeName, formedByPersonnelId, formedByPersonnelName, personnelList, formedByPersonnel, savingsOfferings, parentMeeting, centerDisplayName, groupDisplayName, additionalFees, defaultFees);
}
Aggregations