Class: SolidusAfterpay::ShippingRatePresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presentes/solidus_afterpay/shipping_rate_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(shipping_rate:) ⇒ ShippingRatePresenter

Returns a new instance of ShippingRatePresenter.



5
6
7
# File 'app/presentes/solidus_afterpay/shipping_rate_presenter.rb', line 5

def initialize(shipping_rate:)
  @shipping_rate = shipping_rate
end

Instance Method Details

#amount_with_taxesObject



16
17
18
# File 'app/presentes/solidus_afterpay/shipping_rate_presenter.rb', line 16

def amount_with_taxes
  shipping_rate.cost.to_f + shipping_rate.taxes.sum(&:amount)
end

#order_amountObject



9
10
11
12
13
14
# File 'app/presentes/solidus_afterpay/shipping_rate_presenter.rb', line 9

def order_amount
  shipping_rate.order.item_total.to_f +
    shipping_rate.cost +
    shipping_rate.taxes.sum(&:amount) +
    order_presenter.line_items_tax_amount
end