Sha256: d57b10cfadebb9f27325de016a28fa3fbd9f3679b4a22cefd492cc7399a69418

Contents?: true

Size: 852 Bytes

Versions: 23

Compression:

Stored size: 852 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])

        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

23 entries across 23 versions & 1 rubygems

Version Path
effective_orders-6.14.6 app/controllers/effective/providers/free.rb
effective_orders-6.14.5 app/controllers/effective/providers/free.rb
effective_orders-6.14.4 app/controllers/effective/providers/free.rb
effective_orders-6.14.3 app/controllers/effective/providers/free.rb
effective_orders-6.14.2 app/controllers/effective/providers/free.rb
effective_orders-6.14.1 app/controllers/effective/providers/free.rb
effective_orders-6.14.0 app/controllers/effective/providers/free.rb
effective_orders-6.13.3 app/controllers/effective/providers/free.rb
effective_orders-6.13.2 app/controllers/effective/providers/free.rb
effective_orders-6.13.1 app/controllers/effective/providers/free.rb
effective_orders-6.13.0 app/controllers/effective/providers/free.rb
effective_orders-6.12.4 app/controllers/effective/providers/free.rb
effective_orders-6.12.3 app/controllers/effective/providers/free.rb
effective_orders-6.12.2 app/controllers/effective/providers/free.rb
effective_orders-6.12.1 app/controllers/effective/providers/free.rb
effective_orders-6.12.0 app/controllers/effective/providers/free.rb
effective_orders-6.9.10 app/controllers/effective/providers/free.rb
effective_orders-6.9.9 app/controllers/effective/providers/free.rb
effective_orders-6.9.8 app/controllers/effective/providers/free.rb
effective_orders-6.9.7 app/controllers/effective/providers/free.rb