Class: Spree::ReimbursementType::Exchange

Inherits:
Spree::ReimbursementType show all
Defined in:
app/models/spree/reimbursement_type/exchange.rb

Constant Summary

Constants inherited from Spree::ReimbursementType

KINDS, ORIGINAL

Class Method Summary collapse

Methods inherited from Base

belongs_to_required_by_default, page, spree_base_scopes

Methods included from Preferences::Preferable

#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Class Method Details

.reimburse(reimbursement, return_items, simulate) ⇒ Object



2
3
4
5
6
7
8
# File 'app/models/spree/reimbursement_type/exchange.rb', line 2

def self.reimburse(reimbursement, return_items, simulate)
  return [] unless return_items.present?

  exchange = Spree::Exchange.new(reimbursement.order, return_items)
  exchange.perform! unless simulate
  [exchange]
end