mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 05:56:20 +02:00
21 lines
517 B
Ruby
21 lines
517 B
Ruby
class Invoice
|
|
class VatRateCalculator
|
|
OLD_VAT_RATE = 20.0
|
|
|
|
attr_reader :registry, :registrar, :current_year
|
|
|
|
def initialize(registry: Registry.current, current_year: Time.zone.today.year, registrar:)
|
|
@registry = registry
|
|
@registrar = registrar
|
|
@current_year = current_year
|
|
end
|
|
|
|
def calculate
|
|
if registrar.vat_liable_locally?(registry)
|
|
current_year > 2023 ? registry.vat_rate : OLD_VAT_RATE
|
|
else
|
|
registrar.vat_rate || 0
|
|
end
|
|
end
|
|
end
|
|
end
|