Search in sources :

Example 36 with DisburseLoanParameters

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

the class LoanAccountCycleTest method verifyAmountsByLastAmountAndInstallmentsByCycle.

/**
     * Verify loan amount with number of installments by loan cycle can be used to create new loans.
     * http://mifosforge.jira.com/browse/MIFOSTEST-114
     *
     * @throws Exception
     */
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyAmountsByLastAmountAndInstallmentsByCycle() throws Exception {
    DefineNewLoanProductPage.SubmitFormParameters productParams = FormParametersHelper.getWeeklyLoanProductParameters();
    productParams.setOfferingName("product114");
    productParams.setOfferingShortName("p114");
    productParams.setCalculateLoanAmount(SubmitFormParameters.BY_LAST_LOAN_AMOUNT);
    String[][] lastLoanAmount = getAmountsFromLastAmount();
    productParams.setAmountsByLastLoanAmount(lastLoanAmount);
    productParams.setCalculateInstallments(SubmitFormParameters.BY_LOAN_CYCLE);
    String[][] calculateInstallments = getInstallmentsByCycle();
    productParams.setCycleInstallments(calculateInstallments);
    CreateLoanAccountSearchParameters searchParams = new CreateLoanAccountSearchParameters();
    searchParams.setSearchString("Stu1233171716380 Client1233171716380");
    searchParams.setLoanProduct("product114");
    DisburseLoanParameters disburseParams = DisburseLoanParameters.getDisbursalParameters("25", "02", "2011");
    LoanProductDetailsPage loanProductDetailsPage = loanProductTestHelper.defineNewLoanProduct(productParams);
    loanProductDetailsPage.verifyAmountTableTypeFromLastAmount(lastLoanAmount);
    loanProductDetailsPage.verifyInstallmentsTableTypeFromCycle(calculateInstallments);
    LoanAccountPage loanAccountPage = loanTestHelper.createWithVerificationAndActivationLoanAccount(searchParams, new String[] { "500", "1,500", "1200.0" }, null, new String[] { "26", "52", "52" });
    String loanFirstID = loanAccountPage.getAccountId();
    loanAccountPage.disburseLoan(disburseParams);
    loanTestHelper.createWithVerificationAndActivationLoanAccount(searchParams, new String[] { "500", "1,500", "1200.0" }, null, new String[] { "20", "30", "30" });
    loanTestHelper.repayLoan(loanFirstID);
    loanTestHelper.createWithVerificationAndActivationLoanAccount(searchParams, new String[] { "1,500", "2,500", "2200.0" }, null, new String[] { "20", "30", "30" });
}
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)

Example 37 with DisburseLoanParameters

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

the class LoanAccountCycleTest method verifyAmountByLastAmountAndInstallmentsSameForAll.

/**
     * Verify loan amount with number of installments is same for all loan can be used to create new loans.
     * http://mifosforge.jira.com/browse/MIFOSTEST-112
     *
     * @throws Exception
     */
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyAmountByLastAmountAndInstallmentsSameForAll() throws Exception {
    DefineNewLoanProductPage.SubmitFormParameters productParams = FormParametersHelper.getWeeklyLoanProductParameters();
    productParams.setOfferingName("product112");
    productParams.setOfferingShortName("p112");
    productParams.setCalculateLoanAmount(SubmitFormParameters.BY_LAST_LOAN_AMOUNT);
    String[][] lastLoanAmount = getAmountsFromLastAmount();
    productParams.setAmountsByLastLoanAmount(lastLoanAmount);
    productParams.setMinInstallemnts("10");
    productParams.setMaxInstallments("100");
    productParams.setDefInstallments("50");
    CreateLoanAccountSearchParameters searchParams = new CreateLoanAccountSearchParameters();
    searchParams.setSearchString("Stu1233171716380 Client1233171716380");
    searchParams.setLoanProduct("product112");
    DisburseLoanParameters disburseParams = DisburseLoanParameters.getDisbursalParameters("25", "02", "2011");
    LoanProductDetailsPage loanProductDetailsPage = loanProductTestHelper.defineNewLoanProduct(productParams);
    loanProductDetailsPage.verifyAmountTableTypeFromLastAmount(lastLoanAmount);
    loanProductDetailsPage.verifyInstallments("10", "100", "50");
    LoanAccountPage loanAccountPage = loanTestHelper.createWithVerificationAndActivationLoanAccount(searchParams, new String[] { "500", "1,500", "1200.0" }, null, null);
    String loanFirstID = loanAccountPage.getAccountId();
    loanAccountPage.disburseLoan(disburseParams);
    loanTestHelper.createWithVerificationAndActivationLoanAccount(searchParams, new String[] { "500", "1,500", "1200.0" }, null, null);
    loanTestHelper.repayLoan(loanFirstID);
    loanTestHelper.createWithVerificationAndActivationLoanAccount(searchParams, new String[] { "1,500", "2,500", "2200.0" }, null, null);
}
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)

