Class: Spree::Api::V2::Storefront::PaymentMethodsController

Inherits:
ResourceController
  • Object
show all
Defined in:
app/controllers/spree/api/v2/storefront/payment_methods_controller.rb

Overview

Order & user independent catalog of the payment methods a vendor accepts. Takes vendor_id as a required query param. See Spree::Api::V2::Tenant::PaymentMethodsController for the caching caveat that comes with that, and for what this deliberately leaves out.

Instance Method Summary collapse

Instance Method Details

#collectionObject

override



18
19
20
21
22
23
24
# File 'app/controllers/spree/api/v2/storefront/payment_methods_controller.rb', line 18

def collection
  @collection ||= SpreeCmCommissioner::PaymentMethods::Find.new(
    vendor: vendor,
    store: current_store,
    type: params[:type]
  ).execute
end

#collection_serializerObject

override



27
28
29
# File 'app/controllers/spree/api/v2/storefront/payment_methods_controller.rb', line 27

def collection_serializer
  ::Spree::V2::Storefront::PaymentMethodSerializer
end

#indexObject

override



11
12
13
14
15
# File 'app/controllers/spree/api/v2/storefront/payment_methods_controller.rb', line 11

def index
  render_serialized_payload do
    collection_serializer.new(collection).serializable_hash
  end
end