Merge pull request #8415 from jibees/add-tax_category_id-to-adjustements

API: add the tax_category_id for each ajustements of an order
This commit is contained in:
Maikel
2021-10-29 12:02:59 +11:00
committed by GitHub

View File

@@ -4,6 +4,15 @@ module Api
class AdjustmentSerializer < ActiveModel::Serializer
attributes :id, :amount, :label, :eligible,
:adjustable_type, :adjustable_id,
:originator_type, :originator_id
:originator_type, :originator_id,
:tax_category_id
def tax_category_id
if object.originator_type == "Spree::TaxRate"
object.originator.tax_category_id
else
object.tax_category_id
end
end
end
end