Class: PaymentMethod::Check
- Inherits:
-
PaymentMethod
- Object
- ActiveRecord::Base
- PaymentMethod
- PaymentMethod::Check
- Defined in:
- app/models/payment_method/check.rb
Constant Summary
Constants inherited from PaymentMethod
Instance Method Summary collapse
- #actions ⇒ Object
-
#can_capture?(payment) ⇒ Boolean
Indicates whether its possible to capture the payment.
-
#can_void?(payment) ⇒ Boolean
Indicates whether its possible to void the payment.
- #capture(payment) ⇒ Object
- #void(payment) ⇒ Object
Methods inherited from PaymentMethod
active?, available, current, #destroy, find_with_destroyed, #method_type, #payment_profiles_supported?, #payment_source_class, #provider_class, providers, register, #source_required?
Instance Method Details
#actions ⇒ Object
2 3 4 |
# File 'app/models/payment_method/check.rb', line 2 def actions %w{capture void} end |
#can_capture?(payment) ⇒ Boolean
Indicates whether its possible to capture the payment
7 8 9 |
# File 'app/models/payment_method/check.rb', line 7 def can_capture?(payment) ['checkout', 'pending'].include?(payment.state) end |
#can_void?(payment) ⇒ Boolean
Indicates whether its possible to void the payment.
12 13 14 |
# File 'app/models/payment_method/check.rb', line 12 def can_void?(payment) payment.state != 'void' end |
#capture(payment) ⇒ Object
16 17 18 19 20 |
# File 'app/models/payment_method/check.rb', line 16 def capture(payment) payment.update_attribute(:state, 'pending') if payment.state == 'checkout' payment.complete true end |
#void(payment) ⇒ Object
22 23 24 25 26 |
# File 'app/models/payment_method/check.rb', line 22 def void(payment) payment.update_attribute(:state, 'pending') if payment.state == 'checkout' payment.void true end |