Example 38 with DisburseLoanParameters

use of org.mifos.test.acceptance.framework.loan.DisburseLoanParameters 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 39 with DisburseLoanParameters

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

the class DecliningPrincipleLoanTest method verifyOverdue.

private void verifyOverdue() throws UnsupportedEncodingException {
    propertiesHelper.setOverdueInterestPaidFirst("true");
    DateTime testDateTime = new DateTime(2010, 10, 12, 0, 0, 0, 0);
    loanTestHelper.setApplicationTime(testDateTime);
    DisburseLoanParameters disburseParams = new DisburseLoanParameters();
    disburseParams.setDisbursalDateDD("12");
    disburseParams.setDisbursalDateMM("10");
    disburseParams.setDisbursalDateYYYY("2010");
    disburseParams.setPaymentType(DisburseLoanParameters.CASH);
    LoanAccountPage loanAccountPage = loanTestHelper.createLoanAccount(clientName, "WeeklyPawdepLoan").changeAccountStatusToAccepted().disburseLoan(disburseParams);
    String accountId = loanAccountPage.getAccountId();
    loanTestHelper.setApplicationTime(testDateTime.plusWeeks(5));
    verifyOverdueSummary(accountId);
    verifyOverduePayment(accountId, testDateTime);
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) DateTime(org.joda.time.DateTime)

Example 40 with DisburseLoanParameters

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

the class PenaltyTest method verifyRepaymentSchelude.

private void verifyRepaymentSchelude(LoanAccountPage loanAccountPage, String penalty, String payment, String diff) {
    DisburseLoanParameters disburseLoanParameters = new DisburseLoanParameters();
    disburseLoanParameters.setPaymentType(DisburseLoanParameters.CASH);
    loanAccountPage.navigateToDisburseLoan().submitAndNavigateToDisburseLoanConfirmationPage(disburseLoanParameters).submitAndNavigateToLoanAccountPage();
    ViewRepaymentSchedulePage repaymentSchedulePage = loanAccountPage.navigateToRepaymentSchedulePage();
    repaymentSchedulePage.verifyRepaymentScheduleTablePenalties(3, penalty);
    ApplyPaymentPage paymentPage = repaymentSchedulePage.navigateToApplyPaymentPage();
    PaymentParameters paymentParameters = new PaymentParameters();
    paymentParameters.setTransactionDateDD("28");
    paymentParameters.setTransactionDateMM("02");
    paymentParameters.setTransactionDateYYYY("2011");
    paymentParameters.setAmount(payment);
    paymentParameters.setPaymentType(PaymentParameters.CASH);
    paymentPage.submitAndNavigateToApplyPaymentConfirmationPage(paymentParameters).submitAndNavigateToLoanAccountDetailsPage().navigateToRepaymentSchedulePage();
    repaymentSchedulePage.verifyRepaymentScheduleTableRow(3, 6, payment);
    repaymentSchedulePage.verifyRepaymentScheduleTableRow(3, 8, payment);
    repaymentSchedulePage.verifyRepaymentScheduleTableRow(5, 6, diff);
    repaymentSchedulePage.verifyRunningBalanceTableRow(3, 3, diff);
    ApplyAdjustmentPage adjustmentPage = repaymentSchedulePage.navigateToApplyAdjustment();
    adjustmentPage.fillAdjustmentFieldsAndSubmit(payment).navigateToRepaymentSchedulePage();
    repaymentSchedulePage.verifyRepaymentScheduleTablePenalties(3, penalty);
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) ApplyAdjustmentPage(org.mifos.test.acceptance.framework.loan.ApplyAdjustmentPage) ApplyPaymentPage(org.mifos.test.acceptance.framework.loan.ApplyPaymentPage) ViewRepaymentSchedulePage(org.mifos.test.acceptance.framework.loan.ViewRepaymentSchedulePage) PaymentParameters(org.mifos.test.acceptance.framework.loan.PaymentParameters)

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