<commit_before>require 'test_helper'
require "support/mercury_helper"

class RemoteMercuryCertificationTest < Test::Unit::TestCase
  include MercuryHelper

  # Tokenization

  def test_sale_and_reversal
    close_batch(tokenization_gateway)

    sale = tokenization_gateway.purchase(101, visa, options("1"))
    assert_success sale
    assert_equal "AP", sale.params["text_response"]

    reversal = tokenization_gateway.refund(101, sale.authorization, options)
    assert_success reversal
    assert_equal "REVERSED", reversal.params["text_response"]
  end

  def test_sale_and_void
    close_batch(tokenization_gateway)

    sale = tokenization_gateway.purchase(103, visa, options("1"))
    assert_success sale
    assert_equal "AP", sale.params["text_response"]

    void = tokenization_gateway.void(sale.authorization, options)
    assert_success void
    assert_equal "REVERSED", void.params["text_response"]
  end

  def test_preauth_capture_and_reversal
    close_batch(tokenization_gateway)

    preauth = tokenization_gateway.authorize(106, visa, options("1"))
    assert_success preauth
    assert_equal "AP", preauth.params["text_response"]

    capture = tokenization_gateway.capture(106, preauth.authorization, options)
    assert_success capture
    assert_equal "AP", capture.params["text_response"]

    reversal = tokenization_gateway.refund(106, capture.authorization, options)
    assert_success reversal
    assert_equal "REVERSED", reversal.params["text_response"]
  end

  def test_preauth_and_reversal
    close_batch(tokenization_gateway)

    preauth = tokenization_gateway.authorize(106, visa, options("1"))
    assert_success preauth
    assert_equal "AP", preauth.params["text_response"]

    reversal = tokenization_gateway.void(preauth.authorization, options)
    assert_success reversal
    assert_equal "REVERSED", reversal.params["text_response"]
  end

  private
<commit_msg>Mercury: use correct cert amount<commit_after>require 'test_helper'
require "support/mercury_helper"

class RemoteMercuryCertificationTest < Test::Unit::TestCase
  include MercuryHelper

  # Tokenization

  def test_sale_and_reversal
    close_batch(tokenization_gateway)

    sale = tokenization_gateway.purchase(101, visa, options("1"))
    assert_success sale
    assert_equal "AP", sale.params["text_response"]

    reversal = tokenization_gateway.refund(101, sale.authorization, options)
    assert_success reversal
    assert_equal "REVERSED", reversal.params["text_response"]
  end

  def test_sale_and_void
    close_batch(tokenization_gateway)

    sale = tokenization_gateway.purchase(103, visa, options("1"))
    assert_success sale
    assert_equal "AP", sale.params["text_response"]

    void = tokenization_gateway.void(sale.authorization, options)
    assert_success void
    assert_equal "REVERSED", void.params["text_response"]
  end

  def test_preauth_capture_and_reversal
    close_batch(tokenization_gateway)

    preauth = tokenization_gateway.authorize(106, visa, options("1"))
    assert_success preauth
    assert_equal "AP", preauth.params["text_response"]

    capture = tokenization_gateway.capture(106, preauth.authorization, options)
    assert_success capture
    assert_equal "AP", capture.params["text_response"]

    reversal = tokenization_gateway.refund(106, capture.authorization, options)
    assert_success reversal
    assert_equal "REVERSED", reversal.params["text_response"]
  end

  def test_preauth_and_reversal
    close_batch(tokenization_gateway)

    preauth = tokenization_gateway.authorize(113, visa, options("1"))
    assert_success preauth
    assert_equal "AP", preauth.params["text_response"]

    reversal = tokenization_gateway.void(preauth.authorization, options)
    assert_success reversal
    assert_equal "REVERSED", reversal.params["text_response"]
  end

  private

{'fraction_non_alphanumeric': 0.0873077925462601, 'fraction_numerical': 0.013031013812874642, 'mean_word_length': 5.281505728314239, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4624536', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1139, 'n_words': 216}