Repository navigation
feat(tracking): structured tracking-url QR codes, Code 128 barcodes, backward-compatible scan resolver - #356
Merged
Conversation
QR codes now carry a versioned tracking url naming the tracking number and the owner's public id (https://<console>/track-order?order=<tn>&r=<public_id>&v=1) instead of the owner's bare uuid, so a phone camera opens the tracking page while scanners read the parameters. The barcode is now Code 128 with the bare tracking number, matching the text printed beneath it. capture-qr and tracking-numbers/from-qr resolve scans through one parser that accepts the new url, a bare tracking number or public id, and the bare owner uuid printed on labels already in circulation. from-qr is now scoped to the session's company and resolves waypoint and place owners too. qr_code_content is published in every environment: it no longer exposes a uuid. Labels print the QR as a fixed square instead of cropping it with object-fit.
…can resolver - TrackingCode: generation, parsing of every format in circulation (legacy uuid, tracking url from any host, bare tracking number or public id, hostile urls), and subject matching for capture-qr - TrackingNumber::findOwnerByCode against SQLite: company scoping, disagreeing url identifiers, unknown numbers and unmapped prefixes - insert path, observer and resource expectations moved off the owner uuid
capture-qr reads `code` straight from the request. The navigator v3 branch sends the scanner's whole result object; the old strict comparison answered 400, and the typed matcher would have thrown. Non-strings now match nothing.
Open
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.
Tracking-number QR codes and barcodes were generated from the owner's bare uuid. This changes them to carry a structured, versioned payload, and makes every scan endpoint accept both the new codes and the uuid codes already printed on parcels.
New code content
QR (medium error correction, up from low): a tracking url.
order,randv.order_,waypoint_,entity_,place_), so it isn't repeated.TrackingCode::PATHandTRACKING_PARAM. The public tracking page is being rebuilt; when its route lands, those two change and nothing else. Parsing never depends on host or path, so codes printed in the meantime keep resolving.Barcode: Code 128 (was PDF417) carrying the bare tracking number, matching the text printed beneath it. Warehouse handhelds type what they scan into a field, so a url there would be noise.
Existing records are left alone. Their stored images keep the uuid codes, and every resolver below still accepts those.
Resolving scans
All parsing goes through the new
Support\TrackingCode. It accepts:order(ortn), or from the last path segment for a future/track/<number>route.The two endpoints:
POST orders/{id}/capture-qr/{subject?}usesTrackingCode::matches().POST tracking-numbers/from-qrusesTrackingNumber::findOwnerByCode(). Two behavior changes:Other changes
qr_code_contenton the TrackingNumber resource is now present in every environment and holds the url. It used to be debug-only because it exposed the owner uuid. Webhook payloads are unchanged.object-fit: coverused to crop it in browsers and stretch it in dompdf. The barcode is capped at 360×90 with its aspect ratio kept, so reprints of older PDF417 labels still fit.TrackingNumberObserver) generates the same codes.Navigator app
No change is needed for this to work: it sends the raw scanned value to
capture-qr, which now understands every format. A follow-up list forfleetbase/navigator-appis in a comment on this PR.Tests
Pest, in the package's existing seam and SQLite style. Verified through CI only.
TrackingCodeTest: generation, parsing of every format including hostile or partial urls, and subject matching.TrackingNumberControllerHelpersTest: the resolver against SQLite, covering company scoping, disagreeing identifiers, unknown numbers and unmapped prefixes.