use of org.mifos.application.master.business.InterestTypesEntity in project head by mifos.
the class LoanOfferingBOIntegrationTest method testLoanOfferingWithDecliningInterestDeductionAtDisbursement.
@Test
public void testLoanOfferingWithDecliningInterestDeductionAtDisbursement() {
try {
createIntitalObjects();
interestTypes = new InterestTypesEntity(InterestType.DECLINING);
Date startDate = offSetCurrentDate(0);
Date endDate = offSetCurrentDate(2);
new LoanOfferingBO(TestObjectFactory.getContext(), "Loan Offering", "LOAP", productCategory, prdApplicableMaster, startDate, endDate, null, null, null, interestTypes, new Money(getCurrency(), "1000"), new Money(getCurrency(), "3000"), new Money(getCurrency(), "2000.0"), 12.0, 2.0, 3.0, (short) 20, (short) 11, (short) 17, false, true, false, null, null, null, frequency, principalglCodeEntity, intglCodeEntity, waiverInterest);
Assert.fail();
} catch (ProductDefinitionException e) {
Assert.assertEquals("exceptions.declineinterestdisbursementdeduction", e.getKey());
}
}
use of org.mifos.application.master.business.InterestTypesEntity in project head by mifos.
the class LoanOfferingBOIntegrationTest method testLoanOfferingWithEqualPrincipalDecliningInterestDeductionAtDisbursement.
@Test
public void testLoanOfferingWithEqualPrincipalDecliningInterestDeductionAtDisbursement() {
try {
createIntitalObjects();
interestTypes = new InterestTypesEntity(InterestType.DECLINING_EPI);
Date startDate = offSetCurrentDate(0);
Date endDate = offSetCurrentDate(2);
new LoanOfferingBO(TestObjectFactory.getContext(), "Loan Offering", "LOAP", productCategory, prdApplicableMaster, startDate, endDate, null, null, null, interestTypes, new Money(getCurrency(), "1000"), new Money(getCurrency(), "3000"), new Money(getCurrency(), "2000.0"), 12.0, 2.0, 3.0, (short) 20, (short) 11, (short) 17, false, true, false, null, null, null, frequency, principalglCodeEntity, intglCodeEntity, waiverInterest);
Assert.fail();
} catch (ProductDefinitionException e) {
Assert.assertEquals("exceptions.declineinterestdisbursementdeduction", e.getKey());
}
}
use of org.mifos.application.master.business.InterestTypesEntity 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.application.master.business.InterestTypesEntity 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.application.master.business.InterestTypesEntity in project head by mifos.
the class TestObjectFactory method createCompleteLoanOfferingObject.
public static LoanOfferingBO createCompleteLoanOfferingObject() throws Exception {
PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.GROUPS);
MeetingBO frequency = TestObjectFactory.createMeeting(getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
GLCodeEntity principalglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, TestGeneralLedgerCode.BANK_ACCOUNT_ONE);
GLCodeEntity intglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, TestGeneralLedgerCode.BANK_ACCOUNT_ONE);
ProductCategoryBO productCategory = getLoanPrdCategory();
InterestTypesEntity interestTypes = new InterestTypesEntity(InterestType.FLAT);
GracePeriodTypeEntity gracePeriodType = new GracePeriodTypeEntity(GraceType.GRACEONALLREPAYMENTS);
List<FeeBO> fees = new ArrayList<FeeBO>();
List<FundBO> funds = new ArrayList<FundBO>();
FundBO fundBO = (FundBO) StaticHibernateUtil.getSessionTL().get(FundBO.class, Short.valueOf("2"));
funds.add(fundBO);
LoanOfferingBO loanOfferingBO = new LoanOfferingBO(getContext(), "Loan Offering", "LOAP", productCategory, prdApplicableMaster, DateUtils.getCurrentDateWithoutTimeStamp(), null, null, gracePeriodType, (short) 2, interestTypes, TestUtils.createMoney("1000"), TestUtils.createMoney("3000"), TestUtils.createMoney("2000.0"), 12.0, 2.0, 3.0, (short) 20, (short) 11, (short) 17, false, false, false, funds, fees, null, frequency, principalglCodeEntity, intglCodeEntity, true);
loanOfferingBO.save();
return loanOfferingBO;
}
Aggregations