use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsBOIntegrationTest method testGetTotalAmountInArrearsWithPaymentDone.
@Test
public void testGetTotalAmountInArrearsWithPaymentDone() throws Exception {
savings = getSavingsAccount();
AccountActionDateEntity accountActionDateEntity = savings.getAccountActionDate(Short.valueOf("1"));
((SavingsScheduleEntity) accountActionDateEntity).setActionDate(offSetCurrentDate(1));
accountActionDateEntity.setPaymentStatus(PaymentStatus.PAID);
savings = (SavingsBO) saveAndFetch(savings);
Assert.assertEquals(savings.getTotalAmountInArrears(), TestUtils.createMoney());
}
use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsBOIntegrationTest method testGetOverDueDepositAmountForVoluntaryAccounts.
@Test
public void testGetOverDueDepositAmountForVoluntaryAccounts() throws Exception {
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
SavingsOfferingBO savingsOffering = helper.createSavingsOffering("dfasdasd1", "sad1");
center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
client1 = TestObjectFactory.createClient("Client", CustomerStatus.CLIENT_ACTIVE, group);
savings = TestObjectFactory.createSavingsAccount("43245434", client1, Short.valueOf("16"), new Date(System.currentTimeMillis()), savingsOffering);
Session session = StaticHibernateUtil.getSessionTL();
StaticHibernateUtil.startTransaction();
SavingsScheduleEntity accountActionDate = (SavingsScheduleEntity) savings.getAccountActionDate((short) 1);
accountActionDate.setDepositPaid(TestUtils.createMoney("100.0"));
session.update(savings);
StaticHibernateUtil.flushSession();
Assert.assertEquals(getRoundedMoney(0.00), savings.getOverDueDepositAmount(accountActionDate.getActionDate()));
}
use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsPaymentStrategyForMandatorySavingsAccountsTest method whenNoUnpaidScheduledInstallmentsExistNoPaymentsAreMade.
@Test
public void whenNoUnpaidScheduledInstallmentsExistNoPaymentsAreMade() {
// setup
final Money balanceBeforeDeposit = new Money(TestUtils.RUPEE, "0.0");
final Money fullDepositAmount = new Money(TestUtils.RUPEE, "100.0");
final Date dateOfDeposit = new DateTime().toDate();
final List<SavingsScheduleEntity> unpaidDepositsForPayingCustomer = Arrays.asList();
// stubbing
when(accountPayment.getAmount()).thenReturn(fullDepositAmount);
when(accountPayment.getPaymentDate()).thenReturn(dateOfDeposit);
// exercise test
paymentStrategy.makeScheduledPayments(accountPayment, unpaidDepositsForPayingCustomer, payingCustomer, SavingsType.MANDATORY, balanceBeforeDeposit);
// verification
verify(accountPayment, times(0)).addAccountTrxn(any(AccountTrxnEntity.class));
}
use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsPaymentStrategyForMandatorySavingsAccountsTest method whenUnpaidScheduledInstallmentsExistEarliestDueInstallmentsArePaidOffFirst.
@Test
public void whenUnpaidScheduledInstallmentsExistEarliestDueInstallmentsArePaidOffFirst() {
// setup
final Money balanceBeforeDeposit = new Money(TestUtils.RUPEE, "0.0");
final Money fullDepositAmount = new Money(TestUtils.RUPEE, "10.0");
final Date dateOfDeposit = new DateTime().toDate();
final SavingsScheduleEntity unpaidSaving1 = new SavingsScheduleBuilder().withInstallmentNumber(1).withAccount(savingsAccount).withCustomer(payingCustomer).withDepositDue(new Money(TestUtils.RUPEE, "10.0")).build();
final SavingsScheduleEntity unpaidSaving2 = new SavingsScheduleBuilder().withInstallmentNumber(2).withAccount(savingsAccount).withCustomer(payingCustomer).withDepositDue(new Money(TestUtils.RUPEE, "50.0")).build();
final List<SavingsScheduleEntity> unpaidDepositsForPayingCustomer = Arrays.asList(unpaidSaving1, unpaidSaving2);
// stubbing
when(accountPayment.getAmount()).thenReturn(fullDepositAmount);
when(accountPayment.getPaymentDate()).thenReturn(dateOfDeposit);
// exercise test
paymentStrategy.makeScheduledPayments(accountPayment, unpaidDepositsForPayingCustomer, payingCustomer, SavingsType.MANDATORY, balanceBeforeDeposit);
// verification
assertThat(unpaidSaving1.isPaid(), is(true));
assertThat(unpaidSaving2.isPaid(), is(false));
}
use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsPaymentStrategyForMandatorySavingsAccountsTest method whenNoUnpaidScheduledInstallmentsExistTheFullAmountOfTheDepositIsReturned.
@Test
public void whenNoUnpaidScheduledInstallmentsExistTheFullAmountOfTheDepositIsReturned() {
// setup
final Money balanceBeforeDeposit = new Money(TestUtils.RUPEE, "0.0");
final Money fullDepositAmount = new Money(TestUtils.RUPEE, "100.0");
final Date dateOfDeposit = new DateTime().toDate();
final List<SavingsScheduleEntity> unpaidDepositsForPayingCustomer = Arrays.asList();
// stubbing
when(accountPayment.getAmount()).thenReturn(fullDepositAmount);
when(accountPayment.getPaymentDate()).thenReturn(dateOfDeposit);
// exercise test
final Money remainingAmount = paymentStrategy.makeScheduledPayments(accountPayment, unpaidDepositsForPayingCustomer, payingCustomer, SavingsType.MANDATORY, balanceBeforeDeposit);
// verification
assertThat(remainingAmount, is(fullDepositAmount));
}
Aggregations