Class: SpreeCmCommissioner::PaymentMethods::Find
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::PaymentMethods::Find
- Defined in:
- app/finders/spree_cm_commissioner/payment_methods/find.rb
Overview
Order & user independent lookup of the payment methods a vendor accepts.
Mirrors the scope selection of Vpago::OrderDecorator#available_payment_methods, minus everything that depends on the order or the current user, so the result is safe to cache on the vendor id alone:
- available_for_order? (only Spree::PaymentMethod::StoreCredit varies, on user balance)
- available_on_frontend_for_early_adopter (user attribute)
- support_payout? (order line items)
- preferred_payment_method_id (user, affects sort only)
Callers needing the per-order truth must keep using Spree::Api::V2::*::CartPaymentMethodGroupsController.
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#vendor ⇒ Object
readonly
Returns the value of attribute vendor.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(vendor:, store: nil, type: nil) ⇒ Find
constructor
A new instance of Find.
Constructor Details
#initialize(vendor:, store: nil, type: nil) ⇒ Find
Returns a new instance of Find.
19 20 21 22 23 |
# File 'app/finders/spree_cm_commissioner/payment_methods/find.rb', line 19 def initialize(vendor:, store: nil, type: nil) @vendor = vendor @store = store @type = type end |
Instance Attribute Details
#store ⇒ Object (readonly)
Returns the value of attribute store.
17 18 19 |
# File 'app/finders/spree_cm_commissioner/payment_methods/find.rb', line 17 def store @store end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
17 18 19 |
# File 'app/finders/spree_cm_commissioner/payment_methods/find.rb', line 17 def type @type end |
#vendor ⇒ Object (readonly)
Returns the value of attribute vendor.
17 18 19 |
# File 'app/finders/spree_cm_commissioner/payment_methods/find.rb', line 17 def vendor @vendor end |
Instance Method Details
#execute ⇒ Object
25 26 27 28 29 |
# File 'app/finders/spree_cm_commissioner/payment_methods/find.rb', line 25 def execute return mini_app_scope if type.present? scope.reject(&:mini_app?) end |