Class: SolidusPaypalCommercePlatform::PaymentSource
- Inherits:
-
Spree::PaymentSource
- Object
- Spree::PaymentSource
- SolidusPaypalCommercePlatform::PaymentSource
- Defined in:
- app/models/solidus_paypal_commerce_platform/payment_source.rb
Instance Method Summary collapse
- #actions ⇒ Object
- #can_capture?(payment) ⇒ Boolean
- #can_credit?(payment) ⇒ Boolean
- #can_void?(payment) ⇒ Boolean
- #display_paypal_funding_source ⇒ Object
Instance Method Details
#actions ⇒ Object
19 20 21 |
# File 'app/models/solidus_paypal_commerce_platform/payment_source.rb', line 19 def actions %w(capture void credit) end |
#can_capture?(payment) ⇒ Boolean
23 24 25 |
# File 'app/models/solidus_paypal_commerce_platform/payment_source.rb', line 23 def can_capture?(payment) payment.pending? || payment.checkout? end |
#can_credit?(payment) ⇒ Boolean
31 32 33 34 35 36 |
# File 'app/models/solidus_paypal_commerce_platform/payment_source.rb', line 31 def can_credit?(payment) payment.completed? && payment.credit_allowed > 0 && capture_id && payment_method.gateway.get_order(paypal_order_id).status == "COMPLETED" end |
#can_void?(payment) ⇒ Boolean
27 28 29 |
# File 'app/models/solidus_paypal_commerce_platform/payment_source.rb', line 27 def can_void?(payment) can_capture?(payment) end |
#display_paypal_funding_source ⇒ Object
13 14 15 16 17 |
# File 'app/models/solidus_paypal_commerce_platform/payment_source.rb', line 13 def display_paypal_funding_source I18n.t(paypal_funding_source, scope: 'solidus_paypal_commerce_platform.paypal_funding_sources', default: paypal_funding_source) end |