Sha256: 6d41a35f468f19a0ec9164e49b099b62443bed4ba6e3b6b8b14b625e65d55016

Contents?: true

Size: 415 Bytes

Versions: 7

Compression:

Stored size: 415 Bytes

Contents

class Spree::Api::BraintreeClientTokenController < Spree::Api::BaseController
  def create
    if params[:payment_method_id]
      gateway = Solidus::Gateway::BraintreeGateway.find_by!(id: params[:payment_method_id])
    else
      gateway = Solidus::Gateway::BraintreeGateway.find_by!(active: true)
    end

    render json: { client_token: gateway.generate_client_token, payment_method_id: gateway.id }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_braintree-0.2.1 app/controllers/spree/api/braintree_client_token_controller.rb
solidus_braintree-0.2.0 app/controllers/spree/api/braintree_client_token_controller.rb
solidus_braintree-0.1.5 app/controllers/spree/api/braintree_client_token_controller.rb
solidus_braintree-0.1.3 app/controllers/spree/api/braintree_client_token_controller.rb
solidus_braintree-0.1.2 app/controllers/spree/api/braintree_client_token_controller.rb
solidus_braintree-0.1.1 app/controllers/spree/api/braintree_client_token_controller.rb
solidus_braintree-0.1.0 app/controllers/spree/api/braintree_client_token_controller.rb