Sha256: b09a1c7a6c47e0ddb55d08a4b483e3ab9e077edd1d5cdba54e41ef239e76618b

Contents?: true

Size: 809 Bytes

Versions: 65

Compression:

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

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

    end
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
effective_orders-6.4.4 app/controllers/effective/providers/free.rb
effective_orders-6.4.3 app/controllers/effective/providers/free.rb
effective_orders-6.4.2 app/controllers/effective/providers/free.rb
effective_orders-6.4.1 app/controllers/effective/providers/free.rb
effective_orders-6.4.0 app/controllers/effective/providers/free.rb
effective_orders-6.3.2 app/controllers/effective/providers/free.rb
effective_orders-6.3.1 app/controllers/effective/providers/free.rb
effective_orders-6.3.0 app/controllers/effective/providers/free.rb
effective_orders-6.2.1 app/controllers/effective/providers/free.rb
effective_orders-6.2.0 app/controllers/effective/providers/free.rb
effective_orders-6.1.5 app/controllers/effective/providers/free.rb
effective_orders-6.1.4 app/controllers/effective/providers/free.rb
effective_orders-6.1.3 app/controllers/effective/providers/free.rb
effective_orders-6.1.2 app/controllers/effective/providers/free.rb
effective_orders-6.1.1 app/controllers/effective/providers/free.rb
effective_orders-6.1.0 app/controllers/effective/providers/free.rb
effective_orders-6.0.1 app/controllers/effective/providers/free.rb
effective_orders-6.0.0 app/controllers/effective/providers/free.rb
effective_orders-5.9.4 app/controllers/effective/providers/free.rb
effective_orders-5.9.3 app/controllers/effective/providers/free.rb