Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Adds an ability to use different Order serializer for Account Orders endpoint

Damian Legawieca4efe63593e1
diff --git a/api/app/controllers/spree/api/v2/storefront/account/orders_controller.rb b/api/app/controllers/spree/api/v2/storefront/account/orders_controller.rb
index f3eeeadd14..e705af201c 100644
--- a/api/app/controllers/spree/api/v2/storefront/account/orders_controller.rb
+++ b/api/app/controllers/spree/api/v2/storefront/account/orders_controller.rb
@@ -35,11 +35,11 @@ module Spree
end
def collection_serializer
- Spree::Api::Dependencies.storefront_cart_serializer.constantize
+ Spree::Api::Dependencies.storefront_order_serializer.constantize
end
def resource_serializer
- Spree::Api::Dependencies.storefront_cart_serializer.constantize
+ Spree::Api::Dependencies.storefront_order_serializer.constantize
end
def collection_finder
diff --git a/api/app/models/spree/api_dependencies.rb b/api/app/models/spree/api_dependencies.rb
index c731614d4c..91e1c3a3a6 100644
--- a/api/app/models/spree/api_dependencies.rb
+++ b/api/app/models/spree/api_dependencies.rb
@@ -14,7 +14,7 @@ module Spree
:storefront_collection_paginator, :storefront_user_serializer, :storefront_products_sorter, :storefront_products_finder,
:storefront_product_serializer, :storefront_taxon_serializer, :storefront_taxon_finder, :storefront_find_by_variant_finder,
:storefront_cart_update_service, :storefront_cart_estimate_shipping_rates_service, :storefront_estimated_shipment_serializer,
- :storefront_store_serializer, :storefront_address_serializer,
+ :storefront_store_serializer, :storefront_address_serializer, :storefront_order_serializer,
:storefront_account_create_address_service, :storefront_account_update_address_service, :storefront_address_finder
].freeze
@@ -66,6 +66,7 @@ module Spree
@storefront_product_serializer = 'Spree::V2::Storefront::ProductSerializer'
@storefront_estimated_shipment_serializer = 'Spree::V2::Storefront::EstimatedShippingRateSerializer'
@storefront_store_serializer = 'Spree::V2::Storefront::StoreSerializer'
+ @storefront_order_serializer = 'Spree::V2::Storefront::CartSerializer'
# sorters
@storefront_order_sorter = Spree::Dependencies.order_sorter