use of org.mifos.accounts.productdefinition.business.LoanOfferingBO 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.productdefinition.business.LoanOfferingBO 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.productdefinition.business.LoanOfferingBO 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;
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class ReportProductOfferingServiceIntegrationTest method testGetLoanOffering1ReturnsLoanOffering.
@Test
public void testGetLoanOffering1ReturnsLoanOffering() throws Exception {
LoanOfferingBO loanOffering1 = LoanOfferingBO.createInstanceForTest(LOAN_OFFERING_1_ID);
expect(loanPrdBusinessServiceMock.getLoanOffering(LOAN_OFFERING_1_ID)).andReturn(loanOffering1);
replay(loanPrdBusinessServiceMock);
LoanOfferingBO retrievedLoanOffering = reportProductOfferingService.getLoanOffering1();
verify(loanPrdBusinessServiceMock);
Assert.assertEquals(loanOffering1, retrievedLoanOffering);
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class CustomerBOIntegrationTest method getLoanAccount.
private AccountBO getLoanAccount(CustomerBO customer, MeetingBO meeting) {
Date startDate = new Date(System.currentTimeMillis());
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(startDate, meeting);
return TestObjectFactory.createLoanAccount("42423142341", customer, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering);
}
Aggregations