Sha256: 2848586205e5d32a790b472efae43f37500c5a4bd08026f09f0152eb0e8ff7e3

Contents?: true

Size: 842 Bytes

Versions: 3

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

3 entries across 3 versions & 1 rubygems

Version Path
dineromail-0.1.2 lib/dineromail/operation.rb
dineromail-0.1.1 lib/dineromail/operation.rb
dineromail-0.1.0 lib/dineromail/operation.rb