Search in sources :

Example 11 with EditLoanAccountStatusParameters

use of org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters in project head by mifos.

the class CreateGLIMLoanAccountTest method checkGLIMLoanCreatedBySubmitForApproval.

/*
     * This test is to verify that you can edit a GLIM loan account after it has been
     * dibursed without getting an invalid disbursal date error. See MIFOS-2597.
     */
// http://mifosforge.jira.com/browse/MIFOSTEST-132
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
//TODO http://mifosforge.jira.com/browse/MIFOS-5081
@Test(enabled = false)
public void checkGLIMLoanCreatedBySubmitForApproval() throws Exception {
    //Given
    applicationDatabaseOperation.updateGLIM(1);
    DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
    DateTime targetTime = new DateTime(2011, 03, 1, 13, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    //When
    ClientsAndAccountsHomepage clientsAndAccountsHomepage = navigationHelper.navigateToClientsAndAccountsPage();
    CreateLoanAccountSearchPage createLoanAccountSearchPage = clientsAndAccountsHomepage.navigateToCreateLoanAccountUsingLeftMenu();
    CreateLoanAccountSearchParameters formParameters = new CreateLoanAccountSearchParameters();
    formParameters.setSearchString("Default Group");
    formParameters.setLoanProduct("WeeklyGroupFlatLoanWithOnetimeFee");
    CreateLoanAccountEntryPage createLoanAccountEntryPage = createLoanAccountSearchPage.searchAndNavigateToCreateLoanAccountPage(formParameters);
    createLoanAccountEntryPage.navigateToReviewInstallmentsPage();
    verifyGLIMErrorMessage();
    createLoanAccountEntryPage.setDisbursalDate(new DateTime(2011, 3, 04, 15, 0, 0, 0));
    createLoanAccountEntryPage.selectGLIMClients(0, "Stu1233266299995 Client1233266299995 Client Id: 0002-000000012", "9999.9", "0009-Horse");
    createLoanAccountEntryPage.selectGLIMClients(1, "Stu1233266309851 Client1233266309851 Client Id: 0002-000000013", "9999.9", "0001-Cow Purchase");
    createLoanAccountEntryPage.selectGLIMClients(2, "Stu1233266319760 Client1233266319760 Client Id: 0002-000000014", "9999.9", "0003-Goat Purchase");
    createLoanAccountEntryPage.selectGLIMClients(3, "Holiday TestClient Client Id: 0002-000000023", "9999.9", "0003-Goat Purchase");
    selectAdditionalFees();
    CreateLoanAccountReviewInstallmentPage createLoanAccountReviewInstallmentPage = createLoanAccountEntryPage.navigateToReviewInstallmentsPage();
    verifyFirstInstallmentAndDisbursalDateOnReviewPage();
    verifyAdditionalFeesOnReviewPage();
    CreateLoanAccountPreviewPage createLoanAccountPreviewPage = createLoanAccountReviewInstallmentPage.clickPreviewAndGoToReviewLoanAccountPage();
    verifyFirstInstallmentAndDisbursalDateOnPreviewPage();
    CreateLoanAccountConfirmationPage createLoanAccountConfirmationPage = createLoanAccountPreviewPage.submitForApprovalAndNavigateToConfirmationPage();
    LoanAccountPage loanAccountPage = createLoanAccountConfirmationPage.navigateToLoanAccountDetailsPage();
    String loanId = loanAccountPage.getAccountId();
    loanAccountPage.verifyLoanIsPendingApproval();
    loanAccountPage.verifyNumberOfInstallments("4");
    loanAccountPage.verifyDisbursalDate("04/03/2011");
    loanAccountPage.verifyPrincipalOriginal("39999.6");
    loanAccountPage.verifyLoanTotalBalance("41147.0");
    loanAccountPage.verifyFeesOriginal("410.0");
    loanAccountPage.verifyInterestOriginal("737.4");
    verifyFees();
    ViewRepaymentSchedulePage viewRepaymentSchedulePage = loanAccountPage.navigateToViewRepaymentSchedule();
    viewRepaymentSchedulePage.verifyRepaymentScheduleTableDueDate(3, "11-Mar-2011");
    viewRepaymentSchedulePage.verifyRepaymentScheduleTableDueDate(4, "18-Mar-2011");
    viewRepaymentSchedulePage.verifyRepaymentScheduleTableDueDate(5, "25-Mar-2011");
    viewRepaymentSchedulePage.verifyRepaymentScheduleTableDueDate(6, "01-Apr-2011");
    viewRepaymentSchedulePage.verifyRepaymentScheduleTablePrincipal(3, "9999.9");
    viewRepaymentSchedulePage.verifyRepaymentScheduleTablePrincipal(4, "9999.9");
    viewRepaymentSchedulePage.verifyRepaymentScheduleTablePrincipal(5, "9999.9");
    viewRepaymentSchedulePage.verifyRepaymentScheduleTablePrincipal(6, "9999.9");
    viewRepaymentSchedulePage.verifyRepaymentScheduleTableFees(3, "110.0");
    viewRepaymentSchedulePage.verifyRepaymentScheduleTableFees(4, "100.0");
    viewRepaymentSchedulePage.verifyRepaymentScheduleTableFees(5, "100.0");
    viewRepaymentSchedulePage.verifyRepaymentScheduleTableFees(6, "100.0");
    viewRepaymentSchedulePage.navigateToLoanAccountPage();
    loanId = loanAccountPage.getAccountId();
    dateTimeUpdaterRemoteTestingService.setDateTime(new LocalDate(2011, 3, 8).toDateTimeAtStartOfDay());
    EditLoanAccountStatusParameters statusParameters = new EditLoanAccountStatusParameters();
    statusParameters.setStatus(EditLoanAccountStatusParameters.APPROVED);
    statusParameters.setNote("Test");
    loanTestHelper.changeLoanAccountStatus(loanId, statusParameters);
    DisburseLoanParameters params = new DisburseLoanParameters();
    params.setDisbursalDateDD("8");
    params.setDisbursalDateMM("3");
    params.setDisbursalDateYYYY("2011");
    params.setPaymentType(DisburseLoanParameters.CASH);
    loanTestHelper.disburseLoan(loanId, params);
    dateTimeUpdaterRemoteTestingService.setDateTime(new LocalDate(2011, 3, 15).toDateTimeAtStartOfDay());
    EditLoanAccountInformationParameters editLoanAccountInformationParameters = new EditLoanAccountInformationParameters();
    editLoanAccountInformationParameters.setExternalID("ID2323ID");
    loanTestHelper.changeLoanAccountInformation(loanId, new CreateLoanAccountSubmitParameters(), editLoanAccountInformationParameters);
    applicationDatabaseOperation.updateGLIM(0);
}
Also used : EditLoanAccountStatusParameters(org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters) DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) ViewRepaymentSchedulePage(org.mifos.test.acceptance.framework.loan.ViewRepaymentSchedulePage) CreateLoanAccountSearchPage(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchPage) EditLoanAccountInformationParameters(org.mifos.test.acceptance.framework.loan.EditLoanAccountInformationParameters) LocalDate(org.joda.time.LocalDate) DateTime(org.joda.time.DateTime) CreateLoanAccountPreviewPage(org.mifos.test.acceptance.framework.loan.CreateLoanAccountPreviewPage) ClientsAndAccountsHomepage(org.mifos.test.acceptance.framework.ClientsAndAccountsHomepage) CreateLoanAccountConfirmationPage(org.mifos.test.acceptance.framework.loan.CreateLoanAccountConfirmationPage) CreateLoanAccountSubmitParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSubmitParameters) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) EditPreviewLoanAccountPage(org.mifos.test.acceptance.framework.loan.EditPreviewLoanAccountPage) DateTimeUpdaterRemoteTestingService(org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService) CreateLoanAccountReviewInstallmentPage(org.mifos.test.acceptance.framework.loan.CreateLoanAccountReviewInstallmentPage) CreateLoanAccountEntryPage(org.mifos.test.acceptance.framework.loan.CreateLoanAccountEntryPage) Test(org.testng.annotations.Test)

