Module: Effective::Providers::AppCheckout

Extended by:
ActiveSupport::Concern
Included in:
OrdersController
Defined in:
app/controllers/effective/providers/app_checkout.rb

Instance Method Summary collapse

Instance Method Details

#app_checkoutObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/effective/providers/app_checkout.rb', line 9

def app_checkout
  @order = Order.find(params[:id])

  (EffectiveOrders.authorized?(self, :update, @order) rescue false)

  checkout = EffectiveOrders.app_checkout[:service].call(order: @order)
  if checkout.success?
    order_purchased(details: payment_details(checkout), provider: 'app_checkout', card: 'none')
  else
    flash = EffectiveOrders.app_checkout[:declined_flash]
    order_declined(details: payment_details(checkout), message: flash, provider: 'app_checkout', card: 'none')
  end
end