Search in sources :

Example 51 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class SavingsIntPostingHelperIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    databaseCleaner.clean();
    DateTime startOfFiscalYear = new DateTime().withDate(2010, 1, 1);
    MeetingBO meetingFrequency = new MeetingBuilder().customerMeeting().startingFrom(startOfFiscalYear.toDate()).monthly().every(1).onDayOfMonth(1).build();
    createCenterGroupClientHierarchy(meetingFrequency);
    MeetingBO interestCalculationFrequency = new MeetingBuilder().savingsInterestCalulationSchedule().monthly().every(2).build();
    IntegrationTestObjectMother.saveMeeting(interestCalculationFrequency);
    MeetingBO interestPostingFrequency = new MeetingBuilder().savingsInterestPostingSchedule().monthly().every(2).build();
    IntegrationTestObjectMother.saveMeeting(interestPostingFrequency);
    SavingsOfferingBO mandatoryMinimumBalance = new SavingsProductBuilder().appliesToClientsOnly().withName("mandatoryMinimumBalance1").withShortName("mm01").mandatory().minimumBalance().withInterestCalculationSchedule(interestPostingFrequency).withInterestPostingSchedule(interestPostingFrequency).withMandatoryAmount("300").withInterestRate(Double.valueOf("12")).withMaxWithdrawalAmount(TestUtils.createMoney("200")).withMinAmountRequiredForInterestCalculation("200").buildForIntegrationTests();
    IntegrationTestObjectMother.saveSavingsProducts(mandatoryMinimumBalance);
    DateTime nextInterestPostingDate = new DateTime().minusDays(1);
    savings1 = new SavingsAccountBuilder().active().withSavingsProduct(mandatoryMinimumBalance).withCustomer(client).withCreatedBy(IntegrationTestObjectMother.testUser()).withActivationDate(startOfFiscalYear).withNextInterestPostingDateOf(nextInterestPostingDate).withBalanceOf(TestUtils.createMoney("0")).withDepositOn("300", startOfFiscalYear).withDepositOn("200", startOfFiscalYear.plusMonths(1)).build();
    IntegrationTestObjectMother.saveSavingsAccount(savings1);
}
Also used : SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) MeetingBO(org.mifos.application.meeting.business.MeetingBO) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) DateTime(org.joda.time.DateTime) Before(org.junit.Before)

Example 52 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class ClientPhotoServiceDatabaseIntegrationTest method setUp.

@Before
public void setUp() throws CustomerException {
    this.clientPhotoService = new ClientPhotoServiceDatabase();
    this.clientPhotoService.setGenericDao(this.genericDao);
    this.clientPhotoService.setHibernateTransactionHelper(this.hibernateTransactionHelper);
    this.weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
    this.testCenter = new CenterBuilder().with(this.weeklyMeeting).withName("Center Photo").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
    IntegrationTestObjectMother.createCenter(this.testCenter, this.weeklyMeeting);
    this.testGroup = new GroupBuilder().withMeeting(this.weeklyMeeting).withName("Group Photo").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(this.testCenter).build();
    IntegrationTestObjectMother.createGroup(this.testGroup, this.weeklyMeeting);
    this.testClient = new ClientBuilder().withMeeting(this.weeklyMeeting).withName("Client 1").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(this.testGroup).buildForIntegrationTests();
    IntegrationTestObjectMother.createClient(this.testClient, this.weeklyMeeting);
}
Also used : GroupBuilder(org.mifos.domain.builders.GroupBuilder) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Before(org.junit.Before)

Example 53 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class HolidayAndWorkingDaysAndMoratoriaScheduledDateGenerationTest method shouldNotGoIntoRecursiveLoopWhenThroughDateOccursExactlyTenPeriodsFromStartDate.

