Module: Effective::Providers::Stripe
- Extended by:
- ActiveSupport::Concern
- Included in:
- OrdersController
- Defined in:
- app/controllers/effective/providers/stripe.rb
Instance Method Summary collapse
-
#stripe_charge ⇒ Object
TODO: Make stripe charge work with admin checkout workflow, purchased_url and declined_url Make it save the customer and not require typing in a CC every time.
Instance Method Details
#stripe_charge ⇒ Object
TODO: Make stripe charge work with admin checkout workflow, purchased_url and declined_url Make it save the customer and not require typing in a CC every time.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/effective/providers/stripe.rb', line 9 def stripe_charge @order ||= Effective::Order.find(stripe_charge_params[:effective_order_id]) @stripe_charge = Effective::Providers::StripeCharge.new(stripe_charge_params) @stripe_charge.order = @order EffectiveOrders.(self, :update, @order) if @stripe_charge.valid? && (response = process_stripe_charge(@stripe_charge)) != false order_purchased( payment: response, provider: 'stripe', card: (response[:charge]['source']['brand'] rescue nil) ) else @page_title = 'Checkout' flash.now[:danger] = @stripe_charge.errors..to_sentence render :show end end |