Module: SolidusMollie::LineItemDecorator

Defined in:
app/decorators/models/line_item_decorator.rb

Instance Method Summary collapse

Instance Method Details

#tax_rateObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/decorators/models/line_item_decorator.rb', line 4

def tax_rate
  if adjustments.tax.any?
    # Solidus allows line items to have multiple TaxRate adjustments.
    # Mollie does not support this. Raise an error if there > 1 TaxRate adjustment.

    if adjustments.tax.count > 1
      raise 'Mollie does not support multiple TaxRate adjustments per line item'
    end
    
    adjustments.tax.first.source.amount
  else
    0.00
  end
end