Module: Effective::Providers::Paypal

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

Instance Method Summary collapse

Instance Method Details

#paypal_postbackObject



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

def paypal_postback
  @order ||= Effective::Order.where(:id => params[:invoice].to_i).first

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

  if @order.present?
    if params[:payment_status] == 'Completed' && params[:custom] == EffectiveOrders.paypal[:secret]
      order_purchased(params)
    else
      order_declined(params)
    end
  end

  head(:ok)
end