mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-09 23:06:06 +00:00
for some helpers like display_checkout_taxes_hash, it's needed to access the tax rates through the adjument's originator. The adjustment's originator will store the minimal details: id, type and amount
17 lines
303 B
Ruby
17 lines
303 B
Ruby
# frozen_string_literal: false
|
|
|
|
class Invoice
|
|
class AdjustmentOriginatorSerializer < ActiveModel::Serializer
|
|
attributes :id, :type, :amount
|
|
def type
|
|
object.class.name
|
|
end
|
|
|
|
def amount
|
|
return nil unless object.respond_to?(:amount)
|
|
|
|
object.amount.to_f
|
|
end
|
|
end
|
|
end
|