lib/payments/payment.rb in paytureman-0.2.0 vs lib/payments/payment.rb in paytureman-0.3.0

- old
+ new

@@ -1,23 +1,23 @@ module Paytureman - + class Payment - + attr_reader :order_id def initialize(order_id, amount, ip) @order_id, @amount, @ip = order_id, amount, ip end - + def save_to_memento(memento) memento.order_id, memento.amount, memento.ip = order_id, amount, ip end - + def self.new_from_memento(memento) new(memento.order_id, memento.amount, memento.ip) end - + def self.new_from_payment(donor) memento = OpenStruct.new donor.save_to_memento(memento) new_from_memento(memento) end @@ -26,21 +26,22 @@ current_payment_type = { :new => PaymentNew, :prepared => PaymentPrepared, :authorized => PaymentBlocked, :voided => PaymentCancelled, - :charged => PaymentCharged + :charged => PaymentCharged, + :refund => PaymentRefunded }[payture.status(order_id)] || PaymentUnknown current_payment_type.new_from_payment(self) end attr_accessor :payture - + protected - + attr_accessor :amount, :ip attr_writer :order_id - + def payture @payture ||= Api.instance end end \ No newline at end of file