Search in sources :

Example 26 with DisburseLoanParameters

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

the class DefineNewLoanProductTest method verifyWaiveInterestForLoanAccount.

/*
     * passing locally but not on hudson. 
     */
//http://mifosforge.jira.com/browse/MIFOSTEST-710
@Test(enabled = true)
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyWaiveInterestForLoanAccount() throws Exception {
    //Given
    DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
    DateTime systemDateTime = new DateTime(2011, 3, 7, 12, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(systemDateTime);
    //When
    DefineNewLoanProductPage.SubmitFormParameters formParameters = FormParametersHelper.getWeeklyLoanProductParameters();
    formParameters.setInterestWaiver(true);
    NavigationHelper navigationHelper = new NavigationHelper(selenium);
    AdminPage adminPage = navigationHelper.navigateToAdminPage();
    DefineNewLoanProductPage newLoanProductPage = adminPage.navigateToDefineLoanProduct();
    newLoanProductPage.fillLoanParameters(formParameters);
    DefineNewLoanProductPreviewPage previewPage = newLoanProductPage.submitAndGotoNewLoanProductPreviewPage();
    //Then
    Assert.assertTrue(selenium.isTextPresent("Can waive interest on repay loan: Yes"));
    Assert.assertTrue(selenium.isTextPresent("Interest: 31102"));
    Assert.assertTrue(selenium.isTextPresent("Principal: 1506"));
    //When
    LoanProductDetailsPage loanProductDetailsPage = previewPage.submit().navigateToViewLoanDetailsPage();
    //Then
    Assert.assertTrue(selenium.isTextPresent("Can waive interest on repay loan: Yes"));
    //When
    EditLoanProductPage editLoanProductPage = loanProductDetailsPage.editLoanProduct();
    //Then
    Assert.assertTrue(selenium.isChecked("EditLoanProduct.input.includeInterestWaiver"));
    //When
    EditLoanProductPreviewPage editLoanProductPreviewPage = editLoanProductPage.editSubmit();
    //Then
    Assert.assertTrue(selenium.isTextPresent("Can waive interest on repay loan: Yes"));
    //When
    loanProductDetailsPage = editLoanProductPreviewPage.submit();
    //Then
    Assert.assertTrue(selenium.isTextPresent("Can waive interest on repay loan: Yes"));
    //When
    CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters();
    searchParameters.setSearchString("WeeklyClient Monday");
    searchParameters.setLoanProduct(formParameters.getOfferingName());
    LoanTestHelper loanTestHelper = new LoanTestHelper(selenium);
    LoanAccountPage loanAccountPage = loanTestHelper.createAndActivateDefaultLoanAccount(searchParameters);
    DisburseLoanParameters disburseParameters = new DisburseLoanParameters();
    disburseParameters.setDisbursalDateDD(Integer.toString(systemDateTime.getDayOfMonth()));
    disburseParameters.setDisbursalDateMM(Integer.toString(systemDateTime.getMonthOfYear()));
    disburseParameters.setDisbursalDateYYYY(Integer.toString(systemDateTime.getYear()));
    disburseParameters.setPaymentType(PaymentParameters.CASH);
    loanAccountPage.navigateToDisburseLoan().submitAndNavigateToDisburseLoanConfirmationPage(disburseParameters).submitAndNavigateToLoanAccountPage();
    RepayLoanPage repayLoanPage = loanAccountPage.navigateToRepayLoan();
    //Then
    Assert.assertTrue(selenium.isChecked("waiverInterestChckBox"));
    Assert.assertEquals("Note: Interest due will be waived off.", selenium.getText("waiverInterestWarning"));
    Assert.assertFalse(repayLoanPage.isTotalRepaymentAmountVisible());
    Assert.assertTrue(repayLoanPage.isWaivedRepaymentAmoutVisible());
    Assert.assertEquals(repayLoanPage.waivedRepaymentAmount(), "2,500");
    //When
    repayLoanPage.interestWaiver(false);
    //Then
    Assert.assertTrue(repayLoanPage.isTotalRepaymentAmountVisible());
    Assert.assertFalse(repayLoanPage.isWaivedRepaymentAmoutVisible());
    Assert.assertFalse(selenium.isTextPresent("Note: Interest due will be waived off."));
    Assert.assertEquals(repayLoanPage.totalRepaymentAmount(), "2,509.1");
    //When
    RepayLoanParameters params = new RepayLoanParameters();
    params.setModeOfRepayment("Cash");
    loanAccountPage = repayLoanPage.submitAndNavigateToRepayLoanConfirmationPage(params).submitAndNavigateToLoanAccountDetailsPage();
    //Then
    loanAccountPage.verifyStatus("Closed- Obligation met");
    String[][] accountSummaryTable = { { "", "Original Loan", "Amount paid", "Loan balance" }, { "Principal", "2,500", "2,500", "0" }, { "Interest", "9.1", "9.1", "0" }, { "Fees", "0", "0", "0" }, { "Penalty", "0", "0", "0" }, { "Total", "2,509.1", "2,509.1", "0" } };
    loanAccountPage.verifyAccountSummary(accountSummaryTable);
    loanAccountPage.navigateToAccountActivityPage();
    Assert.assertEquals("Loan Repayment", selenium.getTable("accountActivityTable.2.1").trim());
    Assert.assertEquals("2,500", selenium.getTable("accountActivityTable.2.2").trim());
    Assert.assertEquals("0", selenium.getTable("accountActivityTable.2.10").trim());
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) EditLoanProductPreviewPage(org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPreviewPage) DateTime(org.joda.time.DateTime) DefineNewLoanProductPreviewPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPreviewPage) EditLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage) SubmitFormParameters(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage.SubmitFormParameters) NavigationHelper(org.mifos.test.acceptance.framework.testhelpers.NavigationHelper) LoanProductDetailsPage(org.mifos.test.acceptance.framework.loanproduct.LoanProductDetailsPage) DefineNewLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage) RepayLoanPage(org.mifos.test.acceptance.framework.loan.RepayLoanPage) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) DateTimeUpdaterRemoteTestingService(org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService) RepayLoanParameters(org.mifos.test.acceptance.framework.loan.RepayLoanParameters) LoanTestHelper(org.mifos.test.acceptance.framework.testhelpers.LoanTestHelper) Test(org.testng.annotations.Test)

