class Braintree::TestingGateway

Public Class Methods

new(gateway) click to toggle source
# File lib/braintree/testing_gateway.rb, line 4
def initialize(gateway)
  @gateway = gateway
  @config = gateway.config
  @config.assert_has_access_token_or_keys
  @transaction_gateway = TransactionGateway.new(gateway)
end

Public Instance Methods

check_environment() click to toggle source
# File lib/braintree/testing_gateway.rb, line 39
def check_environment
  raise TestOperationPerformedInProduction if @config.environment == :production
end
settle(transaction_id) click to toggle source
# File lib/braintree/testing_gateway.rb, line 11
def settle(transaction_id)
  check_environment

  response = @config.http.put("#{@config.base_merchant_path}/transactions/#{transaction_id}/settle")
  @transaction_gateway._handle_transaction_response(response)
end
settlement_confirm(transaction_id) click to toggle source
# File lib/braintree/testing_gateway.rb, line 18
def settlement_confirm(transaction_id)
  check_environment

  response = @config.http.put("#{@config.base_merchant_path}/transactions/#{transaction_id}/settlement_confirm")
  @transaction_gateway._handle_transaction_response(response)
end
settlement_decline(transaction_id) click to toggle source
# File lib/braintree/testing_gateway.rb, line 25
def settlement_decline(transaction_id)
  check_environment

  response = @config.http.put("#{@config.base_merchant_path}/transactions/#{transaction_id}/settlement_decline")
  @transaction_gateway._handle_transaction_response(response)
end
settlement_pending(transaction_id) click to toggle source
# File lib/braintree/testing_gateway.rb, line 32
def settlement_pending(transaction_id)
  check_environment

  response = @config.http.put("#{@config.base_merchant_path}/transactions/#{transaction_id}/settlement_pending")
  @transaction_gateway._handle_transaction_response(response)
end