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);
}
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;
}
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;
}
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);
}
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;
}
Aggregations