Search in sources :

Example 11 with DisburseLoanParameters

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

the class LoanAccountCycleTest method verifyAmountsAndInstallmentsByLastAmount.

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

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

the class LoanAccountOverdueInterestTest method verifyPayOverdueInstalment.

@Test(enabled = true)
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyPayOverdueInstalment() throws Exception {
    SubmitFormParameters loanParameters = FormParametersHelper.getWeeklyLoanProductParameters();
    loanParameters.setOfferingName("OverdueLoan");
    loanProductTestHelper.defineNewLoanProduct(loanParameters);
    CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters();
    searchParameters.setSearchString("Stu");
    searchParameters.setLoanProduct("OverdueLoan");
    CreateLoanAccountSubmitParameters submitAccountParameters = new CreateLoanAccountSubmitParameters();
    submitAccountParameters.setAmount("1012.0");
    LoanAccountPage loanPage = loanTestHelper.createLoanAccount(searchParameters, submitAccountParameters);
    String loanId = loanPage.getAccountId();
    loanPage.changeAccountStatusToAccepted();
    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);
    loanTestHelper.disburseLoan(loanId, disburseParameters);
    DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
    systemDateTime = systemDateTime.plusDays(20);
    dateTimeUpdaterRemoteTestingService.setDateTime(systemDateTime);
    loanPage = navigationHelper.navigateToLoanAccountPage(loanId);
    ViewRepaymentSchedulePage repaymentPage = loanPage.navigateToRepaymentSchedulePage();
    repaymentPage.verifyRepaymentScheduleTablePrincipal(3, "17.3");
    repaymentPage.verifyRepaymentScheduleTableInterest(3, "3.7 (0)");
    repaymentPage.verifyRepaymentScheduleTablePrincipal(4, "17.4");
    repaymentPage.verifyRepaymentScheduleTableInterest(4, "3.6 (0)");
    PaymentParameters params = new PaymentParameters();
    params.setTransactionDateDD(Integer.toString(systemDateTime.getDayOfMonth()));
    params.setTransactionDateMM(Integer.toString(systemDateTime.getMonthOfYear()));
    params.setTransactionDateYYYY(Integer.toString(systemDateTime.getYear()));
    params.setPaymentType(PaymentParameters.CASH);
    params.setAmount("4.2");
    loanPage = repaymentPage.navigateToApplyPaymentPage().submitAndNavigateToApplyPaymentConfirmationPage(params).submitAndNavigateToLoanAccountDetailsPage();
    loanPage = navigationHelper.navigateToLoanAccountPage(loanId);
    repaymentPage = loanPage.navigateToRepaymentSchedulePage();
    repaymentPage.verifyRepaymentScheduleTableAfterPayPrincipal(3, "0");
    repaymentPage.verifyRepaymentScheduleTableAfterPayInterest(3, "3.7");
    repaymentPage.verifyRepaymentScheduleTableAfterPayPrincipal(5, "17.3");
    repaymentPage.verifyRepaymentScheduleTableAfterPayInterest(5, "0 (3.7)");
    repaymentPage.verifyRepaymentScheduleTableAfterPayPrincipal(6, "17.4");
    repaymentPage.verifyRepaymentScheduleTableAfterPayInterest(6, "3.1 (0.5)");
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) ViewRepaymentSchedulePage(org.mifos.test.acceptance.framework.loan.ViewRepaymentSchedulePage) CreateLoanAccountSubmitParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSubmitParameters) SubmitFormParameters(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage.SubmitFormParameters) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) DateTimeUpdaterRemoteTestingService(org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService) PaymentParameters(org.mifos.test.acceptance.framework.loan.PaymentParameters) Test(org.testng.annotations.Test)

Example 13 with DisburseLoanParameters

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

the class ClientLoanTransactionHistoryTest method verifyTransactionHistoryWithDoubleEntryAccounting.

//http://mifosforge.jira.com/browse/MIFOSTEST-361
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyTransactionHistoryWithDoubleEntryAccounting() throws DatabaseUnitException, SQLException, IOException, URISyntaxException {
    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);
    PaymentParameters paymentParameters = new PaymentParameters();
    paymentParameters.setAmount("200.0");
    DateTime paymentDate = systemDateTime.plusDays(10);
    paymentParameters.setTransactionDateDD(Integer.toString(paymentDate.getDayOfMonth()));
    paymentParameters.setTransactionDateMM(Integer.toString(paymentDate.getMonthOfYear()));
    paymentParameters.setTransactionDateYYYY(Integer.toString(paymentDate.getYear()));
    paymentParameters.setPaymentType(PaymentParameters.CASH);
    //Then
    String loanId = "000100000000050";
    loanTestHelper.verifyLastEntryInStatusHistory(loanId, EditLoanAccountStatusParameters.PENDING_APPROVAL, EditLoanAccountStatusParameters.APPROVED);
    //When
    loanTestHelper.disburseLoan(loanId, disburseParameters);
    loanTestHelper.setApplicationTime(paymentDate);
    loanTestHelper.applyPayment(loanId, paymentParameters);
    //Then
    loanTestHelper.verifyTransactionHistory(loanId, Double.valueOf(paymentParameters.getAmount()));
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) DateTime(org.joda.time.DateTime) PaymentParameters(org.mifos.test.acceptance.framework.loan.PaymentParameters)

