Sha256: 6241fac37f4b98eb633d79bc43b9ae22631e018fac3c0d457e4be2a6e9242005

Contents?: true

Size: 966 Bytes

Versions: 14

Compression:

Stored size: 966 Bytes

Contents

module Effective
  module Providers
    module Ccbill
      extend ActiveSupport::Concern

      included do
        skip_before_action :verify_authenticity_token, only: [:ccbill_postback]
      end

      # TODO: Make ccbill work with admin checkout workflow

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

        (EffectiveOrders.authorize!(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

14 entries across 14 versions & 1 rubygems

Version Path
effective_orders-3.2.3 app/controllers/effective/providers/ccbill.rb
effective_orders-3.2.2 app/controllers/effective/providers/ccbill.rb
effective_orders-3.2.1 app/controllers/effective/providers/ccbill.rb
effective_orders-3.2.0 app/controllers/effective/providers/ccbill.rb
effective_orders-3.1.7 app/controllers/effective/providers/ccbill.rb
effective_orders-3.1.6 app/controllers/effective/providers/ccbill.rb
effective_orders-3.1.4 app/controllers/effective/providers/ccbill.rb
effective_orders-3.1.3 app/controllers/effective/providers/ccbill.rb
effective_orders-3.1.0 app/controllers/effective/providers/ccbill.rb
effective_orders-3.0.4 app/controllers/effective/providers/ccbill.rb
effective_orders-3.0.3 app/controllers/effective/providers/ccbill.rb
effective_orders-3.0.2 app/controllers/effective/providers/ccbill.rb
effective_orders-3.0.1 app/controllers/effective/providers/ccbill.rb
effective_orders-3.0.0 app/controllers/effective/providers/ccbill.rb