Search in sources :

Example 6 with PaymentParameters

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

use of org.mifos.test.acceptance.framework.loan.PaymentParameters 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)

Example 8 with PaymentParameters

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

the class CreateGLIMLoanAccountTest method checkGLIMIndividualSchedule.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(enabled = true)
public void checkGLIMIndividualSchedule() throws Exception {
    DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
    DateTime targetTime = new DateTime(2011, 03, 1, 13, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters();
    searchParameters.setSearchString("Default Group");
    searchParameters.setLoanProduct("WeeklyGroupFlatLoanWithOnetimeFee");
    CreateLoanAccountEntryPage loanAccountEntryPage = loanTestHelper.navigateToCreateLoanAccountEntryPage(searchParameters);
    loanAccountEntryPage.selectGLIMClients(0, "Stu1233266299995 Client1233266299995 Client Id: 0002-000000012", "9999", "0012-Sheep Purchase");
    loanAccountEntryPage.selectGLIMClients(1, "Stu1233266309851 Client1233266309851 Client Id: 0002-000000013", "99999");
    loanAccountEntryPage.selectGLIMClients(2, "Stu1233266319760 Client1233266319760 Client Id: 0002-000000014", "99999");
    LoanAccountPage loanAccountPage = loanAccountEntryPage.navigateToReviewInstallmentsPage().clickPreviewAndGoToReviewLoanAccountPage().submitForApprovalAndNavigateToConfirmationPage().navigateToLoanAccountDetailsPage();
    loanAccountPage.verifyGLIMIndividualScheduleLinks(3, true);
    EditLoanAccountStatusParameters statusParams = new EditLoanAccountStatusParameters();
    statusParams.setNote("GLIM test");
    statusParams.setStatus(EditLoanAccountStatusParameters.APPROVED);
    loanAccountPage.changeAccountStatus(statusParams);
    loanAccountPage.verifyGLIMIndividualScheduleLinks(3, true);
    String loanId = loanAccountPage.getAccountId();
    dateTimeUpdaterRemoteTestingService.setDateTime(new LocalDate(2011, 3, 8).toDateTimeAtStartOfDay());
    loanAccountPage = navigationHelper.navigateToLoanAccountPage(loanId);
    DisburseLoanParameters disburseParams = new DisburseLoanParameters();
    disburseParams.setAmount("209997.0");
    disburseParams.setDisbursalDateDD("8");
    disburseParams.setDisbursalDateMM("3");
    disburseParams.setDisbursalDateYYYY("2011");
    disburseParams.setPaymentType(DisburseLoanParameters.CASH);
    loanAccountPage.disburseLoan(disburseParams);
    loanAccountPage.verifyGLIMIndividualScheduleLinks(3, false);
    totalGroupLoanEqualSumOfindividual(loanAccountPage, 3, 1.0);
    PaymentParameters paymentParams = new PaymentParameters();
    paymentParams.setAmount("1500.0");
    paymentParams.setTransactionDateDD("8");
    paymentParams.setTransactionDateMM("3");
    paymentParams.setTransactionDateYYYY("2011");
    paymentParams.setPaymentType(PaymentParameters.CASH);
    loanTestHelper.applyPayment(loanId, paymentParams);
    loanAccountPage.verifyGLIMIndividualScheduleLinks(3, false);
    totalGroupLoanEqualSumOfindividual(loanAccountPage, 3, 1.0);
    loanAccountPage.navigateToApplyAdjustment().fillAdjustmentFieldsWithoutRevertingAndSubmit("1500.0");
    loanAccountPage.verifyGLIMIndividualScheduleLinks(3, false);
    totalGroupLoanEqualSumOfindividual(loanAccountPage, 3, 1.0);
    String[] expectedPrincipalAmounts = new String[] { "24.9", "249.2", "249.3" };
    String[] expectedInterestAmounts = new String[] { "46", "460.3", "460.3" };
    String[] expectedFeeAmounts = new String[] { "0.5", "4.8", "4.7" };
    verifyProRatedGLIMPayments(loanAccountPage, 3, expectedPrincipalAmounts, expectedInterestAmounts, expectedFeeAmounts);
    loanTestHelper.repayLoan(loanId);
    loanAccountPage.verifyGLIMIndividualScheduleLinks(3, false);
    totalGroupLoanEqualSumOfindividual(loanAccountPage, 3, 1.0);
    loanAccountPage.navigateToApplyAdjustment().submitAdjustment();
    loanAccountPage.verifyGLIMIndividualScheduleLinks(3, false);
    totalGroupLoanEqualSumOfindividual(loanAccountPage, 3, 1.0);
    statusParams.setNote("GLIM test");
    statusParams.setStatus(EditLoanAccountStatusParameters.CLOSED_WRITTEN_OFF);
    loanAccountPage.changeAccountStatus(statusParams);
    loanAccountPage.verifyGLIMIndividualScheduleLinks(3, false);
    totalGroupLoanEqualSumOfindividual(loanAccountPage, 3, 1.0);
}
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) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) EditPreviewLoanAccountPage(org.mifos.test.acceptance.framework.loan.EditPreviewLoanAccountPage) DateTimeUpdaterRemoteTestingService(org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService) LocalDate(org.joda.time.LocalDate) DateTime(org.joda.time.DateTime) CreateLoanAccountEntryPage(org.mifos.test.acceptance.framework.loan.CreateLoanAccountEntryPage) PaymentParameters(org.mifos.test.acceptance.framework.loan.PaymentParameters) Test(org.testng.annotations.Test)

