Files
openfoodnetwork/app/models/invoice/data_presenter/adjustable.rb
Mohamed ABDELLANI 7cb200e21e fix linting errors
2023-10-11 09:27:16 +01:00

21 lines
629 B
Ruby

# frozen_string_literal: false
class Invoice
class DataPresenter
class Adjustable < Invoice::DataPresenter::Base
attributes :id, :type, :currency, :included_tax_total, :additional_tax_total, :amount
def display_taxes(display_zero: false)
if included_tax_total.positive?
amount = Spree::Money.new(included_tax_total, currency:)
I18n.t(:tax_amount_included, amount:)
elsif additional_tax_total.positive?
Spree::Money.new(additional_tax_total, currency:)
elsif display_zero
Spree::Money.new(0.00, currency:)
end
end
end
end
end