fix(fleetops): decode the QR image instead of asking the API for the uuid - #37
Merged
Conversation
…uuid
The two QR requests need the value a scanner reads, which is the tracking
number's owner uuid — the one documented place the API takes a uuid rather than a
public_id. Neither had a source, so Decode Tracking Number QR sent the literal
{{qr_code}} and Capture QR Code for Order sent an empty string.
Create a Tracking Number already returns `qr_code`, a base64 PNG generated from
that uuid, and it is public on the TrackingNumber resource. The after-response
script now decodes it with jsqr and fast-png and sets {{qr_code}} — reproducing
what a scanning device does, rather than having the API expose the raw uuid.
The decode is wrapped: if the runtime cannot resolve the packages the rest of the
run continues and the two QR requests fail visibly on their own, rather than an
unhandled script error taking the collection down.
Capture QR Code for Order resolves its subject as the order itself when no `type`
is sent, and the tracking number is owned by {{order_id}} — so one decoded value
serves both requests.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The two QR requests need the value a scanner reads — the tracking number's owner uuid, which is the one documented place the API takes a uuid rather than a public_id. Neither had a source:
Decode Tracking Number QRsent the literal{{qr_code}}andCapture QR Code for Ordersent an empty string.Create a Tracking Numberalready returnsqr_code, a base64 PNG generated from that uuid, and it is public on theTrackingNumberresource (unlikeOrderandEntity, where it isisInternalRequest()-gated). The after-response script now decodes it withjsqr+fast-pngand sets{{qr_code}}.This reproduces what a scanning device actually does, which is the right thing for the collection to demonstrate — and avoids exposing the raw uuid on the API, which is not what that endpoint is for.
Details worth noting
captureQrScanresolves its subject as the order itself when notypeis sent, and the tracking number is owned by{{order_id}}— so the decoded uuid matches$subject->uuid.catchlogs and the run continues; the two QR requests then fail visibly on their own rather than an unhandled script error taking the whole collection down.Requires
Capture QR Code for Orderto run after the tracking number exists — ordering change in fleetbase/fleetbase.🤖 Generated with Claude Code