Sha256: 0d2a0ab9d5e99c151677adbc38eac99c75ebe556bcbef7db2a08c928fb4af3ef

Contents?: true

Size: 839 Bytes

Versions: 27

Compression:

Stored size: 839 Bytes

Contents

module Effective
  module Providers
    module Refund
      extend ActiveSupport::Concern

      def refund
        @order ||= Order.find(params[:id])

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

        unless @order.refund?
          flash[:danger] = 'Unable to process refund order with a positive total'
          redirect_to effective_orders.order_path(@order)
          return
        end

        flash[:success] = EffectiveOrders.refund[:success].presence

        order_purchased(
          payment: 'refund. no payment required.',
          provider: 'refund',
          purchased_url: refund_params[:purchased_url],
          declined_url: refund_params[:declined_url]
        )
      end

      def refund_params
        params.require(:refund).permit(:purchased_url, :declined_url)
      end

    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
effective_orders-4.6.3 app/controllers/effective/providers/refund.rb
effective_orders-4.6.2 app/controllers/effective/providers/refund.rb
effective_orders-4.6.0 app/controllers/effective/providers/refund.rb
effective_orders-4.5.12 app/controllers/effective/providers/refund.rb
effective_orders-4.5.11 app/controllers/effective/providers/refund.rb
effective_orders-4.5.10 app/controllers/effective/providers/refund.rb
effective_orders-4.5.9 app/controllers/effective/providers/refund.rb
effective_orders-4.5.8 app/controllers/effective/providers/refund.rb
effective_orders-4.5.7 app/controllers/effective/providers/refund.rb
effective_orders-4.5.6 app/controllers/effective/providers/refund.rb
effective_orders-4.5.5 app/controllers/effective/providers/refund.rb
effective_orders-4.5.4 app/controllers/effective/providers/refund.rb
effective_orders-4.5.3 app/controllers/effective/providers/refund.rb
effective_orders-4.5.2 app/controllers/effective/providers/refund.rb
effective_orders-4.5.1 app/controllers/effective/providers/refund.rb
effective_orders-4.5.0 app/controllers/effective/providers/refund.rb
effective_orders-4.4.10 app/controllers/effective/providers/refund.rb
effective_orders-4.4.9 app/controllers/effective/providers/refund.rb
effective_orders-4.4.8 app/controllers/effective/providers/refund.rb
effective_orders-4.4.7 app/controllers/effective/providers/refund.rb