Sha256: d45d454bf3bbf02b7455b2d943fc0a9cf483c643282e709e700b3e744039a7bd

Contents?: true

Size: 906 Bytes

Versions: 8

Compression:

Stored size: 906 Bytes

Contents

module Effective
  module Providers
    module Ccbill
      extend ActiveSupport::Concern

      included do
        skip_before_filter :verify_authenticity_token, only: [:ccbill_postback]
      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

8 entries across 8 versions & 1 rubygems

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