Search in sources :

Example 1 with RepayLoanParameters

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

the class BatchJobPenaltyTest method verifyAfterRepayLoan.

private void verifyAfterRepayLoan(final String accountId, final String[] penalties, final boolean secondTime) throws Exception {
    RepayLoanParameters params = new RepayLoanParameters();
    params.setModeOfRepayment(RepayLoanParameters.CASH);
    navigationHelper.navigateToLoanAccountPage(accountId).navigateToRepayLoan().submitAndNavigateToRepayLoanConfirmationPage(params).submitAndNavigateToLoanAccountDetailsPage();
    BigDecimal sum = BigDecimal.ZERO;
    BigDecimal principal = new BigDecimal(450);
    String[][] schedule = new String[penalties.length][2];
    for (int i = 0; i < penalties.length; ++i) {
        BigDecimal penalty = BigDecimal.valueOf(Double.valueOf(penalties[i]));
        sum = sum.add(penalty.setScale(1, BigDecimal.ROUND_HALF_UP));
        schedule[i][0] = penalties[i];
        schedule[i][1] = StringUtil.formatNumber(penalty.add(principal).setScale(1, BigDecimal.ROUND_HALF_UP).toString());
    }
    String sumToString = StringUtil.formatNumber(sum.toString());
    penaltyHelper.verifyCalculatePenaltyWithPayment(accountId, new String[] { sumToString, sumToString, "0" }, schedule, null);
    if (!secondTime) {
        changeDateTime(04, 5);
    }
    penaltyHelper.verifyCalculatePenaltyWithPayment(accountId, new String[] { sumToString, sumToString, "0" }, schedule, null);
}
Also used : RepayLoanParameters(org.mifos.test.acceptance.framework.loan.RepayLoanParameters) BigDecimal(java.math.BigDecimal)

Example 2 with RepayLoanParameters

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

the class LoanTestHelper method repayLoan.

/**
     * Repay loan account with id <tt>loanId</tt>.
     * @param loanId The account id.
     * @return The loan account page for the loan account.
     */
public LoanAccountPage repayLoan(String loanId) {
    RepayLoanParameters params = new RepayLoanParameters();
    params.setModeOfRepayment(RepayLoanParameters.CASH);
    LoanAccountPage loanAccountPage = navigationHelper.navigateToLoanAccountPage(loanId);
    RepayLoanPage repayLoanPage = loanAccountPage.navigateToRepayLoan();
    RepayLoanConfirmationPage repayLoanConfirmationPage = repayLoanPage.submitAndNavigateToRepayLoanConfirmationPage(params);
    loanAccountPage = repayLoanConfirmationPage.submitAndNavigateToLoanAccountDetailsPage();
    loanAccountPage.verifyStatus(LoanAccountPage.CLOSED);
    return loanAccountPage;
}
Also used : RepayLoanConfirmationPage(org.mifos.test.acceptance.framework.loan.RepayLoanConfirmationPage) RepayLoanPage(org.mifos.test.acceptance.framework.loan.RepayLoanPage) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) EditPreviewLoanAccountPage(org.mifos.test.acceptance.framework.loan.EditPreviewLoanAccountPage) RepayLoanParameters(org.mifos.test.acceptance.framework.loan.RepayLoanParameters)

Example 3 with RepayLoanParameters

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

the class LoanTestHelper method setRepaymentParameters.

public RepayLoanParameters setRepaymentParameters() {
    RepayLoanParameters repayLoanParameters = new RepayLoanParameters();
    repayLoanParameters.setModeOfRepayment(RepayLoanParameters.CASH);
    repayLoanParameters.setReceiptDateDD("");
    return repayLoanParameters;
}
Also used : RepayLoanParameters(org.mifos.test.acceptance.framework.loan.RepayLoanParameters)

Example 4 with RepayLoanParameters

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

the class LoanRepayTest method repayLoanFromSavingsAccountWithInsufficentBalance.

public void repayLoanFromSavingsAccountWithInsufficentBalance() {
    String loanToRepay = "000100000000015";
    String savingAccountWithInsufficentBalance = "000100000000059";
    String expectedErrorMessage = "No enough balance in the account, please select a different account.";
    RepayLoanParameters repayLoanParameters = new RepayLoanParameters();
    repayLoanParameters.setModeOfRepayment(RepayLoanParameters.TRANSFER_FROM_SAVINGS);
    repayLoanParameters.setAccountForTransferGlobalNum(savingAccountWithInsufficentBalance);
    repayLoanParameters.setAccountForTransferBalance(String.valueOf(0));
    repayLoanParameters.setAccountForTransferMaxWithdrawalAmount(String.valueOf(0));
    repayLoanParameters.setAccountForTransferName("MonthlyClientSavingsAccount");
    repayLoanParameters.setAccountForTransferType("Voluntary");
    String errors = navigationHelper.navigateToLoanAccountPage(loanToRepay).navigateToRepayLoan().submitAndNavigateToRepayLoanConfirmationPage(repayLoanParameters).submitWithError().getErrors();
    Assert.assertEquals(errors, expectedErrorMessage);
}
Also used : RepayLoanParameters(org.mifos.test.acceptance.framework.loan.RepayLoanParameters)

Example 5 with RepayLoanParameters

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

the class LoanRepayTest method getRepayLoanParameters.

private RepayLoanParameters getRepayLoanParameters() {
    RepayLoanParameters repayLoanParameters = new RepayLoanParameters();
    repayLoanParameters.setModeOfRepayment(RepayLoanParameters.CASH);
    return repayLoanParameters;
}
Also used : RepayLoanParameters(org.mifos.test.acceptance.framework.loan.RepayLoanParameters)

Aggregations

RepayLoanParameters (org.mifos.test.acceptance.framework.loan.RepayLoanParameters)7 LoanAccountPage (org.mifos.test.acceptance.framework.loan.LoanAccountPage)3 EditPreviewLoanAccountPage (org.mifos.test.acceptance.framework.loan.EditPreviewLoanAccountPage)2 RepayLoanPage (org.mifos.test.acceptance.framework.loan.RepayLoanPage)2 BigDecimal (java.math.BigDecimal)1 DateTime (org.joda.time.DateTime)1 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)1 CreateLoanAccountSearchParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters)1 DisburseLoanParameters (org.mifos.test.acceptance.framework.loan.DisburseLoanParameters)1 RepayLoanConfirmationPage (org.mifos.test.acceptance.framework.loan.RepayLoanConfirmationPage)1 DefineNewLoanProductPage (org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage)1 SubmitFormParameters (org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage.SubmitFormParameters)1 DefineNewLoanProductPreviewPage (org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPreviewPage)1 EditLoanProductPage (org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage)1 EditLoanProductPreviewPage (org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPreviewPage)1 LoanProductDetailsPage (org.mifos.test.acceptance.framework.loanproduct.LoanProductDetailsPage)1 LoanTestHelper (org.mifos.test.acceptance.framework.testhelpers.LoanTestHelper)1 NavigationHelper (org.mifos.test.acceptance.framework.testhelpers.NavigationHelper)1 DateTimeUpdaterRemoteTestingService (org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService)1 Test (org.testng.annotations.Test)1