mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 17:28:18 +02:00
parent
d85e57d800
commit
7723a30d1b
17 changed files with 240 additions and 200 deletions
19
app/models/invoice/vat_rate_calculator.rb
Normal file
19
app/models/invoice/vat_rate_calculator.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
class Invoice
|
||||
class VatRateCalculator
|
||||
attr_reader :registry
|
||||
attr_reader :registrar
|
||||
|
||||
def initialize(registry: Registry.current, registrar:)
|
||||
@registry = registry
|
||||
@registrar = registrar
|
||||
end
|
||||
|
||||
def calculate
|
||||
if registrar.vat_liable_locally?(registry)
|
||||
registry.vat_rate
|
||||
else
|
||||
registrar.vat_rate || 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue