Class: SolidusStripe::PaymentSource
- Inherits:
-
Spree::PaymentSource
- Object
- Spree::PaymentSource
- SolidusStripe::PaymentSource
- Defined in:
- app/models/solidus_stripe/payment_source.rb
Instance Method Summary collapse
- #actions ⇒ Object
- #can_capture?(payment) ⇒ Boolean
- #can_credit?(payment) ⇒ Boolean
- #can_void?(payment) ⇒ Boolean
- #stripe_payment_method ⇒ Object
Instance Method Details
#actions ⇒ Object
15 16 17 |
# File 'app/models/solidus_stripe/payment_source.rb', line 15 def actions %w[capture void credit] end |
#can_capture?(payment) ⇒ Boolean
19 20 21 |
# File 'app/models/solidus_stripe/payment_source.rb', line 19 def can_capture?(payment) payment.pending? end |
#can_credit?(payment) ⇒ Boolean
27 28 29 |
# File 'app/models/solidus_stripe/payment_source.rb', line 27 def can_credit?(payment) payment.completed? && payment.credit_allowed > 0 end |
#can_void?(payment) ⇒ Boolean
23 24 25 |
# File 'app/models/solidus_stripe/payment_source.rb', line 23 def can_void?(payment) payment.pending? end |
#stripe_payment_method ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/models/solidus_stripe/payment_source.rb', line 7 def stripe_payment_method return if stripe_payment_method_id.blank? @stripe_payment_method ||= payment_method.gateway.request do Stripe::PaymentMethod.retrieve(stripe_payment_method_id) end end |