Class: Bean::Payment
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Bean::Payment
- Includes:
- Machine
- Defined in:
- lib/bean/payment.rb
Instance Attribute Summary collapse
-
#credit_card ⇒ Object
Returns the value of attribute credit_card.
Instance Method Summary collapse
Methods included from Machine
Instance Attribute Details
#credit_card ⇒ Object
Returns the value of attribute credit_card.
9 10 11 |
# File 'lib/bean/payment.rb', line 9 def credit_card @credit_card end |
Instance Method Details
#authorize(amount = amount, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bean/payment.rb', line 11 def (amount=amount, = {}) return false if bean card = .delete(:on) || (credit_card rescue nil) return false unless card process(amount,{ :event => 'authorize', :state => 'authorized', :credit => 'payment', :debit =>'pending' }) do |gw| gw.(amount, card, ) end end |
#capture(options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bean/payment.rb', line 26 def capture( = {}) return false unless bean.state == 'authorized' process(amount,{ :event => 'capture', :state => 'captured', :credit => 'pending', :debit =>'cash' }) do |gw| gw.capture(amount, bean.reference, ) end end |