Module: Effective::Providers::StripeConnect
- Extended by:
- ActiveSupport::Concern
- Included in:
- OrdersController
- Defined in:
- app/controllers/effective/providers/stripe_connect.rb
Instance Method Summary collapse
-
#stripe_connect_redirect_uri ⇒ Object
So this is the postback after Stripe does its oAuth authentication.
Instance Method Details
#stripe_connect_redirect_uri ⇒ Object
So this is the postback after Stripe does its oAuth authentication
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/effective/providers/stripe_connect.rb', line 11 def stripe_connect_redirect_uri if params[:code].present? token_params = request_access_token(params[:code]) # We got a code, so now we make a curl request for the access_token customer = Effective::Customer.for_user(current_user) if token_params['access_token'].present? && customer.present? if customer.update_attributes(:stripe_connect_access_token => token_params['access_token']) flash[:success] = 'Successfully Connected with Stripe Connect' else flash[:danger] = "Unable to update customer: #{customer.errors[:base].first}" end else flash[:danger] = "Error when connecting to Stripe /oauth/token: #{token_params[:error]}. Please try again." end else flash[:danger] = "Error when connecting to Stripe /oauth/authorize: #{params[:error]}. Please try again." end redirect_to URI.parse(@stripe_state_params['redirect_to']).path rescue effective_orders.orders_path end |