Files
openfoodnetwork/app/serializers/invoice/adjustment_originator_serializer.rb
Mohamed ABDELLANI d40338bed5 add adjustment originators to the order serialization
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
2023-10-11 09:26:50 +01:00

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