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
Attach the order status subscriber to the event bus
Damian Legawiec9d51581810f7
diff --git a/spree/core/lib/spree/core/engine.rb b/spree/core/lib/spree/core/engine.rbindex 18da1ea430..b23e0dee45 100644--- a/spree/core/lib/spree/core/engine.rb+++ b/spree/core/lib/spree/core/engine.rb@@ -463,6 +463,7 @@ module Spree# survives Zeitwerk code reloads in development.Spree.subscribers.concat [Spree::OrderPlacedSubscriber,+ Spree::OrderStatusSubscriber,Spree::ExportSubscriber,Spree::ReportSubscriber,Spree::InvitationEmailSubscriber,diff --git a/spree/core/spec/subscribers/spree/order_status_subscriber_spec.rb b/spree/core/spec/subscribers/spree/order_status_subscriber_spec.rbindex 14b29e1b69..37175c7b98 100644--- a/spree/core/spec/subscribers/spree/order_status_subscriber_spec.rb+++ b/spree/core/spec/subscribers/spree/order_status_subscriber_spec.rb@@ -39,4 +39,20 @@ RSpec.describe Spree::OrderStatusSubscriber doexpect { described_class.new.handle(event) }.not_to raise_errorend++ # End to end through the event bus, not by calling handle() by hand: the+ # admin capture endpoint drives the payment machine directly, so the+ # after_transition publish is the only thing keeping the order's rollup+ # fresh — this is the wire that broke when a draft's payment settled but+ # the order kept saying none.+ it 'rolls the order up when a payment is captured through the machine', events: true do+ order = create(:order_with_line_items, store: @default_store)+ order.update_columns(status: 'draft', completed_at: nil)+ payment = create(:payment, order: order, cart: nil, amount: order.total, state: 'pending')+ order.update_columns(payment_status: 'none')++ payment.capture!++ expect(order.reload.payment_status).to eq('paid')+ endend