Skip to content

Document order operations: payments, edits, driver offers, stock, booking slots and comment visibility - #67

Open
roncodes wants to merge 3 commits into
mainfrom
docs/order-operations
Open

roncodes wants to merge 3 commits into
mainfrom
docs/order-operations

Conversation

@roncodes

Copy link
Copy Markdown
Member

Summary

Brings the API specification up to date with the order operations work shipped on 13 Oct 2026: order payments and edits, driver offers, stock, booking slots, address change requests, and comment visibility. Every request, field, status code and error body was checked against the code (sources below), not only against the change summary.

Source Change in this repo
fleetbase/storefront release/v0.4.25: dffc7f6, 249f666, 1eec05e, 505cfff, 038fa19, f444390 Storefront API. Orders: the Storefront Order object now documents payment / meta.payment (states, amounts, payment_link, store_credit_code, adjustments), meta.booking, meta.cancel_reason, meta.tip_amount / delivery_tip_amount, meta.address_change_request, and per-item meta (note, packed_at, unavailable, substitute_for, added_by_edit). New Request Address Change (POST orders/{id}/address-change-request). Products: track_inventory, inventory, in_stock; new List Product Booking Slots (GET products/{id}/slots?date=). Checkout: 422 cart_items_unavailable (with items[].available) and booking_slot_unavailable on Before / Before Cash Pickup (and Update Stripe Payment Intent, which is mentioned under Before). Notifications: order_updated, and what an order_canceled body now says
fleetbase/fleetops#394 (feat/order-edits-and-offers → release/v0.6.72) Fleetbase API. New Accept an Order and Decline an Order (`POST orders/{id}/accept
fleetbase/core-api#306 (fix/driver-channel-and-comment-visibility → release/v1.6.69) Core API. Comments: visibility on create (validated) and on the resource; Query/Retrieve leave internal comments and replies out (404 for an internal comment); comment.created event in the folder description. Chat Channels: participant role / meta, message system / meta, sender: null, Storefront order chat channel meta

⚠️ Depends on unreleased versions, merge order

Possible overlap with #65 and #66

Related Issue

None. Follows the PRs listed above.

Type of Change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Test
  • Chore

Implementation Notes

  • Fleetbase API collection script: it now honours expected_status the same way the Storefront collection does (read it, consume it, assert that status instead of 2xx). A contract run has no order offered to a driver, so Accept/Decline need it to assert their documented 404 instead of failing. Other requests are unaffected because the override is unset right after it is read. I tried pm.execution.skipRequest() first, but the Postman CLI (1.46) reports a skipped v3 request as "Request could not be completed" and exits 1.
  • Contract runs on an empty stack: the new requests fall back to a placeholder and assert their refusal unless the environment provides what they need:
    • Accept / Decline an Order: {{offer_order_id}} + {{offer_driver_id}} (an order offered to that driver, not started). Otherwise 404.
    • Request Address Change: {{address_change_order_id}} (an open delivery order of the run's customer), optional {{place_id}}. Otherwise 404.
    • List Product Booking Slots: {{service_product_id}} (a bookable service), optional {{slot_date}} (defaults to today, UTC). Otherwise 404 for the run's non-bookable product.
  • Placeholders only: all IDs in examples are invented, and no tokens or credentials are included. No environment template changes.
  • Saved responses: Fleetbase API gets saved examples (Accept OK/403, Decline OK/422, Update an Order 422 locked), as that collection uses them. Storefront responses are described in the request descriptions, as that collection does.
  • Realtime events: documented in folder descriptions, as the Storefront Notifications folder already does: Fleet-Ops Orders (order.changed, order.driver_unassigned, order.offer_*) and Core Comments (comment.created).

Validation

  • Tests
  • Lint
  • Build
  • Manual validation
$ npm run postman:lint
Validated 5 Postman Native Git collections and 3 environments.
Linting Fleetbase API...              No issues found. Scanned: 248 | Errors: 0 | Warnings: 0
Linting Fleetbase Core API...         No issues found. Scanned: 24  | Errors: 0 | Warnings: 0
Linting Fleetbase Integrated Vendor Flow... No issues found. Scanned: 7 | Errors: 0 | Warnings: 0
Linting Fleetbase Ledger API...       No issues found. Scanned: 8   | Errors: 0 | Warnings: 0
Linting Fleetbase Storefront API...   No issues found. Scanned: 78  | Errors: 0 | Warnings: 0
  • Every embedded JSON example and body in the changed files parses.
  • The four new requests were run with the Postman CLI against a local stub that answers 404 JSON. They addressed the placeholder ids, sent the expected bodies (Request Address Change dropped the unset place, and slots sent today's date), and passed with expected_status: Fleetbase API 2 requests / 2 assertions / 0 failed, Storefront 2 requests / 6 assertions / 0 failed.
  • Not run against a live API. The scoped postman:run:* scripts need a running Fleetbase stack with these unreleased versions. The module contract workflows will run them once the releases land.

Documentation Impact

  • No documentation changes needed
  • Documentation updated in fleetbase/fleetbase.io
  • Documentation needed but not included

API Reference Impact

  • No API reference changes needed
  • Updated fleetbase/postman
  • API reference updates required but not included

API reference notes: changes are in postman/collections/Fleetbase Storefront API, Fleetbase API and Fleetbase Core API. After merge, fleetbase.io regenerates its API reference from this repo through the bump-postman workflow.

Documentation Notes

Guide pages in fleetbase/fleetbase.io that should follow (not part of this PR):

Risk

Documentation only, apart from the expected_status support in the Fleetbase API collection script, which changes nothing for requests that don't set it. The main risk is merging before the module releases (see above).

Screenshots / Recordings

None.

…d booking slots

- Storefront Order: payment (and meta.payment) with its states and adjustments,
  meta.booking, cancel_reason, tip amounts, address_change_request, and the
  per-item meta the store sets (note, packed_at, unavailable, substitute_for,
  added_by_edit).
- New Request Address Change (POST orders/{id}/address-change-request).
- Product: track_inventory, inventory and in_stock.
- New List Product Booking Slots (GET products/{id}/slots).
- Checkout initialize: 422 cart_items_unavailable and booking_slot_unavailable.
- Notifications: order_updated, and what order_canceled now says.
From fleetbase/fleetops#394 (release v0.6.72):
- New Accept an Order and Decline an Order (POST orders/{id}/accept|decline).
- Cancel an Order takes a reason.
- Update an Order and Update a Payload: the status lock policy and its 422
  locked response, entities_mode=replace, cod_amount at the top level and 0.
- Entities: the 422 when the order's items are locked.
- Order: the offer field; Orders folder: offers and the order.changed,
  order.driver_unassigned and order.offer_* realtime events.
- The collection script honours expected_status, as the Storefront one does,
  so the offer requests can assert their 404 when a run has no offered order.
From fleetbase/core-api#306 (release v1.6.69):
- Comments: visibility on create and on the resource; the public list and
  retrieve leave internal comments and replies out; comment.created event.
- Chat: participant role and meta, message system and meta, null sender,
  and the Storefront order chat channel meta.
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