Sha256: 409eaea8770ce0179216ef9fde79450d466ef1923815d2d7d54bba5e927f2aeb

Contents?: true

Size: 833 Bytes

Versions: 19

Compression:

Stored size: 833 Bytes

Contents

module Effective
  module Providers
    module Free
      extend ActiveSupport::Concern

      def free
        raise('free provider is not available') unless EffectiveOrders.free?

        @order ||= Order.find(params[:id])

        EffectiveResources.authorize!(self, :update, @order)

        unless @order.free?
          flash[:danger] = 'Unable to process free order with a non-zero total'
          redirect_to effective_orders.order_path(@order)
          return
        end

        order_purchased(
          payment: 'free order. no payment required.',
          provider: 'free',
          card: 'none',
          purchased_url: free_params[:purchased_url],
          email: false
        )
      end

      def free_params
        params.require(:free).permit(:purchased_url, :declined_url)
      end

    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
effective_orders-5.1.15 app/controllers/effective/providers/free.rb
effective_orders-5.1.14 app/controllers/effective/providers/free.rb
effective_orders-5.1.13 app/controllers/effective/providers/free.rb
effective_orders-5.1.12 app/controllers/effective/providers/free.rb
effective_orders-5.1.11 app/controllers/effective/providers/free.rb
effective_orders-5.1.10 app/controllers/effective/providers/free.rb
effective_orders-5.1.9 app/controllers/effective/providers/free.rb
effective_orders-5.1.8 app/controllers/effective/providers/free.rb
effective_orders-5.1.7 app/controllers/effective/providers/free.rb
effective_orders-5.1.6 app/controllers/effective/providers/free.rb
effective_orders-5.1.5 app/controllers/effective/providers/free.rb
effective_orders-5.1.4 app/controllers/effective/providers/free.rb
effective_orders-5.1.3 app/controllers/effective/providers/free.rb
effective_orders-5.1.2 app/controllers/effective/providers/free.rb
effective_orders-5.1.1 app/controllers/effective/providers/free.rb
effective_orders-5.1.0 app/controllers/effective/providers/free.rb
effective_orders-5.0.5 app/controllers/effective/providers/free.rb
effective_orders-5.0.4 app/controllers/effective/providers/free.rb
effective_orders-5.0.3 app/controllers/effective/providers/free.rb