Files
openfoodnetwork/app/serializers/invoice/line_item_serializer.rb
2024-02-19 11:35:09 +01:00

19 lines
688 B
Ruby

# frozen_string_literal: false
class Invoice
class LineItemSerializer < ActiveModel::Serializer
attributes :id, :added_tax, :currency, :included_tax, :price_with_adjustments, :quantity,
:variant_id, :unit_price_price_and_unit, :unit_presentation,
:enterprise_fee_additional_tax, :enterprise_fee_included_tax
has_one :variant, serializer: Invoice::VariantSerializer
def enterprise_fee_additional_tax
EnterpriseFeeAdjustments.new(object.enterprise_fee_adjustments).total_additional_tax
end
def enterprise_fee_included_tax
EnterpriseFeeAdjustments.new(object.enterprise_fee_adjustments).total_included_tax
end
end
end