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
Drop resuming a parcel from the seller panel
Damian Legawiecfaa4396213fb
diff --git a/packages/seller-dashboard/src/components/orders/fulfillments-card.tsx b/packages/seller-dashboard/src/components/orders/fulfillments-card.tsxindex f1dee5436b..7422ac2919 100644--- a/packages/seller-dashboard/src/components/orders/fulfillments-card.tsx+++ b/packages/seller-dashboard/src/components/orders/fulfillments-card.tsx@@ -67,7 +67,7 @@ export function FulfillmentsCard({ order }: { order: Order }) {function FulfillmentRow({ orderId, fulfillment }: { orderId: string; fulfillment: Fulfillment }) {const { t } = useTranslation()const confirm = useConfirm()- const { cancel, resume } = useFulfillmentActions(orderId)+ const { cancel } = useFulfillmentActions(orderId)const [shipping, setShipping] = useState(false)const [trackingOpen, setTrackingOpen] = useState(false)@@ -117,14 +117,6 @@ function FulfillmentRow({ orderId, fulfillment }: { orderId: string; fulfillment{t('orders.fulfillments.split')}</DropdownMenuItem>)}- {status === 'canceled' && (- <DropdownMenuItem- disabled={resume.isPending}- onClick={() => resume.mutate(fulfillment.id)}- >- {t('orders.fulfillments.resume')}- </DropdownMenuItem>- )}{cancelable && (<><DropdownMenuSeparator />diff --git a/packages/seller-dashboard/src/hooks/use-fulfillments.ts b/packages/seller-dashboard/src/hooks/use-fulfillments.tsindex d6dfc02a78..be3a43297a 100644--- a/packages/seller-dashboard/src/hooks/use-fulfillments.ts+++ b/packages/seller-dashboard/src/hooks/use-fulfillments.ts@@ -22,8 +22,8 @@ export function useFulfillmentActions(orderId: string) {queryClient.invalidateQueries({ queryKey: buildKey('seller-orders') })},onError: (error) => {- // A rejected workflow — a parcel that cannot be resumed, a split that- // would empty its source — otherwise looks like a dead button.+ // A rejected workflow — a parcel that cannot ship, a split that would+ // empty its source — otherwise looks like a dead button.toastManager.add({type: 'error',title: error instanceof Error ? error.message : String(error),@@ -60,10 +60,6 @@ export function useFulfillmentActions(orderId: string) {sellerClient().orders.fulfillments.cancel(orderId, fulfillmentId),)- const resume = useFulfillmentMutation((fulfillmentId: string) =>- sellerClient().orders.fulfillments.resume(orderId, fulfillmentId),- )-const split = useFulfillmentMutation(({fulfillmentId,@@ -76,5 +72,5 @@ export function useFulfillmentActions(orderId: string) {}) => sellerClient().orders.fulfillments.split(orderId, fulfillmentId, params),)- return { fulfill, update, cancel, resume, split }+ return { fulfill, update, cancel, split }}diff --git a/packages/seller-dashboard/src/locales/en.json b/packages/seller-dashboard/src/locales/en.jsonindex 6ce0063caa..8602a41c3e 100644--- a/packages/seller-dashboard/src/locales/en.json+++ b/packages/seller-dashboard/src/locales/en.json@@ -301,7 +301,6 @@"units_selected": "{{selected}} of {{total}} units selected","partial_warning": "Sending part of this parcel moves the rest onto a new one.","quantity_for": "Quantity for {{name}}",- "resume": "Resume","cancel": "Cancel parcel","cancel_title": "Cancel this parcel?","cancel_message": "The goods go back on the shelf and the carrier is stood down.",diff --git a/spree/api/app/controllers/spree/api/v3/seller/orders/fulfillments_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/orders/fulfillments_controller.rbindex 27216f1613..c3377ef104 100644--- a/spree/api/app/controllers/spree/api/v3/seller/orders/fulfillments_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/seller/orders/fulfillments_controller.rb@@ -20,7 +20,7 @@ module Spreebefore_action :set_orderbefore_action :set_fulfillment,- only: [:show, :update, :fulfill, :cancel, :resume, :split]+ only: [:show, :update, :fulfill, :cancel, :split]def index# This action builds its own collection rather than going through@@ -84,11 +84,6 @@ module Spreerun_workflow(Spree.fulfillment_cancel_workflow)end- # PATCH /api/v3/seller/orders/:order_id/fulfillments/:id/resume- def resume- run_workflow(Spree.fulfillment_resume_workflow)- end-# PATCH /api/v3/seller/orders/:order_id/fulfillments/:id/split## Moves part of what this parcel holds onto one of its own, for@@ -126,7 +121,7 @@ module Spreeauthorize! :show, @orderend- WRITE_ACTIONS = %w[update fulfill cancel resume split].freeze+ WRITE_ACTIONS = %w[update fulfill cancel split].freezedef set_fulfillment@fulfillment = @order.fulfillments.find_by_prefix_id!(params[:id])diff --git a/spree/api/config/routes.rb b/spree/api/config/routes.rbindex 72edba13d3..7a7ffe0079 100644--- a/spree/api/config/routes.rb+++ b/spree/api/config/routes.rb@@ -870,7 +870,6 @@ Spree::Core::Engine.add_routes domember dopatch :fulfillpatch :cancel- patch :resumepatch :splitendenddiff --git a/spree/api/spec/controllers/spree/api/v3/seller/orders/fulfillments_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/seller/orders/fulfillments_controller_spec.rbindex 3e8b4a7af1..fe01a9df87 100644--- a/spree/api/spec/controllers/spree/api/v3/seller/orders/fulfillments_controller_spec.rb+++ b/spree/api/spec/controllers/spree/api/v3/seller/orders/fulfillments_controller_spec.rb@@ -124,7 +124,7 @@ RSpec.describe Spree::Api::V3::Seller::Orders::FulfillmentsController, type: :coendend- describe 'PATCH #cancel and #resume' do+ describe 'PATCH #cancel' doit 'cancels a parcel the seller will not send' dopatch :cancel, params: { order_id: order.prefixed_id, id: fulfillment.prefixed_id }, as: :json@@ -132,13 +132,13 @@ RSpec.describe Spree::Api::V3::Seller::Orders::FulfillmentsController, type: :coexpect(fulfillment.reload).to be_canceledend- it 'resumes a canceled parcel' do- Spree::Fulfillments::Cancel.call(fulfillment: fulfillment)-- patch :resume, params: { order_id: order.prefixed_id, id: fulfillment.prefixed_id }, as: :json-- expect(response).to have_http_status(:ok)- expect(fulfillment.reload).not_to be_canceled+ # Resuming a canceled parcel was removed from the platform: the goods went+ # back on the shelf and the carrier was stood down, so the honest move is+ # a new parcel rather than reviving that one.+ it 'has no route for resuming one' do+ expect {+ patch :resume, params: { order_id: order.prefixed_id, id: fulfillment.prefixed_id }, as: :json+ }.to raise_error(ActionController::UrlGenerationError)endit "404s cancelling through another seller's order" do