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
Show public metadata for Address, Cart, CreditCard, LineItem
Aleksandar Petrushev4197469b8661
diff --git a/api/app/serializers/spree/v2/storefront/address_serializer.rb b/api/app/serializers/spree/v2/storefront/address_serializer.rbindex 02b86d6c58..33110b8ec8 100644--- a/api/app/serializers/spree/v2/storefront/address_serializer.rb+++ b/api/app/serializers/spree/v2/storefront/address_serializer.rb@@ -5,7 +5,7 @@ module Spreeset_type :addressattributes :firstname, :lastname, :address1, :address2, :city, :zipcode, :phone, :state_name,- :company, :country_name, :country_iso3, :country_iso, :label+ :company, :country_name, :country_iso3, :country_iso, :label, :public_metadataattribute :state_code do |address|address.state_abbrdiff --git a/api/app/serializers/spree/v2/storefront/cart_serializer.rb b/api/app/serializers/spree/v2/storefront/cart_serializer.rbindex 0d1db21a3f..5354904013 100644--- a/api/app/serializers/spree/v2/storefront/cart_serializer.rb+++ b/api/app/serializers/spree/v2/storefront/cart_serializer.rb@@ -10,7 +10,7 @@ module Spree: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,- :shipment_state, :payment_state+ :shipment_state, :payment_state, :public_metadatahas_many :line_itemshas_many :variantsdiff --git a/api/app/serializers/spree/v2/storefront/credit_card_serializer.rb b/api/app/serializers/spree/v2/storefront/credit_card_serializer.rbindex c1b9b7f69c..56f35178b7 100644--- a/api/app/serializers/spree/v2/storefront/credit_card_serializer.rb+++ b/api/app/serializers/spree/v2/storefront/credit_card_serializer.rb@@ -4,7 +4,7 @@ module Spreeclass CreditCardSerializer < BaseSerializerset_type :credit_card- attributes :cc_type, :last_digits, :month, :year, :name, :default+ attributes :cc_type, :last_digits, :month, :year, :name, :default, :public_metadatabelongs_to :payment_methodenddiff --git a/api/app/serializers/spree/v2/storefront/line_item_serializer.rb b/api/app/serializers/spree/v2/storefront/line_item_serializer.rbindex 1a287c9d3f..d3329279d3 100644--- a/api/app/serializers/spree/v2/storefront/line_item_serializer.rb+++ b/api/app/serializers/spree/v2/storefront/line_item_serializer.rb@@ -10,7 +10,7 @@ module Spree:discounted_amount, :display_discounted_amount,:display_additional_tax_total, :promo_total, :display_promo_total,:included_tax_total, :display_included_tax_total,- :pre_tax_amount, :display_pre_tax_amount+ :pre_tax_amount, :display_pre_tax_amount, :public_metadatabelongs_to :varianthas_many :digital_linksdiff --git a/api/spec/requests/spree/api/v2/storefront/account/addresses_spec.rb b/api/spec/requests/spree/api/v2/storefront/account/addresses_spec.rbindex 38c22d8b07..52ace3a072 100644--- a/api/spec/requests/spree/api/v2/storefront/account/addresses_spec.rb+++ b/api/spec/requests/spree/api/v2/storefront/account/addresses_spec.rb@@ -26,6 +26,7 @@ describe 'Storefront API v2 Addresses spec', type: :request doexpect(json_response['data'][0]).to have_attribute(:country_iso3)expect(json_response['data'][0]).to have_attribute(:country_iso)expect(json_response['data'][0]).to have_attribute(:state_code)+ expect(json_response['data'][0]).to have_attribute(:public_metadata)endenddiff --git a/api/spec/requests/spree/api/v2/storefront/account/credit_cards_spec.rb b/api/spec/requests/spree/api/v2/storefront/account/credit_cards_spec.rbindex 0ead476fd7..96909a9735 100644--- a/api/spec/requests/spree/api/v2/storefront/account/credit_cards_spec.rb+++ b/api/spec/requests/spree/api/v2/storefront/account/credit_cards_spec.rb@@ -14,6 +14,7 @@ describe 'Storefront API v2 CreditCards spec', type: :request doexpect(json_response['data'][0]).to have_attribute(:month)expect(json_response['data'][0]).to have_attribute(:year)expect(json_response['data'][0]).to have_attribute(:name)+ expect(json_response['data'][0]).to have_attribute(:public_metadata)endenddiff --git a/api/spec/requests/spree/api/v2/storefront/cart_spec.rb b/api/spec/requests/spree/api/v2/storefront/cart_spec.rbindex 771238a126..b9440ddd13 100644--- a/api/spec/requests/spree/api/v2/storefront/cart_spec.rb+++ b/api/spec/requests/spree/api/v2/storefront/cart_spec.rb@@ -122,6 +122,7 @@ describe 'API V2 Storefront Cart Spec', type: :request doexpect(json_response['data']).to have_attribute(:display_pre_tax_item_amount).with_value(new_order.display_pre_tax_item_amount.to_s)expect(json_response['data']).to have_attribute(:pre_tax_total).with_value(new_order.pre_tax_total.to_s)expect(json_response['data']).to have_attribute(:display_pre_tax_total).with_value(new_order.display_pre_tax_total.to_s)+ expect(json_response['data']).to have_attribute(:public_metadata).with_value(new_order.public_metadata)expect(json_response['data']).to have_relationships(:user, :line_items, :variants, :billing_address, :shipping_address, :payments, :shipments, :promotions)end@@ -558,6 +559,7 @@ describe 'API V2 Storefront Cart Spec', type: :request doexpect(json_response[:included][0]).to have_attribute(:country_name).with_value(order.bill_address.country_name)expect(json_response[:included][0]).to have_attribute(:country_iso3).with_value(order.bill_address.country_iso3)expect(json_response[:included][0]).to have_attribute(:state_code).with_value(order.bill_address.state_abbr)+ expect(json_response[:included][0]).to have_attribute(:public_metadata).with_value(order.bill_address.public_metadata)endit 'will return included ship_address' do@@ -580,6 +582,7 @@ describe 'API V2 Storefront Cart Spec', type: :request doexpect(json_response[:included][0]).to have_attribute(:country_name).with_value(order.ship_address.country_name)expect(json_response[:included][0]).to have_attribute(:country_iso3).with_value(order.ship_address.country_iso3)expect(json_response[:included][0]).to have_attribute(:state_code).with_value(order.ship_address.state_abbr)+ expect(json_response[:included][0]).to have_attribute(:public_metadata).with_value(order.ship_address.public_metadata)endendend