Sha256: 910bdf8004d7d745c4fa5ece0a5836cf8eadc7306b801d199d97396f89d7fe2b

Contents?: true

Size: 869 Bytes

Versions: 16

Compression:

Stored size: 869 Bytes

Contents

module Braintree
  class ClientTokenGateway
    def initialize(gateway)
      @gateway = gateway
      @config = gateway.config
    end

    def generate(options={})
      params = nil
      if options
        Util.verify_keys(ClientTokenGateway._generate_signature, options)
        params = {:client_token => options}
      end
      result = @config.http.post("/client_token", params)

      if result[:client_token]
        result[:client_token][:value]
      else
        raise ArgumentError, result[:api_error_response][:message]
      end
    end

    def self._generate_signature # :nodoc:
      [
        :address_id, :customer_id, :proxy_merchant_id, :merchant_account_id,
        :version, :sepa_mandate_acceptance_location, :sepa_mandate_type,
        {:options => [:make_default, :verify_card, :fail_on_duplicate_payment_method]}
      ]
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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