Class: SpreePaypalWebsiteStandard::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/spree_paypal_website_standard.rb

Class Method Summary collapse

Class Method Details

.activateObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/spree_paypal_website_standard.rb', line 9

def self.activate
  Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
    Rails.env.production? ? require(c) : load(c)
  end
  
  # add new events and states to the FSM
=begin
  fsm = Order.state_machines[:state]  
  fsm.events << StateMachine::Event.new(fsm, "fail_payment")
  fsm.events["fail_payment"].transition(:to => 'payment_failure', :from => ['in_progress', 'payment_pending'])
  
  fsm.events << StateMachine::Event.new(fsm, "pend_payment")
  fsm.events["pend_payment"].transition(:to => 'payment_pending', :from => 'in_progress')    
  fsm.after_transition(:to => 'payment_pending', :do => lambda {|order| order.update_attribute(:checkout_complete, true)})  
  
  fsm.events["pay"].transition(:to => 'paid', :from => ['payment_pending', 'in_progress'])
=end
end