Sha256: 49a3eda97c41b99341fffa393458414a170e031ea01e3179c5cb369623d7a2cf

Contents?: true

Size: 992 Bytes

Versions: 23

Compression:

Stored size: 992 Bytes

Contents

module Effective
  module Providers
    module Refund
      extend ActiveSupport::Concern

      def refund
        raise('refund provider is not available') unless EffectiveOrders.refund?
        raise('refund provider is not configured for buyer purchase') unless EffectiveOrders.buyer_purchases_refund?

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

        EffectiveResources.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]
        )
      end

      def refund_params
        params.require(:refund).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/refund.rb
effective_orders-6.14.5 app/controllers/effective/providers/refund.rb
effective_orders-6.14.4 app/controllers/effective/providers/refund.rb
effective_orders-6.14.3 app/controllers/effective/providers/refund.rb
effective_orders-6.14.2 app/controllers/effective/providers/refund.rb
effective_orders-6.14.1 app/controllers/effective/providers/refund.rb
effective_orders-6.14.0 app/controllers/effective/providers/refund.rb
effective_orders-6.13.3 app/controllers/effective/providers/refund.rb
effective_orders-6.13.2 app/controllers/effective/providers/refund.rb
effective_orders-6.13.1 app/controllers/effective/providers/refund.rb
effective_orders-6.13.0 app/controllers/effective/providers/refund.rb
effective_orders-6.12.4 app/controllers/effective/providers/refund.rb
effective_orders-6.12.3 app/controllers/effective/providers/refund.rb
effective_orders-6.12.2 app/controllers/effective/providers/refund.rb
effective_orders-6.12.1 app/controllers/effective/providers/refund.rb
effective_orders-6.12.0 app/controllers/effective/providers/refund.rb
effective_orders-6.9.10 app/controllers/effective/providers/refund.rb
effective_orders-6.9.9 app/controllers/effective/providers/refund.rb
effective_orders-6.9.8 app/controllers/effective/providers/refund.rb
effective_orders-6.9.7 app/controllers/effective/providers/refund.rb