Example 27 with DisburseLoanParameters

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

the class CreateLSIMClientLoanAccountTest method createWeeklyLoanAccountWithNonMeetingDatesForDisburseAndRepay.

// http://mifosforge.jira.com/browse/MIFOSTEST-121
@Test(enabled = true)
public void createWeeklyLoanAccountWithNonMeetingDatesForDisburseAndRepay() throws Exception {
    //Given
    setTime(2011, 02, 23);
    //When
    DefineNewLoanProductPage.SubmitFormParameters defineNewLoanProductformParameters = FormParametersHelper.getWeeklyLoanProductParameters();
    CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters();
    searchParameters.setSearchString("Stu1233171716380 Client1233171716380");
    searchParameters.setLoanProduct(defineNewLoanProductformParameters.getOfferingName());
    CreateLoanAccountSubmitParameters submitAccountParameters = new CreateLoanAccountSubmitParameters();
    submitAccountParameters = createSearchParameters("23", "02", "2011");
    submitAccountParameters.setLoanPurpose("0008-Animal Trading");
    EditLoanAccountStatusParameters editLoanAccountStatusParameters = new EditLoanAccountStatusParameters();
    editLoanAccountStatusParameters.setStatus(AccountStatus.LOAN_APPROVED.getStatusText());
    editLoanAccountStatusParameters.setNote("activate account");
    DisburseLoanParameters disburseLoanParameters = new DisburseLoanParameters();
    disburseLoanParameters = createDisubreseLoanParameters("24", "02", "2011");
    loanProductTestHelper.defineNewLoanProduct(defineNewLoanProductformParameters);
    String loanId = loanTestHelper.createLoanAccount(searchParameters, submitAccountParameters).getAccountId();
    loanTestHelper.changeLoanAccountStatus(loanId, editLoanAccountStatusParameters);
    //Then
    loanTestHelper.disburseLoanWithWrongParams(loanId, disburseLoanParameters, "Date of transaction can not be a future date.");
    disburseLoanParameters.setDisbursalDateDD("23");
    loanTestHelper.disburseLoan(loanId, disburseLoanParameters);
    //loanTestHelper.disburseLoan(loanId, disburseLoanParameters);
    loanTestHelper.repayLoan(loanId);
}
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) DefineNewLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage) CreateLoanAccountSubmitParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSubmitParameters) Test(org.testng.annotations.Test)

