Add enterprise_fee_additional_tax and enterprise_fee_included_tax

This commit is contained in:
Gaetan Craig-Riou
2024-01-23 10:31:04 +11:00
parent b28e63174d
commit 8181f3b09a

View File

@@ -3,12 +3,17 @@
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_tax
:variant_id, :unit_price_price_and_unit, :unit_presentation,
:enterprise_fee_additional_tax, :enterprise_fee_included_tax
has_one :variant, serializer: Invoice::VariantSerializer
has_many :tax_rates, serializer: Invoice::TaxRateSerializer
def enterprise_fee_tax
EnterpriseFeeAdjustments.new(object.enterprise_fee_adjustments).total_tax
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