Files
openfoodnetwork/app/helpers/spree/payment_methods_helper.rb
David Cook 7e0042ea1d Apply code suggestion
Co-authored-by: Gaetan Craig-Riou <gaetan.riou@gmail.com>

Co-authored-by: Gaetan Craig-Riou <40413322+rioug@users.noreply.github.com>
2023-07-05 11:27:03 +10:00

18 lines
395 B
Ruby

# frozen_string_literal: true
module Spree
module PaymentMethodsHelper
def payment_method(payment)
# hack to allow us to retrieve the name of a "deleted" payment method
id = payment.payment_method_id
return if id.nil?
Spree::PaymentMethod.find_with_destroyed(id)
end
def payment_method_name(payment)
payment_method(payment)&.name
end
end
end