Sha256: f8e8a9b781fe299bd9b29f967d07e8ca3fed11178f0222cfc36d59493be97681

Contents?: true

Size: 700 Bytes

Versions: 6

Compression:

Stored size: 700 Bytes

Contents

module Spree
  module Admin
    class RefundsController < ResourceController
      belongs_to 'spree/payment'
      before_action :load_order

      helper_method :refund_reasons

      private

      def location_after_save
        admin_order_payments_path(@payment.order)
      end

      def load_order
        # the spree/admin/shared/order_tabs partial expects the @order instance variable to be set
        @order = @payment.order if @payment
      end

      def refund_reasons
        @refund_reasons ||= RefundReason.active.all
      end

      def build_resource
        super.tap do |refund|
          refund.amount = refund.payment.credit_allowed
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_backend-2.4.2 app/controllers/spree/admin/refunds_controller.rb
spree_backend-2.4.1 app/controllers/spree/admin/refunds_controller.rb
spree_backend-2.4.0 app/controllers/spree/admin/refunds_controller.rb
spree_backend-2.4.0.rc3 app/controllers/spree/admin/refunds_controller.rb
spree_backend-2.4.0.rc2 app/controllers/spree/admin/refunds_controller.rb
spree_backend-2.4.0.rc1 app/controllers/spree/admin/refunds_controller.rb