use of org.mifos.accounts.financial.business.GLCodeEntity in project head by mifos.
the class FeeInstallmentTest method createWeeklyFeeBO.
private FeeBO createWeeklyFeeBO(int every) {
MeetingBO feeMeeting = new MeetingBuilder().every(every).weekly().build();
FeeBO feeBO = new AmountFeeBO(new Money(TestUtils.RUPEE, "10.0"), "Fee", FeeCategory.ALLCUSTOMERS, FeeFrequencyType.PERIODIC, new GLCodeEntity(Short.valueOf("1"), "10000"), feeMeeting, null, new DateTime().minusDays(14).toDate(), TestUtils.makeUserWithLocales().getId());
return feeBO;
}
use of org.mifos.accounts.financial.business.GLCodeEntity in project head by mifos.
the class TestObjectFactory method createLoanOffering.
public static LoanOfferingBO createLoanOffering(final String name, final String shortName, final ApplicableTo applicableTo, final Date startDate, final PrdStatus offeringStatus, final Double defLnAmnt, final Double defIntRate, final Short defInstallments, final InterestType interestType, final boolean interestDeductedAtDisbursement, final boolean principalDueInLastInstallment, final MeetingBO meeting, final GraceType graceType, final short gracePeriodDuration, final String loanAmountCalcType, final String noOfInstallCalcType, final MifosCurrency currency, VariableInstallmentDetailsBO variableInstallmentDetails) {
PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(applicableTo);
ProductCategoryBO productCategory = TestObjectFactory.getLoanPrdCategory();
GracePeriodTypeEntity gracePeriodType = new GracePeriodTypeEntity(graceType);
InterestTypesEntity interestTypes = new InterestTypesEntity(interestType);
GLCodeEntity glCodePrincipal = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, TestGeneralLedgerCode.LOANS_TO_CLIENTS);
GLCodeEntity glCodeInterest = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, TestGeneralLedgerCode.INTEREST_ON_LOANS);
LoanOfferingBO loanOffering;
boolean loanCounter = true;
boolean waiverInterest = true;
try {
loanOffering = new LoanOfferingBO(getContext(), name, shortName, productCategory, prdApplicableMaster, startDate, null, null, gracePeriodType, gracePeriodDuration, interestTypes, new Money(currency, defLnAmnt.toString()), new Money(currency, defLnAmnt.toString()), new Money(currency, defLnAmnt.toString()), defIntRate, defIntRate, defIntRate, defInstallments, defInstallments, defInstallments, loanCounter, interestDeductedAtDisbursement, principalDueInLastInstallment, new ArrayList<FundBO>(), new ArrayList<FeeBO>(), new ArrayList<PenaltyBO>(), meeting, glCodePrincipal, glCodeInterest, loanAmountCalcType, noOfInstallCalcType, waiverInterest);
} catch (ProductDefinitionException e) {
throw new RuntimeException(e);
}
loanOffering.setCurrency(currency);
PrdStatusEntity prdStatus = testObjectPersistence.retrievePrdStatus(offeringStatus);
LoanOfferingTestUtils.setStatus(loanOffering, prdStatus);
LoanOfferingTestUtils.setGracePeriodType(loanOffering, gracePeriodType, gracePeriodDuration);
if (variableInstallmentDetails != null) {
loanOffering.setVariableInstallmentsAllowed(true);
loanOffering.setVariableInstallmentDetails(variableInstallmentDetails);
}
IntegrationTestObjectMother.saveLoanProducts(loanOffering);
return IntegrationTestObjectMother.findLoanProductBySystemId(loanOffering.getGlobalPrdOfferingNum());
}
use of org.mifos.accounts.financial.business.GLCodeEntity 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.financial.business.GLCodeEntity in project head by mifos.
the class TestObjectFactory method createLoanOffering.
/**
* @param defLnAmnt - Loan Amount same would be set as min and max amounts
* @param defIntRate - Interest Rate same would be set as min and max amounts
* @param defInstallments Number of installments set as min and max amounts
*/
public static LoanOfferingBO createLoanOffering(final String name, final String shortName, final ApplicableTo applicableTo, final Date startDate, final PrdStatus offeringStatus, final Double defLnAmnt, final Double defIntRate, final Short defInstallments, final InterestType interestType, final boolean interestDeductedAtDisbursement, final boolean principalDueInLastInstallment, final MeetingBO meeting, final GraceType graceType) {
PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(applicableTo);
ProductCategoryBO productCategory = TestObjectFactory.getLoanPrdCategory();
GracePeriodTypeEntity gracePeriodType = new GracePeriodTypeEntity(graceType);
InterestTypesEntity interestTypes = new InterestTypesEntity(interestType);
GLCodeEntity glCodePrincipal = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, Short.valueOf("11"));
GLCodeEntity glCodeInterest = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, Short.valueOf("21"));
LoanOfferingBO loanOffering;
short gracePeriodDuration = (short) 0;
boolean loanCounter = true;
boolean waiverInterest = true;
try {
loanOffering = new LoanOfferingBO(getContext(), name, shortName, productCategory, prdApplicableMaster, startDate, null, null, gracePeriodType, gracePeriodDuration, interestTypes, TestUtils.createMoney(defLnAmnt), TestUtils.createMoney(defLnAmnt), TestUtils.createMoney(defLnAmnt), defIntRate, defIntRate, defIntRate, defInstallments, defInstallments, defInstallments, loanCounter, interestDeductedAtDisbursement, principalDueInLastInstallment, new ArrayList<FundBO>(), new ArrayList<FeeBO>(), new ArrayList<PenaltyBO>(), meeting, glCodePrincipal, glCodeInterest, waiverInterest);
} catch (ProductDefinitionException e) {
throw new RuntimeException(e);
}
PrdStatusEntity prdStatus = testObjectPersistence.retrievePrdStatus(offeringStatus);
LoanOfferingTestUtils.setStatus(loanOffering, prdStatus);
LoanOfferingTestUtils.setGracePeriodType(loanOffering, gracePeriodType, gracePeriodDuration);
return (LoanOfferingBO) testObjectPersistence.persist(loanOffering);
}
use of org.mifos.accounts.financial.business.GLCodeEntity in project head by mifos.
the class TestObjectFactory method createPeriodicAmountFee.
private static FeeBO createPeriodicAmountFee(final String feeName, final FeeCategory feeCategory, final String feeAmnt, final RecurrenceType meetingFrequency, final Short recurAfter, final UserContext userContext, String categoryLookupValue) {
try {
GLCodeEntity glCode = ChartOfAccountsCache.get("31301").getAssociatedGlcode();
MeetingBO meeting = new MeetingBO(meetingFrequency, recurAfter, new DateTimeService().getCurrentJavaDateTime(), MeetingType.PERIODIC_FEE);
LookUpValueEntity lookUpValue = new LookUpValueEntity();
lookUpValue.setLookUpName(categoryLookupValue);
CategoryTypeEntity categoryType = new CategoryTypeEntity(feeCategory);
categoryType.setLookUpValue(lookUpValue);
FeeBO fee = new AmountFeeBO(userContext, feeName, categoryType, new FeeFrequencyTypeEntity(FeeFrequencyType.PERIODIC), glCode, TestUtils.createMoney(feeAmnt), false, meeting);
return testObjectPersistence.createFee(fee);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations