Sha256: 5455653a2b768d1342f9f0b355ca82e3a1e5a051f4b428fb6e37c311ca75289f

Contents?: true

Size: 655 Bytes

Versions: 11

Compression:

Stored size: 655 Bytes

Contents

module RefundMethods
  extend ActiveSupport::Concern
  included do
    class_attribute :eligible_refund_methods
    self.eligible_refund_methods = whitelisted_refund_methods.empty? ? defined_refund_methods : whitelisted_refund_methods
  end

  class_methods do
    def whitelisted_refund_methods
      # Override this methods to whitelist payment methods
      []
    end

    def defined_refund_methods
      payment_methods = Spree::PaymentMethod.pluck(:type)
      sorted_payment_methods = payment_methods.reject { |payment_method| payment_method =~ /StoreCredit/ }
      (sorted_payment_methods | payment_methods).map(&:constantize)
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
spree-returnly-0.13.1 app/services/refund_methods.rb
solidus-returnly-0.13.1 app/services/refund_methods.rb
spree-returnly-0.13.0 app/services/refund_methods.rb
solidus-returnly-0.13.0 app/services/refund_methods.rb
solidus-returnly-0.12.0 app/services/refund_methods.rb
solidus-returnly-0.11.0 app/services/refund_methods.rb
solidus-returnly-0.10.0 app/services/refund_methods.rb
solidus-returnly-0.9.0 app/services/refund_methods.rb
solidus-returnly-0.8.1 app/services/refund_methods.rb
solidus-returnly-0.8.0 app/services/refund_methods.rb
solidus-returnly-0.7.1 app/services/refund_methods.rb