Example 12 with EditLoanAccountStatusParameters

use of org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters in project head by mifos.

the class ClientLoanStatusHistoryTest method approvedToRejected.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void approvedToRejected() throws Exception {
    EditLoanAccountStatusParameters params = new EditLoanAccountStatusParameters();
    params.setStatus(EditLoanAccountStatusParameters.CANCEL);
    params.setCancelReason("Rejected");
    params.setNote("Test");
    loanTestHelper.changeLoanAccountStatus(ACCOUNT_APPROVED_ID, params);
    loanTestHelper.verifyLastEntryInStatusHistory(ACCOUNT_APPROVED_ID, EditLoanAccountStatusParameters.APPROVED, EditLoanAccountStatusParameters.CANCEL);
}
Also used : EditLoanAccountStatusParameters(org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters)

Example 13 with EditLoanAccountStatusParameters

use of org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters in project head by mifos.

the class LoanAccountPerformanceHistoryTest method repayMultipleLoansAndVerifyPerformanceHistory.

// http://mifosforge.jira.com/browse/MIFOSTEST-359
@Test(enabled = true)
// one of the dependent methods throws Exception
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void repayMultipleLoansAndVerifyPerformanceHistory() throws Exception {
    //Given
    CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters();
    CreateLoanAccountSubmitParameters submitAccountParameters = new CreateLoanAccountSubmitParameters();
    searchParameters.setLoanProduct("WeeklyClientFlatLoanWithNoFee");
    searchParameters.setSearchString("WeeklyOld Monday");
    submitAccountParameters.setInterestRate("24.0");
    submitAccountParameters.setNumberOfInstallments("10");
    submitAccountParameters.setLoanPurpose("0008-Animal Trading");
    DisburseLoanParameters disburseParameters = new DisburseLoanParameters();
    disburseParameters.setDisbursalDateDD("04");
    disburseParameters.setDisbursalDateMM("03");
    disburseParameters.setDisbursalDateYYYY("2011");
    disburseParameters.setPaymentType(PaymentParameters.CASH);
    PerformanceHistoryAtributes performanceHistoryAtributes = new PerformanceHistoryAtributes();
    performanceHistoryAtributes.setDelinquentPortfolio(0.0);
    //When
    Map<String, String> loanIds = new HashMap<String, String>();
    submitAccountParameters.setAmount("2000.0");
    loanIds.put(submitAccountParameters.getAmount(), loanTestHelper.createLoanAccount(searchParameters, submitAccountParameters).getAccountId());
    performanceHistoryAtributes.incrementLoanCycle();
    performanceHistoryAtributes.incrementLoanCycleForProduct(searchParameters.getLoanProduct());
    submitAccountParameters.setAmount("3000.0");
    loanIds.put(submitAccountParameters.getAmount(), loanTestHelper.createLoanAccount(searchParameters, submitAccountParameters).getAccountId());
    performanceHistoryAtributes.incrementLoanCycle();
    performanceHistoryAtributes.incrementLoanCycleForProduct(searchParameters.getLoanProduct());
    submitAccountParameters.setAmount("5000.0");
    searchParameters.setLoanProduct("AnotherWeeklyClientFlatLoanWithNoFee");
    loanIds.put(submitAccountParameters.getAmount(), loanTestHelper.createLoanAccount(searchParameters, submitAccountParameters).getAccountId());
    performanceHistoryAtributes.incrementLoanCycle();
    performanceHistoryAtributes.incrementLoanCycleForProduct(searchParameters.getLoanProduct());
    EditLoanAccountStatusParameters params = new EditLoanAccountStatusParameters();
    params.setStatus(EditLoanAccountStatusParameters.APPROVED);
    params.setNote("Approved.");
    Set<String> amounts = loanIds.keySet();
    for (String accountid : loanIds.values()) {
        loanTestHelper.changeLoanAccountStatus(accountid, params);
        loanTestHelper.disburseLoan(accountid, disburseParameters);
        performanceHistoryAtributes.incrementNoOfActiveLoan();
    }
    //Then
    for (String amount : amounts) {
        loanTestHelper.repayLoan(loanIds.get(amount));
        String lastLoan = amount.substring(0, amount.length() - 2);
        lastLoan = lastLoan.substring(0, 1) + "," + lastLoan.substring(1);
        performanceHistoryAtributes.setAmountOfLastLoan(lastLoan);
        performanceHistoryAtributes.decrementNoOfActiveLoan();
        loanTestHelper.verifyPerformenceHistory(searchParameters.getSearchString(), performanceHistoryAtributes);
    }
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) EditLoanAccountStatusParameters(org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters) CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) HashMap(java.util.HashMap) CreateLoanAccountSubmitParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSubmitParameters) PerformanceHistoryAtributes(org.mifos.test.acceptance.framework.loan.PerformanceHistoryAtributes) Test(org.testng.annotations.Test)

