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-4.15.0 lib/braintree/testing_gateway.rb
braintree-4.14.0 lib/braintree/testing_gateway.rb
braintree-4.13.0 lib/braintree/testing_gateway.rb
braintree-4.12.0 lib/braintree/testing_gateway.rb
braintree-4.11.0 lib/braintree/testing_gateway.rb
braintree-4.10.0 lib/braintree/testing_gateway.rb
braintree-4.9.0 lib/braintree/testing_gateway.rb
braintree-4.8.0 lib/braintree/testing_gateway.rb
braintree-4.7.0 lib/braintree/testing_gateway.rb
braintree-4.6.0 lib/braintree/testing_gateway.rb
braintree-4.5.0 lib/braintree/testing_gateway.rb
braintree-4.4.0 lib/braintree/testing_gateway.rb
braintree-4.3.0 lib/braintree/testing_gateway.rb
braintree-4.2.0 lib/braintree/testing_gateway.rb
braintree-4.1.0 lib/braintree/testing_gateway.rb
braintree-4.0.0 lib/braintree/testing_gateway.rb
braintree-3.4.0 lib/braintree/testing_gateway.rb
braintree-3.3.0 lib/braintree/testing_gateway.rb
braintree-3.2.0 lib/braintree/testing_gateway.rb
braintree-3.1.0 lib/braintree/testing_gateway.rb