Search in sources :

Example 31 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.

the class LoanDisbursementActionStrutsTest method getLoanAccountInGoodStanding.

private LoanBO getLoanAccountInGoodStanding(AccountState state, Date startDate, int disbursalType) {
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
    center2 = TestObjectFactory.createWeeklyFeeCenter("Center2", meeting);
    group2 = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group2", CustomerStatus.GROUP_ACTIVE, center2);
    return TestObjectFactory.createLoanAccountWithDisbursement("888888", group2, state, startDate, loanBO.getLoanOffering(), disbursalType);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO)

Example 32 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.

the class BulkEntryActionStrutsTest method testGetLastMeetingDateForCustomer.

@Test
public void testGetLastMeetingDateForCustomer() throws Exception {
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center_Active", meeting);
    setRequestPathInfo("/collectionsheetaction.do");
    addRequestParameter("method", "getLastMeetingDateForCustomer");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("officeId", "3");
    addRequestParameter("loanOfficerId", "1");
    addRequestParameter("customerId", String.valueOf(center.getCustomerId().intValue()));
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(CollectionSheetEntryConstants.COLLECTION_SHEET_ENTRY_FORM_DTO, createDefaultCollectionSheetDto(), request);
    Short officeId = center.getOfficeId();
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward("load_success");
    if (AccountingRules.isBackDatedTxnAllowed()) {
        Assert.assertEquals("The value for isBackDated Trxn Allowed", SessionUtils.getAttribute(CollectionSheetEntryConstants.ISBACKDATEDTRXNALLOWED, request), Constants.YES);
        Assert.assertEquals(new java.sql.Date(DateUtils.getDateWithoutTimeStamp(getMeetingDates(officeId, meeting).getTime()).getTime()).toString(), SessionUtils.getAttribute("LastMeetingDate", request).toString());
        Assert.assertEquals(new java.util.Date(DateUtils.getDateWithoutTimeStamp(getMeetingDates(officeId, meeting).getTime()).getTime()), DateUtils.getDate(((BulkEntryActionForm) request.getSession().getAttribute(CollectionSheetEntryConstants.BULKENTRYACTIONFORM)).getTransactionDate()));
    } else {
        Assert.assertEquals("The value for isBackDated Trxn Allowed", SessionUtils.getAttribute(CollectionSheetEntryConstants.ISBACKDATEDTRXNALLOWED, request), Constants.NO);
        Assert.assertEquals(new java.sql.Date(DateUtils.getDateWithoutTimeStamp(getMeetingDates(officeId, meeting).getTime()).getTime()).toString(), SessionUtils.getAttribute("LastMeetingDate", request).toString());
        Assert.assertEquals(DateUtils.getUserLocaleDate(getUserLocale(request), new java.sql.Date(DateUtils.getCurrentDateWithoutTimeStamp().getTime()).toString()), ((BulkEntryActionForm) request.getSession().getAttribute(CollectionSheetEntryConstants.BULKENTRYACTIONFORM)).getTransactionDate());
    }
}
Also used : BulkEntryActionForm(org.mifos.application.collectionsheet.struts.actionforms.BulkEntryActionForm) MeetingBO(org.mifos.application.meeting.business.MeetingBO) Date(java.util.Date) Date(java.util.Date) Test(org.junit.Test)

Example 33 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.

the class BulkEntryActionStrutsTest method getFailureBulkEntry.

