Sha256: cfc828634b23f7a7152613d2776ef755827484704e3ee21b35395642e41823ae
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
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 def current current_payment_type = { :new => PaymentNew, :prepared => PaymentPrepared, :authorized => PaymentBlocked, :voided => PaymentCancelled, :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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
paytureman-0.5.0 | lib/payments/payment.rb |
paytureman-0.3.0 | lib/payments/payment.rb |