Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Update app/controllers/solidus_paypal_braintree/client_tokens_control…
Browse files Browse the repository at this point in the history
…ler.rb

Co-Authored-By: Thomas von Deyen <[email protected]>
  • Loading branch information
skukx and tvdeyen authored Nov 1, 2019
1 parent 687b697 commit 9168828
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ class ClientTokensController < Spree::Api::BaseController
before_action :load_gateway

def create
render json: { client_token: generate_token, payment_method_id: @gateway.id }
token = @gateway.generate_token
if token
render json: { client_token: token, payment_method_id: @gateway.id }
else
render json: { error: Gateway::TOKEN_GENERATION_DISABLED_MESSAGE }, status: 422
end
end

private
Expand Down

0 comments on commit 9168828

Please sign in to comment.