Sha256: 076b8a50ed203ed09b39e529ac2aa961f3be488da6989e5242f49e576d8abda3

Contents?: true

Size: 879 Bytes

Versions: 41

Compression:

Stored size: 879 Bytes

Contents

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

    def create(payment_method_token)
      response = @config.http.post("#{@config.base_merchant_path}/payment_methods/#{payment_method_token}/nonces")
      payment_method_nonce = PaymentMethodNonce._new(@gateway, response.fetch(:payment_method_nonce))
      SuccessfulResult.new(:payment_method_nonce => payment_method_nonce)
    end

    def find(payment_method_nonce)
      response = @config.http.get("#{@config.base_merchant_path}/payment_method_nonces/#{payment_method_nonce}")
      payment_method_nonce = PaymentMethodNonce._new(@gateway, response.fetch(:payment_method_nonce))
      SuccessfulResult.new(:payment_method_nonce => payment_method_nonce)
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
braintree-2.46.0 lib/braintree/payment_method_nonce_gateway.rb