Class: SolidusOpenPay::PaymentSource
- Inherits:
-
Spree::PaymentSource
- Object
- Spree::PaymentSource
- SolidusOpenPay::PaymentSource
- Includes:
- AttributesAccess
- Defined in:
- app/models/solidus_open_pay/payment_source.rb
Instance Method Summary collapse
- #actions ⇒ Object
- #can_capture?(payment) ⇒ Boolean
- #can_credit?(payment) ⇒ Boolean
- #can_void?(payment) ⇒ Boolean
Instance Method Details
#actions ⇒ Object
9 10 11 |
# File 'app/models/solidus_open_pay/payment_source.rb', line 9 def actions %w[capture void credit] end |
#can_capture?(payment) ⇒ Boolean
13 14 15 |
# File 'app/models/solidus_open_pay/payment_source.rb', line 13 def can_capture?(payment) payment.pending? || payment.checkout? end |
#can_credit?(payment) ⇒ Boolean
21 22 23 |
# File 'app/models/solidus_open_pay/payment_source.rb', line 21 def can_credit?(payment) payment.completed? && payment.credit_allowed.positive? end |
#can_void?(payment) ⇒ Boolean
17 18 19 |
# File 'app/models/solidus_open_pay/payment_source.rb', line 17 def can_void?(payment) can_capture?(payment) end |