Sha256: 443fdf876d0d18696986f4d6ea8a85095117c70a755af6dc4a7df2906dc56860

Contents?: true

Size: 1005 Bytes

Versions: 18

Compression:

Stored size: 1005 Bytes

Contents

module Braintree
  class PaymentMethodNonceGateway # :nodoc:
    include BaseModule

    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 create!(*args)
      return_object_or_raise(:payment_method_nonce) { create(*args) }
    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

18 entries across 18 versions & 1 rubygems

Version Path
braintree-2.101.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.100.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.99.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.98.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.97.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.96.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.95.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.94.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.93.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.92.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.91.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.90.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.89.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.88.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.87.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.86.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.85.0 lib/braintree/payment_method_nonce_gateway.rb
braintree-2.84.0 lib/braintree/payment_method_nonce_gateway.rb