use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.
the class FeeInstallmentTest method createMergedFeeInstallmentsForTwoFeesAccountScheduledBiWeeklyFee1ScheduledWeeklyFee2ScheduledEveryThreeWeeks.
/**
* Expected results:
* | week | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
* | account event | | 1 | | 2 | | 3 | | 4 | | 5 | | 6 |
* | fee1 event | x | x | x | x | x | x | x | x | x | x | x | x |
* | fee2 event | | | y | | | y | | | y | | | y |
*/
@Test
public void createMergedFeeInstallmentsForTwoFeesAccountScheduledBiWeeklyFee1ScheduledWeeklyFee2ScheduledEveryThreeWeeks() {
ScheduledEvent masterEvent = new ScheduledEventBuilder().every(2).weeks().build();
FeeBO feeBO1 = createWeeklyFeeBO(1);
FeeBO feeBO2 = createWeeklyFeeBO(3);
AccountFeesEntity accountFeesEntity1 = createAccountFeesEntity(feeBO1, 10.0);
AccountFeesEntity accountFeesEntity2 = createAccountFeesEntity(feeBO2, 13.0);
List<AccountFeesEntity> accountFees = Arrays.asList(new AccountFeesEntity[] { accountFeesEntity1, accountFeesEntity2 });
List<FeeInstallment> feeInstallments = FeeInstallment.createMergedFeeInstallments(masterEvent, accountFees, 6);
assertThat(feeInstallments.size(), is(10));
assertFeeInstallment(feeInstallments.get(0), 1, 10.0, feeBO1);
assertFeeInstallment(feeInstallments.get(1), 2, 20.0, feeBO1);
assertFeeInstallment(feeInstallments.get(2), 3, 20.0, feeBO1);
assertFeeInstallment(feeInstallments.get(3), 4, 20.0, feeBO1);
assertFeeInstallment(feeInstallments.get(4), 5, 20.0, feeBO1);
assertFeeInstallment(feeInstallments.get(5), 6, 20.0, feeBO1);
assertFeeInstallment(feeInstallments.get(6), 1, 13.0, feeBO2);
assertFeeInstallment(feeInstallments.get(7), 3, 13.0, feeBO2);
assertFeeInstallment(feeInstallments.get(8), 4, 13.0, feeBO2);
assertFeeInstallment(feeInstallments.get(9), 6, 13.0, feeBO2);
}
use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.
the class FeeInstallmentTest method createMergedFeeInstallmentsForOneFeeAccountScheduledEveryThirdWeekFeeScheduledEverySecondWeek.
@Test
public void createMergedFeeInstallmentsForOneFeeAccountScheduledEveryThirdWeekFeeScheduledEverySecondWeek() {
ScheduledEvent accountScheduledEvent = new ScheduledEventBuilder().every(3).weeks().build();
FeeBO feeBO = createWeeklyFeeBO(2);
AccountFeesEntity accountFeesEntity = createAccountFeesEntity(feeBO, 10.0);
List<FeeInstallment> feeInstallments = FeeInstallment.createMergedFeeInstallmentsForOneFee(accountScheduledEvent, accountFeesEntity, 4);
assertThat(feeInstallments.size(), is(4));
assertFeeInstallment(feeInstallments.get(0), 1, 10.0, feeBO);
assertFeeInstallment(feeInstallments.get(1), 2, 10.0, feeBO);
assertFeeInstallment(feeInstallments.get(2), 3, 20.0, feeBO);
assertFeeInstallment(feeInstallments.get(3), 4, 10.0, feeBO);
}
use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.
the class GroupCreationUsingCustomerServiceIntegrationTest method cleanDatabaseTables.
@Before
public void cleanDatabaseTables() {
databaseCleaner.clean();
noAccountFees = new ArrayList<AccountFeesEntity>();
existingUser = IntegrationTestObjectMother.testUser();
existingLoanOfficer = IntegrationTestObjectMother.testUser();
existingOffice = IntegrationTestObjectMother.sampleBranchOffice();
existingMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
IntegrationTestObjectMother.saveMeeting(existingMeeting);
existingCenter = new CenterBuilder().with(existingMeeting).withName("Center-IntegrationTest").with(existingOffice).withLoanOfficer(existingLoanOfficer).withUserContext().build();
IntegrationTestObjectMother.createCenter(existingCenter, existingMeeting);
}
use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.
the class CustomerAccountCreationTest method givenMonthlyFrequencyAndChildCreatedAfterParentsFirstScheduleFirstCustomerScheduleForChildSynchsWithNearestScheduleOfParent.
@Test
public void givenMonthlyFrequencyAndChildCreatedAfterParentsFirstScheduleFirstCustomerScheduleForChildSynchsWithNearestScheduleOfParent() throws Exception {
// setup
applicableCalendarEvents = new CalendarEventBuilder().build();
DateTime tue19thOfApril = new DateTime().withDate(2011, 4, 19);
DateTime thursday26thOfMay = new DateTime().withDate(2011, 5, 26);
accountFees = new ArrayList<AccountFeesEntity>();
MeetingBO centerMeeting = new MeetingBuilder().customerMeeting().monthly().every(1).occuringOnA(WeekDay.MONDAY).startingFrom(tue19thOfApril.minusDays(1).toDate()).onDayOfMonth(18).build();
MeetingBO groupMeeting = new MeetingBuilder().customerMeeting().monthly().every(1).occuringOnA(WeekDay.MONDAY).startingFrom(thursday26thOfMay.minusDays(1).toDate()).onDayOfMonth(18).build();
CenterBO center = new CenterBuilder().active().withActivationDate(tue19thOfApril).with(centerMeeting).build();
GroupBO group = new GroupBuilder().active().withParentCustomer(center).withActivationDate(thursday26thOfMay).withMeeting(groupMeeting).build();
// exercise test
CustomerAccountBO centerAccount = CustomerAccountBO.createNew(center, accountFees, centerMeeting, applicableCalendarEvents);
CustomerAccountBO groupAccount = CustomerAccountBO.createNew(group, accountFees, groupMeeting, applicableCalendarEvents);
// verification
List<AccountActionDateEntity> centerSchedules = new ArrayList<AccountActionDateEntity>(centerAccount.getAccountActionDates());
List<AccountActionDateEntity> groupSchedules = new ArrayList<AccountActionDateEntity>(groupAccount.getAccountActionDates());
LocalDate secondCenterDate = new LocalDate(centerSchedules.get(1).getActionDate());
LocalDate firstGroupDate = new LocalDate(groupSchedules.get(0).getActionDate());
assertThat(firstGroupDate, is(secondCenterDate));
}
use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.
the class CustomerAccountCreationTest method firstCustomerScheduleIsAlwaysTheClosestMatchingDayOfWeekAndDoesNotTakeIntoAccountWeeklyMeetingFrequency.
@Test
public void firstCustomerScheduleIsAlwaysTheClosestMatchingDayOfWeekAndDoesNotTakeIntoAccountWeeklyMeetingFrequency() throws Exception {
// setup
applicableCalendarEvents = new CalendarEventBuilder().build();
DateTime tue19thOfApril = new DateTime().withDate(2011, 4, 19);
accountFees = new ArrayList<AccountFeesEntity>();
MeetingBO centerMeeting = new MeetingBuilder().customerMeeting().weekly().every(2).occuringOnA(WeekDay.MONDAY).startingFrom(tue19thOfApril.minusDays(1).toDate()).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 mon25thOfApril = new DateTime().withDate(2011, 4, 25).toLocalDate();
assertThat(firstCenterDate, is(mon25thOfApril));
}
Aggregations