Sha256: 951bae5e723e121460fafa0c5b8b45b56840ffb11d540969127e749ffab932d3

Contents?: true

Size: 456 Bytes

Versions: 5

Compression:

Stored size: 456 Bytes

Contents

class Spree::Api::BraintreeClientTokenController < Spree::Api::BaseController
  skip_before_action :authenticate_user

  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

5 entries across 5 versions & 1 rubygems

Version Path
solidus_braintree-1.4.0 app/controllers/spree/api/braintree_client_token_controller.rb
solidus_braintree-1.3.0 app/controllers/spree/api/braintree_client_token_controller.rb
solidus_braintree-1.2.0 app/controllers/spree/api/braintree_client_token_controller.rb
solidus_braintree-1.1.0 app/controllers/spree/api/braintree_client_token_controller.rb
solidus_braintree-1.0.0 app/controllers/spree/api/braintree_client_token_controller.rb