Example 28 with DisburseLoanParameters

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

the class CreateClientLoanAccountTest method createLoanAccountsWithRestrictedProductsMix.

/**
     * Verify a user is prevented to create loan accounts of loan products restricted by the mix.
     * http://mifosforge.jira.com/browse/MIFOSTEST-94
     *
     * @throws Exception
     */
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(enabled = true)
public void createLoanAccountsWithRestrictedProductsMix() throws Exception {
    DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
    DateTime targetTime = new DateTime(2011, 1, 24, 15, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    DefineNewLoanProductPage.SubmitFormParameters productParams = FormParametersHelper.getWeeklyLoanProductParameters();
    productParams.setOfferingName("product94");
    productParams.setOfferingShortName("p94");
    productParams.setDefaultInterestRate("15.3");
    productParams.setMaxInterestRate("50");
    productParams.setInterestTypes(SubmitFormParameters.DECLINING_BALANCE);
    productParams.setDefaultLoanAmount("13333");
    productParams.setDefInstallments("13");
    productParams.setApplicableFor(DefineNewLoanProductPage.SubmitFormParameters.GROUPS);
    loanProductTestHelper.defineNewLoanProduct(productParams);
    productParams.setOfferingName("product94B");
    productParams.setOfferingShortName("p94b");
    loanProductTestHelper.defineNewLoanProduct(productParams);
    CreateLoanAccountSearchParameters searchParams1 = new CreateLoanAccountSearchParameters();
    searchParams1.setSearchString("GroupWeekly");
    searchParams1.setLoanProduct("product94");
    CreateLoanAccountSearchParameters searchParams2 = new CreateLoanAccountSearchParameters();
    searchParams2.setSearchString("GroupWeekly");
    searchParams2.setLoanProduct("product94B");
    DisburseLoanParameters disburseParams = new DisburseLoanParameters();
    disburseParams.setPaymentType(DisburseLoanParameters.CASH);
    disburseParams.setDisbursalDateDD("24");
    disburseParams.setDisbursalDateMM("01");
    disburseParams.setDisbursalDateYYYY("2011");
    String error = "The loan could not be disbursed as " + searchParams1.getLoanProduct() + " and " + searchParams2.getLoanProduct() + " are not allowed to co-exist";
    LoanAccountPage loanAccountPage = loanTestHelper.createTwoLoanAccountsWithMixedRestricedPoducts(searchParams1, searchParams2, disburseParams, new DateTime(2011, 02, 28, 10, 0, 0, 0));
    loanAccountPage.verifyError(error);
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) SubmitFormParameters(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage.SubmitFormParameters) DefineNewLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) DateTimeUpdaterRemoteTestingService(org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService) DateTime(org.joda.time.DateTime) Test(org.testng.annotations.Test)

Example 29 with DisburseLoanParameters

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

the class CreateClientLoanAccountTest method verifyAccountFromProductInstallmentsSame.

