Module: ErpOrders::Extensions::ActiveRecord::ActsAsOrderTxn::ClassMethods

Defined in:
lib/erp_orders/extensions/active_record/acts_as_order_txn.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_order_txnObject



12
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/erp_orders/extensions/active_record/acts_as_order_txn.rb', line 12

def acts_as_order_txn
  extend ActsAsOrderTxn::SingletonMethods
  include ActsAsOrderTxn::InstanceMethods

  after_initialize :initialize_order_txn
  after_create :save_order_txn
  after_update :save_order_txn
  after_destroy :destroy_order_txn

  has_one :order_txn, :as => :order_txn_record

  #from OrderTxn
  [:bill_to_address_line_1, :bill_to_address_line_1=,
   :bill_to_city, :bill_to_city=,
   :bill_to_country, :bill_to_country=,
   :bill_to_country_name, :bill_to_country_name=,
   :bill_to_first_name, :bill_to_first_name=,
   :bill_to_last_name, :bill_to_last_name=,
   :bill_to_postal_code, :bill_to_postal_code=,
   :bill_to_state, :bill_to_state=,
   :Company, :Company=,
   :credit_card_id, :credit_card_id=,
   :customer_ip, :customer_ip=,
   :email, :email=,
   :error_message, :error_message=,
   :Fax, :Fax=,
   :description, :description=,
   :order_number, :order_number=,
   :order_txn_type_id, :order_txn_type_id=,
   :payment_gateway_txn_id, :payment_gateway_txn_id=,
   :Phone2, :Phone2=,
   :phone_number, :phone_number=,
   :ship_to_phone2, :ship_to_phone2=,
   :Salutation, :Salutation=,
   :ship_to_company, :ship_to_company=,
   :ship_to_address_line_1, :ship_to_address_line_1=,
   :ship_to_city, :ship_to_city=,
   :ship_to_country, :ship_to_country=,
   :ship_to_country_name, :ship_to_country_name=,
   :ship_to_salutation, :ship_to_salutation=,
   :ship_to_first_name, :ship_to_first_name=,
   :ship_to_last_name, :ship_to_last_name=,
   :ship_to_postal_code, :ship_to_postal_code=,
   :ship_to_state, :ship_to_state=,
   :ship_to_fax, :ship_to_fax=,
   :state_machine, :state_machine=,
   :status, :status=,
   :add_line_item,
   :line_items,
   :order_line_items,
   :determine_txn_party_roles,
   :determine_charge_elements,
   :determine_charge_accounts,
   :process,
   :set_shipping_info,
   :set_billing_info,
   :authorize_payments,
   :capture_payments,
   :rollback_authorizations,
   :submit, :total_amount
  ].each { |m| delegate m, :to => :order_txn }

  #from OrderTxn And BizTxnEvent
  [:biz_txn,
   :biz_txn_event,
   :root_txn,
   :find_party_by_role,
   :txn_type, :txn_type=,
   :txn_type_iid, :txn_type_iid=, :create_dependent_txns,
   :biz_txn_type_id, :biz_txn_type_id=,
   :external_id_source, :external_id_source=,
   :account, :account=].each { |m| delegate m, :to => :order_txn }
end