Skip to content

Cancel a parcel at the carrier (F-1401/T-21424) - #21

Merged
bakkerpeter merged 1 commit into
masterfrom
f-1401-verzendlabel-printen
Dec 4, 2026
Merged

bakkerpeter merged 1 commit into
masterfrom
f-1401-verzendlabel-printen

Conversation

@afosto-portal

@afosto-portal afosto-portal Bot commented Dec 4, 2026

Copy link
Copy Markdown

What

Adds parcel.Client.Cancel(ctx, parcelID) for Sendcloud's POST /api/v2/parcels/{id}/cancel, so label-service can cancel a Sendcloud label when a label is deleted or replaced (F-1401).

  • 200: returns the CancelStatus (status, message) Sendcloud gives.
  • 202: same, with IsQueued: true — Sendcloud watches a ready-to-send parcel for 14 days and cancels it if nothing changes.
  • 400 / 404 / 410: returns a *sendcloud.Error with the HTTP code and Sendcloud's message (these responses use {status, message}, not the usual {error: …} body).

Docs: https://sendcloud.dev/api/v2/parcels/cancel-a-parcel

Tests

go test ./... passes; parcel/client_test.go covers cancelled, queued, refused and a non-status error body with a stubbed transport.

Next

label-service's Sendcloud handler can call this from CancelLabel after this is merged and tagged.

🤖 Generated with Claude Code

Adds Parcel.Cancel for POST /api/v2/parcels/{id}/cancel. A queued
cancellation (202) is reported with IsQueued; a refusal comes back as a
*sendcloud.Error carrying Sendcloud's message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bakkerpeter
bakkerpeter merged commit ea91c8e into master Dec 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant