module Stall::TotalPricesManager

Public Instance Methods

remainder() click to toggle source

Returns the balance between the actual total price and the zero-floored total price displayed to the users.

This allows for calculating credit notes amount when an order is paid with a negative remainder

# File lib/stall/total_prices_manager.rb, line 26
def remainder
  total_price - original_total_price
end
remainder?() click to toggle source
# File lib/stall/total_prices_manager.rb, line 30
def remainder?
  Stall.config.convert_cart_remainder_to_credit_note && remainder.to_d > 0
end

Private Instance Methods

ensure_money(price) click to toggle source
# File lib/stall/total_prices_manager.rb, line 36
def ensure_money(price)
  (Money === price) ? price : Money.new(price, currency)
end