/**
     * Verify loan product created with default loan amount and number of installments
     * are "same for all loans" can be used to create new loan accounts with the correct default amounts.
     * http://mifosforge.jira.com/browse/MIFOSTEST-97
     *
     * @throws Exception
     */
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public //CreateClient: weekly, Stu12332659912419 Client12332659912419, monday, activate
void verifyAccountFromProductInstallmentsSame() throws Exception {
    setAppDate(new DateTime(2011, 1, 24, 15, 0, 0, 0));
    DefineNewLoanProductPage.SubmitFormParameters productParams = FormParametersHelper.getWeeklyLoanProductParameters();
    productParams.setOfferingName("ProdTest97");
    productParams.setOfferingShortName("T97");
    productParams.setMinLoanAmount("1000");
    productParams.setMaxLoanAmount("10000");
    productParams.setDefaultLoanAmount("5000");
    productParams.setMinInstallemnts("10");
    productParams.setMaxInstallments("100");
    productParams.setDefInstallments("50");
    CreateLoanAccountSearchParameters searchParams = new CreateLoanAccountSearchParameters();
    searchParams.setSearchString("Stu12332659912419 Client12332659912419");
    searchParams.setLoanProduct("ProdTest97");
    DisburseLoanParameters disburseParams = new DisburseLoanParameters();
    disburseParams.setPaymentType(DisburseLoanParameters.CASH);
    disburseParams.setDisbursalDateDD("24");
    disburseParams.setDisbursalDateMM("01");
    disburseParams.setDisbursalDateYYYY("2011");
    ChargeParameters chargeParameters = new ChargeParameters();
    chargeParameters.setType(ChargeParameters.MISC_FEES);
    chargeParameters.setAmount("599.0");
    LoanAccountPage loanAccountPage = loanTestHelper.createProductAndThenAccount(productParams, searchParams, disburseParams);
    loanAccountPage.verifyNumberOfInstallments("10", "100", "50");
    loanAccountPage.verifyPrincipalBalance("5,000");
    loanTestHelper.applyOneChargeOnLoanAccount(chargeParameters);
    loanAccountPage.navigateToViewInstallmentDetails().verifyInstallmentAmount(4, 1, "599");
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) SubmitFormParameters(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage.SubmitFormParameters) DefineNewLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) DateTime(org.joda.time.DateTime) ChargeParameters(org.mifos.test.acceptance.framework.loan.ChargeParameters)

Example 30 with DisburseLoanParameters

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

the class CreateClientLoanAccountTest method verifyCreatingLoanAccountsOnProductWithLoanCycles.

