use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class BulkEntryPersistenceIntegrationTest method testSuccessfulApplyPayment.
@Test
public void testSuccessfulApplyPayment() throws Exception {
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
center = TestObjectFactory.createWeeklyFeeCenter("Center_Active", meeting);
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
Date startDate = new Date(System.currentTimeMillis());
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(startDate, meeting);
account = TestObjectFactory.createLoanAccount("42423142341", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering);
StaticHibernateUtil.flushSession();
account = legacyAccountDao.getAccount(account.getAccountId());
Assert.assertEquals(((LoanBO) account).getLoanOffering().getPrdOfferingName(), "Loan");
List<AccountActionDateEntity> accntActionDates = new ArrayList<AccountActionDateEntity>();
accntActionDates.add(account.getAccountActionDates().iterator().next());
Date currentDate = startDate;
PaymentData paymentData = TestObjectFactory.getLoanAccountPaymentData(accntActionDates, TestUtils.createMoney("100.0"), null, account.getPersonnel(), "423423", Short.valueOf("1"), currentDate, currentDate);
try {
IntegrationTestObjectMother.applyAccountPayment(account, paymentData);
Assert.assertEquals(((LoanBO) account).getLoanSummary().getFeesPaid(), TestUtils.createMoney("100.0"));
} catch (Exception e) {
e.printStackTrace();
}
account.getAccountPayments().clear();
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class BulkEntryPersistenceIntegrationTest method testFailureApplyPayment.
@Test
public void testFailureApplyPayment() throws Exception {
Date startDate = new Date(System.currentTimeMillis());
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
center = TestObjectFactory.createWeeklyFeeCenter("Center_Active", meeting);
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(startDate, meeting);
account = TestObjectFactory.createLoanAccount("42423142341", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering);
StaticHibernateUtil.flushSession();
account = legacyAccountDao.getAccount(account.getAccountId());
Assert.assertEquals(((LoanBO) account).getLoanOffering().getPrdOfferingName(), "Loan");
for (AccountActionDateEntity actionDate : account.getAccountActionDates()) {
if (actionDate.getInstallmentId().equals(Short.valueOf("1"))) {
actionDate.setPaymentStatus(PaymentStatus.PAID);
}
}
List<AccountActionDateEntity> accntActionDates = new ArrayList<AccountActionDateEntity>();
accntActionDates.addAll(account.getAccountActionDates());
PaymentData paymentData = TestObjectFactory.getLoanAccountPaymentData(accntActionDates, TestUtils.createMoney("3000.0"), null, account.getPersonnel(), "423423", Short.valueOf("1"), startDate, startDate);
try {
account.applyPayment(paymentData);
Assert.fail("should throw exception");
} catch (AccountException be) {
Assert.assertNotNull(be);
Assert.assertEquals(be.getKey(), "errors.makePayment");
Assert.assertTrue(true);
}
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class BulkEntryPersistenceIntegrationTest method testSuccessfulLoanUpdate.
@Test
public void testSuccessfulLoanUpdate() throws Exception {
Date startDate = new Date(System.currentTimeMillis());
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
center = TestObjectFactory.createWeeklyFeeCenter("Center_Active", meeting);
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(startDate, meeting);
account = TestObjectFactory.createLoanAccount("42423142341", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering);
StaticHibernateUtil.flushSession();
account = legacyAccountDao.getAccount(account.getAccountId());
Assert.assertEquals(((LoanBO) account).getLoanOffering().getPrdOfferingName(), "Loan");
List<AccountActionDateEntity> accntActionDates = new ArrayList<AccountActionDateEntity>();
accntActionDates.add(account.getAccountActionDates().iterator().next());
Date currentDate = startDate;
PaymentData paymentData = TestObjectFactory.getLoanAccountPaymentData(accntActionDates, TestUtils.createMoney("100.0"), null, account.getPersonnel(), "423423", Short.valueOf("1"), currentDate, currentDate);
IntegrationTestObjectMother.applyAccountPayment(account, paymentData);
Assert.assertEquals(((LoanBO) account).getLoanSummary().getFeesPaid(), TestUtils.createMoney("100.0"));
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class EditStatusActionStrutsTest method getLoanAccount.
private LoanBO getLoanAccount(CustomerBO customer, MeetingBO meeting, AccountState accountState) {
Date startDate = new Date(System.currentTimeMillis());
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(startDate, meeting);
return TestObjectFactory.createLoanAccount("42423142341", customer, accountState, startDate, loanOffering);
}
use of org.mifos.accounts.productdefinition.business.LoanOfferingBO in project head by mifos.
the class NotesActionStrutsTest method getLoanAccount.
private LoanBO getLoanAccount() {
createInitialObjects();
Date startDate = new Date(System.currentTimeMillis());
LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(startDate, meeting);
return TestObjectFactory.createLoanAccount("42423142341", client, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering);
}
Aggregations