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.68.2 lib/braintree/testing_gateway.rb
braintree-2.68.1 lib/braintree/testing_gateway.rb
braintree-2.68.0 lib/braintree/testing_gateway.rb
braintree-2.67.0 lib/braintree/testing_gateway.rb
braintree-2.66.0 lib/braintree/testing_gateway.rb
braintree-2.65.0 lib/braintree/testing_gateway.rb
braintree-2.64.0 lib/braintree/testing_gateway.rb
braintree-2.63.0 lib/braintree/testing_gateway.rb
braintree-2.62.0 lib/braintree/testing_gateway.rb
braintree-2.61.1 lib/braintree/testing_gateway.rb
braintree-2.61.0 lib/braintree/testing_gateway.rb
braintree-2.60.0 lib/braintree/testing_gateway.rb
braintree-2.59.0 lib/braintree/testing_gateway.rb
braintree-2.58.0 lib/braintree/testing_gateway.rb
braintree-2.57.0 lib/braintree/testing_gateway.rb
braintree-2.56.0 lib/braintree/testing_gateway.rb
braintree-2.55.0 lib/braintree/testing_gateway.rb
braintree-2.54.0 lib/braintree/testing_gateway.rb
braintree-2.50.0 lib/braintree/testing_gateway.rb
braintree-2.49.0 lib/braintree/testing_gateway.rb