use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.
the class CustomerAccountCreationTest method firstCustomerScheduleIsAlwaysTheClosestMatchingDayOfWeekAndDoesNotTakeIntoAccountMonthlyMeetingFrequency.
@Test
public void firstCustomerScheduleIsAlwaysTheClosestMatchingDayOfWeekAndDoesNotTakeIntoAccountMonthlyMeetingFrequency() throws Exception {
// setup
applicableCalendarEvents = new CalendarEventBuilder().build();
DateTime tue19thOfApril = new DateTime().withDate(2011, 4, 19);
accountFees = new ArrayList<AccountFeesEntity>();
MeetingBO centerMeeting = new MeetingBuilder().customerMeeting().monthly().every(2).occuringOnA(WeekDay.MONDAY).startingFrom(tue19thOfApril.minusDays(1).toDate()).onDayOfMonth(18).build();
CenterBO center = new CenterBuilder().active().withActivationDate(tue19thOfApril).with(centerMeeting).build();
// exercise test
CustomerAccountBO centerAccount = CustomerAccountBO.createNew(center, accountFees, centerMeeting, applicableCalendarEvents);
// verification
List<AccountActionDateEntity> centerSchedules = new ArrayList<AccountActionDateEntity>(centerAccount.getAccountActionDates());
LocalDate firstCenterDate = new LocalDate(centerSchedules.get(0).getActionDate());
LocalDate mon18thOfMay = new DateTime().withDate(2011, 5, 18).toLocalDate();
assertThat(firstCenterDate, is(mon18thOfMay));
}
use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.
the class CustomerAccountCreationTest method customerAccountCanBeCreatedWithNoAccountFees.
@Test
public void customerAccountCanBeCreatedWithNoAccountFees() throws Exception {
// setup
accountFees = new ArrayList<AccountFeesEntity>();
customer = new CenterBuilder().inActive().build();
// exercise test
customerAccount = CustomerAccountBO.createNew(customer, accountFees, customerMeeting, applicableCalendarEvents);
// verification
assertThat(customerAccount.getAccountFees().isEmpty(), is(true));
}
use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.
the class CustomerAccountCreationTest method customerAccountIsNotCreatedWithCustomerSchedulesWhenAssociatedCustomerIsNotActive.
@Test
public void customerAccountIsNotCreatedWithCustomerSchedulesWhenAssociatedCustomerIsNotActive() throws Exception {
// setup
accountFees = new ArrayList<AccountFeesEntity>();
customer = new CenterBuilder().inActive().build();
// exercise test
customerAccount = CustomerAccountBO.createNew(customer, accountFees, customerMeeting, applicableCalendarEvents);
// verification
assertThat(customerAccount.getAccountActionDates().isEmpty(), is(true));
}
use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.
the class FeeInstallmentTest method createMergedFeeInstallmentsForOneFeeBothAccountAndFeeAreScheduledEveryWeekShouldGetOneFeeInstallmentPerAccountEvent.
@Test
public void createMergedFeeInstallmentsForOneFeeBothAccountAndFeeAreScheduledEveryWeekShouldGetOneFeeInstallmentPerAccountEvent() {
ScheduledEvent masterEvent = new ScheduledEventBuilder().every(1).weeks().build();
FeeBO feeBO = createWeeklyFeeBO(1);
AccountFeesEntity accountFeesEntity = createAccountFeesEntity(feeBO, 10.0);
List<FeeInstallment> feeInstallments = FeeInstallment.createMergedFeeInstallmentsForOneFee(masterEvent, accountFeesEntity, 3);
assertThat(feeInstallments.size(), is(3));
assertFeeInstallment(feeInstallments.get(0), 1, 10.0, feeBO);
assertFeeInstallment(feeInstallments.get(1), 2, 10.0, feeBO);
assertFeeInstallment(feeInstallments.get(2), 3, 10.0, feeBO);
}
use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.
the class FeeInstallmentTest method createMergedFeeInstallmentsForOneFeeAccountScheduledEveryWeekFeeScheduledEveryOtherWeekShouldGetOneFeeInstallmentPerEveryOtherAccountEvent.
@Test
public void createMergedFeeInstallmentsForOneFeeAccountScheduledEveryWeekFeeScheduledEveryOtherWeekShouldGetOneFeeInstallmentPerEveryOtherAccountEvent() {
ScheduledEvent accountEvent = new ScheduledEventBuilder().every(1).weeks().build();
FeeBO feeBO = createWeeklyFeeBO(2);
AccountFeesEntity accountFeesEntity = createAccountFeesEntity(feeBO, 10.0);
List<FeeInstallment> feeInstallments = FeeInstallment.createMergedFeeInstallmentsForOneFee(accountEvent, accountFeesEntity, 4);
assertThat(feeInstallments.size(), is(2));
assertFeeInstallment(feeInstallments.get(0), 1, 10.0, feeBO);
assertFeeInstallment(feeInstallments.get(1), 3, 10.0, feeBO);
}
Aggregations