Sha256: dc6c3f630469daa08559fdb35ceb749524bfa6d07081b30d272bd046cd02a9b4
Contents?: true
Size: 570 Bytes
Versions: 3
Compression:
Stored size: 570 Bytes
Contents
module Akatus class Item include Transferrable transferrable_attrs :reference, :description, :quantity, :price, :weight, :shipping_cost, :discount, :split_fee def initialize(opts = {}) opts = { :shipping_cost => 0, :discount => 0, :weight => 0, :quantity => 1 }.merge(opts) super(opts) end def total_amount quantity * BigDecimal.new(price.to_s) + BigDecimal.new(shipping_cost.to_s) - BigDecimal.new(discount.to_s) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
akatus-1.0.2 | lib/akatus/item.rb |
akatus-1.0.1 | lib/akatus/item.rb |
akatus-1.0.0 | lib/akatus/item.rb |