Class: C2eCore::Drops::OrderVatDrop

Inherits:
BaseDrop
  • Object
show all
Includes:
Helpers::OrderConversions
Defined in:
/build/app/mailers/c2e_core/drops/order_vat_drop.rb

Instance Method Summary collapse

Methods included from Helpers::OrderConversions

#converted_price, #format_price

Constructor Details

#initialize(vat_hash, order) ⇒ OrderVatDrop

Returns a new instance of OrderVatDrop.



8
9
10
11
12
# File '/build/app/mailers/c2e_core/drops/order_vat_drop.rb', line 8

def initialize(vat_hash, order)
  super()
  @order = order
  @vat_hash = vat_hash
end

Instance Method Details

#baseDecimal

Returns - Base of current VAT record. E.g.: 100.0.

Returns:

  • (Decimal)
    • Base of current VAT record. E.g.: 100.0



20
21
22
# File '/build/app/mailers/c2e_core/drops/order_vat_drop.rb', line 20

def base
  converted_price @vat_hash[:base].to_d
end

#percentageDecimal

Returns - Percentage of current VAT record. E.g.: 15.0.

Returns:

  • (Decimal)
    • Percentage of current VAT record. E.g.: 15.0



15
16
17
# File '/build/app/mailers/c2e_core/drops/order_vat_drop.rb', line 15

def percentage
  @vat_hash[:vat_rate].to_d
end

#totalDecimal

Returns - Total value of current VAT record. E.g.: 115.0.

Returns:

  • (Decimal)
    • Total value of current VAT record. E.g.: 115.0



30
31
32
# File '/build/app/mailers/c2e_core/drops/order_vat_drop.rb', line 30

def total
  converted_price(base + vat)
end

#vatDecimal

Returns - Vat of current VAT record. E.g.: 15.0.

Returns:

  • (Decimal)
    • Vat of current VAT record. E.g.: 15.0



25
26
27
# File '/build/app/mailers/c2e_core/drops/order_vat_drop.rb', line 25

def vat
  converted_price @vat_hash[:vat].to_d
end