use of org.mifos.accounts.fees.business.FeeFormulaEntity in project head by mifos.
the class FeeServiceFacadeWebTier method parameters.
private FeeParameters parameters() {
try {
List<GLCodeEntity> glCodes = generalLedgerDao.retreiveGlCodesBy(FinancialActionConstants.FEEPOSTING, FinancialConstants.CREDIT);
List<CategoryTypeEntity> categories = this.feeDao.doRetrieveFeeCategories();
List<FeeFormulaEntity> formulas = this.feeDao.retrieveFeeFormulae();
List<FeeFrequencyTypeEntity> frequencies = this.feeDao.retrieveFeeFrequencies();
List<FeePaymentEntity> timesOfCharging = this.feeDao.retrieveFeePayments();
List<MasterDataEntity> timesOfChargeingCustomer = new ArrayList<MasterDataEntity>();
for (MasterDataEntity timeOfCharging : timesOfCharging) {
if (timeOfCharging.getId().equals(FeePayment.UPFRONT.getValue())) {
timesOfChargeingCustomer.add(timeOfCharging);
}
}
return new FeeParameters(listToMap(categories), listToMap(timesOfCharging), listToMap(timesOfChargeingCustomer), listToMap(formulas), listToMap(frequencies), glCodesToMap(glCodes));
} catch (FinancialException e) {
throw new BusinessRuleException(e.getKey(), e);
}
}
use of org.mifos.accounts.fees.business.FeeFormulaEntity in project head by mifos.
the class FeeDaoHibernateIntegrationTest method shouldFindFeeFormulaType.
@Test
public void shouldFindFeeFormulaType() {
// exercise test
FeeFormulaEntity entity = this.feeDao.findFeeFormulaEntityByType(FeeFormula.AMOUNT_AND_INTEREST);
// verification
assertThat(entity, is(notNullValue()));
}
use of org.mifos.accounts.fees.business.FeeFormulaEntity in project head by mifos.
the class TestObjectFactory method createPeriodicRateFee.
public static RateFeeBO createPeriodicRateFee(final String feeName, final FeeCategory feeCategory, final Double rate, final FeeFormula feeFormula, final RecurrenceType meetingFrequency, final Short recurAfter, final UserContext userContext, final MeetingBO meeting) {
try {
MeetingBO newMeeting = new MeetingBO(meetingFrequency, recurAfter, new DateTimeService().getCurrentJavaDateTime(), MeetingType.PERIODIC_FEE);
// GLCodeEntity glCode =
// ChartOfAccountsCache.get("31301").getAssociatedGlcode();
GLCodeEntity glCode = new GLCodeEntity((short) 1, "31301");
RateFeeBO fee = new RateFeeBO(userContext, feeName, new CategoryTypeEntity(feeCategory), new FeeFrequencyTypeEntity(FeeFrequencyType.PERIODIC), glCode, rate, new FeeFormulaEntity(feeFormula), false, newMeeting);
// [keith] I have no idea why the fee must save itself. Otherwise
// mySQL errors crop up
// when you try to attach the fee to a loan.
fee.save();
// addObject(fee);
return fee;
// return (RateFeeBO) addObject(testObjectPersistence.persist(fee));
// return (RateFeeBO)
// addObject(testObjectPersistence.createFee(fee));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.mifos.accounts.fees.business.FeeFormulaEntity in project head by mifos.
the class TestObjectFactory method createOneTimeRateFee.
/**
* createOneTimeRateFee.
* <p/>
* Changing TestObjectFactory#getUserContext() to {@link TestUtils#makeUserWithLocales()} caused a failure in
* {@link LoanBOIntegrationTest#testApplyUpfrontFee} (and other tests).
*
* @param categoryTypeName TODO
*/
public static FeeBO createOneTimeRateFee(final String feeName, final FeeCategory feeCategory, final Double rate, final FeeFormula feeFormula, final FeePayment feePayment, String categoryTypeName) {
GLCodeEntity glCode = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, TestGeneralLedgerCode.FEES);
FeeBO fee;
try {
LookUpValueEntity lookUpValue = new LookUpValueEntity();
lookUpValue.setLookUpName(categoryTypeName);
CategoryTypeEntity categoryType = new CategoryTypeEntity(feeCategory);
categoryType.setLookUpValue(lookUpValue);
fee = new RateFeeBO(getUserContext(), feeName, categoryType, new FeeFrequencyTypeEntity(FeeFrequencyType.ONETIME), glCode, rate, new FeeFormulaEntity(feeFormula), false, new FeePaymentEntity(feePayment));
} catch (Exception e) {
throw new RuntimeException(e);
}
return testObjectPersistence.createFee(fee);
}
use of org.mifos.accounts.fees.business.FeeFormulaEntity in project head by mifos.
the class FeeServiceImpl method createOneTimeFee.
private FeeBO createOneTimeFee(FeeCreateRequest feeCreateRequest, FeeFrequencyTypeEntity feeFrequencyType, CategoryTypeEntity feeCategoryType, GLCodeEntity glCodeEntity, UserContext userContext) throws FeeException {
FeePaymentEntity feePaymentEntity = this.feeDao.findFeePaymentEntityByType(feeCreateRequest.getFeePaymentType());
FeeBO feeBO = null;
if (feeCreateRequest.isRateFee()) {
FeeFormulaEntity feeFormulaEntity = this.feeDao.findFeeFormulaEntityByType(feeCreateRequest.getFeeFormula());
feeBO = new RateFeeBO(userContext, feeCreateRequest.getFeeName(), feeCategoryType, feeFrequencyType, glCodeEntity, feeCreateRequest.getRate(), feeFormulaEntity, feeCreateRequest.isCustomerDefaultFee(), feePaymentEntity);
} else {
Money feeMoney = new Money(getCurrency(feeCreateRequest.getCurrencyId()), feeCreateRequest.getAmount());
feeBO = new AmountFeeBO(userContext, feeCreateRequest.getFeeName(), feeCategoryType, feeFrequencyType, glCodeEntity, feeMoney, feeCreateRequest.isCustomerDefaultFee(), feePaymentEntity);
}
return feeBO;
}
Aggregations