Class: Bitsy::ForwardTaxCalculator

Inherits:
Object
  • Object
show all
Defined in:
app/services/bitsy/forward_tax_calculator.rb

Class Method Summary collapse

Class Method Details

.calculate(payment, min_payment, total_received_amount, initial_tax_rate, added_tax_rate) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'app/services/bitsy/forward_tax_calculator.rb', line 4

def self.calculate(payment, min_payment, total_received_amount, initial_tax_rate, added_tax_rate)
  initial_tax_amount = AmountForInitialTaxCalculator.calculate(
    payment,
    min_payment,
    total_received_amount,
  )
  initial_tax_fee = initial_tax_amount * initial_tax_rate
  amount_for_added_tax = payment - initial_tax_amount
  added_tax_fee = amount_for_added_tax * added_tax_rate
  initial_tax_fee + added_tax_fee
end