private CollectionSheetEntryGridDto getFailureBulkEntry() throws Exception {
    Date startDate = new Date(System.currentTimeMillis());
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
    client = TestObjectFactory.createClient("Client", CustomerStatus.CLIENT_ACTIVE, group);
    LoanOfferingBO loanOffering1 = TestObjectFactory.createLoanOffering(startDate, meeting);
    LoanOfferingBO loanOffering2 = TestObjectFactory.createLoanOffering("Loan2345", "313f", startDate, meeting);
    groupAccount = TestObjectFactory.createLoanAccount("42423142341", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering1);
    clientAccount = TestObjectFactory.createLoanAccount("3243", client, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering2);
    MeetingBO meetingIntCalc = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    MeetingBO meetingIntPost = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    SavingsOfferingBO savingsOffering = TestObjectFactory.createSavingsProduct("SavingPrd123c", "ased", ApplicableTo.GROUPS, startDate, PrdStatus.SAVINGS_ACTIVE, 300.0, RecommendedAmountUnit.PER_INDIVIDUAL, 1.2, 200.0, 200.0, SavingsType.VOLUNTARY, InterestCalcType.MINIMUM_BALANCE, meetingIntCalc, meetingIntPost);
    SavingsOfferingBO savingsOffering1 = TestObjectFactory.createSavingsProduct("SavingPrd1we", "vbgr", ApplicableTo.GROUPS, startDate, PrdStatus.SAVINGS_ACTIVE, 300.0, RecommendedAmountUnit.PER_INDIVIDUAL, 1.2, 200.0, 200.0, SavingsType.VOLUNTARY, InterestCalcType.MINIMUM_BALANCE, meetingIntCalc, meetingIntPost);
    centerSavingsAccount = TestObjectFactory.createSavingsAccount("432434", center, Short.valueOf("16"), startDate, savingsOffering);
    clientSavingsAccount = TestObjectFactory.createSavingsAccount("432434", client, Short.valueOf("16"), startDate, savingsOffering1);
    CollectionSheetEntryDto bulkEntryParent = new CollectionSheetEntryDto(getCusomerView(center), null);
    bulkEntryParent.addSavingsAccountDetail(getSavingsAccountView(centerSavingsAccount));
    bulkEntryParent.setCustomerAccountDetails(getCustomerAccountView(center));
    CollectionSheetEntryDto bulkEntryChild = new CollectionSheetEntryDto(getCusomerView(group), null);
    LoanAccountDto groupLoanAccountView = getLoanAccountView(groupAccount);
    bulkEntryChild.addLoanAccountDetails(groupLoanAccountView);
    bulkEntryChild.setCustomerAccountDetails(getCustomerAccountView(group));
    CollectionSheetEntryDto bulkEntrySubChild = new CollectionSheetEntryDto(getCusomerView(client), null);
    LoanAccountDto clientLoanAccountView = getLoanAccountView(clientAccount);
    bulkEntrySubChild.addLoanAccountDetails(clientLoanAccountView);
    bulkEntrySubChild.addSavingsAccountDetail(getSavingsAccountView(clientSavingsAccount));
    bulkEntrySubChild.setCustomerAccountDetails(getCustomerAccountView(client));
    bulkEntryChild.addChildNode(bulkEntrySubChild);
    bulkEntryParent.addChildNode(bulkEntryChild);
    bulkEntryChild.getLoanAccountDetails().get(0).setEnteredAmount("100.0");
    bulkEntryChild.getLoanAccountDetails().get(0).setPrdOfferingId(groupLoanAccountView.getPrdOfferingId());
    bulkEntrySubChild.getLoanAccountDetails().get(0).setEnteredAmount("100.0");
    bulkEntrySubChild.getLoanAccountDetails().get(0).setPrdOfferingId(clientLoanAccountView.getPrdOfferingId());
    ProductDto loanOfferingDto = new ProductDto(loanOffering1.getPrdOfferingId(), loanOffering1.getPrdOfferingShortName());
    ProductDto loanOfferingDto2 = new ProductDto(loanOffering2.getPrdOfferingId(), loanOffering2.getPrdOfferingShortName());
    List<ProductDto> loanProducts = Arrays.asList(loanOfferingDto, loanOfferingDto2);
    ProductDto savingsOfferingDto = new ProductDto(savingsOffering.getPrdOfferingId(), savingsOffering.getPrdOfferingShortName());
    List<ProductDto> savingsProducts = Arrays.asList(savingsOfferingDto);
    final PersonnelDto loanOfficer = getPersonnelView(center.getPersonnel());
    final OfficeDetailsDto officeDetailsDto = null;
    final List<CustomValueListElementDto> attendanceTypesList = new ArrayList<CustomValueListElementDto>();
    bulkEntryParent.setCountOfCustomers(3);
    final CollectionSheetEntryGridDto bulkEntry = new CollectionSheetEntryGridDto(bulkEntryParent, loanOfficer, officeDetailsDto, getPaymentTypeView(), startDate, "324343242", startDate, loanProducts, savingsProducts, attendanceTypesList);
    return bulkEntry;
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomValueListElementDto(org.mifos.application.master.business.CustomValueListElementDto) ArrayList(java.util.ArrayList) LoanAccountDto(org.mifos.accounts.loan.util.helpers.LoanAccountDto) PersonnelDto(org.mifos.dto.domain.PersonnelDto) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) Date(java.util.Date) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) CollectionSheetEntryDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryDto) LoanAccountsProductDto(org.mifos.accounts.loan.util.helpers.LoanAccountsProductDto) ProductDto(org.mifos.application.servicefacade.ProductDto) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)

Example 34 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.

the class BulkEntryActionStrutsTest method testLoadCustomers.