Example 14 with DisburseLoanParameters

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

the class CreateClientLoanAccountTest method createMultipleLoanAccountsWithRestrictedProductsMix.

/**
     * Verify a user is prevented from creating a second loan account
     * (for two or more clients using the bulk loan creation pipeline)
     * with a loan product restricted with the first loan.
     * http://mifosforge.jira.com/browse/MIFOSTEST-95
     *
     * @throws Exception
     */
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(enabled = true)
public void createMultipleLoanAccountsWithRestrictedProductsMix() throws Exception {
    DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
    DateTime targetTime = new DateTime(2011, 3, 18, 13, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    DefineNewLoanProductPage.SubmitFormParameters productParams = FormParametersHelper.getWeeklyLoanProductParameters();
    productParams.setOfferingName("product95");
    productParams.setOfferingShortName("p95");
    productParams.setDefaultInterestRate("15.3");
    productParams.setMaxInterestRate("50");
    productParams.setInterestTypes(SubmitFormParameters.DECLINING_BALANCE);
    productParams.setDefaultLoanAmount("13333");
    productParams.setDefInstallments("13");
    loanProductTestHelper.defineNewLoanProduct(productParams);
    productParams.setOfferingName("product95B");
    productParams.setOfferingShortName("p95b");
    loanProductTestHelper.defineNewLoanProduct(productParams);
    CreateMultipleLoanAccountSelectParameters multipleAccParameters1 = new CreateMultipleLoanAccountSelectParameters();
    multipleAccParameters1.setBranch("MyOfficeDHMFT");
    multipleAccParameters1.setLoanOfficer("loan officer");
    multipleAccParameters1.setCenter("WeeklyMeetingCenter");
    multipleAccParameters1.setLoanProduct("product95");
    CreateMultipleLoanAccountSelectParameters multipleAccParameters2 = new CreateMultipleLoanAccountSelectParameters();
    multipleAccParameters2.setBranch("MyOfficeDHMFT");
    multipleAccParameters2.setLoanOfficer("loan officer");
    multipleAccParameters2.setCenter("WeeklyMeetingCenter");
    multipleAccParameters2.setLoanProduct("product95B");
    DisburseLoanParameters disburseParams = new DisburseLoanParameters();
    disburseParams.setPaymentType(DisburseLoanParameters.CASH);
    disburseParams.setDisbursalDateDD("18");
    disburseParams.setDisbursalDateMM("03");
    disburseParams.setDisbursalDateYYYY("2011");
    String error = "The loan could not be disbursed as " + multipleAccParameters1.getLoanProduct() + " and " + multipleAccParameters2.getLoanProduct() + " are not allowed to co-exist";
    String[] clients = new String[1];
    clients[0] = "MemberWeekly Group";
    String firstRepaymentDate = "21-Mar-2011";
    CreateLoanAccountsSuccessPage createLoanAccountsSuccessPage = loanTestHelper.createMultipleLoanAccountsWithMixedRestricedPoducts(multipleAccParameters1, multipleAccParameters2, disburseParams, clients, firstRepaymentDate);
    List<String> accountNumbers = createLoanAccountsSuccessPage.verifyAndGetLoanAccountNumbers(clients.length);
    LoanAccountPage loanAccountPage = createLoanAccountsSuccessPage.selectLoansAndNavigateToLoanAccountPage(0);
    for (int i = 0; i < accountNumbers.size(); i++) {
        if (i > 0) {
            loanAccountPage = loanAccountPage.navigateToClientsAndAccountsUsingHeaderTab().searchForClient(accountNumbers.get(i)).navigateToLoanAccountSearchResult("Account # " + accountNumbers.get(i));
        }
        loanAccountPage.changeAccountStatusToAccepted();
        loanAccountPage.tryNavigatingToDisburseLoanWithError();
        loanAccountPage.verifyError(error);
    }
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) CreateLoanAccountsSuccessPage(org.mifos.test.acceptance.framework.loan.CreateLoanAccountsSuccessPage) SubmitFormParameters(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage.SubmitFormParameters) DefineNewLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage) CreateMultipleLoanAccountSelectParameters(org.mifos.test.acceptance.framework.loan.CreateMultipleLoanAccountSelectParameters) 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 15 with DisburseLoanParameters

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

