Sha256: 5b60539c80146da821fe0f3bf93a0f93a5b06fcb92b21b9c98a20891b678570c

Contents?: true

Size: 842 Bytes

Versions: 1

Compression:

Stored size: 842 Bytes

Contents

require 'dineromail/item'
module Dineromail
  class Operation
    include HappyMapper
    
    tag 'operacion'
    element :transaction_id, Integer, :tag => 'id'
    element :date, DateTime, :tag => 'fecha'
    element :status, Integer, :tag => 'estado'
    element :amount, Float, :tag => 'monto'
    element :net_amount, Float, :tag => 'montoneto'
    element :pay_method, String, :tag => 'metodopago'
    element :pay_medium, String, :tag => 'mediopago'
    has_one :buyer, Buyer, :tag => 'comprador'
    has_many :items, Dineromail::Item, :tag => 'item'
    
    PENDING_STATUS = 1
    COMPLETED_STATUS = 2
    CANCELLED_STATUS = 3
    
    def pending?
      status == PENDING_STATUS
    end
    
    def completed?
      status == ACCREDITED_STATUS
    end
    
    def cancelled?
      status == CANCELLED_STATUS
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dineromail-0.1.3 lib/dineromail/operation.rb