@SuppressWarnings("unchecked")
@Test
public void testLoadCustomers() throws PageExpiredException {
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center_Active", meeting);
    setRequestPathInfo("/collectionsheetaction.do");
    addRequestParameter("method", "loadCustomerList");
    addRequestParameter("officeId", "3");
    addRequestParameter("loanOfficerId", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(CollectionSheetEntryConstants.COLLECTION_SHEET_ENTRY_FORM_DTO, createDefaultCollectionSheetDto(), request);
    actionPerform();
    verifyForward("load_success");
    List<CustomerDto> parentCustomerList = (List<CustomerDto>) SessionUtils.getAttribute(CollectionSheetEntryConstants.CUSTOMERSLIST, request);
    Assert.assertEquals(1, parentCustomerList.size());
    Assert.assertEquals("The value for isCenter Hierarchy Exists", SessionUtils.getAttribute(CollectionSheetEntryConstants.ISCENTERHIERARCHYEXISTS, request), Constants.YES);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomerDto(org.mifos.dto.domain.CustomerDto) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 35 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.

the class BulkEntryDisplayHelperIntegrationTest method createBulkEntry.

private CollectionSheetEntryGridDto createBulkEntry() throws Exception {
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    Date startDate = new Date(System.currentTimeMillis());
    center = TestObjectFactory.createWeeklyFeeCenter(this.getClass().getSimpleName() + " Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter(this.getClass().getSimpleName() + " Group", CustomerStatus.GROUP_ACTIVE, center);
    client = TestObjectFactory.createClient(this.getClass().getSimpleName() + " Client", CustomerStatus.CLIENT_ACTIVE, group);
    LoanOfferingBO loanOffering1 = TestObjectFactory.createLoanOffering(startDate, meeting);
    LoanOfferingBO loanOffering2 = TestObjectFactory.createLoanOffering("Loan2345", "313f", startDate, meeting);
    groupAccount = TestObjectFactory.createLoanAccount("42423142341", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering1);
    clientAccount = getLoanAccount(AccountState.LOAN_APPROVED, startDate, loanOffering2);
    java.util.Date currentDate = new java.util.Date(System.currentTimeMillis());
    SavingsOfferingBO savingsOffering1 = TestObjectFactory.createSavingsProduct("SavingPrd1", "ased", currentDate, RecommendedAmountUnit.COMPLETE_GROUP);
    SavingsOfferingBO savingsOffering2 = TestObjectFactory.createSavingsProduct("SavingPrd2", "cvdf", currentDate, RecommendedAmountUnit.COMPLETE_GROUP);
    SavingsOfferingBO savingsOffering3 = TestObjectFactory.createSavingsProduct("SavingPrd3", "zxsd", currentDate, RecommendedAmountUnit.COMPLETE_GROUP);
    centerSavingsAccount = TestObjectFactory.createSavingsAccount("43244334", center, Short.valueOf("16"), startDate, savingsOffering1);
    groupSavingsAccount = TestObjectFactory.createSavingsAccount("43234434", group, Short.valueOf("16"), startDate, savingsOffering2);
    clientSavingsAccount = TestObjectFactory.createSavingsAccount("43245434", client, Short.valueOf("16"), startDate, savingsOffering3);
    CollectionSheetEntryDto bulkEntryParent = new CollectionSheetEntryDto(getCusomerView(center), TestUtils.RUPEE);
    SavingsAccountDto centerSavingsAccountView = getSavingsAccountView(centerSavingsAccount);
    centerSavingsAccountView.setDepositAmountEntered("100");
    centerSavingsAccountView.setWithDrawalAmountEntered("10");
    bulkEntryParent.addSavingsAccountDetail(centerSavingsAccountView);
    bulkEntryParent.setCustomerAccountDetails(getCustomerAccountView(center));
    CollectionSheetEntryDto bulkEntryChild = new CollectionSheetEntryDto(getCusomerView(group), TestUtils.RUPEE);
    LoanAccountDto groupLoanAccountView = getLoanAccountView(groupAccount);
    SavingsAccountDto groupSavingsAccountView = getSavingsAccountView(groupSavingsAccount);
    groupSavingsAccountView.setDepositAmountEntered("100");
    groupSavingsAccountView.setWithDrawalAmountEntered("10");
    bulkEntryChild.addLoanAccountDetails(groupLoanAccountView);
    bulkEntryChild.addSavingsAccountDetail(groupSavingsAccountView);
    bulkEntryChild.setCustomerAccountDetails(getCustomerAccountView(group));
    CollectionSheetEntryDto bulkEntrySubChild = new CollectionSheetEntryDto(getCusomerView(client), TestUtils.RUPEE);
    LoanAccountDto clientLoanAccountView = getLoanAccountView(clientAccount);
    clientLoanAccountView.setAmountPaidAtDisbursement(0.0);
    SavingsAccountDto clientSavingsAccountView = getSavingsAccountView(clientSavingsAccount);
    clientSavingsAccountView.setDepositAmountEntered("100");
    clientSavingsAccountView.setWithDrawalAmountEntered("10");
    bulkEntrySubChild.addLoanAccountDetails(clientLoanAccountView);
    bulkEntrySubChild.setAttendence(new Short("2"));
    bulkEntrySubChild.addSavingsAccountDetail(clientSavingsAccountView);
    bulkEntrySubChild.setCustomerAccountDetails(getCustomerAccountView(client));
    bulkEntryChild.addChildNode(bulkEntrySubChild);
    bulkEntryParent.addChildNode(bulkEntryChild);
    bulkEntryChild.getLoanAccountDetails().get(0).setPrdOfferingId(groupLoanAccountView.getPrdOfferingId());
    bulkEntryChild.getLoanAccountDetails().get(0).setEnteredAmount("100.0");
    bulkEntrySubChild.getLoanAccountDetails().get(0).setDisBursementAmountEntered(clientAccount.getLoanAmount().toString());
    bulkEntrySubChild.getLoanAccountDetails().get(0).setPrdOfferingId(clientLoanAccountView.getPrdOfferingId());
    ProductDto loanOfferingDto = new ProductDto(loanOffering1.getPrdOfferingId(), loanOffering1.getPrdOfferingShortName());
    ProductDto loanOfferingDto2 = new ProductDto(loanOffering2.getPrdOfferingId(), loanOffering2.getPrdOfferingShortName());
    List<ProductDto> loanProducts = Arrays.asList(loanOfferingDto, loanOfferingDto2);
    ProductDto savingOfferingDto = new ProductDto(savingsOffering1.getPrdOfferingId(), savingsOffering1.getPrdOfferingShortName());
    ProductDto savingOfferingDto2 = new ProductDto(savingsOffering2.getPrdOfferingId(), savingsOffering2.getPrdOfferingShortName());
    ProductDto savingOfferingDto3 = new ProductDto(savingsOffering3.getPrdOfferingId(), savingsOffering3.getPrdOfferingShortName());
    List<ProductDto> savingsProducts = Arrays.asList(savingOfferingDto, savingOfferingDto2, savingOfferingDto3);
    final PersonnelDto loanOfficer = getPersonnelView(center.getPersonnel());
    final OfficeDetailsDto officeDetailsDto = null;
    final List<CustomValueListElementDto> attendanceTypesList = new ArrayList<CustomValueListElementDto>();
    CollectionSheetEntryGridDto bulkEntry = new CollectionSheetEntryGridDto(bulkEntryParent, loanOfficer, officeDetailsDto, getPaymentTypeView(), new java.util.Date(), "324343242", new java.util.Date(), loanProducts, savingsProducts, attendanceTypesList);
    return bulkEntry;
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomValueListElementDto(org.mifos.application.master.business.CustomValueListElementDto) ArrayList(java.util.ArrayList) LoanAccountDto(org.mifos.accounts.loan.util.helpers.LoanAccountDto) PersonnelDto(org.mifos.dto.domain.PersonnelDto) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) Date(java.sql.Date) SavingsAccountDto(org.mifos.accounts.savings.util.helpers.SavingsAccountDto) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) CollectionSheetEntryDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryDto) ProductDto(org.mifos.application.servicefacade.ProductDto) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)

Aggregations

MeetingBO (org.mifos.application.meeting.business.MeetingBO)355 Test (org.junit.Test)176 Date (java.util.Date)91 ArrayList (java.util.ArrayList)84 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)74 DateTime (org.joda.time.DateTime)68 LocalDate (org.joda.time.LocalDate)56 Money (org.mifos.framework.util.helpers.Money)56 CenterBuilder (org.mifos.domain.builders.CenterBuilder)54 CenterBO (org.mifos.customers.center.business.CenterBO)46 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)44 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)42 Date (java.sql.Date)40 UserContext (org.mifos.security.util.UserContext)34 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)33 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)30 OfficeBO (org.mifos.customers.office.business.OfficeBO)27 CustomerBO (org.mifos.customers.business.CustomerBO)23 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)22 MifosUser (org.mifos.security.MifosUser)20