spree_paypal_express/app/models/paypal_payment.rb

24 lines
637 B
Ruby
Raw Normal View History

class PaypalPayment < Payment
2010-01-22 16:29:55 +00:00
has_many :paypal_txns
2010-01-22 16:29:55 +00:00
alias :txns :paypal_txns
2010-01-28 16:48:01 +00:00
def find_authorization
#find the transaction associated with the original authorization/capture
txns.find(:first,
:conditions => {:pending_reason => "authorization", :payment_status => "Pending"},
:order => 'created_at DESC')
end
def find_capture
#find the transaction associated with the original authorization/capture
txns.find(:first,
:conditions => {:payment_status => "Completed"},
:order => 'created_at DESC')
end
2010-01-28 16:48:01 +00:00
def can_capture?
find_capture.nil?
end
end