Sha256: f788bdfe9f582ff32004f865481e56e98ecf2a518f8f0635089a62bd1ea00c36

Contents?: true

Size: 931 Bytes

Versions: 8

Compression:

Stored size: 931 Bytes

Contents

module Effective
  module Providers
    module Paypal
      extend ActiveSupport::Concern

      included do
        skip_before_filter :verify_authenticity_token, :only => [:paypal_postback]
      end

      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


    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
effective_orders-2.1.15 app/controllers/effective/providers/paypal.rb
effective_orders-2.1.14 app/controllers/effective/providers/paypal.rb
effective_orders-2.1.13 app/controllers/effective/providers/paypal.rb
effective_orders-2.1.12 app/controllers/effective/providers/paypal.rb
effective_orders-2.1.10 app/controllers/effective/providers/paypal.rb
effective_orders-2.1.9 app/controllers/effective/providers/paypal.rb
effective_orders-2.1.8 app/controllers/effective/providers/paypal.rb
effective_orders-2.1.7 app/controllers/effective/providers/paypal.rb