Class: CreditcardPayment

Inherits:
Payment show all
Defined in:
app/models/creditcard_payment.rb

Instance Method Summary collapse

Instance Method Details

#can_capture?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/models/creditcard_payment.rb', line 15

def can_capture?
  txns.last == find_authorization
end

#find_authorizationObject



8
9
10
11
12
13
# File 'app/models/creditcard_payment.rb', line 8

def find_authorization
  #find the transaction associated with the original authorization/capture 
  txns.find(:first, 
            :conditions => ["txn_type = ? AND response_code IS NOT NULL", CreditcardTxn::TxnType::AUTHORIZE.to_s],
            :order => 'created_at DESC')
end