Class: Spree::Order

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/order_decorator.rb

Instance Method Summary collapse

Instance Method Details

#after_cancelObject

cancel order handler



15
16
17
18
19
20
# File 'app/models/spree/order_decorator.rb', line 15

def after_cancel
  exactor_connector = SpreeExactorConnector::SpreeExactorConnector.new
  exactor_connector.do_cancel!(self)
  update_column(:exactor_order_hash_sum, nil)
  super_after_cancel
end

#after_resumeObject

when order was resumed handler



23
24
25
26
27
28
# File 'app/models/spree/order_decorator.rb', line 23

def after_resume
  update_adjustments
  exactor_connector = SpreeExactorConnector::SpreeExactorConnector.new
  exactor_connector.do_checkout!(self)
  super_after_resume
end

#create_tax_charge!Object



50
51
52
53
54
55
56
57
58
# File 'app/models/spree/order_decorator.rb', line 50

def create_tax_charge!
  # destroy any previous adjustments (everything is recalculated from scratch)
  price_adjustments.each(&:destroy)
  if (adjustments.tax.reload.size!=1)
    adjustments.tax.each(&:destroy)
    TaxRate.match(self).each { |rate| rate.adjust(self) }
  end

end

#edit_orderObject



30
31
32
33
34
35
36
37
38
# File 'app/models/spree/order_decorator.rb', line 30

def edit_order
  exactor_connector = SpreeExactorConnector::SpreeExactorConnector.new
  if (!exactor_invoice_transaction.nil?)
    if (!exactor_commit_transaction.nil?)
      exactor_connector.do_cancel!(self)
    end
    exactor_connector.do_checkout!(self)
  end
end

#finalize!Object

check out handler



8
9
10
11
12
# File 'app/models/spree/order_decorator.rb', line 8

def finalize!
  exactor_connector = SpreeExactorConnector::SpreeExactorConnector.new
  exactor_connector.do_checkout!(self)
  super_finalize!
end

#super_after_cancelObject



4
# File 'app/models/spree/order_decorator.rb', line 4

alias :super_after_cancel :after_cancel

#super_after_resumeObject



5
# File 'app/models/spree/order_decorator.rb', line 5

alias :super_after_resume :after_resume

#super_finalize!Object



3
# File 'app/models/spree/order_decorator.rb', line 3

alias :super_finalize! :finalize!

#update_adjustmentsObject

this method is intended to add adjustment to old transactions which was created without our plugin REMARK: this method moved to OrderUpdater class in Spree 2.0.0



62
63
64
# File 'app/models/spree/order_decorator.rb', line 62

def update_adjustments
  self.updater.update_adjustments
end

#update_payment_stateObject

REMARK: this method moved to OrderUpdater class in Spree 2.0.0



41
42
43
# File 'app/models/spree/order_decorator.rb', line 41

def update_payment_state
  self.updater.update_payment_state
end

#update_shipment_stateObject

REMARK: this method moved to OrderUpdater class in Spree 2.0.0



46
47
48
# File 'app/models/spree/order_decorator.rb', line 46

def update_shipment_state
  self.updater.update_shipment_state
end