Sha256: cd8e0104a23193f122be596db868c10056fbe7b6a44d919e076d727e1d7dd2e5

Contents?: true

Size: 847 Bytes

Versions: 24

Compression:

Stored size: 847 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],
          current_user: current_user
        )
      end

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

    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
effective_orders-6.9.2 app/controllers/effective/providers/free.rb
effective_orders-6.9.1 app/controllers/effective/providers/free.rb
effective_orders-6.9.0 app/controllers/effective/providers/free.rb
effective_orders-6.8.2 app/controllers/effective/providers/free.rb
effective_orders-6.8.1 app/controllers/effective/providers/free.rb
effective_orders-6.8.0 app/controllers/effective/providers/free.rb
effective_orders-6.7.3 app/controllers/effective/providers/free.rb
effective_orders-6.7.2 app/controllers/effective/providers/free.rb
effective_orders-6.7.1 app/controllers/effective/providers/free.rb
effective_orders-6.7.0 app/controllers/effective/providers/free.rb
effective_orders-6.6.3 app/controllers/effective/providers/free.rb
effective_orders-6.6.2 app/controllers/effective/providers/free.rb
effective_orders-6.6.1 app/controllers/effective/providers/free.rb
effective_orders-6.6.0 app/controllers/effective/providers/free.rb
effective_orders-6.5.9 app/controllers/effective/providers/free.rb
effective_orders-6.5.8 app/controllers/effective/providers/free.rb
effective_orders-6.5.7 app/controllers/effective/providers/free.rb
effective_orders-6.5.6 app/controllers/effective/providers/free.rb
effective_orders-6.5.5 app/controllers/effective/providers/free.rb
effective_orders-6.5.4 app/controllers/effective/providers/free.rb