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());
}
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());
}
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);
}
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();
}
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);
}
Aggregations