Sha256: 210b0f44cb72b5551004d481576c52df0cda3f580505ed3e75f802d850a6b52a

Contents?: true

Size: 1.36 KB

Versions: 82

Compression:

Stored size: 1.36 KB

Contents

module Braintree
  class TestingGateway # :nodoc:

    def initialize(gateway)
      @gateway = gateway
      @config = gateway.config
      @config.assert_has_access_token_or_keys
      @transaction_gateway = TransactionGateway.new(gateway)
    end

    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

    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

    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

    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

    def check_environment
      raise TestOperationPerformedInProduction if @config.environment == :production
    end
  end
end

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
braintree-2.86.0 lib/braintree/testing_gateway.rb
braintree-2.85.0 lib/braintree/testing_gateway.rb
braintree-2.84.0 lib/braintree/testing_gateway.rb
braintree-2.83.0 lib/braintree/testing_gateway.rb
braintree-2.82.0 lib/braintree/testing_gateway.rb
braintree-2.81.0 lib/braintree/testing_gateway.rb
braintree-2.80.1 lib/braintree/testing_gateway.rb
braintree-2.80.0 lib/braintree/testing_gateway.rb
braintree-2.79.0 lib/braintree/testing_gateway.rb
braintree-2.78.0 lib/braintree/testing_gateway.rb
braintree-2.77.0 lib/braintree/testing_gateway.rb
braintree-2.76.0 lib/braintree/testing_gateway.rb
braintree-2.75.0 lib/braintree/testing_gateway.rb
braintree-2.74.0 lib/braintree/testing_gateway.rb
braintree-2.73.0 lib/braintree/testing_gateway.rb
braintree-2.72.0 lib/braintree/testing_gateway.rb
braintree-2.71.0 lib/braintree/testing_gateway.rb
braintree-2.70.0 lib/braintree/testing_gateway.rb
braintree-2.69.1 lib/braintree/testing_gateway.rb
braintree-2.69.0 lib/braintree/testing_gateway.rb