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
Use past tense for Webhook event names (#11432)
Damian Legawiec758da9138da8
diff --git a/api/app/models/spree/api/webhooks/order_decorator.rb b/api/app/models/spree/api/webhooks/order_decorator.rbindex 824de71de6..0ae590537a 100644--- a/api/app/models/spree/api/webhooks/order_decorator.rb+++ b/api/app/models/spree/api/webhooks/order_decorator.rb@@ -4,12 +4,12 @@ module Spreemodule OrderDecoratordef after_cancelsuper- queue_webhooks_requests!('order.cancel')+ queue_webhooks_requests!('order.canceled')enddef finalize!super- queue_webhooks_requests!('order.complete')+ queue_webhooks_requests!('order.placed')endendenddiff --git a/api/app/models/spree/api/webhooks/payment_decorator.rb b/api/app/models/spree/api/webhooks/payment_decorator.rbindex 44ef58cee6..37ecff10ff 100644--- a/api/app/models/spree/api/webhooks/payment_decorator.rb+++ b/api/app/models/spree/api/webhooks/payment_decorator.rb@@ -4,7 +4,7 @@ module Spreemodule PaymentDecoratordef after_voidsuper- queue_webhooks_requests!('payment.void')+ queue_webhooks_requests!('payment.voided')endendenddiff --git a/api/app/models/spree/api/webhooks/shipment_decorator.rb b/api/app/models/spree/api/webhooks/shipment_decorator.rbindex 4026696370..19824edbc0 100644--- a/api/app/models/spree/api/webhooks/shipment_decorator.rb+++ b/api/app/models/spree/api/webhooks/shipment_decorator.rb@@ -4,7 +4,7 @@ module Spreemodule ShipmentDecoratordef after_shipsuper- queue_webhooks_requests!('shipment.ship')+ queue_webhooks_requests!('shipment.shipped')endendenddiff --git a/api/spec/integration/api/v2/platform/orders_spec.rb b/api/spec/integration/api/v2/platform/orders_spec.rbindex 1d49a92062..a05985d011 100644--- a/api/spec/integration/api/v2/platform/orders_spec.rb+++ b/api/spec/integration/api/v2/platform/orders_spec.rb@@ -185,11 +185,11 @@ describe 'Orders API', swagger: true doparameter name: :id, in: :path, type: :stringjson_api_include_parameter(options[:include_example])- response '200', 'record cancelled' do+ response '200', 'record canceled' dolet(:id) { create(:completed_order_with_totals).id }run_test!end- response '422', 'cannot be cancelled' do+ response '422', 'cannot be canceled' dorun_test!endit_behaves_like 'record not found'diff --git a/api/spec/models/spree/api/webhooks/order_spec.rb b/api/spec/models/spree/api/webhooks/order_spec.rbindex 987f21410e..0d270f3482 100644--- a/api/spec/models/spree/api/webhooks/order_spec.rb+++ b/api/spec/models/spree/api/webhooks/order_spec.rb@@ -22,7 +22,7 @@ describe Spree::Order doit 'executes QueueRequests.call with a order.cancel event and {} body after invoking cancel' doTimecop.freeze(Time.local(1990)) doorder.cancel- expect(queue_requests).to have_received(:call).with(event: 'order.cancel', body: body).once+ expect(queue_requests).to have_received(:call).with(event: 'order.canceled', body: body).onceendendend@@ -30,9 +30,9 @@ describe Spree::Order dodescribe '#finalize!' dolet(:order) { described_class.create(email: '[email protected]', store: store) }- it 'executes QueueRequests.call with a order.complete event and {} body after invoking finalize!' do+ it 'executes QueueRequests.call with a order.placed event and {} body after invoking finalize!' doorder.finalize!- expect(queue_requests).to have_received(:call).with(event: 'order.complete', body: body).once+ expect(queue_requests).to have_received(:call).with(event: 'order.placed', body: body).onceendendenddiff --git a/api/spec/models/spree/api/webhooks/payment_spec.rb b/api/spec/models/spree/api/webhooks/payment_spec.rbindex 06ed01d027..e948ebe2e7 100644--- a/api/spec/models/spree/api/webhooks/payment_spec.rb+++ b/api/spec/models/spree/api/webhooks/payment_spec.rb@@ -20,9 +20,9 @@ describe Spree::Payment doafter { ENV['DISABLE_SPREE_WEBHOOKS'] = 'true' }- it 'executes QueueRequests.call with a payment.void event and {} body after invoking void' do+ it 'executes QueueRequests.call with a payment.voided event and {} body after invoking void' dopayment.void- expect(queue_requests).to have_received(:call).with(event: 'payment.void', body: body).once+ expect(queue_requests).to have_received(:call).with(event: 'payment.voided', body: body).onceendenddiff --git a/api/spec/models/spree/api/webhooks/shipment_spec.rb b/api/spec/models/spree/api/webhooks/shipment_spec.rbindex 2831391178..7df966e8f2 100644--- a/api/spec/models/spree/api/webhooks/shipment_spec.rb+++ b/api/spec/models/spree/api/webhooks/shipment_spec.rb@@ -19,10 +19,10 @@ describe Spree::Shipment dolet(:queue_requests) { instance_double(Spree::Webhooks::Subscribers::QueueRequests) }- it 'executes QueueRequests.call with a shipment.ship event and {} body after invoking ship' do+ it 'executes QueueRequests.call with a shipment.shipped event and {} body after invoking ship' doshipment.cancel # previous state that allows the object be shippedshipment.ship- expect(queue_requests).to have_received(:call).with(event: 'shipment.ship', body: body).once+ expect(queue_requests).to have_received(:call).with(event: 'shipment.shipped', body: body).onceendendenddiff --git a/api/spec/models/spree/webhooks/subscriber_spec.rb b/api/spec/models/spree/webhooks/subscriber_spec.rbindex 36241c4f09..995545f895 100644--- a/api/spec/models/spree/webhooks/subscriber_spec.rb+++ b/api/spec/models/spree/webhooks/subscriber_spec.rb@@ -26,8 +26,8 @@ describe Spree::Webhooks::Subscriber dodescribe '.urls_for' dosubject { described_class.urls_for(event) }- let(:event) { 'order.complete' }- let(:subscriptions) { ['order.complete'] }+ let(:event) { 'order.placed' }+ let(:subscriptions) { ['order.placed'] }let!(:subscriber) { described_class.create(url: url, subscriptions: subscriptions, active: true) }let(:url) { 'https://url1.com/' }