/**
     * Verify the loan product created with default number of installments
     * by loan cycle can be used to create new loans accounts.
     * http://mifosforge.jira.com/browse/MIFOSTEST-99
     *
     * @throws Exception
     */
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyCreatingLoanAccountsOnProductWithLoanCycles() throws Exception {
    setAppDate(new DateTime(2011, 1, 24, 15, 0, 0, 0));
    DefineNewLoanProductPage.SubmitFormParameters productParams = FormParametersHelper.getWeeklyLoanProductParameters();
    productParams.setOfferingName("ProdTest99");
    productParams.setOfferingShortName("T99");
    productParams.setMinLoanAmount("1000");
    productParams.setMaxLoanAmount("10000");
    productParams.setDefaultLoanAmount("5000");
    productParams.setCalculateInstallments(SubmitFormParameters.BY_LOAN_CYCLE);
    String[][] cycleInstallments = { { "26", "52", "52" }, { "20", "30", "30" }, { "15", "25", "25" }, { "10", "15", "15" }, { "5", "10", "10" }, { "1", "5", "5" } };
    productParams.setCycleInstallments(cycleInstallments);
    CreateLoanAccountSearchParameters searchParams = new CreateLoanAccountSearchParameters();
    searchParams.setSearchString("Stu12332659912419 Client12332659912419");
    searchParams.setLoanProduct("ProdTest99");
    DisburseLoanParameters disburseParams = new DisburseLoanParameters();
    disburseParams.setPaymentType(DisburseLoanParameters.CASH);
    disburseParams.setDisbursalDateDD("24");
    disburseParams.setDisbursalDateMM("01");
    disburseParams.setDisbursalDateYYYY("2011");
    LoanProductDetailsPage loanProductDetailsPage = loanProductTestHelper.defineNewLoanProduct(productParams);
    loanProductDetailsPage.verifyLoanAmountTableTypeSame("1,000", "10,000", "5,000");
    loanProductDetailsPage.verifyInstallmentsTableTypeFromCycle(cycleInstallments);
    LoanAccountPage loanAccountPage = loanTestHelper.createActivateAndDisburseDefaultLoanAccount(searchParams, disburseParams);
    loanAccountPage.verifyNumberOfInstallments("26", "52", "52");
    String loan1ID = loanAccountPage.getAccountId();
    loanTestHelper.repayLoan(loan1ID);
    loanTestHelper.createActivateAndDisburseDefaultLoanAccount(searchParams, disburseParams);
    //extension MIFOSTEST-1186
    loanAccountPage.navigateToViewLoanAccountActivityPage();
    loanAccountPage.verifyPage("ViewLoanAccountActivity");
    Assert.assertEquals(selenium.getTable("accountActivityTable.2.1"), "Loan Disbursal");
    Assert.assertEquals(selenium.getTable("accountActivityTable.2.2"), "5,000");
    Assert.assertEquals(selenium.getTable("accountActivityTable.2.11"), "5,288");
    loanAccountPage.navigateBack();
    loanAccountPage.verifyNumberOfInstallments("20", "30", "30");
    String loan2ID = loanAccountPage.getAccountId();
    loanTestHelper.repayLoan(loan2ID);
    loanTestHelper.createActivateAndDisburseDefaultLoanAccount(searchParams, disburseParams);
    loanAccountPage.verifyNumberOfInstallments("15", "25", "25");
    // extension to verify MIFOS-5005
    DisburseLoanConfirmationPage disburseLoanConfirmationPage = loanTestHelper.createAndActivateDefaultLoanAccount(searchParams).navigateToDisburseLoan().submitAndNavigateToDisburseLoanConfirmationPage(disburseParams);
    disburseLoanConfirmationPage.submitButDisbursalFailed("This loan cannot be disbursed because the customer already has an active loan for this loan product.");
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) SubmitFormParameters(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage.SubmitFormParameters) LoanProductDetailsPage(org.mifos.test.acceptance.framework.loanproduct.LoanProductDetailsPage) DefineNewLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) DateTime(org.joda.time.DateTime) DisburseLoanConfirmationPage(org.mifos.test.acceptance.framework.loan.DisburseLoanConfirmationPage)

Aggregations

DisburseLoanParameters (org.mifos.test.acceptance.framework.loan.DisburseLoanParameters)40 LoanAccountPage (org.mifos.test.acceptance.framework.loan.LoanAccountPage)29 CreateLoanAccountSearchParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters)26 DateTime (org.joda.time.DateTime)15 DefineNewLoanProductPage (org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage)14 Test (org.testng.annotations.Test)14 SubmitFormParameters (org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage.SubmitFormParameters)13 EditLoanAccountStatusParameters (org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters)11 DateTimeUpdaterRemoteTestingService (org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService)10 LoanProductDetailsPage (org.mifos.test.acceptance.framework.loanproduct.LoanProductDetailsPage)8 PaymentParameters (org.mifos.test.acceptance.framework.loan.PaymentParameters)7 ViewRepaymentSchedulePage (org.mifos.test.acceptance.framework.loan.ViewRepaymentSchedulePage)6 CreateLoanAccountEntryPage (org.mifos.test.acceptance.framework.loan.CreateLoanAccountEntryPage)5 EditPreviewLoanAccountPage (org.mifos.test.acceptance.framework.loan.EditPreviewLoanAccountPage)5 CreateLoanAccountSubmitParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSubmitParameters)4 HashMap (java.util.HashMap)3 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 ArrayList (java.util.ArrayList)2