Sha256: 2d4446c3e97c60348d2e32af6f4f2459362d02014f4e3c3a1aee0c1bca688866

Contents?: true

Size: 1017 Bytes

Versions: 3

Compression:

Stored size: 1017 Bytes

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 check_environment
      raise TestOperationPerformedInProduction if Braintree::Configuration.environment == :production
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
braintree-2.33.1 lib/braintree/testing_gateway.rb
braintree-2.33.0 lib/braintree/testing_gateway.rb
braintree-2.32.1 lib/braintree/testing_gateway.rb