Class: ODDB::Html::State::PayPal::Collect

Inherits:
Global
  • Object
show all
Defined in:
lib/oddb/html/state/paypal/collect.rb

Constant Summary collapse

VIEW =
View::PayPal::Collect

Constants inherited from Global

Global::GLOBAL_MAP, Global::LIMIT

Instance Attribute Summary

Attributes inherited from Global

#passed_turing_test

Attributes included from LoginMethods

#desired_input

Instance Method Summary collapse

Methods inherited from Global

#_download, #compare, #explain_ddd_price, #explain_price, #fachinfo, #feedback, #home, #limit_state, #limited?, #logout, #method_missing, #navigation, #package, #package_infos, #partitioned_keys, #patinfo, #proceed_export, #proceed_poweruser, #product, #products, #remote_infos, #sequence

Methods included from Checkout

#ajax_autofill, #checkout, #checkout_keys, #checkout_mandatory, #create_user

Methods included from LoginMethods

#login_

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ODDB::Html::State::Global

Instance Method Details

#collectObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/oddb/html/state/paypal/collect.rb', line 13

def collect
  @model = Business::Invoice.find_by_id(@session.user_input(:invoice))
  state = self
  # since the permissions of the current User may have changed, we
  # need to reconsider his viral modules
  if((user = @session.user).is_a?(Util::KnownUser))
    reconsider_permissions(user)
  end
  item = @model.items.first
  case item.type
  when :export
    if @session.allowed?('download', "#{ODDB.config.auth_domain}.#{item.text}") \
      || @model.status == 'completed'
      extend State::Drugs::Events
      state = _download(item.text)
    else
      ## wait for ipn
    end
  else
    if(@session.allowed?('view', ODDB.config.auth_domain))
      if(des = @session.desired_state)
        state = des
      else
        state.extend Drugs::Events
      end
    end
  end
  state
end