Example 14 with EditLoanAccountStatusParameters

use of org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters in project head by mifos.

the class LoanTestHelper method setApprovedStatusParameters.

public EditLoanAccountStatusParameters setApprovedStatusParameters() {
    EditLoanAccountStatusParameters loanAccountStatusParameters = new EditLoanAccountStatusParameters();
    loanAccountStatusParameters.setStatus(EditLoanAccountStatusParameters.APPROVED);
    loanAccountStatusParameters.setNote("test notes");
    return loanAccountStatusParameters;
}
Also used : EditLoanAccountStatusParameters(org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters)

Example 15 with EditLoanAccountStatusParameters

use of org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters in project head by mifos.

the class ApplyPaymentOnGLIMLoanAccountTest method checkApplyPaymentOnGLIMLoanAccount.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(enabled = true)
public void checkApplyPaymentOnGLIMLoanAccount() throws Exception {
    LoanAccountPage loanAccountPage = createNewLoan();
    AccountChangeStatusPage accountChangeStatusPage = loanAccountPage.navigateToEditAccountStatus();
    EditLoanAccountStatusParameters params = new EditLoanAccountStatusParameters();
    params.setNote("asd");
    params.setStatus(EditLoanAccountStatusParameters.APPROVED);
    loanAccountPage = accountChangeStatusPage.submitAndNavigateToNextPage(params).submitAndNavigateToLoanAccountPage();
    DisburseLoanParameters disburseParams = new DisburseLoanParameters();
    disburseParams.setDisbursalDateDD("04");
    disburseParams.setDisbursalDateMM("03");
    disburseParams.setDisbursalDateYYYY("2011");
    disburseParams.setPaymentType(DisburseLoanParameters.CASH);
    loanAccountPage = loanAccountPage.disburseLoan(disburseParams);
    ApplyGroupPaymentPage applyGroupPaymentPage = loanAccountPage.navigateToApplyGroupPayment();
    applyGroupPaymentPage.setAmount("140");
    applyGroupPaymentPage.verifyIndividualAmount(0, "20.0");
    applyGroupPaymentPage.verifyIndividualAmount(1, "40.0");
    applyGroupPaymentPage.verifyIndividualAmount(2, "80.0");
    //principal 25, less
    applyGroupPaymentPage.setIndividualAmount(0, "20");
    //principal 50, equal
    applyGroupPaymentPage.setIndividualAmount(1, "50");
    //principal 100, more
    applyGroupPaymentPage.setIndividualAmount(2, "120");
    applyGroupPaymentPage.verifyAmount("190");
    applyGroupPaymentPage.setPaymentMethod("1");
    applyGroupPaymentPage.setDate("04", "03", "2011");
    ApplyGroupPaymentConfirmationPage applyGroupPaymentConfirmation = applyGroupPaymentPage.submit();
    loanAccountPage = applyGroupPaymentConfirmation.submitAndNavigateToLoanAccountDetailsPage();
    ViewRepaymentSchedulePage viewRepaymentSchedulePage = loanAccountPage.navigateToViewRepaymentSchedule();
    verifyRepaymentScheduleInstallmentsPaid(viewRepaymentSchedulePage, EXPECTED_PAID_INSTALLMENTS);
    loanAccountPage = viewRepaymentSchedulePage.navigateToLoanAccountPage();
    for (int i = 0; i <= 2; i += 1) {
        viewRepaymentSchedulePage = loanAccountPage.navigateToIndividualRepaymentSchedulePage(i);
        verifyRepaymentScheduleInstallmentsPaid(viewRepaymentSchedulePage, INDIVIDUAL_EXPECTED_PAID_INSTALLMENTS[i]);
        loanAccountPage = viewRepaymentSchedulePage.navigateToLoanAccountPage();
    }
    // Test applying payment for last installment
    applyGroupPaymentPage = loanAccountPage.navigateToApplyGroupPayment();
    applyGroupPaymentPage.setPaymentMethod("1");
    applyGroupPaymentPage.setAmount("1500");
    applyGroupPaymentConfirmation = applyGroupPaymentPage.submit();
    loanAccountPage = applyGroupPaymentConfirmation.submitAndNavigateToLoanAccountDetailsPage();
    // Last installment left to payoff whole account
    applyGroupPaymentPage = loanAccountPage.navigateToApplyGroupPayment();
    applyGroupPaymentPage.verifyAmount("60.0");
    applyGroupPaymentPage.verifyIndividualAmount(0, "15.7");
    applyGroupPaymentPage.verifyIndividualAmount(1, "21.4");
    applyGroupPaymentPage.verifyIndividualAmount(2, "22.9");
    applyGroupPaymentPage.setPaymentMethod("1");
    applyGroupPaymentConfirmation = applyGroupPaymentPage.submit();
    loanAccountPage = applyGroupPaymentConfirmation.submitAndNavigateToLoanAccountDetailsPage();
    loanAccountPage.verifyLoanStatus(LoanAccountPage.CLOSED);
}
Also used : EditLoanAccountStatusParameters(org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters) DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) AccountChangeStatusPage(org.mifos.test.acceptance.framework.loan.AccountChangeStatusPage) ViewRepaymentSchedulePage(org.mifos.test.acceptance.framework.loan.ViewRepaymentSchedulePage) ApplyGroupPaymentConfirmationPage(org.mifos.test.acceptance.framework.loan.ApplyGroupPaymentConfirmationPage) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) ApplyGroupPaymentPage(org.mifos.test.acceptance.framework.loan.ApplyGroupPaymentPage) Test(org.testng.annotations.Test)

