Beispiel #1
0
  /**
   * MPESA - Import has expected errors due to invalid data and overpayment amount and user is not
   * able to continue http://mifosforge.jira.com/browse/MIFOSTEST-692
   *
   * @throws Exception
   */
  @SuppressWarnings("PMD.SignatureDeclareThrowsException")
  @Test(enabled = true)
  public void failImportTransaction() throws Exception {
    // Given
    String path = this.getClass().getResource("/mpesa/" + FILE_WITH_OVERPAYMENT_AMOUNT).toString();
    String dataset = "mpesa_export_dbunit.xml";

    initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, dataset, dataSource, selenium);

    propertiesHelper.setImportTransactionOrder("AL3,AL5");

    SavingsAccountHelper savingsAccountHelper = new SavingsAccountHelper(selenium);
    savingsAccountHelper.closeSavingsAccount("000100000000019", "Close account");

    // When
    ImportTransactionsPage importTransactionsPage = importTransaction(path);
    importTransactionsPage.checkErrors(
        new String[] {
          "Row <24> error - THY89933"
              + " - Last account is a loan account but the total paid in amount"
              + " is greater than the total due amount"
        });

    // Then
    LoanAccountPage loanAccountPage = navigationHelper.navigateToLoanAccountPage("000100000000013");
    loanAccountPage.verifyStatus(LoanAccountPage.ACTIVE);
    loanAccountPage.verifyExactLoanAmount("2,000");

    TransactionHistoryPage transactionHistoryPage =
        loanAccountPage.navigateToTransactionHistoryPage();
    transactionHistoryPage.verifyTransactionHistory(183, 1, 6);
  }
  @SuppressWarnings("PMD.SignatureDeclareThrowsException")
  // http://mifosforge.jira.com/browse/MIFOSTEST-216
  @Test(enabled = true)
  public void verifyPropertySavingsPendingApprovalStateEnabled() throws Exception {
    // Given
    propertiesHelper.setSavingsPendingApprovalStateEnabled("false");
    // When
    CreateSavingsAccountSearchParameters searchParameters =
        new CreateSavingsAccountSearchParameters();
    searchParameters.setSearchString("UpdateCustomProperties TestClient");
    searchParameters.setSavingsProduct("MandatorySavingsAccount");
    CreateSavingsAccountSubmitParameters submitAccountParameters =
        new CreateSavingsAccountSubmitParameters();
    submitAccountParameters.setAmount("248.0");
    SavingsAccountDetailPage savingsAccountPage =
        savingsAccountHelper.createSavingsAccountWithoutPendingApprovalState(
            searchParameters, submitAccountParameters);
    savingsAccountPage.verifyPage();
    // Then
    savingsAccountPage.verifySavingsAmount(submitAccountParameters.getAmount());
    savingsAccountPage.verifySavingsProduct(searchParameters.getSavingsProduct());
    savingsAccountPage.verifyStatus("Active");

    propertiesHelper.setSavingsPendingApprovalStateEnabled("true");
  }
 private void verifySavingsAccountCreation(
     CreateSavingsAccountSearchParameters searchParameters,
     CreateSavingsAccountSubmitParameters submitAccountParameters) {
   SavingsAccountDetailPage savingsAccountPage =
       savingsAccountHelper.createSavingsAccount(searchParameters, submitAccountParameters);
   savingsAccountPage.verifyPage();
   savingsAccountPage.verifySavingsAmount(submitAccountParameters.getAmount());
   savingsAccountPage.verifySavingsProduct(searchParameters.getSavingsProduct());
 }
  private SavingsAccountDetailPage createSavingAccountWithCreatedProduct(
      String client, String productName, String amount) {
    CreateSavingsAccountSearchParameters searchParameters =
        new CreateSavingsAccountSearchParameters();
    searchParameters.setSearchString(client);
    searchParameters.setSavingsProduct(productName);

    CreateSavingsAccountSubmitParameters submitAccountParameters =
        new CreateSavingsAccountSubmitParameters();
    submitAccountParameters.setAmount(amount);
    SavingsAccountDetailPage savingsAccountPage =
        savingsAccountHelper.createSavingsAccount(searchParameters, submitAccountParameters);
    savingsAccountPage.verifyPage();
    savingsAccountPage.verifySavingsAmount(amount);
    savingsAccountPage.verifySavingsProduct(searchParameters.getSavingsProduct());
    return savingsAccountPage;
  }
  /*
   * FIXME - keithw - test passes when run individually but not as part of ci build. it appears that question groups data is not
   *                  cleaned up right as instead of stepping to review installments, the questionnaire page is presented.
   */
  @SuppressWarnings("PMD.SignatureDeclareThrowsException")
  // http://mifosforge.jira.com/browse/MIFOSTEST-215
  @Test(enabled = true)
  public void verifyPropertyPendingApprovalStateEnabledForSavingsAndLoanAccounts()
      throws Exception {
    // Given
    propertiesHelper.setSavingsPendingApprovalStateEnabled("true");
    propertiesHelper.setLoanPendingApprovalStateEnabled("true");
    propertiesHelper.setGroupPendingApprovalStateEnabled("true");
    // When
    CreateSavingsAccountSearchParameters searchParameters =
        new CreateSavingsAccountSearchParameters();
    searchParameters.setSearchString("UpdateCustomProperties TestClient");
    searchParameters.setSavingsProduct("MonthlyClientSavingsAccount");

    CreateSavingsAccountSubmitParameters submitAccountParameters =
        new CreateSavingsAccountSubmitParameters();
    submitAccountParameters.setAmount("248.0");

    SavingsAccountDetailPage savingsAccountPage =
        savingsAccountHelper.createSavingsAccount(searchParameters, submitAccountParameters);
    savingsAccountPage.verifyPage();
    // Then
    savingsAccountPage.verifySavingsAmount(submitAccountParameters.getAmount());
    savingsAccountPage.verifySavingsProduct(searchParameters.getSavingsProduct());
    savingsAccountPage.verifyStatus("Application Pending Approval");
    // when
    CreateLoanAccountSearchParameters searchParameters2 = new CreateLoanAccountSearchParameters();
    searchParameters2.setSearchString("UpdateCustomProperties TestClient");
    searchParameters2.setLoanProduct("ClientEmergencyLoan");
    CreateLoanAccountSubmitParameters submitAccountParameters2 =
        new CreateLoanAccountSubmitParameters();
    submitAccountParameters2.setAmount("2765.0");
    submitAccountParameters2.setGracePeriodTypeNone(true);
    LoanTestHelper loanTestHelper = new LoanTestHelper(selenium);
    LoanAccountPage loanAccountPage =
        loanTestHelper.createLoanAccount(searchParameters2, submitAccountParameters2);
    loanAccountPage.verifyStatus("Application Pending Approval");
  }