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
Replace Event serializers with just API serializers (#13649)
Damian Legawiecb8cff3e3f1e2
diff --git a/packages/sdk/src/types/generated/StoreAsset.ts b/packages/sdk/src/types/generated/StoreAsset.tsnew file mode 100644index 0000000000..bde126ee35--- /dev/null+++ b/packages/sdk/src/types/generated/StoreAsset.ts@@ -0,0 +1,16 @@+// Typelizer digest 65840e3a584f4c9182267ad6134e3d1a+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreAsset = {+ id: string;+ viewable_id: string;+ type: string | null;+ viewable_type: string;+ position: number | null;+ alt: string | null;+ created_at: string;+ updated_at: string;+}++export default StoreAsset;diff --git a/packages/sdk/src/types/generated/StoreCustomerReturn.ts b/packages/sdk/src/types/generated/StoreCustomerReturn.tsnew file mode 100644index 0000000000..4a53421f39--- /dev/null+++ b/packages/sdk/src/types/generated/StoreCustomerReturn.ts@@ -0,0 +1,13 @@+// Typelizer digest 421fa761c2e391577e196f4dbb0432e9+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreCustomerReturn = {+ id: string;+ number: string;+ created_at: string;+ updated_at: string;+ stock_location_id: string | null;+}++export default StoreCustomerReturn;diff --git a/packages/sdk/src/types/generated/StoreDigital.ts b/packages/sdk/src/types/generated/StoreDigital.tsnew file mode 100644index 0000000000..14b76d30a9--- /dev/null+++ b/packages/sdk/src/types/generated/StoreDigital.ts@@ -0,0 +1,12 @@+// Typelizer digest 597a5f5af98eeab1fc822f6222e8f9be+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreDigital = {+ id: string;+ created_at: string;+ updated_at: string;+ variant_id: string | null;+}++export default StoreDigital;diff --git a/packages/sdk/src/types/generated/StoreExport.ts b/packages/sdk/src/types/generated/StoreExport.tsnew file mode 100644index 0000000000..6e1bb2ec6e--- /dev/null+++ b/packages/sdk/src/types/generated/StoreExport.ts@@ -0,0 +1,15 @@+// Typelizer digest 92d3a88c00561b7fa9048a0d8b5e8969+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreExport = {+ id: string;+ number: string;+ type: string | null;+ format: string | null;+ created_at: string;+ updated_at: string;+ user_id: string | null;+}++export default StoreExport;diff --git a/packages/sdk/src/types/generated/StoreGiftCardBatch.ts b/packages/sdk/src/types/generated/StoreGiftCardBatch.tsnew file mode 100644index 0000000000..59892c41f4--- /dev/null+++ b/packages/sdk/src/types/generated/StoreGiftCardBatch.ts@@ -0,0 +1,17 @@+// Typelizer digest 98b4d4ac55999abe93be35c48d303442+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreGiftCardBatch = {+ id: string;+ codes_count: number;+ currency: string | null;+ prefix: string | null;+ created_at: string;+ updated_at: string;+ amount: string | null;+ expires_at: string | null;+ created_by_id: string | null;+}++export default StoreGiftCardBatch;diff --git a/packages/sdk/src/types/generated/StoreImage.ts b/packages/sdk/src/types/generated/StoreImage.tsindex bc225d294f..23371c485a 100644--- a/packages/sdk/src/types/generated/StoreImage.ts+++ b/packages/sdk/src/types/generated/StoreImage.ts@@ -1,13 +1,14 @@-// Typelizer digest 6206dd2fae0f618a038109f783b60f5d+// Typelizer digest 3320b3c7c4b9e615f6a52d84d9856182//// DO NOT MODIFY: This file was automatically generated by Typelizer.type StoreImage = {id: string;viewable_id: string;- position: number;- alt: string | null;+ type: string | null;viewable_type: string;+ position: number | null;+ alt: string | null;created_at: string;updated_at: string;original_url: string | null;diff --git a/packages/sdk/src/types/generated/StoreImport.ts b/packages/sdk/src/types/generated/StoreImport.tsnew file mode 100644index 0000000000..dc529d0476--- /dev/null+++ b/packages/sdk/src/types/generated/StoreImport.ts@@ -0,0 +1,18 @@+// Typelizer digest ecc8424755a64f612629b9d3842975c3+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreImport = {+ id: string;+ number: string;+ type: string | null;+ rows_count: number;+ created_at: string;+ updated_at: string;+ status: string;+ owner_type: string | null;+ owner_id: string | null;+ user_id: string | null;+}++export default StoreImport;diff --git a/packages/sdk/src/types/generated/StoreImportRow.ts b/packages/sdk/src/types/generated/StoreImportRow.tsnew file mode 100644index 0000000000..4d18a3b521--- /dev/null+++ b/packages/sdk/src/types/generated/StoreImportRow.ts@@ -0,0 +1,17 @@+// Typelizer digest 22ef72bf09f0a5cb38fa4e25d882c8af+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreImportRow = {+ id: string;+ row_number: number;+ status: string;+ validation_errors: unknown;+ item_type: string | null;+ created_at: string;+ updated_at: string;+ import_id: string | null;+ item_id: string | null;+}++export default StoreImportRow;diff --git a/packages/sdk/src/types/generated/StoreInvitation.ts b/packages/sdk/src/types/generated/StoreInvitation.tsnew file mode 100644index 0000000000..5dcc9073ac--- /dev/null+++ b/packages/sdk/src/types/generated/StoreInvitation.ts@@ -0,0 +1,22 @@+// Typelizer digest cd4c21032c7c5deadd645850c144f78d+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreInvitation = {+ id: string;+ email: string;+ resource_type: string | null;+ inviter_type: string | null;+ invitee_type: string | null;+ created_at: string;+ updated_at: string;+ status: string;+ resource_id: string | null;+ inviter_id: string | null;+ invitee_id: string | null;+ role_id: string | null;+ expires_at: string | null;+ accepted_at: string | null;+}++export default StoreInvitation;diff --git a/packages/sdk/src/types/generated/StoreNewsletterSubscriber.ts b/packages/sdk/src/types/generated/StoreNewsletterSubscriber.tsnew file mode 100644index 0000000000..01118446fd--- /dev/null+++ b/packages/sdk/src/types/generated/StoreNewsletterSubscriber.ts@@ -0,0 +1,15 @@+// Typelizer digest 9ee51e6d12735f6340458069c4e45718+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreNewsletterSubscriber = {+ id: string;+ email: string;+ created_at: string;+ updated_at: string;+ verified: boolean;+ verified_at: string | null;+ user_id: string | null;+}++export default StoreNewsletterSubscriber;diff --git a/packages/sdk/src/types/generated/StorePost.ts b/packages/sdk/src/types/generated/StorePost.tsnew file mode 100644index 0000000000..cec50b2682--- /dev/null+++ b/packages/sdk/src/types/generated/StorePost.ts@@ -0,0 +1,18 @@+// Typelizer digest 6e2ac0a25224ad90c2139dd0bcd8ce7f+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StorePost = {+ id: string;+ title: string;+ slug: string;+ meta_title: string | null;+ meta_description: string | null;+ published_at: string | null;+ created_at: string;+ updated_at: string;+ author_id: string | null;+ post_category_id: string | null;+}++export default StorePost;diff --git a/packages/sdk/src/types/generated/StorePostCategory.ts b/packages/sdk/src/types/generated/StorePostCategory.tsnew file mode 100644index 0000000000..29a7b765b2--- /dev/null+++ b/packages/sdk/src/types/generated/StorePostCategory.ts@@ -0,0 +1,13 @@+// Typelizer digest a651d4a565319fe46bdd1a6360437738+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StorePostCategory = {+ id: string;+ title: string;+ slug: string;+ created_at: string;+ updated_at: string;+}++export default StorePostCategory;diff --git a/packages/sdk/src/types/generated/StorePromotion.ts b/packages/sdk/src/types/generated/StorePromotion.tsnew file mode 100644index 0000000000..b8db661d4d--- /dev/null+++ b/packages/sdk/src/types/generated/StorePromotion.ts@@ -0,0 +1,26 @@+// Typelizer digest 9041ed7c996c0a4de3ab73808be89e58+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StorePromotion = {+ id: string;+ name: string;+ description: string | null;+ code: string | null;+ type: string | null;+ kind: string | null;+ path: string | null;+ match_policy: string | null;+ usage_limit: number | null;+ advertise: boolean;+ multi_codes: boolean;+ code_prefix: string | null;+ number_of_codes: number | null;+ starts_at: string | null;+ expires_at: string | null;+ created_at: string;+ updated_at: string;+ promotion_category_id: string | null;+}++export default StorePromotion;diff --git a/packages/sdk/src/types/generated/StoreRefund.ts b/packages/sdk/src/types/generated/StoreRefund.tsnew file mode 100644index 0000000000..26bf7af1a8--- /dev/null+++ b/packages/sdk/src/types/generated/StoreRefund.ts@@ -0,0 +1,16 @@+// Typelizer digest 5137d9205af4f5359d4ced8d97d42562+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreRefund = {+ id: string;+ transaction_id: string | null;+ created_at: string;+ updated_at: string;+ amount: string | null;+ payment_id: string | null;+ refund_reason_id: string | null;+ reimbursement_id: string | null;+}++export default StoreRefund;diff --git a/packages/sdk/src/types/generated/StoreReimbursement.ts b/packages/sdk/src/types/generated/StoreReimbursement.tsnew file mode 100644index 0000000000..ea3b2906ea--- /dev/null+++ b/packages/sdk/src/types/generated/StoreReimbursement.ts@@ -0,0 +1,16 @@+// Typelizer digest e66d6132f2ab08485503fb4248c5dbb1+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreReimbursement = {+ id: string;+ number: string;+ reimbursement_status: string | null;+ created_at: string;+ updated_at: string;+ total: string | null;+ order_id: string | null;+ customer_return_id: string | null;+}++export default StoreReimbursement;diff --git a/packages/sdk/src/types/generated/StoreReport.ts b/packages/sdk/src/types/generated/StoreReport.tsnew file mode 100644index 0000000000..a3238c2a85--- /dev/null+++ b/packages/sdk/src/types/generated/StoreReport.ts@@ -0,0 +1,16 @@+// Typelizer digest b8dcd8849cddfc7e3068562e64a106f8+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreReport = {+ id: string;+ type: string | null;+ currency: string | null;+ created_at: string;+ updated_at: string;+ user_id: string | null;+ date_from: string | null;+ date_to: string | null;+}++export default StoreReport;diff --git a/packages/sdk/src/types/generated/StoreReturnAuthorization.ts b/packages/sdk/src/types/generated/StoreReturnAuthorization.tsnew file mode 100644index 0000000000..ff753b842b--- /dev/null+++ b/packages/sdk/src/types/generated/StoreReturnAuthorization.ts@@ -0,0 +1,16 @@+// Typelizer digest 7adfa2798f99417d99d3aeb5335fb3cf+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreReturnAuthorization = {+ id: string;+ number: string;+ created_at: string;+ updated_at: string;+ state: string;+ order_id: string | null;+ stock_location_id: string | null;+ return_authorization_reason_id: string | null;+}++export default StoreReturnAuthorization;diff --git a/packages/sdk/src/types/generated/StoreReturnItem.ts b/packages/sdk/src/types/generated/StoreReturnItem.tsnew file mode 100644index 0000000000..94f4ff089d--- /dev/null+++ b/packages/sdk/src/types/generated/StoreReturnItem.ts@@ -0,0 +1,21 @@+// Typelizer digest 00077f44d12be449eb5f0aab9f13ded3+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreReturnItem = {+ id: string;+ reception_status: string | null;+ acceptance_status: string | null;+ created_at: string;+ updated_at: string;+ pre_tax_amount: string | null;+ included_tax_total: string | null;+ additional_tax_total: string | null;+ inventory_unit_id: string | null;+ return_authorization_id: string | null;+ customer_return_id: string | null;+ reimbursement_id: string | null;+ exchange_variant_id: string | null;+}++export default StoreReturnItem;diff --git a/packages/sdk/src/types/generated/StoreStockItem.ts b/packages/sdk/src/types/generated/StoreStockItem.tsnew file mode 100644index 0000000000..ea2db1ac1a--- /dev/null+++ b/packages/sdk/src/types/generated/StoreStockItem.ts@@ -0,0 +1,15 @@+// Typelizer digest 07e32d71eabc65f16073e0a207ea0b88+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreStockItem = {+ id: string;+ count_on_hand: number;+ backorderable: boolean;+ created_at: string;+ updated_at: string;+ stock_location_id: string | null;+ variant_id: string | null;+}++export default StoreStockItem;diff --git a/packages/sdk/src/types/generated/StoreStockMovement.ts b/packages/sdk/src/types/generated/StoreStockMovement.tsnew file mode 100644index 0000000000..776ab147d0--- /dev/null+++ b/packages/sdk/src/types/generated/StoreStockMovement.ts@@ -0,0 +1,16 @@+// Typelizer digest fb445f809f55b80a5d27da5387f99f33+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreStockMovement = {+ id: string;+ quantity: number;+ action: string | null;+ originator_type: string | null;+ created_at: string;+ updated_at: string;+ originator_id: string | null;+ stock_item_id: string | null;+}++export default StoreStockMovement;diff --git a/packages/sdk/src/types/generated/StoreStockTransfer.ts b/packages/sdk/src/types/generated/StoreStockTransfer.tsnew file mode 100644index 0000000000..4bf1cc84a3--- /dev/null+++ b/packages/sdk/src/types/generated/StoreStockTransfer.ts@@ -0,0 +1,16 @@+// Typelizer digest dd6b70468df19a6114c81a3dc3133199+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreStockTransfer = {+ id: string;+ number: string | null;+ type: string | null;+ reference: string | null;+ created_at: string;+ updated_at: string;+ source_location_id: string | null;+ destination_location_id: string | null;+}++export default StoreStockTransfer;diff --git a/packages/sdk/src/types/generated/index.ts b/packages/sdk/src/types/generated/index.tsindex 3c43427906..85779b082b 100644--- a/packages/sdk/src/types/generated/index.ts+++ b/packages/sdk/src/types/generated/index.ts@@ -1,4 +1,4 @@-// Typelizer digest 8891b39beca3cb4c025fc2e141b8e372+// Typelizer digest dfa2e2f24b33aa259147f751dda8ff6e//// DO NOT MODIFY: This file was automatically generated by Typelizer.export type { default as StoreAddress } from './StoreAddress'@@ -10,17 +10,26 @@ export type { default as AdminProduct } from './AdminProduct'export type { default as AdminTaxon } from './AdminTaxon'export type { default as AdminTaxonomy } from './AdminTaxonomy'export type { default as AdminVariant } from './AdminVariant'+export type { default as StoreAsset } from './StoreAsset'export type { default as StoreBase } from './StoreBase'export type { default as StoreCountry } from './StoreCountry'export type { default as StoreCreditCard } from './StoreCreditCard'export type { default as StoreCurrency } from './StoreCurrency'+export type { default as StoreCustomerReturn } from './StoreCustomerReturn'export type { default as StoreCustomer } from './StoreCustomer'export type { default as StoreDigitalLink } from './StoreDigitalLink'+export type { default as StoreDigital } from './StoreDigital'+export type { default as StoreExport } from './StoreExport'+export type { default as StoreGiftCardBatch } from './StoreGiftCardBatch'export type { default as StoreGiftCard } from './StoreGiftCard'export type { default as StoreImage } from './StoreImage'+export type { default as StoreImportRow } from './StoreImportRow'+export type { default as StoreImport } from './StoreImport'+export type { default as StoreInvitation } from './StoreInvitation'export type { default as StoreLineItem } from './StoreLineItem'export type { default as StoreLocale } from './StoreLocale'export type { default as StoreMetafield } from './StoreMetafield'+export type { default as StoreNewsletterSubscriber } from './StoreNewsletterSubscriber'export type { default as StoreOptionType } from './StoreOptionType'export type { default as StoreOptionValue } from './StoreOptionValue'export type { default as StoreOrderPromotion } from './StoreOrderPromotion'@@ -30,13 +39,24 @@ export type { default as StorePayment } from './StorePayment'export type { default as StorePaymentSession } from './StorePaymentSession'export type { default as StorePaymentSetupSession } from './StorePaymentSetupSession'export type { default as StorePaymentSource } from './StorePaymentSource'+export type { default as StorePostCategory } from './StorePostCategory'+export type { default as StorePost } from './StorePost'export type { default as StorePrice } from './StorePrice'export type { default as StoreProduct } from './StoreProduct'+export type { default as StorePromotion } from './StorePromotion'+export type { default as StoreRefund } from './StoreRefund'+export type { default as StoreReimbursement } from './StoreReimbursement'+export type { default as StoreReport } from './StoreReport'+export type { default as StoreReturnAuthorization } from './StoreReturnAuthorization'+export type { default as StoreReturnItem } from './StoreReturnItem'export type { default as StoreShipment } from './StoreShipment'export type { default as StoreShippingMethod } from './StoreShippingMethod'export type { default as StoreShippingRate } from './StoreShippingRate'export type { default as StoreState } from './StoreState'+export type { default as StoreStockItem } from './StoreStockItem'export type { default as StoreStockLocation } from './StoreStockLocation'+export type { default as StoreStockMovement } from './StoreStockMovement'+export type { default as StoreStockTransfer } from './StoreStockTransfer'export type { default as StoreStoreCredit } from './StoreStoreCredit'export type { default as StoreStore } from './StoreStore'export type { default as StoreTaxon } from './StoreTaxon'diff --git a/spree/api/app/serializers/spree/api/v3/asset_serializer.rb b/spree/api/app/serializers/spree/api/v3/asset_serializer.rbnew file mode 100644index 0000000000..cdeec47d49--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/asset_serializer.rb@@ -0,0 +1,20 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class AssetSerializer < BaseSerializer+ typelize type: [:string, nullable: true], viewable_type: :string,+ viewable_id: :string, position: [:number, nullable: true],+ alt: [:string, nullable: true]++ attribute :viewable_id do |asset|+ asset.viewable&.prefixed_id+ end++ attributes :type, :viewable_type, :position, :alt,+ created_at: :iso8601, updated_at: :iso8601+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/customer_return_serializer.rb b/spree/api/app/serializers/spree/api/v3/customer_return_serializer.rbnew file mode 100644index 0000000000..a438bbfa0a--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/customer_return_serializer.rb@@ -0,0 +1,17 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class CustomerReturnSerializer < BaseSerializer+ typelize number: :string, stock_location_id: [:string, nullable: true]++ attributes :number, created_at: :iso8601, updated_at: :iso8601++ attribute :stock_location_id do |customer_return|+ customer_return.stock_location&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/digital_serializer.rb b/spree/api/app/serializers/spree/api/v3/digital_serializer.rbnew file mode 100644index 0000000000..e3e1ad4fac--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/digital_serializer.rb@@ -0,0 +1,17 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class DigitalSerializer < BaseSerializer+ typelize variant_id: [:string, nullable: true]++ attributes created_at: :iso8601, updated_at: :iso8601++ attribute :variant_id do |digital|+ digital.variant&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/export_serializer.rb b/spree/api/app/serializers/spree/api/v3/export_serializer.rbnew file mode 100644index 0000000000..9ef7272baa--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/export_serializer.rb@@ -0,0 +1,19 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class ExportSerializer < BaseSerializer+ typelize number: :string, type: [:string, nullable: true], format: [:string, nullable: true],+ user_id: [:string, nullable: true]++ attributes :number, :type, :format,+ created_at: :iso8601, updated_at: :iso8601++ attribute :user_id do |export|+ export.user&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/gift_card_batch_serializer.rb b/spree/api/app/serializers/spree/api/v3/gift_card_batch_serializer.rbnew file mode 100644index 0000000000..e7555755bd--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/gift_card_batch_serializer.rb@@ -0,0 +1,28 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class GiftCardBatchSerializer < BaseSerializer+ typelize codes_count: :number, amount: [:string, nullable: true], currency: [:string, nullable: true],+ prefix: [:string, nullable: true], expires_at: [:string, nullable: true],+ created_by_id: [:string, nullable: true]++ attributes :codes_count, :currency, :prefix,+ created_at: :iso8601, updated_at: :iso8601++ attribute :amount do |batch|+ batch.amount&.to_s+ end++ attribute :expires_at do |batch|+ batch.expires_at&.iso8601+ end++ attribute :created_by_id do |batch|+ batch.created_by&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/image_serializer.rb b/spree/api/app/serializers/spree/api/v3/image_serializer.rbindex ab71c2fa90..2b98a30ad1 100644--- a/spree/api/app/serializers/spree/api/v3/image_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/image_serializer.rb@@ -1,7 +1,7 @@module Spreemodule Apimodule V3- class ImageSerializer < BaseSerializer+ class ImageSerializer < AssetSerializertypelize position: :number, alt: [:string, nullable: true], viewable_type: :string, viewable_id: :string,original_url: [:string, nullable: true], mini_url: [:string, nullable: true],small_url: [:string, nullable: true], medium_url: [:string, nullable: true],diff --git a/spree/api/app/serializers/spree/api/v3/import_row_serializer.rb b/spree/api/app/serializers/spree/api/v3/import_row_serializer.rbnew file mode 100644index 0000000000..e74b786ca5--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/import_row_serializer.rb@@ -0,0 +1,24 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class ImportRowSerializer < BaseSerializer+ typelize import_id: [:string, nullable: true], row_number: :number,+ status: :string, validation_errors: 'unknown',+ item_type: [:string, nullable: true], item_id: [:string, nullable: true]++ attributes :row_number, :status, :validation_errors, :item_type,+ created_at: :iso8601, updated_at: :iso8601++ attribute :import_id do |row|+ row.import&.prefixed_id+ end++ attribute :item_id do |row|+ row.item&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/import_serializer.rb b/spree/api/app/serializers/spree/api/v3/import_serializer.rbnew file mode 100644index 0000000000..b56ae3a2f9--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/import_serializer.rb@@ -0,0 +1,32 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class ImportSerializer < BaseSerializer+ typelize number: :string, type: [:string, nullable: true], status: :string,+ owner_type: [:string, nullable: true], owner_id: [:string, nullable: true],+ user_id: [:string, nullable: true], rows_count: :number++ attributes :number, :type, :rows_count,+ created_at: :iso8601, updated_at: :iso8601++ attribute :status do |import|+ import.status.to_s+ end++ attribute :owner_type do |import|+ import.owner_type+ end++ attribute :owner_id do |import|+ import.owner&.prefixed_id+ end++ attribute :user_id do |import|+ import.user&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/invitation_serializer.rb b/spree/api/app/serializers/spree/api/v3/invitation_serializer.rbnew file mode 100644index 0000000000..6ea86433a4--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/invitation_serializer.rb@@ -0,0 +1,47 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class InvitationSerializer < BaseSerializer+ typelize email: :string, status: :string,+ resource_type: [:string, nullable: true], resource_id: [:string, nullable: true],+ inviter_type: [:string, nullable: true], inviter_id: [:string, nullable: true],+ invitee_type: [:string, nullable: true], invitee_id: [:string, nullable: true],+ role_id: [:string, nullable: true],+ expires_at: [:string, nullable: true], accepted_at: [:string, nullable: true]++ attributes :email, :resource_type, :inviter_type, :invitee_type,+ created_at: :iso8601, updated_at: :iso8601++ attribute :status do |invitation|+ invitation.status.to_s+ end++ attribute :resource_id do |invitation|+ invitation.resource&.prefixed_id+ end++ attribute :inviter_id do |invitation|+ invitation.inviter&.prefixed_id+ end++ attribute :invitee_id do |invitation|+ invitation.invitee&.prefixed_id+ end++ attribute :role_id do |invitation|+ invitation.role&.prefixed_id+ end++ attribute :expires_at do |invitation|+ invitation.expires_at&.iso8601+ end++ attribute :accepted_at do |invitation|+ invitation.accepted_at&.iso8601+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/newsletter_subscriber_serializer.rb b/spree/api/app/serializers/spree/api/v3/newsletter_subscriber_serializer.rbnew file mode 100644index 0000000000..84fb064a06--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/newsletter_subscriber_serializer.rb@@ -0,0 +1,27 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class NewsletterSubscriberSerializer < BaseSerializer+ typelize email: :string, verified: :boolean,+ verified_at: [:string, nullable: true],+ user_id: [:string, nullable: true]++ attributes :email, created_at: :iso8601, updated_at: :iso8601++ attribute :verified do |subscriber|+ subscriber.verified?+ end++ attribute :verified_at do |subscriber|+ subscriber.verified_at&.iso8601+ end++ attribute :user_id do |subscriber|+ subscriber.user&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/post_category_serializer.rb b/spree/api/app/serializers/spree/api/v3/post_category_serializer.rbnew file mode 100644index 0000000000..915378f4e1--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/post_category_serializer.rb@@ -0,0 +1,13 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class PostCategorySerializer < BaseSerializer+ typelize title: :string, slug: :string++ attributes :title, :slug, created_at: :iso8601, updated_at: :iso8601+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/post_serializer.rb b/spree/api/app/serializers/spree/api/v3/post_serializer.rbnew file mode 100644index 0000000000..8212d76091--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/post_serializer.rb@@ -0,0 +1,25 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class PostSerializer < BaseSerializer+ typelize title: :string, slug: :string,+ meta_title: [:string, nullable: true], meta_description: [:string, nullable: true],+ published_at: [:string, nullable: true],+ author_id: [:string, nullable: true], post_category_id: [:string, nullable: true]++ attributes :title, :slug, :meta_title, :meta_description,+ published_at: :iso8601, created_at: :iso8601, updated_at: :iso8601++ attribute :author_id do |post|+ post.author&.prefixed_id+ end++ attribute :post_category_id do |post|+ post.post_category&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/price_serializer.rb b/spree/api/app/serializers/spree/api/v3/price_serializer.rbindex 222ff3969f..655c39d8ff 100644--- a/spree/api/app/serializers/spree/api/v3/price_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/price_serializer.rb@@ -26,9 +26,7 @@ module Spreeendattribute :price_list_id do |price|- next nil unless price&.price_list_id.present?-- price.price_list.prefixed_id+ price.price_list&.prefixed_idendendenddiff --git a/spree/api/app/serializers/spree/api/v3/promotion_serializer.rb b/spree/api/app/serializers/spree/api/v3/promotion_serializer.rbnew file mode 100644index 0000000000..5fb4786063--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/promotion_serializer.rb@@ -0,0 +1,28 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class PromotionSerializer < BaseSerializer+ typelize name: :string, description: [:string, nullable: true],+ code: [:string, nullable: true], type: [:string, nullable: true],+ kind: [:string, nullable: true], path: [:string, nullable: true],+ match_policy: [:string, nullable: true], usage_limit: [:number, nullable: true],+ advertise: :boolean, multi_codes: :boolean,+ code_prefix: [:string, nullable: true], number_of_codes: [:number, nullable: true],+ starts_at: [:string, nullable: true], expires_at: [:string, nullable: true],+ promotion_category_id: [:string, nullable: true]++ attributes :name, :description, :code, :type, :kind, :path,+ :match_policy, :usage_limit, :advertise, :multi_codes,+ :code_prefix, :number_of_codes,+ starts_at: :iso8601, expires_at: :iso8601,+ created_at: :iso8601, updated_at: :iso8601++ attribute :promotion_category_id do |promotion|+ promotion.promotion_category&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/refund_serializer.rb b/spree/api/app/serializers/spree/api/v3/refund_serializer.rbnew file mode 100644index 0000000000..77206937a6--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/refund_serializer.rb@@ -0,0 +1,31 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class RefundSerializer < BaseSerializer+ typelize amount: [:string, nullable: true], transaction_id: [:string, nullable: true],+ payment_id: [:string, nullable: true], refund_reason_id: [:string, nullable: true],+ reimbursement_id: [:string, nullable: true]++ attributes :transaction_id, created_at: :iso8601, updated_at: :iso8601++ attribute :amount do |refund|+ refund.amount&.to_s+ end++ attribute :payment_id do |refund|+ refund.payment&.prefixed_id+ end++ attribute :refund_reason_id do |refund|+ refund.reason&.prefixed_id+ end++ attribute :reimbursement_id do |refund|+ refund.reimbursement&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/reimbursement_serializer.rb b/spree/api/app/serializers/spree/api/v3/reimbursement_serializer.rbnew file mode 100644index 0000000000..f64023f22c--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/reimbursement_serializer.rb@@ -0,0 +1,28 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class ReimbursementSerializer < BaseSerializer+ typelize number: :string, reimbursement_status: [:string, nullable: true],+ total: [:string, nullable: true],+ order_id: [:string, nullable: true], customer_return_id: [:string, nullable: true]++ attributes :number, :reimbursement_status,+ created_at: :iso8601, updated_at: :iso8601++ attribute :total do |reimbursement|+ reimbursement.total&.to_s+ end++ attribute :order_id do |reimbursement|+ reimbursement.order&.prefixed_id+ end++ attribute :customer_return_id do |reimbursement|+ reimbursement.customer_return&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/report_serializer.rb b/spree/api/app/serializers/spree/api/v3/report_serializer.rbnew file mode 100644index 0000000000..df460bb00d--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/report_serializer.rb@@ -0,0 +1,29 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class ReportSerializer < BaseSerializer+ typelize type: [:string, nullable: true],+ user_id: [:string, nullable: true],+ currency: [:string, nullable: true],+ date_from: [:string, nullable: true], date_to: [:string, nullable: true]++ attributes :type, :currency,+ created_at: :iso8601, updated_at: :iso8601++ attribute :user_id do |report|+ report.user&.prefixed_id+ end++ attribute :date_from do |report|+ report.date_from&.iso8601+ end++ attribute :date_to do |report|+ report.date_to&.iso8601+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/return_authorization_serializer.rb b/spree/api/app/serializers/spree/api/v3/return_authorization_serializer.rbnew file mode 100644index 0000000000..d97b535c85--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/return_authorization_serializer.rb@@ -0,0 +1,31 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class ReturnAuthorizationSerializer < BaseSerializer+ typelize number: :string, state: :string,+ order_id: [:string, nullable: true], stock_location_id: [:string, nullable: true],+ return_authorization_reason_id: [:string, nullable: true]++ attributes :number, created_at: :iso8601, updated_at: :iso8601++ attribute :state do |return_authorization|+ return_authorization.state.to_s+ end++ attribute :order_id do |return_authorization|+ return_authorization.order&.prefixed_id+ end++ attribute :stock_location_id do |return_authorization|+ return_authorization.stock_location&.prefixed_id+ end++ attribute :return_authorization_reason_id do |return_authorization|+ return_authorization.reason&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/return_item_serializer.rb b/spree/api/app/serializers/spree/api/v3/return_item_serializer.rbnew file mode 100644index 0000000000..1902653f24--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/return_item_serializer.rb@@ -0,0 +1,53 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class ReturnItemSerializer < BaseSerializer+ typelize reception_status: [:string, nullable: true], acceptance_status: [:string, nullable: true],+ pre_tax_amount: [:string, nullable: true],+ included_tax_total: [:string, nullable: true], additional_tax_total: [:string, nullable: true],+ inventory_unit_id: [:string, nullable: true],+ return_authorization_id: [:string, nullable: true],+ customer_return_id: [:string, nullable: true],+ reimbursement_id: [:string, nullable: true],+ exchange_variant_id: [:string, nullable: true]++ attributes :reception_status, :acceptance_status,+ created_at: :iso8601, updated_at: :iso8601++ attribute :pre_tax_amount do |item|+ item.pre_tax_amount&.to_s+ end++ attribute :included_tax_total do |item|+ item.included_tax_total&.to_s+ end++ attribute :additional_tax_total do |item|+ item.additional_tax_total&.to_s+ end++ attribute :inventory_unit_id do |item|+ item.inventory_unit&.prefixed_id+ end++ attribute :return_authorization_id do |item|+ item.return_authorization&.prefixed_id+ end++ attribute :customer_return_id do |item|+ item.customer_return&.prefixed_id+ end++ attribute :reimbursement_id do |item|+ item.reimbursement&.prefixed_id+ end++ attribute :exchange_variant_id do |item|+ item.exchange_variant&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/stock_item_serializer.rb b/spree/api/app/serializers/spree/api/v3/stock_item_serializer.rbnew file mode 100644index 0000000000..23a7b978d8--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/stock_item_serializer.rb@@ -0,0 +1,23 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class StockItemSerializer < BaseSerializer+ typelize count_on_hand: :number, backorderable: :boolean,+ stock_location_id: [:string, nullable: true], variant_id: [:string, nullable: true]++ attributes :count_on_hand, :backorderable,+ created_at: :iso8601, updated_at: :iso8601++ attribute :stock_location_id do |stock_item|+ stock_item.stock_location&.prefixed_id+ end++ attribute :variant_id do |stock_item|+ stock_item.variant&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/stock_movement_serializer.rb b/spree/api/app/serializers/spree/api/v3/stock_movement_serializer.rbnew file mode 100644index 0000000000..c7cc64fa23--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/stock_movement_serializer.rb@@ -0,0 +1,24 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class StockMovementSerializer < BaseSerializer+ typelize quantity: :number, action: [:string, nullable: true],+ originator_type: [:string, nullable: true], originator_id: [:string, nullable: true],+ stock_item_id: [:string, nullable: true]++ attributes :quantity, :action, :originator_type,+ created_at: :iso8601, updated_at: :iso8601++ attribute :originator_id do |movement|+ movement.originator&.prefixed_id+ end++ attribute :stock_item_id do |movement|+ movement.stock_item&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/app/serializers/spree/api/v3/stock_transfer_serializer.rb b/spree/api/app/serializers/spree/api/v3/stock_transfer_serializer.rbnew file mode 100644index 0000000000..ec5302c991--- /dev/null+++ b/spree/api/app/serializers/spree/api/v3/stock_transfer_serializer.rb@@ -0,0 +1,25 @@+# frozen_string_literal: true++module Spree+ module Api+ module V3+ class StockTransferSerializer < BaseSerializer+ typelize number: [:string, nullable: true], type: [:string, nullable: true],+ reference: [:string, nullable: true],+ source_location_id: [:string, nullable: true],+ destination_location_id: [:string, nullable: true]++ attributes :number, :type, :reference,+ created_at: :iso8601, updated_at: :iso8601++ attribute :source_location_id do |transfer|+ transfer.source_location&.prefixed_id+ end++ attribute :destination_location_id do |transfer|+ transfer.destination_location&.prefixed_id+ end+ end+ end+ end+enddiff --git a/spree/api/lib/spree/api/dependencies.rb b/spree/api/lib/spree/api/dependencies.rbindex b9ab220d34..aaeda6fd33 100644--- a/spree/api/lib/spree/api/dependencies.rb+++ b/spree/api/lib/spree/api/dependencies.rb@@ -126,6 +126,28 @@ module Spreelocale_serializer: 'Spree::Api::V3::LocaleSerializer',metafield_serializer: 'Spree::Api::V3::MetafieldSerializer',+ # v3 event serializers (for models without Store API endpoints yet)+ asset_serializer: 'Spree::Api::V3::AssetSerializer',+ customer_return_serializer: 'Spree::Api::V3::CustomerReturnSerializer',+ digital_serializer: 'Spree::Api::V3::DigitalSerializer',+ export_serializer: 'Spree::Api::V3::ExportSerializer',+ gift_card_batch_serializer: 'Spree::Api::V3::GiftCardBatchSerializer',+ import_serializer: 'Spree::Api::V3::ImportSerializer',+ import_row_serializer: 'Spree::Api::V3::ImportRowSerializer',+ invitation_serializer: 'Spree::Api::V3::InvitationSerializer',+ newsletter_subscriber_serializer: 'Spree::Api::V3::NewsletterSubscriberSerializer',+ post_serializer: 'Spree::Api::V3::PostSerializer',+ post_category_serializer: 'Spree::Api::V3::PostCategorySerializer',+ promotion_serializer: 'Spree::Api::V3::PromotionSerializer',+ refund_serializer: 'Spree::Api::V3::RefundSerializer',+ reimbursement_serializer: 'Spree::Api::V3::ReimbursementSerializer',+ report_serializer: 'Spree::Api::V3::ReportSerializer',+ return_authorization_serializer: 'Spree::Api::V3::ReturnAuthorizationSerializer',+ return_item_serializer: 'Spree::Api::V3::ReturnItemSerializer',+ stock_item_serializer: 'Spree::Api::V3::StockItemSerializer',+ stock_movement_serializer: 'Spree::Api::V3::StockMovementSerializer',+ stock_transfer_serializer: 'Spree::Api::V3::StockTransferSerializer',+# v3 admin serializers (API v3 Admin)admin_customer_serializer: 'Spree::Api::V3::Admin::CustomerSerializer',admin_order_serializer: 'Spree::Api::V3::Admin::OrderSerializer',diff --git a/spree/api/spec/serializers/spree/api/v3/asset_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/asset_serializer_spec.rbnew file mode 100644index 0000000000..3b045fb163--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/asset_serializer_spec.rb@@ -0,0 +1,30 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::AssetSerializer do+ let(:store) { @default_store }+ let(:product) { create(:product, stores: [store]) }+ let(:asset) { create(:asset, viewable: product.master) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(asset, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id type viewable_type viewable_id position alt created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(asset.prefixed_id)+ end++ it 'returns prefixed viewable_id' do+ expect(subject['viewable_id']).to eq(product.master.prefixed_id)+ end++ it 'returns viewable_type' do+ expect(subject['viewable_type']).to eq('Spree::Variant')+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/customer_return_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/customer_return_serializer_spec.rbnew file mode 100644index 0000000000..7bf35f6ed7--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/customer_return_serializer_spec.rb@@ -0,0 +1,25 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::CustomerReturnSerializer do+ let(:store) { @default_store }+ let(:customer_return) { create(:customer_return) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(customer_return, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id number stock_location_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(customer_return.prefixed_id)+ end++ it 'returns prefixed stock_location_id' do+ expect(subject['stock_location_id']).to eq(customer_return.stock_location.prefixed_id)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/digital_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/digital_serializer_spec.rbnew file mode 100644index 0000000000..248d36338e--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/digital_serializer_spec.rb@@ -0,0 +1,25 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::DigitalSerializer do+ let(:store) { @default_store }+ let(:digital) { create(:digital) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(digital, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id variant_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(digital.prefixed_id)+ end++ it 'returns prefixed variant_id' do+ expect(subject['variant_id']).to eq(digital.variant.prefixed_id)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/export_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/export_serializer_spec.rbnew file mode 100644index 0000000000..6722d6a202--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/export_serializer_spec.rb@@ -0,0 +1,29 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::ExportSerializer do+ let(:store) { @default_store }+ let(:export) { create(:export) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(export, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id number type format user_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(export.prefixed_id)+ end++ it 'returns prefixed user_id' do+ expect(subject['user_id']).to eq(export.user.prefixed_id)+ end++ it 'returns the export type' do+ expect(subject['type']).to eq('Spree::Exports::Products')+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/gift_card_batch_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/gift_card_batch_serializer_spec.rbnew file mode 100644index 0000000000..6023d49157--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/gift_card_batch_serializer_spec.rb@@ -0,0 +1,25 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::GiftCardBatchSerializer do+ let(:store) { @default_store }+ let(:gift_card_batch) { create(:gift_card_batch, amount: 25.00, prefix: 'GC', currency: 'USD') }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(gift_card_batch, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id codes_count amount currency prefix expires_at created_by_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(gift_card_batch.prefixed_id)+ end++ it 'returns amount as string' do+ expect(subject['amount']).to eq('25.0')+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/import_row_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/import_row_serializer_spec.rbnew file mode 100644index 0000000000..9d157450df--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/import_row_serializer_spec.rb@@ -0,0 +1,25 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::ImportRowSerializer do+ let(:store) { @default_store }+ let(:import_row) { create(:import_row) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(import_row, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id import_id row_number status validation_errors item_type item_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(import_row.prefixed_id)+ end++ it 'returns prefixed import_id' do+ expect(subject['import_id']).to eq(import_row.import.prefixed_id)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/import_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/import_serializer_spec.rbnew file mode 100644index 0000000000..4d180b45e9--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/import_serializer_spec.rb@@ -0,0 +1,29 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::ImportSerializer do+ let(:store) { @default_store }+ let(:import) { create(:import) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(import, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id number type status owner_type owner_id user_id rows_count created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(import.prefixed_id)+ end++ it 'returns prefixed user_id' do+ expect(subject['user_id']).to eq(import.user.prefixed_id)+ end++ it 'returns status as string' do+ expect(subject['status']).to be_a(String)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/invitation_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/invitation_serializer_spec.rbnew file mode 100644index 0000000000..1bcca56a09--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/invitation_serializer_spec.rb@@ -0,0 +1,26 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::InvitationSerializer do+ let(:store) { @default_store }+ let(:invitation) { create(:invitation) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(invitation, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id email status resource_type resource_id inviter_type inviter_id+ invitee_type invitee_id role_id expires_at accepted_at created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(invitation.prefixed_id)+ end++ it 'returns prefixed inviter_id' do+ expect(subject['inviter_id']).to eq(invitation.inviter.prefixed_id)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/newsletter_subscriber_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/newsletter_subscriber_serializer_spec.rbnew file mode 100644index 0000000000..50662f9c99--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/newsletter_subscriber_serializer_spec.rb@@ -0,0 +1,25 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::NewsletterSubscriberSerializer do+ let(:store) { @default_store }+ let(:newsletter_subscriber) { create(:newsletter_subscriber, :verified) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(newsletter_subscriber, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id email verified verified_at user_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(newsletter_subscriber.prefixed_id)+ end++ it 'returns verified as boolean' do+ expect(subject['verified']).to be(true)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/post_category_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/post_category_serializer_spec.rbnew file mode 100644index 0000000000..b441114dea--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/post_category_serializer_spec.rb@@ -0,0 +1,21 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::PostCategorySerializer do+ let(:store) { @default_store }+ let(:post_category) { create(:post_category, store: store) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(post_category, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id title slug created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(post_category.prefixed_id)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/post_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/post_serializer_spec.rbnew file mode 100644index 0000000000..c0b6634e6c--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/post_serializer_spec.rb@@ -0,0 +1,30 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::PostSerializer do+ let(:store) { @default_store }+ let(:post) { create(:post, store: store) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(post, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id title slug meta_title meta_description published_at+ author_id post_category_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(post.prefixed_id)+ end++ it 'returns prefixed author_id' do+ expect(subject['author_id']).to eq(post.author.prefixed_id)+ end++ it 'returns prefixed post_category_id' do+ expect(subject['post_category_id']).to eq(post.post_category.prefixed_id)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/promotion_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/promotion_serializer_spec.rbnew file mode 100644index 0000000000..cc06e65c3f--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/promotion_serializer_spec.rb@@ -0,0 +1,27 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::PromotionSerializer do+ let(:store) { @default_store }+ let(:promotion) { create(:promotion) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(promotion, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id name description code type kind path match_policy usage_limit+ advertise multi_codes code_prefix number_of_codes+ starts_at expires_at promotion_category_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(promotion.prefixed_id)+ end++ it 'returns the promotion name' do+ expect(subject['name']).to eq('Promo')+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/refund_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/refund_serializer_spec.rbnew file mode 100644index 0000000000..edd998e261--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/refund_serializer_spec.rb@@ -0,0 +1,30 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::RefundSerializer do+ let(:store) { @default_store }+ let(:payment) { create(:payment, amount: 100, state: 'completed') }+ let(:refund) { create(:refund, payment: payment, amount: 10) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(refund, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id amount transaction_id payment_id refund_reason_id reimbursement_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(refund.prefixed_id)+ end++ it 'returns amount as string' do+ expect(subject['amount']).to eq('10.0')+ end++ it 'returns prefixed payment_id' do+ expect(subject['payment_id']).to eq(refund.payment.prefixed_id)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/reimbursement_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/reimbursement_serializer_spec.rbnew file mode 100644index 0000000000..f97505a659--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/reimbursement_serializer_spec.rb@@ -0,0 +1,25 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::ReimbursementSerializer do+ let(:store) { @default_store }+ let(:reimbursement) { create(:reimbursement) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(reimbursement, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id number reimbursement_status total order_id customer_return_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(reimbursement.prefixed_id)+ end++ it 'returns prefixed order_id' do+ expect(subject['order_id']).to eq(reimbursement.order.prefixed_id)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/report_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/report_serializer_spec.rbnew file mode 100644index 0000000000..532d119e81--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/report_serializer_spec.rb@@ -0,0 +1,29 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::ReportSerializer do+ let(:store) { @default_store }+ let(:report) { create(:report) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(report, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id type user_id currency date_from date_to created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(report.prefixed_id)+ end++ it 'returns prefixed user_id' do+ expect(subject['user_id']).to eq(report.user.prefixed_id)+ end++ it 'returns date_from as ISO8601' do+ expect(subject['date_from']).to be_present+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/return_authorization_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/return_authorization_serializer_spec.rbnew file mode 100644index 0000000000..8f05cd140f--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/return_authorization_serializer_spec.rb@@ -0,0 +1,29 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::ReturnAuthorizationSerializer do+ let(:store) { @default_store }+ let(:return_authorization) { create(:return_authorization) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(return_authorization, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id number state order_id stock_location_id return_authorization_reason_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(return_authorization.prefixed_id)+ end++ it 'returns prefixed order_id' do+ expect(subject['order_id']).to eq(return_authorization.order.prefixed_id)+ end++ it 'returns state as string' do+ expect(subject['state']).to be_a(String)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/return_item_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/return_item_serializer_spec.rbnew file mode 100644index 0000000000..72afbebb5d--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/return_item_serializer_spec.rb@@ -0,0 +1,28 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::ReturnItemSerializer do+ let(:store) { @default_store }+ let(:return_item) { create(:return_item) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(return_item, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id reception_status acceptance_status pre_tax_amount+ included_tax_total additional_tax_total inventory_unit_id+ return_authorization_id customer_return_id reimbursement_id+ exchange_variant_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(return_item.prefixed_id)+ end++ it 'returns prefixed inventory_unit_id' do+ expect(subject['inventory_unit_id']).to eq(return_item.inventory_unit.prefixed_id)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/stock_item_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/stock_item_serializer_spec.rbnew file mode 100644index 0000000000..5eedb03e9f--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/stock_item_serializer_spec.rb@@ -0,0 +1,33 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::StockItemSerializer do+ let(:store) { @default_store }+ let(:stock_item) { create(:stock_item) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(stock_item, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id count_on_hand backorderable stock_location_id variant_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(stock_item.prefixed_id)+ end++ it 'returns prefixed stock_location_id' do+ expect(subject['stock_location_id']).to eq(stock_item.stock_location.prefixed_id)+ end++ it 'returns prefixed variant_id' do+ expect(subject['variant_id']).to eq(stock_item.variant.prefixed_id)+ end++ it 'returns count_on_hand as number' do+ expect(subject['count_on_hand']).to be_a(Integer)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/stock_movement_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/stock_movement_serializer_spec.rbnew file mode 100644index 0000000000..276faf5e31--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/stock_movement_serializer_spec.rb@@ -0,0 +1,25 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::StockMovementSerializer do+ let(:store) { @default_store }+ let(:stock_movement) { create(:stock_movement) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(stock_movement, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id quantity action originator_type originator_id stock_item_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(stock_movement.prefixed_id)+ end++ it 'returns prefixed stock_item_id' do+ expect(subject['stock_item_id']).to eq(stock_movement.stock_item.prefixed_id)+ end+enddiff --git a/spree/api/spec/serializers/spree/api/v3/stock_transfer_serializer_spec.rb b/spree/api/spec/serializers/spree/api/v3/stock_transfer_serializer_spec.rbnew file mode 100644index 0000000000..fd308319a9--- /dev/null+++ b/spree/api/spec/serializers/spree/api/v3/stock_transfer_serializer_spec.rb@@ -0,0 +1,29 @@+# frozen_string_literal: true++require 'spec_helper'++RSpec.describe Spree::Api::V3::StockTransferSerializer do+ let(:store) { @default_store }+ let(:stock_transfer) { create(:stock_transfer) }+ let(:base_params) { { store: store, currency: 'USD' } }++ subject { described_class.new(stock_transfer, params: base_params).to_h }++ it 'includes all expected attributes' do+ expect(subject.keys).to match_array(%w[+ id number type reference source_location_id destination_location_id created_at updated_at+ ])+ end++ it 'returns the prefixed id' do+ expect(subject['id']).to eq(stock_transfer.prefixed_id)+ end++ it 'returns prefixed source_location_id' do+ expect(subject['source_location_id']).to eq(stock_transfer.source_location.prefixed_id)+ end++ it 'returns prefixed destination_location_id' do+ expect(subject['destination_location_id']).to eq(stock_transfer.destination_location.prefixed_id)+ end+enddiff --git a/spree/core/app/models/concerns/spree/publishable.rb b/spree/core/app/models/concerns/spree/publishable.rbindex 6d4f16b9d4..ad440845f0 100644--- a/spree/core/app/models/concerns/spree/publishable.rb+++ b/spree/core/app/models/concerns/spree/publishable.rb@@ -4,8 +4,14 @@ module Spree# Concern for models that publish events.## This concern is included in Spree::Base, so all Spree models- # can emit events. Event payloads are generated using dedicated- # serializers from the Spree::Events namespace.+ # can emit events. Event payloads are generated using V3 API serializers+ # resolved by convention: Spree::Order → Spree::Api::V3::OrderSerializer.+ #+ # Models without a V3 serializer get a minimal fallback payload:+ # { id: prefixed_id, created_at: ..., updated_at: ... }+ #+ # STI models (e.g., Spree::Exports::Products) can override+ # event_serializer_class to point to the parent serializer.## @example Disabling events for a specific model# class Spree::LogEntry < Spree.base_class@@ -20,46 +26,16 @@ module Spree# end# end#- # @example Creating an event serializer (required for each model that publishes events)- # # app/serializers/spree/events/order_serializer.rb- # class Spree::Events::OrderSerializer < Spree::Events::BaseSerializer- # protected- #- # def attributes- # {- # id: resource.id,- # number: resource.number,- # state: resource.state.to_s,- # # ... other attributes- # }+ # @example Overriding the serializer for STI models+ # class Spree::Export < Spree.base_class+ # def event_serializer_class+ # Spree::Api::V3::ExportSerializer# end# end#module Publishableextend ActiveSupport::Concern- # Error raised when a model tries to publish an event but has no serializer defined- class MissingSerializerError < StandardError- def initialize(model_class)- serializer_name = "Spree::Events::#{model_class.name.demodulize}Serializer"- super(- "Missing event serializer for #{model_class.name}. " \- "Please create #{serializer_name} that inherits from Spree::Events::BaseSerializer. " \- "Example:\n\n" \- " class #{serializer_name} < Spree::Events::BaseSerializer\n" \- " protected\n\n" \- " def attributes\n" \- " {\n" \- " id: resource.id,\n" \- " # add other attributes here\n" \- " updated_at: timestamp(resource.updated_at)\n" \- " }\n" \- " end\n" \- " end"- )- end- end-included doclass_attribute :publish_events, default: trueclass_attribute :lifecycle_events_enabled, default: false@@ -168,36 +144,44 @@ module Spree# Get the payload for events#- # Uses dedicated event serializer (Spree::Events::ModelSerializer).- # Raises MissingSerializerError if no serializer is defined.+ # Uses the V3 serializer resolved by convention.+ # Falls back to a minimal payload if no serializer is found.## @return [Hash]- # @raise [MissingSerializerError] if no serializer is defined for this modeldef event_payloadserializer = event_serializer_class- raise MissingSerializerError, self.class unless serializer+ unless serializer+ return {+ id: respond_to?(:prefixed_id) ? prefixed_id : id,+ created_at: created_at&.iso8601,+ updated_at: updated_at&.iso8601+ }+ end- serializer.serialize(self, event_context)+ # Use as_json to ensure all values are JSON-safe primitives.+ # Alba's to_h can return raw Ruby objects (e.g., Spree::Money) which+ # ActiveJob cannot serialize for async event subscribers.+ serializer.new(self, params: event_serializer_params).to_h.as_jsonend# Find the event serializer class for this model#- # Looks for Spree::Events::ModelNameSerializer (e.g., Spree::Events::OrderSerializer)- # Also walks up the class hierarchy to find a serializer for parent classes.- # This allows subclasses like Spree::Exports::Products to use ExportSerializer.+ # Looks for Spree::Api::V3::ModelNameSerializer by convention.+ # Walks up the class hierarchy to support STI models.+ #+ # Models can override this method to specify a custom serializer,+ # which is useful for STI models like Export, Import, Report.## @return [Class, nil] The serializer class or nil if not founddef event_serializer_classreturn nil unless self.class.name- # Try this class and walk up the hierarchyklass = self.classwhile klass && klass != Object && klass != BasicObjectclass_name = klass.name&.demodulize- # Skip looking for BaseSerializer - that's the parent class for all serializersif class_name.present? && class_name != 'Base'- serializer = "Spree::Events::#{class_name}Serializer".safe_constantize+ serializer = "Spree::Api::V3::#{class_name}Serializer".safe_constantizereturn serializer if serializerend@@ -227,6 +211,22 @@ module Spreeprivate+ # Build params for V3 serializers+ #+ # @return [Hash]+ def event_serializer_params+ store = respond_to?(:store) ? self.store : nil+ store ||= Spree::Current.store++ {+ store: store,+ currency: Spree::Current.currency,+ user: nil,+ locale: nil,+ includes: []+ }+ end+def should_publish_events?self.class.publish_events && Spree::Events.enabled?enddiff --git a/spree/core/app/models/concerns/spree/user_methods.rb b/spree/core/app/models/concerns/spree/user_methods.rbindex 58459b19b8..790a52baf8 100644--- a/spree/core/app/models/concerns/spree/user_methods.rb+++ b/spree/core/app/models/concerns/spree/user_methods.rb@@ -166,7 +166,7 @@ module Spreeenddef event_serializer_class- Spree::Events::UserSerializer+ 'Spree::Api::V3::CustomerSerializer'.safe_constantizeenddef event_prefixdiff --git a/spree/core/app/models/spree/export.rb b/spree/core/app/models/spree/export.rbindex 5c3a8d293b..b03bd35396 100644--- a/spree/core/app/models/spree/export.rb+++ b/spree/core/app/models/spree/export.rb@@ -59,7 +59,7 @@ module Spreeattribute :record_selection, :string, default: 'filtered'def event_serializer_class- Spree::Events::ExportSerializer+ 'Spree::Api::V3::ExportSerializer'.safe_constantizeenddef done?diff --git a/spree/core/app/models/spree/import.rb b/spree/core/app/models/spree/import.rbindex e5fb216f0a..d68aa3157c 100644--- a/spree/core/app/models/spree/import.rb+++ b/spree/core/app/models/spree/import.rb@@ -226,7 +226,7 @@ module Spreeenddef event_serializer_class- Spree::Events::ImportSerializer+ 'Spree::Api::V3::ImportSerializer'.safe_constantizeendclass << selfdiff --git a/spree/core/app/models/spree/report.rb b/spree/core/app/models/spree/report.rbindex 0563e6a201..4ec9b1bbc0 100644--- a/spree/core/app/models/spree/report.rb+++ b/spree/core/app/models/spree/report.rb@@ -34,7 +34,7 @@ module Spreehas_one_attached :attachment, service: Spree.private_storage_service_namedef event_serializer_class- Spree::Events::ReportSerializer+ 'Spree::Api::V3::ReportSerializer'.safe_constantizeenddef self.report_typediff --git a/spree/core/app/serializers/spree/events/asset_serializer.rb b/spree/core/app/serializers/spree/events/asset_serializer.rbdeleted file mode 100644index b8b4807198..0000000000--- a/spree/core/app/serializers/spree/events/asset_serializer.rb+++ /dev/null@@ -1,22 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class AssetSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- type: resource.type,- viewable_type: resource.viewable_type,- viewable_id: public_id(resource.viewable),- position: resource.position,- alt: resource.alt,- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/base_serializer.rb b/spree/core/app/serializers/spree/events/base_serializer.rbdeleted file mode 100644index 652772dd95..0000000000--- a/spree/core/app/serializers/spree/events/base_serializer.rb+++ /dev/null@@ -1,70 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class BaseSerializer- attr_reader :resource, :context-- def initialize(resource, context = {})- @resource = resource- @context = context- end-- # Main serialization method- def as_json- attributes- end-- # Class method for convenience- def self.serialize(resource, context = {})- new(resource, context).as_json- end-- protected-- # Override in subclasses to define attributes- def attributes- {- id: public_id(resource)- }- end-- # Context helpers- def event_name- context[:event_name]- end-- def triggered_at- context[:triggered_at] || Time.current- end-- # Returns the public-facing ID for a record.- # Prefers prefixed_id when available (handles FriendlyId models that- # return slugs from to_param), falls back to to_param.- def public_id(record)- return nil if record.nil?-- record.try(:prefixed_id).presence || record.to_param- end-- # Attribute helpers-- # Safely get attribute, returns nil if not present- def attribute(name)- resource.public_send(name) if resource.respond_to?(name)- end-- # Timestamp helper - ISO8601 format- def timestamp(time)- time&.iso8601- end-- # Money helper - decimal value for events- def money(amount)- return nil if amount.nil?-- amount.respond_to?(:to_d) ? amount.to_d : amount- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/customer_return_serializer.rb b/spree/core/app/serializers/spree/events/customer_return_serializer.rbdeleted file mode 100644index 4f4b799c66..0000000000--- a/spree/core/app/serializers/spree/events/customer_return_serializer.rb+++ /dev/null@@ -1,20 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class CustomerReturnSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- number: resource.number,- stock_location_id: public_id(resource.stock_location),- store_id: public_id(resource.store),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/digital_link_serializer.rb b/spree/core/app/serializers/spree/events/digital_link_serializer.rbdeleted file mode 100644index 87afb7bca9..0000000000--- a/spree/core/app/serializers/spree/events/digital_link_serializer.rb+++ /dev/null@@ -1,20 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class DigitalLinkSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- digital_id: public_id(resource.digital),- line_item_id: public_id(resource.line_item),- access_counter: resource.access_counter,- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/digital_serializer.rb b/spree/core/app/serializers/spree/events/digital_serializer.rbdeleted file mode 100644index dec9b48b9a..0000000000--- a/spree/core/app/serializers/spree/events/digital_serializer.rb+++ /dev/null@@ -1,18 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class DigitalSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- variant_id: public_id(resource.variant),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/export_serializer.rb b/spree/core/app/serializers/spree/events/export_serializer.rbdeleted file mode 100644index 9e2df6f349..0000000000--- a/spree/core/app/serializers/spree/events/export_serializer.rb+++ /dev/null@@ -1,22 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class ExportSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- number: resource.number,- type: resource.type,- format: resource.format,- user_id: public_id(resource.user),- store_id: public_id(resource.store),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/gift_card_batch_serializer.rb b/spree/core/app/serializers/spree/events/gift_card_batch_serializer.rbdeleted file mode 100644index e8fdad48f8..0000000000--- a/spree/core/app/serializers/spree/events/gift_card_batch_serializer.rb+++ /dev/null@@ -1,24 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class GiftCardBatchSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- codes_count: resource.codes_count,- amount: money(resource.amount),- currency: resource.currency,- prefix: resource.prefix,- expires_at: resource.expires_at&.to_s,- store_id: public_id(resource.store),- created_by_id: public_id(resource.created_by),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/gift_card_serializer.rb b/spree/core/app/serializers/spree/events/gift_card_serializer.rbdeleted file mode 100644index d42c0c082c..0000000000--- a/spree/core/app/serializers/spree/events/gift_card_serializer.rb+++ /dev/null@@ -1,29 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class GiftCardSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- code: resource.code,- state: resource.state.to_s,- amount: money(resource.amount),- amount_used: money(resource.amount_used),- amount_authorized: money(resource.amount_authorized),- amount_remaining: money(resource.amount_remaining),- currency: resource.currency,- expires_at: resource.expires_at&.iso8601,- redeemed_at: timestamp(resource.redeemed_at),- user_id: public_id(resource.user),- store_id: public_id(resource.store),- gift_card_batch_id: public_id(resource.batch),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/image_serializer.rb b/spree/core/app/serializers/spree/events/image_serializer.rbdeleted file mode 100644index 76e74653d5..0000000000--- a/spree/core/app/serializers/spree/events/image_serializer.rb+++ /dev/null@@ -1,9 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- # Image serializer - uses the same attributes as AssetSerializer- class ImageSerializer < AssetSerializer- end- end-enddiff --git a/spree/core/app/serializers/spree/events/import_row_serializer.rb b/spree/core/app/serializers/spree/events/import_row_serializer.rbdeleted file mode 100644index b2a6b6b986..0000000000--- a/spree/core/app/serializers/spree/events/import_row_serializer.rb+++ /dev/null@@ -1,23 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class ImportRowSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- import_id: public_id(resource.import),- row_number: resource.row_number,- status: resource.status,- validation_errors: resource.validation_errors,- item_type: resource.item_type,- item_id: public_id(resource.item),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/import_serializer.rb b/spree/core/app/serializers/spree/events/import_serializer.rbdeleted file mode 100644index fb8568503f..0000000000--- a/spree/core/app/serializers/spree/events/import_serializer.rb+++ /dev/null@@ -1,24 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class ImportSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- number: resource.number,- type: resource.type,- status: resource.status.to_s,- owner_type: resource.owner_type,- owner_id: public_id(resource.owner),- user_id: public_id(resource.user),- rows_count: resource.rows_count,- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/invitation_serializer.rb b/spree/core/app/serializers/spree/events/invitation_serializer.rbdeleted file mode 100644index 42db9cfd19..0000000000--- a/spree/core/app/serializers/spree/events/invitation_serializer.rb+++ /dev/null@@ -1,28 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class InvitationSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- email: resource.email,- status: resource.status.to_s,- resource_type: resource.resource_type,- resource_id: public_id(resource.resource),- inviter_type: resource.inviter_type,- inviter_id: public_id(resource.inviter),- invitee_type: resource.invitee_type,- invitee_id: public_id(resource.invitee),- role_id: public_id(resource.role),- expires_at: timestamp(resource.expires_at),- accepted_at: timestamp(resource.accepted_at),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/line_item_serializer.rb b/spree/core/app/serializers/spree/events/line_item_serializer.rbdeleted file mode 100644index 0673d2cc72..0000000000--- a/spree/core/app/serializers/spree/events/line_item_serializer.rb+++ /dev/null@@ -1,31 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class LineItemSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- quantity: resource.quantity,- price: money(resource.price),- currency: resource.currency,- cost_price: money(resource.cost_price),- adjustment_total: money(resource.adjustment_total),- additional_tax_total: money(resource.additional_tax_total),- promo_total: money(resource.promo_total),- included_tax_total: money(resource.included_tax_total),- pre_tax_amount: money(resource.pre_tax_amount),- taxable_adjustment_total: money(resource.taxable_adjustment_total),- non_taxable_adjustment_total: money(resource.non_taxable_adjustment_total),- variant_id: public_id(resource.variant),- order_id: public_id(resource.order),- tax_category_id: public_id(resource.tax_category),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/newsletter_subscriber_serializer.rb b/spree/core/app/serializers/spree/events/newsletter_subscriber_serializer.rbdeleted file mode 100644index 3f8a289d9b..0000000000--- a/spree/core/app/serializers/spree/events/newsletter_subscriber_serializer.rb+++ /dev/null@@ -1,21 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class NewsletterSubscriberSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- email: resource.email,- verified: resource.verified?,- verified_at: timestamp(resource.verified_at),- user_id: public_id(resource.user),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/order_serializer.rb b/spree/core/app/serializers/spree/events/order_serializer.rbdeleted file mode 100644index 0199f039c4..0000000000--- a/spree/core/app/serializers/spree/events/order_serializer.rb+++ /dev/null@@ -1,39 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class OrderSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- number: resource.number,- state: resource.state.to_s,- payment_state: resource.payment_state.to_s,- shipment_state: resource.shipment_state.to_s,- total: money(resource.total),- item_total: money(resource.item_total),- shipment_total: money(resource.shipment_total),- adjustment_total: money(resource.adjustment_total),- promo_total: money(resource.promo_total),- included_tax_total: money(resource.included_tax_total),- additional_tax_total: money(resource.additional_tax_total),- item_count: resource.item_count,- currency: resource.currency,- email: resource.email,- user_id: public_id(resource.user),- store_id: public_id(resource.store),- canceler_id: public_id(resource.canceler),- approver_id: public_id(resource.approver),- considered_risky: resource.considered_risky,- completed_at: timestamp(resource.completed_at),- canceled_at: timestamp(resource.canceled_at),- approved_at: timestamp(resource.approved_at),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/payment_serializer.rb b/spree/core/app/serializers/spree/events/payment_serializer.rbdeleted file mode 100644index 3e485c54c2..0000000000--- a/spree/core/app/serializers/spree/events/payment_serializer.rb+++ /dev/null@@ -1,24 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class PaymentSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- number: resource.number,- state: resource.state.to_s,- amount: money(resource.amount),- order_id: public_id(resource.order),- payment_method_id: public_id(resource.payment_method),- source_type: resource.source_type,- source_id: public_id(resource.source),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/payment_session_serializer.rb b/spree/core/app/serializers/spree/events/payment_session_serializer.rbdeleted file mode 100644index 4cb61a4eda..0000000000--- a/spree/core/app/serializers/spree/events/payment_session_serializer.rb+++ /dev/null@@ -1,25 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class PaymentSessionSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- status: resource.status.to_s,- amount: money(resource.amount),- currency: resource.currency,- external_id: resource.external_id,- order_id: public_id(resource.order),- payment_method_id: public_id(resource.payment_method),- customer_id: public_id(resource.customer),- expires_at: timestamp(resource.expires_at),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/payment_setup_session_serializer.rb b/spree/core/app/serializers/spree/events/payment_setup_session_serializer.rbdeleted file mode 100644index f4bac085a5..0000000000--- a/spree/core/app/serializers/spree/events/payment_setup_session_serializer.rb+++ /dev/null@@ -1,23 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class PaymentSetupSessionSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- status: resource.status.to_s,- external_id: resource.external_id,- payment_method_id: public_id(resource.payment_method),- customer_id: public_id(resource.customer),- payment_source_id: public_id(resource.payment_source),- payment_source_type: resource.payment_source_type,- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/post_category_serializer.rb b/spree/core/app/serializers/spree/events/post_category_serializer.rbdeleted file mode 100644index 8dacdcee9b..0000000000--- a/spree/core/app/serializers/spree/events/post_category_serializer.rb+++ /dev/null@@ -1,20 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class PostCategorySerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- title: resource.title,- slug: resource.slug,- store_id: public_id(resource.store),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/post_serializer.rb b/spree/core/app/serializers/spree/events/post_serializer.rbdeleted file mode 100644index 1d5353fc39..0000000000--- a/spree/core/app/serializers/spree/events/post_serializer.rb+++ /dev/null@@ -1,26 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class PostSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- title: resource.title,- slug: resource.slug,- meta_title: resource.meta_title,- meta_description: resource.meta_description,- published_at: timestamp(resource.published_at),- deleted_at: timestamp(resource.deleted_at),- author_id: public_id(resource.author),- post_category_id: public_id(resource.post_category),- store_id: public_id(resource.store),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/price_serializer.rb b/spree/core/app/serializers/spree/events/price_serializer.rbdeleted file mode 100644index 6514e4481f..0000000000--- a/spree/core/app/serializers/spree/events/price_serializer.rb+++ /dev/null@@ -1,22 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class PriceSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- amount: money(resource.amount),- compare_at_amount: money(resource.compare_at_amount),- currency: resource.currency,- variant_id: public_id(resource.variant),- deleted_at: timestamp(resource.deleted_at),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/product_serializer.rb b/spree/core/app/serializers/spree/events/product_serializer.rbdeleted file mode 100644index fa5408d2ef..0000000000--- a/spree/core/app/serializers/spree/events/product_serializer.rb+++ /dev/null@@ -1,24 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class ProductSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- name: resource.name,- slug: resource.slug,- status: resource.status.to_s,- tax_category_id: public_id(resource.tax_category),- shipping_category_id: public_id(resource.shipping_category),- available_on: timestamp(resource.available_on),- discontinue_on: timestamp(resource.discontinue_on),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/promotion_serializer.rb b/spree/core/app/serializers/spree/events/promotion_serializer.rbdeleted file mode 100644index e14569e8a8..0000000000--- a/spree/core/app/serializers/spree/events/promotion_serializer.rb+++ /dev/null@@ -1,32 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class PromotionSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- name: resource.name,- description: resource.description,- code: resource.code,- type: resource.type,- kind: resource.kind,- path: resource.path,- match_policy: resource.match_policy,- usage_limit: resource.usage_limit,- advertise: resource.advertise,- multi_codes: resource.multi_codes,- code_prefix: resource.code_prefix,- number_of_codes: resource.number_of_codes,- starts_at: timestamp(resource.starts_at),- expires_at: timestamp(resource.expires_at),- promotion_category_id: public_id(resource.promotion_category),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/refund_serializer.rb b/spree/core/app/serializers/spree/events/refund_serializer.rbdeleted file mode 100644index 90aa62e258..0000000000--- a/spree/core/app/serializers/spree/events/refund_serializer.rb+++ /dev/null@@ -1,23 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class RefundSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- amount: money(resource.amount),- transaction_id: resource.transaction_id,- payment_id: public_id(resource.payment),- refund_reason_id: public_id(resource.reason),- reimbursement_id: public_id(resource.reimbursement),- refunder_id: public_id(resource.refunder),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/reimbursement_serializer.rb b/spree/core/app/serializers/spree/events/reimbursement_serializer.rbdeleted file mode 100644index fadf354f9a..0000000000--- a/spree/core/app/serializers/spree/events/reimbursement_serializer.rb+++ /dev/null@@ -1,22 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class ReimbursementSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- number: resource.number,- reimbursement_status: resource.reimbursement_status,- total: money(resource.total),- order_id: public_id(resource.order),- customer_return_id: public_id(resource.customer_return),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/report_serializer.rb b/spree/core/app/serializers/spree/events/report_serializer.rbdeleted file mode 100644index 4b14fb82f1..0000000000--- a/spree/core/app/serializers/spree/events/report_serializer.rb+++ /dev/null@@ -1,23 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class ReportSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- type: resource.type,- store_id: public_id(resource.store),- user_id: public_id(resource.user),- currency: resource.currency,- date_from: timestamp(resource.date_from),- date_to: timestamp(resource.date_to),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/return_authorization_serializer.rb b/spree/core/app/serializers/spree/events/return_authorization_serializer.rbdeleted file mode 100644index ff932c5fa0..0000000000--- a/spree/core/app/serializers/spree/events/return_authorization_serializer.rb+++ /dev/null@@ -1,22 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class ReturnAuthorizationSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- number: resource.number,- state: resource.state.to_s,- order_id: public_id(resource.order),- stock_location_id: public_id(resource.stock_location),- return_authorization_reason_id: public_id(resource.reason),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/return_item_serializer.rb b/spree/core/app/serializers/spree/events/return_item_serializer.rbdeleted file mode 100644index 6377fdcf98..0000000000--- a/spree/core/app/serializers/spree/events/return_item_serializer.rb+++ /dev/null@@ -1,27 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class ReturnItemSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- reception_status: resource.reception_status,- acceptance_status: resource.acceptance_status,- pre_tax_amount: money(resource.pre_tax_amount),- included_tax_total: money(resource.included_tax_total),- additional_tax_total: money(resource.additional_tax_total),- inventory_unit_id: public_id(resource.inventory_unit),- return_authorization_id: public_id(resource.return_authorization),- customer_return_id: public_id(resource.customer_return),- reimbursement_id: public_id(resource.reimbursement),- exchange_variant_id: public_id(resource.exchange_variant),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/shipment_serializer.rb b/spree/core/app/serializers/spree/events/shipment_serializer.rbdeleted file mode 100644index e4c788da0d..0000000000--- a/spree/core/app/serializers/spree/events/shipment_serializer.rb+++ /dev/null@@ -1,24 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class ShipmentSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- number: resource.number,- state: resource.state.to_s,- tracking: resource.tracking,- cost: money(resource.cost),- order_id: public_id(resource.order),- stock_location_id: public_id(resource.stock_location),- shipped_at: timestamp(resource.shipped_at),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/stock_item_serializer.rb b/spree/core/app/serializers/spree/events/stock_item_serializer.rbdeleted file mode 100644index 6d6d500214..0000000000--- a/spree/core/app/serializers/spree/events/stock_item_serializer.rb+++ /dev/null@@ -1,22 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class StockItemSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- count_on_hand: resource.count_on_hand,- backorderable: resource.backorderable,- stock_location_id: public_id(resource.stock_location),- variant_id: public_id(resource.variant),- deleted_at: timestamp(resource.deleted_at),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/stock_movement_serializer.rb b/spree/core/app/serializers/spree/events/stock_movement_serializer.rbdeleted file mode 100644index e305892571..0000000000--- a/spree/core/app/serializers/spree/events/stock_movement_serializer.rb+++ /dev/null@@ -1,22 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class StockMovementSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- quantity: resource.quantity,- action: resource.action,- originator_type: resource.originator_type,- originator_id: public_id(resource.originator),- stock_item_id: public_id(resource.stock_item),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/stock_transfer_serializer.rb b/spree/core/app/serializers/spree/events/stock_transfer_serializer.rbdeleted file mode 100644index 6f8dc60673..0000000000--- a/spree/core/app/serializers/spree/events/stock_transfer_serializer.rb+++ /dev/null@@ -1,22 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class StockTransferSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- number: resource.number,- type: resource.type,- reference: resource.reference,- source_location_id: public_id(resource.source_location),- destination_location_id: public_id(resource.destination_location),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/store_credit_serializer.rb b/spree/core/app/serializers/spree/events/store_credit_serializer.rbdeleted file mode 100644index 86c64a5263..0000000000--- a/spree/core/app/serializers/spree/events/store_credit_serializer.rb+++ /dev/null@@ -1,30 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class StoreCreditSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- amount: money(resource.amount),- amount_used: money(resource.amount_used),- amount_authorized: money(resource.amount_authorized),- currency: resource.currency,- memo: resource.memo,- user_id: public_id(resource.user),- category_id: public_id(resource.category),- type_id: public_id(resource.credit_type),- store_id: public_id(resource.store),- created_by_id: public_id(resource.created_by),- originator_type: resource.originator_type,- originator_id: public_id(resource.originator),- deleted_at: timestamp(resource.deleted_at),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/user_serializer.rb b/spree/core/app/serializers/spree/events/user_serializer.rbdeleted file mode 100644index 70547cb0f6..0000000000--- a/spree/core/app/serializers/spree/events/user_serializer.rb+++ /dev/null@@ -1,18 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class UserSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- email: resource.email,- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/variant_serializer.rb b/spree/core/app/serializers/spree/events/variant_serializer.rbdeleted file mode 100644index 284ce8b9b2..0000000000--- a/spree/core/app/serializers/spree/events/variant_serializer.rb+++ /dev/null@@ -1,34 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class VariantSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- sku: resource.sku,- barcode: resource.barcode,- is_master: resource.is_master,- position: resource.position,- weight: money(resource.weight),- height: money(resource.height),- width: money(resource.width),- depth: money(resource.depth),- weight_unit: resource.weight_unit,- dimensions_unit: resource.dimensions_unit,- cost_price: money(resource.cost_price),- cost_currency: resource.cost_currency,- track_inventory: resource.track_inventory,- product_id: public_id(resource.product),- tax_category_id: public_id(resource.tax_category),- discontinue_on: timestamp(resource.discontinue_on),- deleted_at: timestamp(resource.deleted_at),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/wished_item_serializer.rb b/spree/core/app/serializers/spree/events/wished_item_serializer.rbdeleted file mode 100644index 0ae3ec4086..0000000000--- a/spree/core/app/serializers/spree/events/wished_item_serializer.rb+++ /dev/null@@ -1,20 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class WishedItemSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- quantity: resource.quantity,- variant_id: public_id(resource.variant),- wishlist_id: public_id(resource.wishlist),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/app/serializers/spree/events/wishlist_serializer.rb b/spree/core/app/serializers/spree/events/wishlist_serializer.rbdeleted file mode 100644index 382845775e..0000000000--- a/spree/core/app/serializers/spree/events/wishlist_serializer.rb+++ /dev/null@@ -1,22 +0,0 @@-# frozen_string_literal: true--module Spree- module Events- class WishlistSerializer < BaseSerializer- protected-- def attributes- {- id: public_id(resource),- name: resource.name,- is_private: resource.is_private,- is_default: resource.is_default,- user_id: public_id(resource.user),- store_id: public_id(resource.store),- created_at: timestamp(resource.created_at),- updated_at: timestamp(resource.updated_at)- }- end- end- end-enddiff --git a/spree/core/lib/spree/core.rb b/spree/core/lib/spree/core.rbindex 59559e14b3..deb77dc942 100644--- a/spree/core/lib/spree/core.rb+++ b/spree/core/lib/spree/core.rb@@ -26,7 +26,6 @@ require 'paranoia'require 'ransack'require 'state_machines-activerecord'require 'active_storage_validations'-require 'request_store'require 'wannabe_bool'require 'geocoder'require 'oembed'diff --git a/spree/core/lib/spree/events.rb b/spree/core/lib/spree/events.rbindex d4a2ae95e1..7bbc6b8a32 100644--- a/spree/core/lib/spree/events.rb+++ b/spree/core/lib/spree/events.rb@@ -177,10 +177,11 @@ module Spree# Check if events are enabled## Events can be temporarily disabled using Spree::Events.disable { ... }+ # or globally with Spree::Events.disable!## @return [Boolean]def enabled?- !RequestStore.store[:spree_events_disabled]+ !@globally_disabled && !Thread.current[:spree_events_disabled]end# Temporarily disable events within a block@@ -195,18 +196,21 @@ module Spree# end#def disable- previous = RequestStore.store[:spree_events_disabled]- RequestStore.store[:spree_events_disabled] = true+ previous = Thread.current[:spree_events_disabled]+ Thread.current[:spree_events_disabled] = trueyieldensure- RequestStore.store[:spree_events_disabled] = previous+ Thread.current[:spree_events_disabled] = previousend# Globally disable events- # Useful for testing to disable events for the entire test suite+ #+ # Uses a class-level flag that is not affected by per-request cleanup.+ # Useful for disabling events for the entire test suite.+ ## @return [void]def disable!- RequestStore.store[:spree_events_disabled] = true+ @globally_disabled = trueend# Temporarily enable events within a block@@ -222,18 +226,21 @@ module Spree# end#def enable- previous = RequestStore.store[:spree_events_disabled]- RequestStore.store[:spree_events_disabled] = false+ previous_global = @globally_disabled+ previous_thread = Thread.current[:spree_events_disabled]+ @globally_disabled = false+ Thread.current[:spree_events_disabled] = falseyieldensure- RequestStore.store[:spree_events_disabled] = previous+ @globally_disabled = previous_global+ Thread.current[:spree_events_disabled] = previous_threadend# Globally enable events# Useful for testing# @return [void]def enable!- RequestStore.store[:spree_events_disabled] = false+ @globally_disabled = falseendendenddiff --git a/spree/core/lib/spree/webhooks.rb b/spree/core/lib/spree/webhooks.rbindex 21f163c9c5..4f1acc074a 100644--- a/spree/core/lib/spree/webhooks.rb+++ b/spree/core/lib/spree/webhooks.rb@@ -3,20 +3,20 @@ module Spreedef self.disable_webhooksSpree::Deprecation.warn('Spree::Webhooks.disable_webhooks is deprecated and will be removed in Spree 5.5. Use Spree::LegacyWebhooks.disable_webhooks instead.')prev_value = disabled?- RequestStore.store[:disable_spree_legacy_webhooks] = true+ Thread.current[:disable_spree_legacy_webhooks] = trueyieldensure- RequestStore.store[:disable_spree_legacy_webhooks] = prev_value+ Thread.current[:disable_spree_legacy_webhooks] = prev_valueenddef self.disabled?Spree::Deprecation.warn('Spree::Webhooks.disabled? is deprecated and will be removed in Spree 5.5. Use Spree::LegacyWebhooks.disabled? instead.')- RequestStore.fetch(:disable_spree_legacy_webhooks) { false }+ !!Thread.current[:disable_spree_legacy_webhooks]enddef self.disabled=(value)Spree::Deprecation.warn('Spree::Webhooks.disabled= is deprecated and will be removed in Spree 5.5. Use Spree::LegacyWebhooks.disabled= instead.')- RequestStore.store[:disable_spree_legacy_webhooks] = value+ Thread.current[:disable_spree_legacy_webhooks] = valueendendenddiff --git a/spree/core/spec/models/concerns/spree/publishable_spec.rb b/spree/core/spec/models/concerns/spree/publishable_spec.rbindex 1bda60bc50..1465058b54 100644--- a/spree/core/spec/models/concerns/spree/publishable_spec.rb+++ b/spree/core/spec/models/concerns/spree/publishable_spec.rb@@ -11,17 +11,15 @@ RSpec.describe Spree::Publishable, events: true doSpree::Events.reset!end- # Define a test serializer for the spec- let(:test_serializer_class) do- Class.new(Spree::Events::BaseSerializer) do- protected+ let(:v3_serializer_class) do+ Class.new do+ def initialize(resource, params: {})+ @resource = resource+ @params = params+ end- def attributes- {- id: resource.id,- name: resource.name,- updated_at: timestamp(resource.updated_at)- }+ def to_h+ { 'id' => 'test_prefix_1', 'name' => @resource.name }endendend@@ -39,7 +37,7 @@ RSpec.describe Spree::Publishable, events: true dodescribe '#publish_event' dobefore dostub_const('Spree::TestProduct', publishable_class)- stub_const('Spree::Events::TestProductSerializer', test_serializer_class)+ stub_const('Spree::Api::V3::TestProductSerializer', v3_serializer_class)endit 'publishes an event with the model payload' do@@ -51,7 +49,7 @@ RSpec.describe Spree::Publishable, events: true doexpect(received_event).to be_presentexpect(received_event.name).to eq('test_product.custom')- expect(received_event.payload['id']).to eq(1)+ expect(received_event.payload['id']).to eq('test_prefix_1')expect(received_event.payload['name']).to eq('Test Product')end@@ -79,54 +77,106 @@ RSpec.describe Spree::Publishable, events: true doenddescribe '#event_payload' do- context 'with a serializer defined' do+ context 'when a V3 serializer exists' dobefore dostub_const('Spree::TestProduct', publishable_class)- stub_const('Spree::Events::TestProductSerializer', test_serializer_class)+ stub_const('Spree::Api::V3::TestProductSerializer', v3_serializer_class)end- it 'returns the serialized payload' do+ it 'uses the V3 serializer' dopayload = instance.event_payload- expect(payload[:id]).to eq(1)- expect(payload[:name]).to eq('Test Product')- expect(payload[:updated_at]).to be_present+ expect(payload).to eq({ 'id' => 'test_prefix_1', 'name' => 'Test Product' })+ end+ end++ context 'when no serializer exists' do+ before do+ stub_const('Spree::NoSerializer', publishable_class)+ end++ it 'returns minimal fallback payload with id, created_at, updated_at' do+ now = Time.current+ instance = publishable_class.new(id: 1, name: 'Test', created_at: now, updated_at: now)++ payload = instance.event_payload++ expect(payload[:id]).to be_a(String)+ expect(payload[:id]).to be_present+ expect(payload[:created_at]).to eq(now.iso8601)+ expect(payload[:updated_at]).to eq(now.iso8601)+ expect(payload).not_to have_key(:name)+ end+ end+ end++ describe '#event_serializer_class' do+ context 'when V3 serializer exists by convention' do+ before do+ stub_const('Spree::TestProduct', publishable_class)+ stub_const('Spree::Api::V3::TestProductSerializer', v3_serializer_class)+ end++ it 'returns the serializer class' do+ expect(instance.event_serializer_class).to eq(v3_serializer_class)endend- context 'without a serializer defined' do- let(:no_serializer_class) do+ context 'when no V3 serializer exists' do+ before do+ stub_const('Spree::NoSerializer', publishable_class)+ end++ it 'returns nil' do+ expect(instance.event_serializer_class).to be_nil+ end+ end++ context 'with STI hierarchy walking' do+ let(:parent_class) doClass.new(Spree::Base) doself.table_name = 'spree_products'include Spree::Publishableendend- before do- stub_const('Spree::NoSerializer', no_serializer_class)+ let(:child_class) do+ Class.new(parent_class) do+ self.table_name = 'spree_products'+ end+ end++ it 'resolves via parent class when child has no serializer' do+ stub_const('Spree::ParentModel', parent_class)+ stub_const('Spree::ChildModel', child_class)+ stub_const('Spree::Api::V3::ParentModelSerializer', v3_serializer_class)++ instance = child_class.new(id: 1)+ expect(instance.event_serializer_class).to eq(v3_serializer_class)end+ end- it 'raises MissingSerializerError with helpful message' do- instance = no_serializer_class.new(id: 1, name: 'Test')+ context 'with model override' do+ let(:override_class) do+ serializer = v3_serializer_class+ Class.new(Spree::Base) do+ self.table_name = 'spree_products'+ include Spree::Publishable- expect { instance.event_payload }.to raise_error(- Spree::Publishable::MissingSerializerError,- /Missing event serializer for Spree::NoSerializer/- )+ define_method(:event_serializer_class) { serializer }+ endend- it 'includes example code in the error message' do- instance = no_serializer_class.new(id: 1, name: 'Test')+ it 'uses the overridden serializer' do+ stub_const('Spree::CustomModel', override_class)+ instance = override_class.new(id: 1)- expect { instance.event_payload }.to raise_error(- Spree::Publishable::MissingSerializerError,- /class Spree::Events::NoSerializerSerializer < Spree::Events::BaseSerializer/- )+ expect(instance.event_serializer_class).to eq(v3_serializer_class)endendcontext 'with anonymous class' do- it 'returns nil for event_serializer_class' do+ it 'returns nil' doanon_class = Class.new(Spree::Base) doself.table_name = 'spree_products'include Spree::Publishable@@ -138,10 +188,45 @@ RSpec.describe Spree::Publishable, events: true doendend+ describe '#event_serializer_params' do+ before do+ stub_const('Spree::TestProduct', publishable_class)+ end++ it 'returns a hash with required keys' do+ params = instance.send(:event_serializer_params)++ expect(params).to include(:store, :currency, :user, :locale, :includes)+ expect(params[:user]).to be_nil+ expect(params[:locale]).to be_nil+ expect(params[:includes]).to eq([])+ end++ context 'when resource has a store method' do+ let(:store) { build(:store) }++ it 'uses the resource store' do+ allow(instance).to receive(:store).and_return(store)+ params = instance.send(:event_serializer_params)++ expect(params[:store]).to eq(store)+ end+ end++ context 'when resource does not have a store method' do+ it 'falls back to Spree::Current.store' do+ current_store = build(:store)+ allow(Spree::Current).to receive(:store).and_return(current_store)+ params = instance.send(:event_serializer_params)++ expect(params[:store]).to eq(current_store)+ end+ end+ end+describe '#event_prefix' dobefore dostub_const('Spree::Product', publishable_class)- stub_const('Spree::Events::ProductSerializer', test_serializer_class)endit 'returns the model name element' do@@ -163,24 +248,12 @@ RSpec.describe Spree::Publishable, events: true dobefore dostub_const('Spree::TestProduct', lifecycle_class)- stub_const('Spree::Events::TestProductSerializer', test_serializer_class)endit 'enables lifecycle events' doexpect(lifecycle_class.lifecycle_events_enabled).to be trueend- it 'publishes create event after commit', skip: 'Requires database transaction' do- received_event = nil- Spree::Events.subscribe('test_product.create', async: false) { |e| received_event = e }- Spree::Events.activate!-- product = lifecycle_class.create!(name: 'New Product')-- expect(received_event).to be_present- expect(received_event.name).to eq('test_product.create')- end-# Note: These specs use ApplicationRecord directly to test Publishable in isolation# since Spree::Base now has lifecycle events enabled by defaultcontext 'with only option' do@@ -234,7 +307,6 @@ RSpec.describe Spree::Publishable, events: true dodescribe '.event_prefix' dobefore dostub_const('Spree::OrderLineItem', publishable_class)- stub_const('Spree::Events::OrderLineItemSerializer', test_serializer_class)endit 'derives from model name' do@@ -243,7 +315,6 @@ RSpec.describe Spree::Publishable, events: true doit 'can be customized' dostub_const('Spree::CustomModel', publishable_class)- stub_const('Spree::Events::CustomModelSerializer', test_serializer_class)Spree::CustomModel.event_prefix = 'custom'expect(Spree::CustomModel.event_prefix).to eq('custom')enddiff --git a/spree/core/spec/models/spree/export_spec.rb b/spree/core/spec/models/spree/export_spec.rbindex eef15ae2d5..d902c5341d 100644--- a/spree/core/spec/models/spree/export_spec.rb+++ b/spree/core/spec/models/spree/export_spec.rb@@ -9,12 +9,6 @@ RSpec.describe Spree::Export, :job, type: :model dolet(:search_params) { nil }let(:export) { build(:product_export, store: store, user: user, format: 'csv', search_params: search_params) }- describe '#event_serializer_class' do- it 'returns the correct event serializer class' do- expect(export.event_serializer_class).to eq(Spree::Events::ExportSerializer)- end- end-describe '#model_class' doit 'returns the correct record class' doexpect(export.model_class).to eq(Spree::Product)diff --git a/spree/core/spec/models/spree/import_spec.rb b/spree/core/spec/models/spree/import_spec.rbindex dd021f08b2..db3fd18d35 100644--- a/spree/core/spec/models/spree/import_spec.rb+++ b/spree/core/spec/models/spree/import_spec.rb@@ -383,12 +383,6 @@ RSpec.describe Spree::Import, :job, type: :model doendend- describe '#event_serializer_class' do- it 'returns the correct event serializer class' do- expect(import.event_serializer_class).to eq(Spree::Events::ImportSerializer)- end- end-describe 'custom events', :events dodescribe 'import.completed' dobefore dodiff --git a/spree/core/spec/models/spree/report_spec.rb b/spree/core/spec/models/spree/report_spec.rbindex 914b76a211..aad399461f 100644--- a/spree/core/spec/models/spree/report_spec.rb+++ b/spree/core/spec/models/spree/report_spec.rb@@ -22,12 +22,6 @@ RSpec.describe Spree::Report, type: :model doendend- describe '#event_serializer_class' do- it 'returns the correct serializer class' do- expect(report.event_serializer_class).to eq(Spree::Events::ReportSerializer)- end- end-describe '#generate' dobefore { report.save! }diff --git a/spree/core/spec/models/spree/user_spec.rb b/spree/core/spec/models/spree/user_spec.rbindex 59b603a5de..1d1cf96104 100644--- a/spree/core/spec/models/spree/user_spec.rb+++ b/spree/core/spec/models/spree/user_spec.rb@@ -3,12 +3,6 @@ require 'spec_helper'describe Spree::LegacyUser, type: :model do # rubocop:disable RSpec/MultipleDescribesit_behaves_like 'lifecycle events', factory: :user, event_prefix: 'user'- describe '#event_serializer_class' do- subject { build(:user).event_serializer_class }-- it { is_expected.to eq(Spree::Events::UserSerializer) }- end-describe '#can_be_deleted?' dosubject { user.can_be_deleted? }diff --git a/spree/core/spec/serializers/spree/events/asset_serializer_spec.rb b/spree/core/spec/serializers/spree/events/asset_serializer_spec.rbdeleted file mode 100644index 9a280a92c1..0000000000--- a/spree/core/spec/serializers/spree/events/asset_serializer_spec.rb+++ /dev/null@@ -1,36 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::AssetSerializer do- subject { described_class.serialize(asset) }-- let(:product) { create(:product) }- let(:variant) { product.master }- let(:asset) { create(:image, viewable: variant) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(asset.prefixed_id)- expect(subject[:type]).to eq(asset.type)- end-- it 'includes viewable polymorphic reference' do- expect(subject[:viewable_type]).to eq('Spree::Variant')- expect(subject[:viewable_id]).to eq(variant.prefixed_id)- end-- it 'includes position' do- expect(subject).to have_key(:position)- end-- it 'includes alt text' do- expect(subject).to have_key(:alt)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/base_serializer_spec.rb b/spree/core/spec/serializers/spree/events/base_serializer_spec.rbdeleted file mode 100644index d655acc48f..0000000000--- a/spree/core/spec/serializers/spree/events/base_serializer_spec.rb+++ /dev/null@@ -1,86 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::BaseSerializer do- let(:test_class) do- Class.new(described_class) do- protected-- def attributes- {- id: resource.id,- name: resource.name,- created_at: timestamp(resource.created_at)- }- end- end- end-- let(:resource) { Spree::Product.new(id: 1, name: 'Test Product', created_at: Time.zone.parse('2024-01-15 10:30:00')) }- let(:context) { { event_name: 'product.test' } }- let(:serializer) { test_class.new(resource, context) }-- describe '#as_json' do- subject { serializer.as_json }-- it 'returns a hash with attributes' do- expect(subject).to be_a(Hash)- expect(subject[:id]).to eq(1)- expect(subject[:name]).to eq('Test Product')- end-- it 'formats timestamps as ISO8601' do- expect(subject[:created_at]).to eq('2024-01-15T10:30:00Z')- end- end-- describe '.serialize' do- it 'creates an instance and calls as_json' do- result = test_class.serialize(resource, context)- expect(result).to be_a(Hash)- expect(result[:id]).to eq(1)- end- end-- describe '#timestamp' do- it 'returns nil for nil values' do- expect(serializer.send(:timestamp, nil)).to be_nil- end-- it 'returns ISO8601 formatted string' do- time = Time.zone.parse('2024-06-15 14:30:00')- expect(serializer.send(:timestamp, time)).to eq('2024-06-15T14:30:00Z')- end- end-- describe '#money' do- it 'returns nil for nil values' do- expect(serializer.send(:money, nil)).to be_nil- end-- it 'returns decimal value for numbers' do- expect(serializer.send(:money, 10.50)).to eq(10.50)- end-- it 'returns decimal value for BigDecimal' do- expect(serializer.send(:money, BigDecimal('99.99'))).to eq(BigDecimal('99.99'))- end- end-- describe '#event_name' do- it 'returns the event name from context' do- expect(serializer.send(:event_name)).to eq('product.test')- end- end-- describe '#attribute' do- it 'returns the attribute value if it exists' do- expect(serializer.send(:attribute, :name)).to eq('Test Product')- end-- it 'returns nil if the attribute does not exist' do- expect(serializer.send(:attribute, :nonexistent)).to be_nil- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/customer_return_serializer_spec.rb b/spree/core/spec/serializers/spree/events/customer_return_serializer_spec.rbdeleted file mode 100644index c44e232bc6..0000000000--- a/spree/core/spec/serializers/spree/events/customer_return_serializer_spec.rb+++ /dev/null@@ -1,26 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::CustomerReturnSerializer do- let(:customer_return) { create(:customer_return) }-- subject { described_class.serialize(customer_return) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(customer_return.prefixed_id)- expect(subject[:number]).to eq(customer_return.number)- end-- it 'includes foreign keys' do- expect(subject[:stock_location_id]).to eq(customer_return.stock_location&.prefixed_id)- expect(subject).to have_key(:store_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/digital_link_serializer_spec.rb b/spree/core/spec/serializers/spree/events/digital_link_serializer_spec.rbdeleted file mode 100644index 4bc0536172..0000000000--- a/spree/core/spec/serializers/spree/events/digital_link_serializer_spec.rb+++ /dev/null@@ -1,29 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::DigitalLinkSerializer do- let(:digital_link) { create(:digital_link) }-- subject { described_class.serialize(digital_link) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(digital_link.prefixed_id)- end-- it 'includes foreign keys' do- expect(subject[:digital_id]).to eq(digital_link.digital&.prefixed_id)- expect(subject[:line_item_id]).to eq(digital_link.line_item&.prefixed_id)- end-- it 'includes access_counter' do- expect(subject).to have_key(:access_counter)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/digital_serializer_spec.rb b/spree/core/spec/serializers/spree/events/digital_serializer_spec.rbdeleted file mode 100644index 3069d84893..0000000000--- a/spree/core/spec/serializers/spree/events/digital_serializer_spec.rb+++ /dev/null@@ -1,25 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::DigitalSerializer do- let(:variant) { create(:variant) }- let(:digital) { create(:digital, variant: variant) }-- subject { described_class.serialize(digital) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(digital.prefixed_id)- end-- it 'includes variant_id' do- expect(subject[:variant_id]).to eq(variant.prefixed_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/export_serializer_spec.rb b/spree/core/spec/serializers/spree/events/export_serializer_spec.rbdeleted file mode 100644index c58740f6e4..0000000000--- a/spree/core/spec/serializers/spree/events/export_serializer_spec.rb+++ /dev/null@@ -1,36 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::ExportSerializer do- let(:store) { @default_store }- let(:admin_user) { create(:admin_user) }- let(:export) { create(:export, store: store, user: admin_user) }-- subject { described_class.serialize(export) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(export.prefixed_id)- expect(subject[:number]).to eq(export.number)- end-- it 'includes type' do- expect(subject[:type]).to be_present- end-- it 'includes format' do- expect(subject).to have_key(:format)- end-- it 'includes foreign keys' do- expect(subject[:user_id]).to eq(admin_user.prefixed_id)- expect(subject[:store_id]).to eq(store.prefixed_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/gift_card_batch_serializer_spec.rb b/spree/core/spec/serializers/spree/events/gift_card_batch_serializer_spec.rbdeleted file mode 100644index 9d1c216932..0000000000--- a/spree/core/spec/serializers/spree/events/gift_card_batch_serializer_spec.rb+++ /dev/null@@ -1,52 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::GiftCardBatchSerializer do- let(:store) { @default_store }- let(:admin_user) { create(:admin_user) }- let(:gift_card_batch) do- create(:gift_card_batch,- store: store,- created_by: admin_user,- amount: 50.00,- currency: 'USD',- codes_count: 10,- prefix: 'GIFT')- end-- subject { described_class.serialize(gift_card_batch) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(gift_card_batch.prefixed_id)- end-- it 'includes codes_count' do- expect(subject[:codes_count]).to eq(10)- end-- it 'includes amount fields' do- expect(subject[:amount]).to eq(50.00)- expect(subject[:currency]).to eq('USD')- end-- it 'includes prefix' do- expect(subject).to have_key(:prefix)- end-- it 'includes expires_at' do- expect(subject).to have_key(:expires_at)- end-- it 'includes foreign keys' do- expect(subject[:store_id]).to eq(store.prefixed_id)- expect(subject[:created_by_id]).to eq(admin_user.prefixed_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/gift_card_serializer_spec.rb b/spree/core/spec/serializers/spree/events/gift_card_serializer_spec.rbdeleted file mode 100644index 8d7d381543..0000000000--- a/spree/core/spec/serializers/spree/events/gift_card_serializer_spec.rb+++ /dev/null@@ -1,55 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::GiftCardSerializer do- let(:store) { @default_store }- let(:gift_card) do- create(:gift_card,- store: store,- amount: 100.00,- amount_used: 25.00,- currency: 'USD',- expires_at: Date.parse('2025-12-31'))- end-- subject { described_class.serialize(gift_card) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(gift_card.prefixed_id)- expect(subject[:code]).to eq(gift_card.code)- end-- it 'includes state as string' do- expect(subject[:state]).to be_a(String)- end-- it 'includes amount fields' do- expect(subject[:amount]).to eq(100.00)- expect(subject[:amount_used]).to eq(25.00)- expect(subject[:amount_authorized]).to be_present- expect(subject[:amount_remaining]).to eq(75.00)- end-- it 'includes currency' do- expect(subject[:currency]).to eq('USD')- end-- it 'includes foreign keys' do- expect(subject[:store_id]).to eq(store.prefixed_id)- expect(subject).to have_key(:user_id)- expect(subject).to have_key(:gift_card_batch_id)- end-- it 'includes dates' do- expect(subject[:expires_at]).to eq('2025-12-31')- expect(subject).to have_key(:redeemed_at)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/import_row_serializer_spec.rb b/spree/core/spec/serializers/spree/events/import_row_serializer_spec.rbdeleted file mode 100644index 8c4295f50d..0000000000--- a/spree/core/spec/serializers/spree/events/import_row_serializer_spec.rb+++ /dev/null@@ -1,69 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::ImportRowSerializer do- subject { described_class.serialize(import_row) }-- let(:store) { @default_store }- let(:user) { create(:admin_user) }- let(:import) { create(:import, owner: store, user: user) }- let(:product) { create(:product) }- let(:import_row) do- create(:import_row,- import: import,- row_number: 1,- status: 'completed',- item: product,- validation_errors: nil- )- end-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(import_row.prefixed_id)- end-- it 'includes import reference' do- expect(subject[:import_id]).to eq(import.prefixed_id)- end-- it 'includes row_number' do- expect(subject[:row_number]).to eq(1)- end-- it 'includes status' do- expect(subject[:status]).to eq('completed')- end-- it 'includes validation_errors' do- expect(subject).to have_key(:validation_errors)- end-- it 'includes item polymorphic reference' do- expect(subject[:item_type]).to eq('Spree::Product')- expect(subject[:item_id]).to eq(product.prefixed_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end-- context 'with validation errors' do- let(:import_row) do- create(:import_row,- import: import,- row_number: 2,- status: 'failed',- validation_errors: 'Name is required'- )- end-- it 'includes validation error message' do- expect(subject[:validation_errors]).to eq('Name is required')- expect(subject[:status]).to eq('failed')- end- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/import_serializer_spec.rb b/spree/core/spec/serializers/spree/events/import_serializer_spec.rbdeleted file mode 100644index b6d5a82d92..0000000000--- a/spree/core/spec/serializers/spree/events/import_serializer_spec.rb+++ /dev/null@@ -1,44 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::ImportSerializer do- let(:store) { @default_store }- let(:admin_user) { create(:admin_user) }- let(:import) { create(:import, owner: store, user: admin_user) }-- subject { described_class.serialize(import) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(import.prefixed_id)- expect(subject[:number]).to eq(import.number)- end-- it 'includes type' do- expect(subject[:type]).to be_present- end-- it 'includes status as string' do- expect(subject[:status]).to be_a(String)- end-- it 'includes owner polymorphic reference' do- expect(subject[:owner_type]).to eq('Spree::Store')- expect(subject[:owner_id]).to eq(store.prefixed_id)- end-- it 'includes user_id' do- expect(subject[:user_id]).to eq(admin_user.prefixed_id)- end-- it 'includes rows_count' do- expect(subject).to have_key(:rows_count)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/invitation_serializer_spec.rb b/spree/core/spec/serializers/spree/events/invitation_serializer_spec.rbdeleted file mode 100644index 40c9dedd30..0000000000--- a/spree/core/spec/serializers/spree/events/invitation_serializer_spec.rb+++ /dev/null@@ -1,49 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::InvitationSerializer do- let(:invitation) { create(:invitation) }-- subject { described_class.serialize(invitation) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(invitation.prefixed_id)- expect(subject[:email]).to eq(invitation.email)- end-- it 'includes status as string' do- expect(subject[:status]).to be_a(String)- end-- it 'includes resource polymorphic reference' do- expect(subject[:resource_type]).to eq(invitation.resource_type)- expect(subject[:resource_id]).to eq(invitation.resource&.prefixed_id)- end-- it 'includes inviter polymorphic reference' do- expect(subject[:inviter_type]).to eq(invitation.inviter_type)- expect(subject[:inviter_id]).to eq(invitation.inviter&.prefixed_id)- end-- it 'includes invitee polymorphic reference' do- expect(subject).to have_key(:invitee_type)- expect(subject).to have_key(:invitee_id)- end-- it 'includes role_id' do- expect(subject[:role_id]).to eq(invitation.role&.prefixed_id)- end-- it 'includes dates' do- expect(subject).to have_key(:expires_at)- expect(subject).to have_key(:accepted_at)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/line_item_serializer_spec.rb b/spree/core/spec/serializers/spree/events/line_item_serializer_spec.rbdeleted file mode 100644index dcf5ac3770..0000000000--- a/spree/core/spec/serializers/spree/events/line_item_serializer_spec.rb+++ /dev/null@@ -1,47 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::LineItemSerializer do- let(:order) { create(:order_with_line_items, line_items_count: 1) }- let(:line_item) { order.line_items.first }-- subject { described_class.serialize(line_item) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(line_item.prefixed_id)- end-- it 'includes quantity' do- expect(subject[:quantity]).to eq(line_item.quantity)- end-- it 'includes price fields' do- expect(subject[:price]).to be_present- expect(subject[:currency]).to eq(line_item.currency)- expect(subject).to have_key(:cost_price)- end-- it 'includes adjustment totals' do- expect(subject).to have_key(:adjustment_total)- expect(subject).to have_key(:additional_tax_total)- expect(subject).to have_key(:promo_total)- expect(subject).to have_key(:included_tax_total)- expect(subject).to have_key(:pre_tax_amount)- expect(subject).to have_key(:taxable_adjustment_total)- expect(subject).to have_key(:non_taxable_adjustment_total)- end-- it 'includes foreign keys' do- expect(subject[:variant_id]).to eq(line_item.variant&.prefixed_id)- expect(subject[:order_id]).to eq(order.prefixed_id)- expect(subject).to have_key(:tax_category_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/newsletter_subscriber_serializer_spec.rb b/spree/core/spec/serializers/spree/events/newsletter_subscriber_serializer_spec.rbdeleted file mode 100644index 56b41f43fa..0000000000--- a/spree/core/spec/serializers/spree/events/newsletter_subscriber_serializer_spec.rb+++ /dev/null@@ -1,43 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::NewsletterSubscriberSerializer do- let(:subscriber) do- create(:newsletter_subscriber,- email: '[email protected]',- verified_at: Time.zone.parse('2024-01-15 10:30:00'))- end-- subject { described_class.serialize(subscriber) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(subscriber.prefixed_id)- expect(subject[:email]).to eq('[email protected]')- end-- it 'includes verified status' do- expect(subject[:verified]).to be true- expect(subject[:verified_at]).to eq('2024-01-15T10:30:00Z')- end-- it 'includes user_id' do- expect(subject).to have_key(:user_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end-- context 'when not verified' do- let(:subscriber) { create(:newsletter_subscriber, verified_at: nil) }-- it 'returns verified as false' do- expect(subject[:verified]).to be false- expect(subject[:verified_at]).to be_nil- end- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/order_serializer_spec.rb b/spree/core/spec/serializers/spree/events/order_serializer_spec.rbdeleted file mode 100644index 3eac6ce3e3..0000000000--- a/spree/core/spec/serializers/spree/events/order_serializer_spec.rb+++ /dev/null@@ -1,67 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::OrderSerializer do- let(:store) { @default_store }- let(:user) { create(:user) }- let(:order) do- create(:completed_order_with_totals,- store: store,- user: user)- end-- subject { described_class.serialize(order) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(order.prefixed_id)- expect(subject[:number]).to eq(order.number)- end-- it 'includes state attributes as strings' do- expect(subject[:state]).to be_a(String)- expect(subject[:payment_state]).to be_a(String)- expect(subject[:shipment_state]).to be_a(String)- end-- it 'includes totals' do- expect(subject[:total]).to be_present- expect(subject[:item_total]).to be_present- expect(subject[:shipment_total]).to be_present- expect(subject[:adjustment_total]).to be_present- expect(subject[:promo_total]).to be_present- end-- it 'includes tax totals' do- expect(subject).to have_key(:included_tax_total)- expect(subject).to have_key(:additional_tax_total)- end-- it 'includes item count and currency' do- expect(subject[:item_count]).to eq(order.item_count)- expect(subject[:currency]).to eq(order.currency)- end-- it 'includes email' do- expect(subject[:email]).to eq(order.email)- end-- it 'includes foreign keys' do- expect(subject[:user_id]).to eq(user.prefixed_id)- expect(subject[:store_id]).to eq(store.prefixed_id)- end-- it 'includes timestamps' do- expect(subject[:completed_at]).to be_present- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end-- it 'does not include associations' do- expect(subject).not_to have_key(:line_items)- expect(subject).not_to have_key(:shipments)- expect(subject).not_to have_key(:payments)- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/payment_serializer_spec.rb b/spree/core/spec/serializers/spree/events/payment_serializer_spec.rbdeleted file mode 100644index 30be50f00f..0000000000--- a/spree/core/spec/serializers/spree/events/payment_serializer_spec.rb+++ /dev/null@@ -1,52 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::PaymentSerializer do- let(:order) { create(:order_with_line_items) }- let(:payment_method) { create(:credit_card_payment_method) }- let(:payment) do- create(:payment,- order: order,- payment_method: payment_method,- amount: 100.00,- state: 'completed')- end-- subject { described_class.serialize(payment) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(payment.prefixed_id)- expect(subject[:number]).to eq(payment.number)- end-- it 'includes state as string' do- expect(subject[:state]).to eq('completed')- end-- it 'includes amount' do- expect(subject[:amount]).to eq(100.00)- end-- it 'includes foreign keys' do- expect(subject[:order_id]).to eq(order.prefixed_id)- expect(subject[:payment_method_id]).to eq(payment_method.prefixed_id)- end-- it 'includes source polymorphic reference' do- expect(subject).to have_key(:source_type)- expect(subject).to have_key(:source_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end-- it 'does not include associations' do- expect(subject).not_to have_key(:refunds)- expect(subject).not_to have_key(:log_entries)- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/payment_session_serializer_spec.rb b/spree/core/spec/serializers/spree/events/payment_session_serializer_spec.rbdeleted file mode 100644index 4616d75287..0000000000--- a/spree/core/spec/serializers/spree/events/payment_session_serializer_spec.rb+++ /dev/null@@ -1,35 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::PaymentSessionSerializer do- let(:store) { @default_store }- let(:order) { create(:order, store: store) }- let(:payment_method) { create(:bogus_payment_method, stores: [store]) }- let(:payment_session) { create(:bogus_payment_session, order: order, payment_method: payment_method, amount: 99.99) }-- subject { described_class.serialize(payment_session) }-- describe '#as_json' do- it 'includes identity and status' do- expect(subject[:id]).to eq(payment_session.prefixed_id)- expect(subject[:status]).to eq('pending')- end-- it 'includes amount fields' do- expect(subject[:amount]).to eq(99.99.to_d)- expect(subject[:currency]).to eq('USD')- end-- it 'includes foreign keys' do- expect(subject[:order_id]).to eq(order.prefixed_id)- expect(subject[:payment_method_id]).to eq(payment_method.prefixed_id)- expect(subject[:external_id]).to be_present- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/post_category_serializer_spec.rb b/spree/core/spec/serializers/spree/events/post_category_serializer_spec.rbdeleted file mode 100644index 6d981660fa..0000000000--- a/spree/core/spec/serializers/spree/events/post_category_serializer_spec.rb+++ /dev/null@@ -1,27 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::PostCategorySerializer do- let(:store) { @default_store }- let(:post_category) { create(:post_category, store: store, title: 'News') }-- subject { described_class.serialize(post_category) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(post_category.prefixed_id)- expect(subject[:title]).to eq('News')- expect(subject[:slug]).to eq(post_category.slug)- end-- it 'includes store_id' do- expect(subject[:store_id]).to eq(store.prefixed_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/post_serializer_spec.rb b/spree/core/spec/serializers/spree/events/post_serializer_spec.rbdeleted file mode 100644index f5cc37bd0f..0000000000--- a/spree/core/spec/serializers/spree/events/post_serializer_spec.rb+++ /dev/null@@ -1,51 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::PostSerializer do- let(:store) { @default_store }- let(:post_category) { create(:post_category, store: store) }- let(:author) { create(:admin_user) }- let(:post) do- create(:post,- store: store,- post_category: post_category,- author: author,- title: 'Test Post',- published_at: Time.current)- end-- subject { described_class.serialize(post) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(post.prefixed_id)- expect(subject[:title]).to eq('Test Post')- expect(subject[:slug]).to eq(post.slug)- end-- it 'includes meta fields' do- expect(subject).to have_key(:meta_title)- expect(subject).to have_key(:meta_description)- end-- it 'includes published_at' do- expect(subject[:published_at]).to be_present- end-- it 'includes deleted_at' do- expect(subject).to have_key(:deleted_at)- end-- it 'includes foreign keys' do- expect(subject[:author_id]).to eq(author.prefixed_id)- expect(subject[:post_category_id]).to eq(post_category.prefixed_id)- expect(subject[:store_id]).to eq(store.prefixed_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/price_serializer_spec.rb b/spree/core/spec/serializers/spree/events/price_serializer_spec.rbdeleted file mode 100644index 980ca5d2cf..0000000000--- a/spree/core/spec/serializers/spree/events/price_serializer_spec.rb+++ /dev/null@@ -1,35 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::PriceSerializer do- let(:variant) { create(:variant) }- let(:price) { variant.prices.first }-- subject { described_class.serialize(price) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(price.prefixed_id)- end-- it 'includes amount fields' do- expect(subject[:amount]).to be_present- expect(subject).to have_key(:compare_at_amount)- expect(subject[:currency]).to eq(price.currency)- end-- it 'includes variant_id' do- expect(subject[:variant_id]).to eq(variant.prefixed_id)- end-- it 'includes deleted_at' do- expect(subject).to have_key(:deleted_at)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/product_serializer_spec.rb b/spree/core/spec/serializers/spree/events/product_serializer_spec.rbdeleted file mode 100644index 9018467370..0000000000--- a/spree/core/spec/serializers/spree/events/product_serializer_spec.rb+++ /dev/null@@ -1,44 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::ProductSerializer do- let(:store) { @default_store }- let(:product) do- create(:product,- name: 'Test Product',- status: 'active',- available_on: Time.zone.parse('2024-01-01 00:00:00'),- stores: [store])- end-- subject { described_class.serialize(product) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(product.prefixed_id)- expect(subject[:name]).to eq('Test Product')- expect(subject[:slug]).to eq(product.slug)- end-- it 'includes status as string' do- expect(subject[:status]).to eq('active')- end-- it 'includes availability timestamps' do- expect(subject[:available_on]).to eq('2024-01-01T00:00:00Z')- expect(subject).to have_key(:discontinue_on)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end-- it 'does not include associations' do- expect(subject).not_to have_key(:variants)- expect(subject).not_to have_key(:images)- expect(subject).not_to have_key(:taxons)- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/promotion_serializer_spec.rb b/spree/core/spec/serializers/spree/events/promotion_serializer_spec.rbdeleted file mode 100644index a636c0cddf..0000000000--- a/spree/core/spec/serializers/spree/events/promotion_serializer_spec.rb+++ /dev/null@@ -1,62 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::PromotionSerializer do- let(:promotion) do- create(:promotion,- name: 'Test Promotion',- code: 'SAVE10',- starts_at: 1.day.ago,- expires_at: 1.month.from_now)- end-- subject { described_class.serialize(promotion) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(promotion.prefixed_id)- expect(subject[:name]).to eq('Test Promotion')- end-- it 'includes code' do- expect(subject).to have_key(:code)- end-- it 'includes description' do- expect(subject).to have_key(:description)- end-- it 'includes type and kind' do- expect(subject).to have_key(:type)- expect(subject).to have_key(:kind)- end-- it 'includes policy settings' do- expect(subject).to have_key(:match_policy)- expect(subject).to have_key(:usage_limit)- expect(subject).to have_key(:advertise)- expect(subject).to have_key(:path)- end-- it 'includes multi-code settings' do- expect(subject).to have_key(:multi_codes)- expect(subject).to have_key(:code_prefix)- expect(subject).to have_key(:number_of_codes)- end-- it 'includes date range' do- expect(subject[:starts_at]).to be_present- expect(subject[:expires_at]).to be_present- end-- it 'includes promotion_category_id' do- expect(subject).to have_key(:promotion_category_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/refund_serializer_spec.rb b/spree/core/spec/serializers/spree/events/refund_serializer_spec.rbdeleted file mode 100644index f3c492c199..0000000000--- a/spree/core/spec/serializers/spree/events/refund_serializer_spec.rb+++ /dev/null@@ -1,36 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::RefundSerializer do- let(:payment) { create(:payment, state: 'completed', amount: 100) }- let(:refund) { create(:refund, payment: payment, amount: 10) }-- subject { described_class.serialize(refund) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(refund.prefixed_id)- end-- it 'includes amount' do- expect(subject[:amount]).to be_present- end-- it 'includes transaction_id' do- expect(subject).to have_key(:transaction_id)- end-- it 'includes foreign keys' do- expect(subject[:payment_id]).to eq(refund.payment&.prefixed_id)- expect(subject).to have_key(:refund_reason_id)- expect(subject).to have_key(:reimbursement_id)- expect(subject).to have_key(:refunder_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/reimbursement_serializer_spec.rb b/spree/core/spec/serializers/spree/events/reimbursement_serializer_spec.rbdeleted file mode 100644index 580517cc4e..0000000000--- a/spree/core/spec/serializers/spree/events/reimbursement_serializer_spec.rb+++ /dev/null@@ -1,34 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::ReimbursementSerializer do- let(:reimbursement) { create(:reimbursement) }-- subject { described_class.serialize(reimbursement) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(reimbursement.prefixed_id)- expect(subject[:number]).to eq(reimbursement.number)- end-- it 'includes reimbursement_status' do- expect(subject[:reimbursement_status]).to be_present- end-- it 'includes total' do- expect(subject).to have_key(:total)- end-- it 'includes foreign keys' do- expect(subject[:order_id]).to eq(reimbursement.order&.prefixed_id)- expect(subject[:customer_return_id]).to eq(reimbursement.customer_return&.prefixed_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/report_serializer_spec.rb b/spree/core/spec/serializers/spree/events/report_serializer_spec.rbdeleted file mode 100644index 4825b46440..0000000000--- a/spree/core/spec/serializers/spree/events/report_serializer_spec.rb+++ /dev/null@@ -1,48 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::ReportSerializer do- subject { described_class.serialize(report) }-- let(:store) { @default_store }- let(:user) { create(:admin_user) }- let(:report) do- create(:report,- store: store,- user: user,- date_from: 1.month.ago,- date_to: Time.current,- currency: 'USD'- )- end-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(report.prefixed_id)- expect(subject[:type]).to eq(report.type)- end-- it 'includes store reference' do- expect(subject[:store_id]).to eq(store.prefixed_id)- end-- it 'includes user reference' do- expect(subject[:user_id]).to eq(user.prefixed_id)- end-- it 'includes currency' do- expect(subject[:currency]).to eq('USD')- end-- it 'includes date range' do- expect(subject[:date_from]).to be_present- expect(subject[:date_to]).to be_present- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/return_authorization_serializer_spec.rb b/spree/core/spec/serializers/spree/events/return_authorization_serializer_spec.rbdeleted file mode 100644index 5b87dcdec6..0000000000--- a/spree/core/spec/serializers/spree/events/return_authorization_serializer_spec.rb+++ /dev/null@@ -1,35 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::ReturnAuthorizationSerializer do- let(:return_authorization) { create(:return_authorization) }-- subject { described_class.serialize(return_authorization) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(return_authorization.prefixed_id)- expect(subject[:number]).to eq(return_authorization.number)- end-- it 'includes state as string' do- expect(subject[:state]).to be_a(String)- end-- it 'includes foreign keys' do- expect(subject[:order_id]).to eq(return_authorization.order&.prefixed_id)- expect(subject[:stock_location_id]).to eq(return_authorization.stock_location&.prefixed_id)- expect(subject).to have_key(:return_authorization_reason_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end-- it 'does not include associations' do- expect(subject).not_to have_key(:return_items)- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/return_item_serializer_spec.rb b/spree/core/spec/serializers/spree/events/return_item_serializer_spec.rbdeleted file mode 100644index c72615b2e1..0000000000--- a/spree/core/spec/serializers/spree/events/return_item_serializer_spec.rb+++ /dev/null@@ -1,39 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::ReturnItemSerializer do- let(:return_item) { create(:return_item) }-- subject { described_class.serialize(return_item) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(return_item.prefixed_id)- end-- it 'includes status fields' do- expect(subject[:reception_status]).to be_present- expect(subject[:acceptance_status]).to be_present- end-- it 'includes amount fields' do- expect(subject).to have_key(:pre_tax_amount)- expect(subject).to have_key(:included_tax_total)- expect(subject).to have_key(:additional_tax_total)- end-- it 'includes foreign keys' do- expect(subject[:inventory_unit_id]).to eq(return_item.inventory_unit&.prefixed_id)- expect(subject[:return_authorization_id]).to eq(return_item.return_authorization&.prefixed_id)- expect(subject).to have_key(:customer_return_id)- expect(subject).to have_key(:reimbursement_id)- expect(subject).to have_key(:exchange_variant_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/shipment_serializer_spec.rb b/spree/core/spec/serializers/spree/events/shipment_serializer_spec.rbdeleted file mode 100644index a770b06111..0000000000--- a/spree/core/spec/serializers/spree/events/shipment_serializer_spec.rb+++ /dev/null@@ -1,44 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::ShipmentSerializer do- let(:shipment) { create(:shipment) }-- subject { described_class.serialize(shipment) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(shipment.prefixed_id)- expect(subject[:number]).to eq(shipment.number)- end-- it 'includes state as string' do- expect(subject[:state]).to be_a(String)- end-- it 'includes tracking' do- expect(subject).to have_key(:tracking)- end-- it 'includes cost' do- expect(subject).to have_key(:cost)- end-- it 'includes foreign keys' do- expect(subject[:order_id]).to eq(shipment.order&.prefixed_id)- expect(subject[:stock_location_id]).to eq(shipment.stock_location&.prefixed_id)- end-- it 'includes timestamps' do- expect(subject).to have_key(:shipped_at)- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end-- it 'does not include associations' do- expect(subject).not_to have_key(:inventory_units)- expect(subject).not_to have_key(:shipping_rates)- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/stock_item_serializer_spec.rb b/spree/core/spec/serializers/spree/events/stock_item_serializer_spec.rbdeleted file mode 100644index af0a53f4d0..0000000000--- a/spree/core/spec/serializers/spree/events/stock_item_serializer_spec.rb+++ /dev/null@@ -1,39 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::StockItemSerializer do- let(:stock_location) { create(:stock_location) }- let(:variant) { create(:variant) }- let(:stock_item) { variant.stock_items.first || create(:stock_item, variant: variant, stock_location: stock_location) }-- subject { described_class.serialize(stock_item) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(stock_item.prefixed_id)- end-- it 'includes count_on_hand' do- expect(subject).to have_key(:count_on_hand)- end-- it 'includes backorderable' do- expect(subject).to have_key(:backorderable)- end-- it 'includes foreign keys' do- expect(subject[:stock_location_id]).to eq(stock_item.stock_location&.prefixed_id)- expect(subject[:variant_id]).to eq(stock_item.variant&.prefixed_id)- end-- it 'includes deleted_at' do- expect(subject).to have_key(:deleted_at)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/stock_movement_serializer_spec.rb b/spree/core/spec/serializers/spree/events/stock_movement_serializer_spec.rbdeleted file mode 100644index f0588c293d..0000000000--- a/spree/core/spec/serializers/spree/events/stock_movement_serializer_spec.rb+++ /dev/null@@ -1,40 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::StockMovementSerializer do- let(:stock_location) { create(:stock_location) }- let(:variant) { create(:variant) }- let(:stock_item) { variant.stock_items.first || create(:stock_item, variant: variant, stock_location: stock_location) }- let(:stock_movement) { create(:stock_movement, stock_item: stock_item, quantity: 5) }-- subject { described_class.serialize(stock_movement) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(stock_movement.prefixed_id)- end-- it 'includes quantity' do- expect(subject[:quantity]).to eq(5)- end-- it 'includes action' do- expect(subject).to have_key(:action)- end-- it 'includes originator polymorphic reference' do- expect(subject).to have_key(:originator_type)- expect(subject).to have_key(:originator_id)- end-- it 'includes stock_item_id' do- expect(subject[:stock_item_id]).to eq(stock_item.prefixed_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/stock_transfer_serializer_spec.rb b/spree/core/spec/serializers/spree/events/stock_transfer_serializer_spec.rbdeleted file mode 100644index 22a305e766..0000000000--- a/spree/core/spec/serializers/spree/events/stock_transfer_serializer_spec.rb+++ /dev/null@@ -1,41 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::StockTransferSerializer do- let(:source_location) { create(:stock_location, name: 'Source') }- let(:destination_location) { create(:stock_location, name: 'Destination') }- let(:stock_transfer) do- create(:stock_transfer,- source_location: source_location,- destination_location: destination_location,- reference: 'REF123')- end-- subject { described_class.serialize(stock_transfer) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(stock_transfer.prefixed_id)- expect(subject[:number]).to eq(stock_transfer.number)- end-- it 'includes type' do- expect(subject).to have_key(:type)- end-- it 'includes reference' do- expect(subject[:reference]).to eq('REF123')- end-- it 'includes location foreign keys' do- expect(subject[:source_location_id]).to eq(source_location.prefixed_id)- expect(subject[:destination_location_id]).to eq(destination_location.prefixed_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/store_credit_serializer_spec.rb b/spree/core/spec/serializers/spree/events/store_credit_serializer_spec.rbdeleted file mode 100644index 0effaa9445..0000000000--- a/spree/core/spec/serializers/spree/events/store_credit_serializer_spec.rb+++ /dev/null@@ -1,64 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::StoreCreditSerializer do- let(:store) { @default_store }- let(:user) { create(:user) }- let(:admin_user) { create(:admin_user) }- let(:store_credit) do- create(:store_credit,- user: user,- created_by: admin_user,- amount: 100.00,- currency: 'USD',- store: store)- end-- subject { described_class.serialize(store_credit) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(store_credit.prefixed_id)- end-- it 'includes amount fields' do- expect(subject[:amount]).to eq(100.00)- expect(subject).to have_key(:amount_used)- expect(subject).to have_key(:amount_authorized)- expect(subject[:currency]).to eq('USD')- end-- it 'includes memo' do- expect(subject).to have_key(:memo)- end-- it 'includes user foreign keys' do- expect(subject[:user_id]).to eq(user.prefixed_id)- expect(subject[:created_by_id]).to eq(admin_user.prefixed_id)- end-- it 'includes category and type ids' do- expect(subject).to have_key(:category_id)- expect(subject).to have_key(:type_id)- end-- it 'includes store_id' do- expect(subject[:store_id]).to eq(store.prefixed_id)- end-- it 'includes originator polymorphic reference' do- expect(subject).to have_key(:originator_type)- expect(subject).to have_key(:originator_id)- end-- it 'includes deleted_at' do- expect(subject).to have_key(:deleted_at)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/user_serializer_spec.rb b/spree/core/spec/serializers/spree/events/user_serializer_spec.rbdeleted file mode 100644index 72695025e0..0000000000--- a/spree/core/spec/serializers/spree/events/user_serializer_spec.rb+++ /dev/null@@ -1,27 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::UserSerializer do- let(:user) { create(:user, email: '[email protected]') }-- subject { described_class.serialize(user) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(user.prefixed_id)- expect(subject[:email]).to eq('[email protected]')- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end-- it 'does not include sensitive data' do- expect(subject).not_to have_key(:encrypted_password)- expect(subject).not_to have_key(:password)- expect(subject).not_to have_key(:spree_api_key)- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/variant_serializer_spec.rb b/spree/core/spec/serializers/spree/events/variant_serializer_spec.rbdeleted file mode 100644index 22409f287e..0000000000--- a/spree/core/spec/serializers/spree/events/variant_serializer_spec.rb+++ /dev/null@@ -1,65 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::VariantSerializer do- let(:product) { create(:product) }- let(:variant) { create(:variant, product: product, sku: 'TEST-SKU-001') }-- subject { described_class.serialize(variant) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(variant.prefixed_id)- expect(subject[:sku]).to eq('TEST-SKU-001')- end-- it 'includes barcode' do- expect(subject).to have_key(:barcode)- end-- it 'includes is_master' do- expect(subject[:is_master]).to eq(variant.is_master)- end-- it 'includes position' do- expect(subject).to have_key(:position)- end-- it 'includes dimensions' do- expect(subject).to have_key(:weight)- expect(subject).to have_key(:height)- expect(subject).to have_key(:width)- expect(subject).to have_key(:depth)- expect(subject).to have_key(:weight_unit)- expect(subject).to have_key(:dimensions_unit)- end-- it 'includes cost fields' do- expect(subject).to have_key(:cost_price)- expect(subject).to have_key(:cost_currency)- end-- it 'includes track_inventory' do- expect(subject).to have_key(:track_inventory)- end-- it 'includes foreign keys' do- expect(subject[:product_id]).to eq(product.prefixed_id)- expect(subject).to have_key(:tax_category_id)- end-- it 'includes discontinue_on' do- expect(subject).to have_key(:discontinue_on)- end-- it 'includes deleted_at' do- expect(subject).to have_key(:deleted_at)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/wished_item_serializer_spec.rb b/spree/core/spec/serializers/spree/events/wished_item_serializer_spec.rbdeleted file mode 100644index 37c8e9c5a9..0000000000--- a/spree/core/spec/serializers/spree/events/wished_item_serializer_spec.rb+++ /dev/null@@ -1,32 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::WishedItemSerializer do- let(:user) { create(:user) }- let(:wishlist) { create(:wishlist, user: user) }- let(:variant) { create(:variant) }- let(:wished_item) { create(:wished_item, wishlist: wishlist, variant: variant, quantity: 2) }-- subject { described_class.serialize(wished_item) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(wished_item.prefixed_id)- end-- it 'includes quantity' do- expect(subject[:quantity]).to eq(2)- end-- it 'includes foreign keys' do- expect(subject[:variant_id]).to eq(variant.prefixed_id)- expect(subject[:wishlist_id]).to eq(wishlist.prefixed_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end- end-enddiff --git a/spree/core/spec/serializers/spree/events/wishlist_serializer_spec.rb b/spree/core/spec/serializers/spree/events/wishlist_serializer_spec.rbdeleted file mode 100644index cf71a34e9e..0000000000--- a/spree/core/spec/serializers/spree/events/wishlist_serializer_spec.rb+++ /dev/null@@ -1,44 +0,0 @@-# frozen_string_literal: true--require 'spec_helper'--RSpec.describe Spree::Events::WishlistSerializer do- let(:store) { @default_store }- let(:user) { create(:user) }- let(:wishlist) do- create(:wishlist,- user: user,- store: store,- name: 'My Wishlist',- is_private: true,- is_default: false)- end-- subject { described_class.serialize(wishlist) }-- describe '#as_json' do- it 'includes identity attributes' do- expect(subject[:id]).to eq(wishlist.prefixed_id)- expect(subject[:name]).to eq('My Wishlist')- end-- it 'includes privacy settings' do- expect(subject[:is_private]).to eq(true)- expect(subject[:is_default]).to eq(false)- end-- it 'includes foreign keys' do- expect(subject[:user_id]).to eq(user.prefixed_id)- expect(subject[:store_id]).to eq(store.prefixed_id)- end-- it 'includes timestamps' do- expect(subject[:created_at]).to be_present- expect(subject[:updated_at]).to be_present- end-- it 'does not include token' do- expect(subject).not_to have_key(:token)- end- end-enddiff --git a/spree/core/spree_core.gemspec b/spree/core/spree_core.gemspecindex bb29270762..29a6033e0c 100644--- a/spree/core/spree_core.gemspec+++ b/spree/core/spree_core.gemspec@@ -61,7 +61,6 @@ Gem::Specification.new do |s|s.add_dependency 'mobility-ransack', '~> 1.2's.add_dependency 'mobility-actiontext', '~> 1.1's.add_dependency 'friendly_id-mobility', '~> 1.0'- s.add_dependency 'request_store', '~> 1.7's.add_dependency 'wannabe_bool's.add_dependency 'any_ascii', '~> 0.3.2's.add_dependency 'safely_block', '~> 0.4'