Module: MerchantSidekick::Sellable::InstanceMethods
- Defined in:
- lib/merchant_sidekick/sellable.rb
Instance Method Summary collapse
-
#price_is_gross? ⇒ Boolean
Funny name, but it returns true if the :price represents a gross price including taxes.
-
#price_is_net? ⇒ Boolean
Opposite of price_is_gross?.
- #sellable? ⇒ Boolean
-
#settle(options = {}) ⇒ Object
There can only be one authorized order per sellable, so the first authorziation is it!.
-
#taxable? ⇒ Boolean
This is a product, where the gross and net prices are equal, or in other words a tax for this product is not applicable, e.g.
Instance Method Details
#price_is_gross? ⇒ Boolean
Funny name, but it returns true if the :price represents a gross price including taxes. For that there must be a method called price_is_gross or price_is_gross! as it is in Issue model price_is_net? and/or price_is_gross? should be overwritten
45 46 47 |
# File 'lib/merchant_sidekick/sellable.rb', line 45 def price_is_gross? false end |
#price_is_net? ⇒ Boolean
Opposite of price_is_gross?
50 51 52 |
# File 'lib/merchant_sidekick/sellable.rb', line 50 def price_is_net? true end |
#sellable? ⇒ Boolean
36 37 38 |
# File 'lib/merchant_sidekick/sellable.rb', line 36 def sellable? true end |
#settle(options = {}) ⇒ Object
There can only be one authorized order per sellable, so the first authorziation is it!
Usage:
order = issue.settle
order.capture unless order.nil?
Options:
issue.settle :merchant => person
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/merchant_sidekick/sellable.rb', line 70 def settle(={}) self.orders.each do |order| if order.kind == 'authorization' && current_line_item = order.line_items_find( :first, :condition => ["sellable_id => ? AND sellable_type = ?", self.id, self.class.name] ) if adjusted_line_item=order.line_items.build( :order => order, :sellable => self ) current_line_items.destroy order.build_addresses order.update order.save! return order end end end nil end |
#taxable? ⇒ Boolean
This is a product, where the gross and net prices are equal, or in other words a tax for this product is not applicable, e.g. for $10 purchasing credit should be overwritten if otherwise
57 58 59 |
# File 'lib/merchant_sidekick/sellable.rb', line 57 def taxable? true end |