Sha256: 0ee732e14959cfef781f57cb3a15e5d01a52ee29de20f001c884f322958fda6a

Contents?: true

Size: 987 Bytes

Versions: 16

Compression:

Stored size: 987 Bytes

Contents

module Effective
  module Providers
    module Pretend
      extend ActiveSupport::Concern

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

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

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

        if params[:commit].to_s.include?('Decline')
          order_declined(
            payment: 'for pretend', 
            provider: 'pretend', 
            card: 'none', 
            declined_url: pretend_params[:declined_url]
          )
        else
          order_purchased(
            payment: 'for pretend', 
            provider: 'pretend', 
            card: 'none', 
            purchased_url: pretend_params[:purchased_url]
          )
        end
      end

      def pretend_params
        params.require(:pretend).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/pretend.rb
effective_orders-6.19.0 app/controllers/effective/providers/pretend.rb
effective_orders-6.18.4 app/controllers/effective/providers/pretend.rb
effective_orders-6.18.3 app/controllers/effective/providers/pretend.rb
effective_orders-6.18.2 app/controllers/effective/providers/pretend.rb
effective_orders-6.18.1 app/controllers/effective/providers/pretend.rb
effective_orders-6.18.0 app/controllers/effective/providers/pretend.rb
effective_orders-6.17.2 app/controllers/effective/providers/pretend.rb
effective_orders-6.17.1 app/controllers/effective/providers/pretend.rb
effective_orders-6.17.0 app/controllers/effective/providers/pretend.rb
effective_orders-6.16.4 app/controllers/effective/providers/pretend.rb
effective_orders-6.16.3 app/controllers/effective/providers/pretend.rb
effective_orders-6.16.2 app/controllers/effective/providers/pretend.rb
effective_orders-6.16.1 app/controllers/effective/providers/pretend.rb
effective_orders-6.16.0 app/controllers/effective/providers/pretend.rb
effective_orders-6.15.0 app/controllers/effective/providers/pretend.rb