Example #1
0
  @Test(enabled = false)
  public void pendingTransaction() {

    WebDriver driver = DriverFactory.getInstance().getDriver();
    // authorization
    driver.get(baseUrl + "login/");
    Utils.authorized(driver, loginMerchant, passwordMerchant, Captcha.getCaptcha(driver));

    // generate link and payment
    idTransaction =
        TestUtils.getNewIdTransaction(
            driver,
            pendingMercahnt,
            optionPendingMerchant,
            id + orderID,
            amount,
            numberCardA,
            numberCardB,
            numberCardC,
            numberCardD,
            expDateMonth,
            expDateYear,
            cvc,
            bank,
            email,
            currencyRUB,
            cardHolderName);

    // check result page
    Assert.assertTrue(Utils.checkResultPageTransaction(driver, amount));
    Assert.assertTrue(Utils.checkResultPageTransaction(driver, id + orderID));
    Assert.assertTrue(Utils.checkResultPageTransaction(driver, pendingMercahntUrl));
    Assert.assertTrue(Utils.checkResultPageTransaction(driver, cardHolderName));
    Assert.assertTrue(Utils.checkResultPageTransaction(driver, email));

    // check link
    driver.findElement(By.linkText("Завершить")).click();
    Assert.assertTrue(driver.getCurrentUrl().contains(pendingMercahntUrl));

    // check in lk merchant
    driver.get(baseUrl + "login/");
    Utils.authorized(driver, loginMerchant, passwordMerchant, Captcha.getCaptcha(driver));
    driver.findElement(By.id("ctl00_ctl11_mhlTransactions")).click();
    driver.findElement(By.id("ctl00_content_all")).click();
    TestUtils.checkCardTransactionMerchant(
        driver,
        MIDpending,
        idTransaction,
        id + orderID,
        typePurchase,
        pendingStatus,
        cardHolderName,
        amount,
        amount,
        testGateway,
        email);

    // check in lk administrator
    driver.get(baseUrl + "login/");
    Utils.authorized(driver, loginAdmin, passwordAdmin, Captcha.getCaptcha(driver));
    driver.findElement(By.id("ctl00_content_LeftMenu1_mhlTransactions")).click();
    driver.findElement(By.id("ctl00_content_all")).click();
    TestUtils.checkCardTransactionAdmin(
        driver,
        MIDpending,
        idTransaction,
        id + orderID,
        typePurchase,
        pendingStatus,
        cardType,
        numberCardA + numberCardB + numberCardC + numberCardD,
        expDate,
        bank,
        amount,
        amount,
        testGateway,
        cardHolderName,
        email);
  }
Example #2
0
  @Test(enabled = true)
  public void preAuthTransactionFull() {

    WebDriver driver = DriverFactory.getInstance().getDriver();
    // authorization
    driver.get(baseUrl + "login/");
    Utils.authorized(driver, loginMerchant, passwordMerchant, Captcha.getCaptcha(driver));

    // generate link and payment
    idTransaction =
        TestUtils.getNewIdTransaction(
            driver,
            preAuthMercahnt,
            optionPreAuthMerchant,
            id + "1" + orderID,
            amount,
            numberCardA,
            numberCardB,
            numberCardC,
            numberCardD,
            expDateMonth,
            expDateYear,
            cvc,
            bank,
            email,
            currencyRUB,
            cardHolderName);

    // check result page
    Assert.assertTrue(Utils.checkResultPageTransaction(driver, amount));
    Assert.assertTrue(Utils.checkResultPageTransaction(driver, id + "1" + orderID));
    Assert.assertTrue(Utils.checkResultPageTransaction(driver, preAuthMercahntUrl));
    Assert.assertTrue(Utils.checkResultPageTransaction(driver, cardHolderName));
    Assert.assertTrue(Utils.checkResultPageTransaction(driver, email));

    // check link
    driver.findElement(By.linkText("Завершить")).click();
    Assert.assertTrue(driver.getCurrentUrl().contains(preAuthMercahntUrl));

    // check in lk merchant
    driver.get(baseUrl + "login/");
    Utils.authorized(driver, loginMerchant, passwordMerchant, Captcha.getCaptcha(driver));
    driver.findElement(By.id("ctl00_ctl11_mhlTransactions")).click();
    driver.findElement(By.id("ctl00_content_all")).click();
    TestUtils.checkCardTransactionMerchant(
        driver,
        MIDpreAuth,
        idTransaction,
        id + "1" + orderID,
        typePurchase,
        preAuthStatus,
        cardHolderName,
        amount,
        amount,
        testGateway,
        email);

    // full preauth complete
    driver.findElement(By.id("ctl00_content_view_cmdComplete")).click();
    driver.findElement(By.id("ctl00_content_completeTransaction_amount")).clear();
    driver.findElement(By.id("ctl00_content_completeTransaction_amount")).sendKeys(amount);
    driver.findElement(By.id("ctl00_content_completeTransaction_cmdComplete")).click();
    Assert.assertTrue(
        driver
            .findElement(By.xpath(".//*[@id='mainContent']/div[4]"))
            .getText()
            .contains("Транзакция подтверждена"));

    Utils.checkCompletedPreauth(
        driver,
        MIDpreAuth,
        idTransaction,
        id + "1" + orderID,
        typePurchase,
        pendingStatus,
        cardHolderName,
        amount,
        amount,
        testGateway,
        email);

    // check completed preauth at administrator backend
    driver.get(baseUrl + "login/");
    Utils.authorized(driver, loginAdmin, passwordAdmin, Captcha.getCaptcha(driver));
    driver.findElement(By.id("ctl00_content_LeftMenu1_mhlTransactions")).click();
    driver.findElement(By.id("ctl00_content_all")).click();
    TestUtils.checkCardTransactionAdmin(
        driver,
        MIDpreAuth,
        idTransaction,
        id + "1" + orderID,
        lastActionComplete,
        pendingStatus,
        cardType,
        numberCardA + numberCardB + numberCardC + numberCardD,
        expDate,
        bank,
        amount,
        amount,
        testGateway,
        cardHolderName,
        email);
  }