Search in sources :

Example 41 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.

the class SavingsClosureActionStrutsTest method createInitialObjects.

private void createInitialObjects() {
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
    center = TestObjectFactory.createWeeklyFeeCenter("Center_Active_test", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group_Active_test", CustomerStatus.GROUP_ACTIVE, center);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO)

Example 42 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO 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();
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) PaymentData(org.mifos.accounts.util.helpers.PaymentData) MeetingBO(org.mifos.application.meeting.business.MeetingBO) LoanBO(org.mifos.accounts.loan.business.LoanBO) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) ArrayList(java.util.ArrayList) Date(java.util.Date) AccountException(org.mifos.accounts.exceptions.AccountException) Test(org.junit.Test)

Example 43 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO 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);
    }
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) PaymentData(org.mifos.accounts.util.helpers.PaymentData) AccountException(org.mifos.accounts.exceptions.AccountException) MeetingBO(org.mifos.application.meeting.business.MeetingBO) LoanBO(org.mifos.accounts.loan.business.LoanBO) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) ArrayList(java.util.ArrayList) Date(java.util.Date) Test(org.junit.Test)

Example 44 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO 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"));
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) PaymentData(org.mifos.accounts.util.helpers.PaymentData) MeetingBO(org.mifos.application.meeting.business.MeetingBO) LoanBO(org.mifos.accounts.loan.business.LoanBO) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) ArrayList(java.util.ArrayList) Date(java.util.Date) Test(org.junit.Test)

Example 45 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO 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;
}
Also used : Money(org.mifos.framework.util.helpers.Money) MeetingBO(org.mifos.application.meeting.business.MeetingBO) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) FeeBO(org.mifos.accounts.fees.business.FeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) DateTime(org.joda.time.DateTime)

Aggregations

MeetingBO (org.mifos.application.meeting.business.MeetingBO)355 Test (org.junit.Test)176 Date (java.util.Date)91 ArrayList (java.util.ArrayList)84 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)74 DateTime (org.joda.time.DateTime)68 LocalDate (org.joda.time.LocalDate)56 Money (org.mifos.framework.util.helpers.Money)56 CenterBuilder (org.mifos.domain.builders.CenterBuilder)54 CenterBO (org.mifos.customers.center.business.CenterBO)46 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)44 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)42 Date (java.sql.Date)40 UserContext (org.mifos.security.util.UserContext)34 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)33 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)30 OfficeBO (org.mifos.customers.office.business.OfficeBO)27 CustomerBO (org.mifos.customers.business.CustomerBO)23 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)22 MifosUser (org.mifos.security.MifosUser)20