14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/effective/providers/paypal.rb', line 14
def paypal_postback
@order ||= Effective::Order.where(id: (params[:invoice].to_i rescue 0)).first
(EffectiveOrders.authorized?(self, :update, @order) rescue false)
if @order.present?
if @order.purchased?
order_purchased(details: params, provider: 'paypal', card: params[:payment_type])
elsif (params[:payment_status] == 'Completed' && params[:custom] == EffectiveOrders.paypal[:secret])
order_purchased(details: params, provider: 'paypal', card: params[:payment_type])
else
order_declined(details: params, provider: 'paypal', card: params[:payment_type])
end
end
head(:ok)
end
|