Module: Effective::Providers::Pretend

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

Instance Method Summary collapse

Instance Method Details

#pretendObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/effective/providers/pretend.rb', line 6

def pretend
  raise('pretend provider is not available') unless EffectiveOrders.pretend?

  @order ||= Order.deep.find(params[:id])

  EffectiveResources.authorize!(self, :update, @order)

  if params[:commit].to_s.include?('Decline')
    order_declined(
      payment: 'for pretend', 
      provider: 'pretend', 
      card: 'none', 
      declined_url: pretend_params[:declined_url]
    )
  else
    order_purchased(
      payment: 'for pretend', 
      provider: 'pretend', 
      card: 'none', 
      purchased_url: pretend_params[:purchased_url],
      current_user: (current_user unless admin_checkout?(pretend_params))
    )
  end
end

#pretend_paramsObject



31
32
33
# File 'app/controllers/effective/providers/pretend.rb', line 31

def pretend_params
  params.require(:pretend).permit(:purchased_url, :declined_url)
end