Sha256: 6c329a9ac37bc4999987bc211ed4d3419a0e8fa1d6b5c8f7b9a4f7fcd23da90e

Contents?: true

Size: 761 Bytes

Versions: 2

Compression:

Stored size: 761 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:
      [
        :customer_id, :proxy_merchant_id,
        {:options => [:make_default, :verify_card, :fail_on_duplicate_payment_method]}
      ]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
braintree-2.31.0 lib/braintree/client_token_gateway.rb
braintree-2.30.2 lib/braintree/client_token_gateway.rb