mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
22 lines
314 B
Ruby
22 lines
314 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Checkout
|
|
class PaymentMethodFetcher
|
|
def initialize(order)
|
|
@order = order
|
|
end
|
|
|
|
def call
|
|
latest_payment&.payment_method
|
|
end
|
|
|
|
private
|
|
|
|
attr_reader :order
|
|
|
|
def latest_payment
|
|
order.payments.order(:created_at).last
|
|
end
|
|
end
|
|
end
|