the class FeeTest method applyAndRemoveFees.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void applyAndRemoveFees() throws Exception {
    // this account has an approved but not disbursed loan.
    String pendingApprovalAccountId = "000100000000043";
    String partialApplicationAccountId = "000100000000044";
    String applicationApprovedAccountId = "000100000000045";
    String client = "WeeklyClient Monday";
    String oneTimeFee = feeTestHelper.createNoRateFee("oneTimeFee", FeesCreatePage.SubmitFormParameters.LOAN, "Upfront", 10);
    String periodicFee = feeTestHelper.createPeriodicRateFee("periodicFee", FeesCreatePage.SubmitFormParameters.LOAN, FeesCreatePage.SubmitFormParameters.PERIODIC_FEE_FREQUENCY, 1, 10, FeesCreatePage.SubmitFormParameters.LOAN_AMOUNT);
    ChargeParameters feeParameters = new ChargeParameters();
    feeParameters.setAmount("10");
    feeParameters.setType(oneTimeFee);
    // ONE TIME FEE
    // add and remove the fee from a pending approval account
    loanTestHelper.applyChargeUsingFeeLabel(pendingApprovalAccountId, feeParameters);
    loanTestHelper.verifyOneTimeFee(oneTimeFee, 1);
    loanTestHelper.removeOneTimeFee(1);
    loanTestHelper.verifyNoOneTimeFeesExist();
    // add and remove the fee from a partial application account
    loanTestHelper.applyChargeUsingFeeLabel(partialApplicationAccountId, feeParameters);
    loanTestHelper.verifyOneTimeFee(oneTimeFee, 1);
    loanTestHelper.removeOneTimeFee(1);
    loanTestHelper.verifyNoOneTimeFeesExist();
    // add and verify that the fee cannot be removed from an application approved account
    loanTestHelper.applyChargeUsingFeeLabel(applicationApprovedAccountId, feeParameters);
    loanTestHelper.verifyOneTimeFee(oneTimeFee, 1);
    loanTestHelper.verifyNoOneTimeFeeRemovalLinkExists(1);
    // PERIODIC FEE
    feeParameters.setType(periodicFee);
    CreateLoanAccountSearchParameters searchParams = new CreateLoanAccountSearchParameters();
    searchParams.setSearchString(client);
    searchParams.setLoanProduct("WeeklyClientFlatLoanWithNoFee");
    DisburseLoanParameters disburseParams = new DisburseLoanParameters();
    disburseParams.setDisbursalDateDD("28");
    disburseParams.setDisbursalDateMM("02");
    disburseParams.setDisbursalDateYYYY("2011");
    disburseParams.setPaymentType(PaymentParameters.CASH);
    disburseParams.setAmount("10,000");
    // add and verify that the fee can be removed from an application approved account
    loanTestHelper.applyChargeUsingFeeLabel("000100000000047", feeParameters);
    loanTestHelper.verifyNoPeriodicFee(periodicFee, 1);
    loanTestHelper.removePeriodicFee(1);
    // add and verify that the fee can't be removed from an application approved account
    // after repay of first instalment
    PaymentParameters paymentParams = new PaymentParameters();
    paymentParams.setTransactionDateDD("28");
    paymentParams.setTransactionDateMM("02");
    paymentParams.setTransactionDateYYYY("2011");
    paymentParams.setPaymentType(PaymentParameters.CASH);
    paymentParams.setAmount("3000");
    paymentParams.setReceiptId("");
    paymentParams.setReceiptDateDD("");
    paymentParams.setReceiptDateMM("");
    paymentParams.setReceiptDateYYYY("");
    DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
    DateTime targetTime = new DateTime(2011, 2, 28, 12, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    String accountWithDisburs = loanTestHelper.createActivateAndDisburseDefaultLoanAccount(searchParams, disburseParams).getAccountId();
    loanTestHelper.applyChargeUsingFeeLabel(accountWithDisburs, feeParameters);
    loanTestHelper.applyPayment(accountWithDisburs, paymentParams);
    loanTestHelper.removePeriodicFee(1);
    loanTestHelper.verifyValidationErrorAppear();
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) DateTimeUpdaterRemoteTestingService(org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService) ChargeParameters(org.mifos.test.acceptance.framework.loan.ChargeParameters) DateTime(org.joda.time.DateTime) 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