Example 9 with PaymentParameters

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

the class ClientTest method createClientAddTwoFeesTryPayMoreThanAmountVerifyErrorMessage.

@Test(enabled = true)
public // http://mifosforge.jira.com/browse/MIFOS-4776
void createClientAddTwoFeesTryPayMoreThanAmountVerifyErrorMessage() {
    String oneTimeFeeName = "One Time Fee";
    String periodicTimeFee = "Periodic Time Fee";
    defineNewFree(oneTimeFeeName, SubmitFormParameters.ONETIME_FEE_FREQUENCY, 10.0);
    defineNewFree(periodicTimeFee, SubmitFormParameters.PERIODIC_FEE_FREQUENCY, 37.0);
    String clientName = "Stu1233266299995 Client1233266299995";
    ChargeParameters chargeParameters = new ChargeParameters();
    chargeParameters.setAmount("10");
    chargeParameters.setType(oneTimeFeeName);
    clientTestHelper.applyCharge(clientName, chargeParameters);
    chargeParameters.setAmount("37");
    chargeParameters.setType(periodicTimeFee);
    clientTestHelper.applyCharge(clientName, chargeParameters);
    PaymentParameters params = new PaymentParameters();
    params.setTransactionDateDD("11");
    params.setTransactionDateMM("02");
    params.setTransactionDateYYYY("2009");
    params.setAmount("48");
    params.setPaymentType(PaymentParameters.CASH);
    params.setReceiptId("");
    params.setReceiptDateDD("");
    params.setReceiptDateMM("");
    params.setReceiptDateYYYY("");
    ApplyPaymentConfirmationPage applyPaymentConfirmationPage = clientTestHelper.navigateToClientViewDetailsPage(clientName).navigateToViewClientChargesDetail().navigateToApplyPayments().submitAndNavigateToApplyPaymentConfirmationPage(params);
    applyPaymentConfirmationPage.dontLoadNext();
    String actual = applyPaymentConfirmationPage.getSelenium().getText("//span[@id='reviewapplypayment.error.message']");
    String expected = "Payment cannot be more than Amount due.";
    Assert.assertEquals(expected, actual);
}
Also used : ApplyPaymentConfirmationPage(org.mifos.test.acceptance.framework.loan.ApplyPaymentConfirmationPage) ChargeParameters(org.mifos.test.acceptance.framework.loan.ChargeParameters) PaymentParameters(org.mifos.test.acceptance.framework.loan.PaymentParameters) Test(org.testng.annotations.Test)

Example 10 with PaymentParameters

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

the class SavingsPaymentTest method testPermissionForPaymentFromSavings.

