module ErpOrders::Extensions::ActiveRecord::ActsAsOrderTxn::ClassMethods

Public Instance Methods

acts_as_order_txn() click to toggle source
# 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