Class: SolidusMollie::MollieSource
- Inherits:
-
Spree::PaymentSource
- Object
- Spree::PaymentSource
- SolidusMollie::MollieSource
- Defined in:
- app/models/solidus_mollie/mollie_source.rb
Overview
Persists the Mollie payment id and last-known status alongside a Spree::Payment. The buyer enters no card data here (that happens on Mollie’s hosted page), so this source has no validated fields.
Instance Method Summary collapse
- #actions ⇒ Object
- #can_credit?(payment) ⇒ Boolean
- #can_void?(payment) ⇒ Boolean
- #paid? ⇒ Boolean
-
#reusable? ⇒ Boolean
Off-site payments are not reusable for one-click in this version.
Instance Method Details
#actions ⇒ Object
15 16 17 |
# File 'app/models/solidus_mollie/mollie_source.rb', line 15 def actions %w[void credit] end |
#can_credit?(payment) ⇒ Boolean
23 24 25 |
# File 'app/models/solidus_mollie/mollie_source.rb', line 23 def can_credit?(payment) payment.completed? && payment.credit_allowed.positive? end |
#can_void?(payment) ⇒ Boolean
19 20 21 |
# File 'app/models/solidus_mollie/mollie_source.rb', line 19 def can_void?(payment) payment.pending? || payment.checkout? end |
#paid? ⇒ Boolean
27 28 29 |
# File 'app/models/solidus_mollie/mollie_source.rb', line 27 def paid? SolidusMollie::PAID_STATUSES.include?(status) end |
#reusable? ⇒ Boolean
Off-site payments are not reusable for one-click in this version.
11 12 13 |
# File 'app/models/solidus_mollie/mollie_source.rb', line 11 def reusable? false end |