Sha256: fd3fc6849dea3e20867eb25917fe9749a3b31f0ad7cb6fb0afefe2a6753afd0c

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

module Effective
  module Providers
    module Ccbill
      extend ActiveSupport::Concern

      included do
        if respond_to?(:skip_before_action)
          skip_before_action :verify_authenticity_token, only: [:ccbill_postback]
        else
          skip_before_filter :verify_authenticity_token, only: [:ccbill_postback]
        end
      end

      def ccbill_postback
        postback = Effective::Providers::CcbillPostback.new(params)
        @order ||= Effective::Order.find(postback.order_id)

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

        if @order.present? && postback.verified?
          if @order.purchased?
            order_purchased(details: postback.order_details, provider: 'ccbill')
          elsif postback.approval? && postback.matches?(@order)
            order_purchased(details: postback.order_details, provider: 'ccbill')
          else
            order_declined(details: postback.order_details, provider: 'ccbill')
          end
        end

        head(:ok)
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
effective_orders-2.2.4 app/controllers/effective/providers/ccbill.rb
effective_orders-2.2.3 app/controllers/effective/providers/ccbill.rb
effective_orders-2.2.2 app/controllers/effective/providers/ccbill.rb
effective_orders-2.2.1 app/controllers/effective/providers/ccbill.rb
effective_orders-2.2.0 app/controllers/effective/providers/ccbill.rb
effective_orders-2.1.17 app/controllers/effective/providers/ccbill.rb
effective_orders-2.1.16 app/controllers/effective/providers/ccbill.rb