Sha256: 84a679d64d4fb6246dcecd081cf161ee0f55b87df226be83d939e343d2e5bbf6

Contents?: true

Size: 893 Bytes

Versions: 16

Compression:

Stored size: 893 Bytes

Contents

module Effective
  module Providers
    module Free
      extend ActiveSupport::Concern

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

        @order ||= Order.deep.find(params[:id])
        @order.current_user = current_user unless admin_checkout?(free_params)

        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]
        )
      end

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

    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
effective_orders-6.19.1 app/controllers/effective/providers/free.rb
effective_orders-6.19.0 app/controllers/effective/providers/free.rb
effective_orders-6.18.4 app/controllers/effective/providers/free.rb
effective_orders-6.18.3 app/controllers/effective/providers/free.rb
effective_orders-6.18.2 app/controllers/effective/providers/free.rb
effective_orders-6.18.1 app/controllers/effective/providers/free.rb
effective_orders-6.18.0 app/controllers/effective/providers/free.rb
effective_orders-6.17.2 app/controllers/effective/providers/free.rb
effective_orders-6.17.1 app/controllers/effective/providers/free.rb
effective_orders-6.17.0 app/controllers/effective/providers/free.rb
effective_orders-6.16.4 app/controllers/effective/providers/free.rb
effective_orders-6.16.3 app/controllers/effective/providers/free.rb
effective_orders-6.16.2 app/controllers/effective/providers/free.rb
effective_orders-6.16.1 app/controllers/effective/providers/free.rb
effective_orders-6.16.0 app/controllers/effective/providers/free.rb
effective_orders-6.15.0 app/controllers/effective/providers/free.rb