Sha256: a4118856264d186579851fd2e7dc25acccd8ba91bb4dfc9a94a5acf54924410d

Contents?: true

Size: 784 Bytes

Versions: 2

Compression:

Stored size: 784 Bytes

Contents

module Braintree
  class PayerAuthenticationGateway # :nodoc:
    def initialize(gateway)
      @gateway = gateway
      @config = gateway.config
    end

    def authenticate(payer_authentication_id, response_payload)
      response = @config.http.post(
        "/payer_authentications/#{payer_authentication_id}/authenticate",
        :payer_authentication => {
          :response_payload => response_payload
        }
      )

      if response[:transaction]
        SuccessfulResult.new(:transaction => Transaction._new(@gateway, response[:transaction]))
      elsif response[:api_error_response]
        ErrorResult.new(@gateway, response[:api_error_response])
      else
        raise UnexpectedError, "expected :transaction or :api_error_response"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
braintree-2.10.3 lib/braintree/payer_authentication_gateway.rb
braintree-2.10.2 lib/braintree/payer_authentication_gateway.rb