Search in sources :

Example 51 with MeetingBO

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

the class SavingsBOIntegrationTest method testSuccessfulApplyPayment.

@Test
public void testSuccessfulApplyPayment() throws AccountException, Exception {
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
    client1 = TestObjectFactory.createClient("Client", CustomerStatus.CLIENT_ACTIVE, group);
    savingsOffering = helper.createSavingsOffering("dfasdasd1", "sad1");
    savings = TestObjectFactory.createSavingsAccount("43245434", client1, AccountStates.SAVINGS_ACC_INACTIVE, new Date(System.currentTimeMillis()), savingsOffering);
    savings = (SavingsBO) legacyAccountDao.getAccount(savings.getAccountId());
    savings.setSavingsBalance(new Money(getCurrency()));
    Money enteredAmount = new Money(currency, "100.0");
    PaymentData paymentData = PaymentData.createPaymentData(enteredAmount, savings.getPersonnel(), Short.valueOf("1"), new Date(System.currentTimeMillis()));
    paymentData.setCustomer(client1);
    paymentData.setReceiptDate(new Date(System.currentTimeMillis()));
    paymentData.setReceiptNum("34244");
    AccountActionDateEntity accountActionDate = savings.getAccountActionDate(Short.valueOf("1"));
    SavingsPaymentData savingsPaymentData = new SavingsPaymentData(accountActionDate);
    paymentData.addAccountPaymentData(savingsPaymentData);
    IntegrationTestObjectMother.applyAccountPayment(savings, paymentData);
    Assert.assertEquals(AccountStates.SAVINGS_ACC_APPROVED, savings.getAccountState().getId().shortValue());
    Assert.assertEquals(TestUtils.createMoney(100.0), savings.getSavingsBalance());
    Assert.assertEquals(1, savings.getSavingsActivityDetails().size());
    savings.getAccountPayments().clear();
    client1 = IntegrationTestObjectMother.findCustomerById(client1.getCustomerId());
}
Also used : SavingsPaymentData(org.mifos.accounts.util.helpers.SavingsPaymentData) Money(org.mifos.framework.util.helpers.Money) PaymentData(org.mifos.accounts.util.helpers.PaymentData) SavingsPaymentData(org.mifos.accounts.util.helpers.SavingsPaymentData) AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) MeetingBO(org.mifos.application.meeting.business.MeetingBO) Date(java.util.Date) Test(org.junit.Test)

Example 52 with MeetingBO

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

the class SavingsBOIntegrationTest method testSuccessfulDepositForCenterAccount.

@Test
public void testSuccessfulDepositForCenterAccount() throws AccountException, Exception {
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
    client1 = TestObjectFactory.createClient("Client", CustomerStatus.CLIENT_ACTIVE, group);
    savingsOffering = helper.createSavingsOffering("dfasdasd1", "sad1");
    savings = TestObjectFactory.createSavingsAccount("43245434", center, AccountStates.SAVINGS_ACC_APPROVED, new Date(System.currentTimeMillis()), savingsOffering);
    savings.setSavingsBalance(new Money(getCurrency()));
    savings = (SavingsBO) legacyAccountDao.getAccount(savings.getAccountId());
    Money enteredAmount = new Money(currency, "100.0");
    PaymentData paymentData = PaymentData.createPaymentData(enteredAmount, savings.getPersonnel(), Short.valueOf("1"), new Date(System.currentTimeMillis()));
    paymentData.setCustomer(client1);
    paymentData.setReceiptDate(new Date(System.currentTimeMillis()));
    paymentData.setReceiptNum("34244");
    AccountActionDateEntity accountActionDate = savings.getAccountActionDate(Short.valueOf("1"));
    SavingsPaymentData savingsPaymentData = new SavingsPaymentData(accountActionDate);
    paymentData.addAccountPaymentData(savingsPaymentData);
    IntegrationTestObjectMother.applyAccountPayment(savings, paymentData);
    savings = (SavingsBO) legacyAccountDao.getAccount(savings.getAccountId());
    Assert.assertEquals(AccountStates.SAVINGS_ACC_APPROVED, savings.getAccountState().getId().shortValue());
    Assert.assertEquals(TestUtils.createMoney(100.0), savings.getSavingsBalance());
    Assert.assertEquals(1, savings.getSavingsActivityDetails().size());
    List<AccountPaymentEntity> payments = savings.getAccountPayments();
    Assert.assertEquals(1, payments.size());
    for (AccountPaymentEntity payment : payments) {
        Assert.assertEquals(1, payment.getAccountTrxns().size());
        for (AccountTrxnEntity accountTrxn : payment.getAccountTrxns()) {
            SavingsTrxnDetailEntity trxn = (SavingsTrxnDetailEntity) accountTrxn;
            Assert.assertEquals(enteredAmount, trxn.getBalance());
            Assert.assertEquals(client1.getCustomerId(), trxn.getCustomer().getCustomerId());
        }
    }
    client1 = IntegrationTestObjectMother.findCustomerById(client1.getCustomerId());
}
Also used : SavingsPaymentData(org.mifos.accounts.util.helpers.SavingsPaymentData) Money(org.mifos.framework.util.helpers.Money) PaymentData(org.mifos.accounts.util.helpers.PaymentData) SavingsPaymentData(org.mifos.accounts.util.helpers.SavingsPaymentData) AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) AccountTrxnEntity(org.mifos.accounts.business.AccountTrxnEntity) MeetingBO(org.mifos.application.meeting.business.MeetingBO) AccountPaymentEntity(org.mifos.accounts.business.AccountPaymentEntity) SavingsTrxnDetailEntity(org.mifos.accounts.savings.business.SavingsTrxnDetailEntity) Date(java.util.Date) Test(org.junit.Test)

Example 53 with MeetingBO

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

the class SavingsBOIntegrationTest method createInitialObjects.

private void createInitialObjects() {
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    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 54 with MeetingBO

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

the class SavingsPostInterestTest method setupForEachTest.

@Before
public void setupForEachTest() {
    client = new ClientBuilder().active().buildForUnitTests();
    MeetingBO interestPostingMeeting = new MeetingBuilder().savingsInterestPostingSchedule().monthly().every(1).build();
    savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToClientsOnly().withInterestPostingSchedule(interestPostingMeeting).buildForUnitTests();
}
Also used : SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) MeetingBO(org.mifos.application.meeting.business.MeetingBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Before(org.junit.Before)

Example 55 with MeetingBO

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

the class SavingsBOIntegrationTest method createCustomerObjects.

private void createCustomerObjects() {
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center_Active_test", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group_Active_test", CustomerStatus.GROUP_ACTIVE, center);
    client1 = TestObjectFactory.createClient("client1", CustomerStatus.CLIENT_ACTIVE, group);
    client2 = TestObjectFactory.createClient("client2", CustomerStatus.CLIENT_ACTIVE, group);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO)

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