Skip to content

Instantly share code, notes, and snippets.

@d11wtq
Created July 12, 2011 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d11wtq/1077938 to your computer and use it in GitHub Desktop.
Save d11wtq/1077938 to your computer and use it in GitHub Desktop.
DataMapper example showing a few different legacy support features
module Commerce
class Refund
include DataMapper::Resource
include Defaults
PENDING = 'pending'
SUCCESSFUL = 'successful'
DECLINED = 'declined'
ERROR = 'error'
property :id, Serial
property :amount, Decimal, :precision => 6, :scale => 2
property :merchant_fee, Decimal, :precision => 6, :scale => 2, :field => 'merchantfee'
property :status, String, :set => [PENDING, SUCCESSFUL, DECLINED, ERROR]
property :gateway_key, String, :field => 'gatewaykey'
property :backend_id, String, :field => 'backendid'
property :error_code, String, :field => 'errorcode'
property :error_message, Text, :field => 'errormessage'
property :created_at, EpochTime, :field => 'timecreated'
property :updated_at, EpochTime, :field => 'timemodified'
belongs_to :payment,
'Commerce::Payment'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment