Sha256: f6116c647916f597285633f2ba3d2ee747339410e166cadb92f899ae3002e282

Contents?: true

Size: 1.22 KB

Versions: 13

Compression:

Stored size: 1.22 KB

Contents

module Braintree
  class TestingGateway # :nodoc:

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

    def settle(transaction_id)
      check_environment

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

    def settlement_confirm(transaction_id)
      check_environment

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

    def settlement_decline(transaction_id)
      check_environment

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

    def settlement_pending(transaction_id)
      check_environment

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

    def check_environment
      raise TestOperationPerformedInProduction if Braintree::Configuration.environment == :production
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
braintree-2.45.0 lib/braintree/testing_gateway.rb
braintree-2.44.0 lib/braintree/testing_gateway.rb
braintree-2.43.0 lib/braintree/testing_gateway.rb
braintree-2.42.0 lib/braintree/testing_gateway.rb
braintree-2.41.0 lib/braintree/testing_gateway.rb
braintree-2.40.0 lib/braintree/testing_gateway.rb
braintree-2.39.0 lib/braintree/testing_gateway.rb
braintree-2.38.0 lib/braintree/testing_gateway.rb
braintree-2.37.0 lib/braintree/testing_gateway.rb
braintree-2.36.0 lib/braintree/testing_gateway.rb
braintree-2.35.0 lib/braintree/testing_gateway.rb
braintree-2.34.1 lib/braintree/testing_gateway.rb
braintree-2.34.0 lib/braintree/testing_gateway.rb