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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Add shipment_state and payment_state to API v2 Cart/Order response
Damian Legawiec6a67ed0a12af
diff --git a/api/app/serializers/spree/v2/storefront/cart_serializer.rb b/api/app/serializers/spree/v2/storefront/cart_serializer.rbindex 3c33f81ec0..0d1db21a3f 100644--- a/api/app/serializers/spree/v2/storefront/cart_serializer.rb+++ b/api/app/serializers/spree/v2/storefront/cart_serializer.rb@@ -9,7 +9,8 @@ module Spree:display_included_tax_total, :tax_total, :currency, :state, :token, :email,:display_item_total, :display_ship_total, :display_adjustment_total, :display_tax_total,:promo_total, :display_promo_total, :item_count, :special_instructions, :display_total,- :pre_tax_item_amount, :display_pre_tax_item_amount, :pre_tax_total, :display_pre_tax_total+ :pre_tax_item_amount, :display_pre_tax_item_amount, :pre_tax_total, :display_pre_tax_total,+ :shipment_state, :payment_statehas_many :line_itemshas_many :variantsdiff --git a/api/app/serializers/spree/v2/storefront/payment_serializer.rb b/api/app/serializers/spree/v2/storefront/payment_serializer.rbindex 78e4f0bd97..0421530f48 100644--- a/api/app/serializers/spree/v2/storefront/payment_serializer.rb+++ b/api/app/serializers/spree/v2/storefront/payment_serializer.rb@@ -8,7 +8,7 @@ module Spreehas_one :payment_methodattributes :amount, :response_code, :number, :cvv_response_code, :cvv_response_message,- :payment_method_id, :payment_method_name+ :payment_method_id, :payment_method_name, :stateendendenddiff --git a/api/lib/spree/api/testing_support/v2/current_order.rb b/api/lib/spree/api/testing_support/v2/current_order.rbindex 94a79f6dc9..cda2721ee4 100644--- a/api/lib/spree/api/testing_support/v2/current_order.rb+++ b/api/lib/spree/api/testing_support/v2/current_order.rb@@ -27,6 +27,8 @@ shared_examples 'returns valid cart JSON' doexpect(json_response['data']).to have_type('cart')expect(json_response['data']).to have_attribute(:number).with_value(order.number)expect(json_response['data']).to have_attribute(:state).with_value(order.state)+ expect(json_response['data']).to have_attribute(:payment_state).with_value(order.payment_state)+ expect(json_response['data']).to have_attribute(:shipment_state).with_value(order.shipment_state)expect(json_response['data']).to have_attribute(:token).with_value(order.token)expect(json_response['data']).to have_attribute(:total).with_value(order.total.to_s)expect(json_response['data']).to have_attribute(:item_total).with_value(order.item_total.to_s)