public void testPermissionForPaymentFromSavings() {
    String loanGlobalNum = setUpLoanAccount();
    String savingsGlobalNum = setUpSavingsAccount();
    String errorMessage = "You do not have permission to make payment to the account using Savings Account Transfer";
    //first uncheck permission and see if access denied page is displayed
    //while trying transfer from savings
    ManageRolePage manageRolePage = navigationHelper.navigateToAdminPage().navigateToViewRolesPage().navigateToManageRolePage("Admin");
    if (manageRolePage.isPermissionEnable("5_1_11")) {
        manageRolePage.disablePermission("5_1_11");
    }
    manageRolePage.submitAndGotoViewRolesPage();
    CreateLoanAccountSearchParameters loanSearchParams = new CreateLoanAccountSearchParameters();
    loanSearchParams.setSearchString(loanGlobalNum);
    LoanAccountPage loanAccountPage = navigationHelper.navigateToLoanAccountPage(loanGlobalNum);
    ApplyPaymentPage applyPaymentPage = loanAccountPage.navigateToApplyPayment();
    PaymentParameters paymentParams = new PaymentParameters();
    paymentParams.setAmount(String.valueOf(TRANSFER_AMOUNT));
    paymentParams.setPaymentType(PaymentParameters.TRANSFER);
    paymentParams.setSavingsAccountGlobalNum(savingsGlobalNum);
    paymentParams.setTransactionDateDD("13");
    paymentParams.setTransactionDateMM("03");
    paymentParams.setTransactionDateYYYY("2011");
    paymentParams.setSavingsAccountBalance(String.valueOf(SAVINGS_START_BALANCE));
    paymentParams.setSavingsAccountMaxWithdrawalAmount(String.valueOf(0));
    paymentParams.setSavingsAccountType("Voluntary");
    paymentParams.setSavingsAccountName("MonthlyClientSavingsAccount");
    try {
        applyPaymentPage.submitAndNavigateToApplyPaymentConfirmationPage(paymentParams);
    } catch (AssertionError e) {
        Assert.assertTrue(selenium.isTextPresent(errorMessage));
    }
    //now enable permission and validate transfer success
    manageRolePage = navigationHelper.navigateToAdminPage().navigateToViewRolesPage().navigateToManageRolePage("Admin");
    if (!manageRolePage.isPermissionEnable("5_1_11")) {
        manageRolePage.enablePermission("5_1_11");
    }
    manageRolePage.submitAndGotoViewRolesPage();
    navigationHelper.navigateToLoanAccountPage(loanGlobalNum).navigateToApplyPayment().submitAndNavigateToApplyPaymentConfirmationPage(paymentParams).submitAndNavigateToLoanAccountDetailsPage();
}
Also used : CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) ManageRolePage(org.mifos.test.acceptance.framework.admin.ManageRolePage) ApplyPaymentPage(org.mifos.test.acceptance.framework.loan.ApplyPaymentPage) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) PaymentParameters(org.mifos.test.acceptance.framework.loan.PaymentParameters)

Aggregations

PaymentParameters (org.mifos.test.acceptance.framework.loan.PaymentParameters)18 LoanAccountPage (org.mifos.test.acceptance.framework.loan.LoanAccountPage)9 CreateLoanAccountSearchParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters)7 DisburseLoanParameters (org.mifos.test.acceptance.framework.loan.DisburseLoanParameters)7 Test (org.testng.annotations.Test)6 DateTime (org.joda.time.DateTime)5 ApplyPaymentPage (org.mifos.test.acceptance.framework.loan.ApplyPaymentPage)4 DateTimeUpdaterRemoteTestingService (org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService)4 ApplyPaymentConfirmationPage (org.mifos.test.acceptance.framework.loan.ApplyPaymentConfirmationPage)3 ChargeParameters (org.mifos.test.acceptance.framework.loan.ChargeParameters)3 EditPreviewLoanAccountPage (org.mifos.test.acceptance.framework.loan.EditPreviewLoanAccountPage)3 CreateLoanAccountEntryPage (org.mifos.test.acceptance.framework.loan.CreateLoanAccountEntryPage)2 EditLoanAccountStatusParameters (org.mifos.test.acceptance.framework.loan.EditLoanAccountStatusParameters)2 ViewRepaymentSchedulePage (org.mifos.test.acceptance.framework.loan.ViewRepaymentSchedulePage)2 SubmitFormParameters (org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage.SubmitFormParameters)2 LocalDate (org.joda.time.LocalDate)1 ManageRolePage (org.mifos.test.acceptance.framework.admin.ManageRolePage)1 CreateCenterEnterDataPage (org.mifos.test.acceptance.framework.center.CreateCenterEnterDataPage)1 MeetingParameters (org.mifos.test.acceptance.framework.center.MeetingParameters)1 ViewCenterChargesDetailPage (org.mifos.test.acceptance.framework.center.ViewCenterChargesDetailPage)1