lib/trebbianno/order.rb in trebbianno-ruby-api-0.0.5 vs lib/trebbianno/order.rb in trebbianno-ruby-api-0.0.6
- old
+ new
@@ -65,10 +65,10 @@
def line_item_discount(item_price, order)
(item_price * discount_percent(order)).round(2)
end
def discount_percent(order)
- order[:item_discount].to_f / line_item_count(order)
+ order[:item_discount].to_f.abs / line_item_count(order)
end
def line_item_count(order)
order[:line_items].inject(0) do |sum, hash|
sum + hash[:price]