lib/dineromail/operation.rb in dineromail-0.1.4 vs lib/dineromail/operation.rb in dineromail-0.2.0
- old
+ new
@@ -2,11 +2,11 @@
module Dineromail
class Operation
include HappyMapper
tag 'operacion'
- element :transaction_id, Integer, :tag => 'id'
+ element :transaction_id, String, :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'
@@ -26,9 +26,19 @@
status == COMPLETED_STATUS
end
def cancelled?
status == CANCELLED_STATUS
+ end
+
+ def transaction_id
+ #If the transaction_id being used is the string representation
+ #of an integer return an integer for backward compatibility
+ if @transaction_id =~ /\A\d+\Z/
+ @transaction_id.to_i
+ else
+ @transaction_id
+ end
end
end
end
\ No newline at end of file