Sha256: c0479d210050651c0abc6bbd0d55c6569972848002418926f0acf81a2e63ce55

Contents?: true

Size: 987 Bytes

Versions: 47

Compression:

Stored size: 987 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.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

47 entries across 47 versions & 1 rubygems

Version Path
effective_orders-6.9.2 app/controllers/effective/providers/refund.rb
effective_orders-6.9.1 app/controllers/effective/providers/refund.rb
effective_orders-6.9.0 app/controllers/effective/providers/refund.rb
effective_orders-6.8.2 app/controllers/effective/providers/refund.rb
effective_orders-6.8.1 app/controllers/effective/providers/refund.rb
effective_orders-6.8.0 app/controllers/effective/providers/refund.rb
effective_orders-6.7.3 app/controllers/effective/providers/refund.rb
effective_orders-6.7.2 app/controllers/effective/providers/refund.rb
effective_orders-6.7.1 app/controllers/effective/providers/refund.rb
effective_orders-6.7.0 app/controllers/effective/providers/refund.rb
effective_orders-6.6.3 app/controllers/effective/providers/refund.rb
effective_orders-6.6.2 app/controllers/effective/providers/refund.rb
effective_orders-6.6.1 app/controllers/effective/providers/refund.rb
effective_orders-6.6.0 app/controllers/effective/providers/refund.rb
effective_orders-6.5.9 app/controllers/effective/providers/refund.rb
effective_orders-6.5.8 app/controllers/effective/providers/refund.rb
effective_orders-6.5.7 app/controllers/effective/providers/refund.rb
effective_orders-6.5.6 app/controllers/effective/providers/refund.rb
effective_orders-6.5.5 app/controllers/effective/providers/refund.rb
effective_orders-6.5.4 app/controllers/effective/providers/refund.rb