Class: CreditcardPayment
- Defined in:
- app/models/creditcard_payment.rb
Instance Method Summary collapse
Instance Method Details
#authorization ⇒ Object
19 20 21 22 23 24 |
# File 'app/models/creditcard_payment.rb', line 19 def #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 |
#can_capture? ⇒ Boolean
8 9 10 |
# File 'app/models/creditcard_payment.rb', line 8 def can_capture? txns.present? and txns.last == end |
#capture ⇒ Object
12 13 14 15 16 17 |
# File 'app/models/creditcard_payment.rb', line 12 def capture return unless can_capture? original_auth = creditcard.capture(original_auth) update_attribute("amount", original_auth.amount) end |