@Test
public void shouldNotGoIntoRecursiveLoopWhenThroughDateOccursExactlyTenPeriodsFromStartDate() {
    MeetingBO meeting = new MeetingBuilder().customerMeeting().weekly().every(1).build();
    ScheduledEvent scheduledEvent = ScheduledEventFactory.createScheduledEventFrom(meeting);
    DateTime startDate = new DateTime().withYear(2010).withMonthOfYear(4).withDayOfMonth(1).toDateMidnight().toDateTime();
    DateTime throughDate = new DateTime().withYear(2010).withMonthOfYear(6).withDayOfMonth(7).toDateMidnight().toDateTime();
    scheduleGeneration.generateScheduledDatesThrough(startDate, throughDate, scheduledEvent, false);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 54 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class HolidayAndWorkingDaysAndMoratoriaScheduledDateGenerationTest method shouldNotGoIntoRecursiveLoopWhenThroughDateOccursMoreThanTenPeriodsFromStartDate.

@Test
public void shouldNotGoIntoRecursiveLoopWhenThroughDateOccursMoreThanTenPeriodsFromStartDate() {
    MeetingBO meeting = new MeetingBuilder().customerMeeting().weekly().every(1).build();
    ScheduledEvent scheduledEvent = ScheduledEventFactory.createScheduledEventFrom(meeting);
    DateTime startDate = new DateTime().withYear(2010).withMonthOfYear(4).withDayOfMonth(1).toDateMidnight().toDateTime();
    DateTime throughDate = new DateTime().withYear(2010).withMonthOfYear(6).withDayOfMonth(21).toDateMidnight().toDateTime();
    scheduleGeneration.generateScheduledDatesThrough(startDate, throughDate, scheduledEvent, false);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 55 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class LoanAdjustmentsIntegrationTest method createLoan.

private LoanBO createLoan() throws Exception {
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
    center = new CenterBuilder().with(weeklyMeeting).withName("Center").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
    IntegrationTestObjectMother.createCenter(center, weeklyMeeting);
    group = new GroupBuilder().withMeeting(weeklyMeeting).withName("Group").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(center).build();
    IntegrationTestObjectMother.createGroup(group, weeklyMeeting);
    client = new ClientBuilder().withMeeting(weeklyMeeting).withName("Client").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
    IntegrationTestObjectMother.createClient(client, weeklyMeeting);
    LoanOfferingBO loanOffering = new LoanProductBuilder().withName("Adjust Loan Product").withMeeting(weeklyMeeting).buildForIntegrationTests();
    IntegrationTestObjectMother.createProduct(loanOffering);
    AmountFeeBO periodicFee = new FeeBuilder().appliesToLoans().periodic().withFeeAmount("10.0").withName("Periodic Fee").with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(periodicFee);
    BigDecimal loanAmount = BigDecimal.valueOf(Double.valueOf("1000.0"));
    BigDecimal minAllowedLoanAmount = loanAmount;
    BigDecimal maxAllowedLoanAmount = loanAmount;
    Double interestRate = loanOffering.getDefInterestRate();
    LocalDate disbursementDate = new LocalDate();
    int numberOfInstallments = 10;
    int minAllowedNumberOfInstallments = loanOffering.getEligibleInstallmentSameForAllLoan().getMaxNoOfInstall();
    int maxAllowedNumberOfInstallments = loanOffering.getEligibleInstallmentSameForAllLoan().getMaxNoOfInstall();
    int graceDuration = 0;
    Integer sourceOfFundId = null;
    Integer loanPurposeId = null;
    Integer collateralTypeId = null;
    String collateralNotes = null;
    String externalId = null;
    boolean repaymentScheduleIndependentOfCustomerMeeting = false;
    RecurringSchedule recurringSchedule = null;
    List<CreateAccountFeeDto> accountFees = new ArrayList<CreateAccountFeeDto>();
    accountFees.add(new CreateAccountFeeDto(periodicFee.getFeeId().intValue(), periodicFee.getFeeAmount().toString()));
    CreateLoanAccount createLoanAccount = new CreateLoanAccount(client.getCustomerId(), loanOffering.getPrdOfferingId().intValue(), AccountState.LOAN_ACTIVE_IN_GOOD_STANDING.getValue().intValue(), loanAmount, minAllowedLoanAmount, maxAllowedLoanAmount, interestRate, disbursementDate, null, numberOfInstallments, minAllowedNumberOfInstallments, maxAllowedNumberOfInstallments, graceDuration, sourceOfFundId, loanPurposeId, collateralTypeId, collateralNotes, externalId, repaymentScheduleIndependentOfCustomerMeeting, recurringSchedule, accountFees, new ArrayList<CreateAccountPenaltyDto>());
    return IntegrationTestObjectMother.createClientLoan(createLoanAccount);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) GroupBuilder(org.mifos.domain.builders.GroupBuilder) LoanProductBuilder(org.mifos.domain.builders.LoanProductBuilder) ArrayList(java.util.ArrayList) CenterBuilder(org.mifos.domain.builders.CenterBuilder) LocalDate(org.joda.time.LocalDate) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) BigDecimal(java.math.BigDecimal) FeeBuilder(org.mifos.domain.builders.FeeBuilder) RecurringSchedule(org.mifos.clientportfolio.loan.service.RecurringSchedule) CreateLoanAccount(org.mifos.clientportfolio.newloan.applicationservice.CreateLoanAccount) CreateAccountPenaltyDto(org.mifos.dto.domain.CreateAccountPenaltyDto) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) CreateAccountFeeDto(org.mifos.dto.domain.CreateAccountFeeDto) ClientBuilder(org.mifos.domain.builders.ClientBuilder)

Aggregations

MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)106 Test (org.junit.Test)74 MeetingBO (org.mifos.application.meeting.business.MeetingBO)74 CenterBuilder (org.mifos.domain.builders.CenterBuilder)73 DateTime (org.joda.time.DateTime)58 ArrayList (java.util.ArrayList)47 CenterBO (org.mifos.customers.center.business.CenterBO)43 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)38 LocalDate (org.joda.time.LocalDate)27 GroupBuilder (org.mifos.domain.builders.GroupBuilder)24 Before (org.junit.Before)21 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)20 FeeBuilder (org.mifos.domain.builders.FeeBuilder)20 OfficeBO (org.mifos.customers.office.business.OfficeBO)19 ClientBuilder (org.mifos.domain.builders.ClientBuilder)15 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)14 CalendarEventBuilder (org.mifos.domain.builders.CalendarEventBuilder)14 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)13 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)11 Ignore (org.junit.Ignore)10