5 include DataMapper::Resource
6 include DataMapper::Validate
8 property :id, Fixnum, :serial => true
9 property :order_number, Fixnum, :default => 0, :nullable => false, :index => :unique
10 property :created_on, DateTime
11 property :shipped_on, DateTime
12 property :notes, DataMapper::Types::Text
13 property :referer, String
14 property :product_cost, Float, :default => 0.0
15 property :shipping_cost, Float, :default => 0.0
16 property :tax, Float, :default => 0.0, :nullable => false
17 property :account_id, Fixnum # foreign-key
18 property :customer_id, Fixnum # foreign-key
19 property :order_shipping_type_id, Fixnum # foreign-key
20 property :order_status_code_id, Fixnum # foreign-key
21 property :promotion_id, Fixnum # foreign-key
23 one_to_many :order_line_items #, :dependent => :destroy
25 one_to_one :billing_address, :class_name => 'OrderAddress' #, :foreign_key => 'billing_address_id'
26 one_to_one :shipping_address, :class_name => 'OrderAddress' #, :foreign_key => 'shipping_address_id'
30 many_to_one :order_shipping_type
31 many_to_one :order_status_code
32 many_to_one :promotion
34 attr_accessor :promotion_code
36 validates_presence_of :order_number