Aggregations

EditLoanAccountStatusParameters (org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters)18 DisburseLoanParameters (org.mifos.test.acceptance.framework.loan.DisburseLoanParameters)11 CreateLoanAccountSearchParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters)8 LoanAccountPage (org.mifos.test.acceptance.framework.loan.LoanAccountPage)8 Test (org.testng.annotations.Test)7 DateTime (org.joda.time.DateTime)5 CreateLoanAccountEntryPage (org.mifos.test.acceptance.framework.loan.CreateLoanAccountEntryPage)5 DateTimeUpdaterRemoteTestingService (org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService)5 ViewRepaymentSchedulePage (org.mifos.test.acceptance.framework.loan.ViewRepaymentSchedulePage)4 CreateLoanAccountConfirmationPage (org.mifos.test.acceptance.framework.loan.CreateLoanAccountConfirmationPage)3 CreateLoanAccountPreviewPage (org.mifos.test.acceptance.framework.loan.CreateLoanAccountPreviewPage)3 CreateLoanAccountReviewInstallmentPage (org.mifos.test.acceptance.framework.loan.CreateLoanAccountReviewInstallmentPage)3 CreateLoanAccountSubmitParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSubmitParameters)3 EditPreviewLoanAccountPage (org.mifos.test.acceptance.framework.loan.EditPreviewLoanAccountPage)3 LocalDate (org.joda.time.LocalDate)2 ClientsAndAccountsHomepage (org.mifos.test.acceptance.framework.ClientsAndAccountsHomepage)2 AccountChangeStatusPage (org.mifos.test.acceptance.framework.loan.AccountChangeStatusPage)2 CreateLoanAccountSearchPage (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchPage)2 PaymentParameters (org.mifos.test.acceptance.framework.loan.PaymentParameters)2 ArrayList (java.util.ArrayList)1