From 76c9d33eb2da5321270c0c92e9571e66e347421e Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Mon, 10 Aug 2026 23:13:42 +0800 Subject: [PATCH] fix(storefront): capture the ids the collection addresses, and create before retrieve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 23 of 60 requests pass. Only one variable was ever captured — customer_token — so requests addressing a resource by id sent an unresolved literal. Captured from responses that already succeed: customer_id from Authenticate a Customer (201) product_id from Create Product (201) store_id from About Store (200) Retrieve a Product ran at 2000, before Create Product at 3000, and Query Products returns [] on a freshly seeded store — so unlike the chat channel case there was no earlier source for the id. Create now precedes Retrieve, which also reads better as documentation. Not captured, because the endpoints that would supply them return empty on a seeded store: location_id (List Locations -> []) and order_id (List a customer orders -> []). Those need fixtures, not a capture. Not capturable at all from a contract run: apple_/google_/facebook identity tokens, and checkout_id, checkout_token, payment_intent_id and service_quote_id, which require a real payment gateway. Recorded rather than worked around. Verified with the CLI, not the filesystem: 60 requested, 60 attempted, 0 unresolved, and every touched file parses with its script compiling. Co-Authored-By: Claude Opus 5 --- .../Authenticate a Customer \342\235\227.request.yaml" | 3 +++ .../Products/Create Product.request.yaml | 10 +++++++++- .../Products/Retrieve a Product.request.yaml | 2 +- .../Store/About Store.request.yaml | 8 ++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git "a/postman/collections/Fleetbase Storefront API/Customer/Authenticate a Customer \342\235\227.request.yaml" "b/postman/collections/Fleetbase Storefront API/Customer/Authenticate a Customer \342\235\227.request.yaml" index b9b3389..c004406 100644 --- "a/postman/collections/Fleetbase Storefront API/Customer/Authenticate a Customer \342\235\227.request.yaml" +++ "b/postman/collections/Fleetbase Storefront API/Customer/Authenticate a Customer \342\235\227.request.yaml" @@ -24,5 +24,8 @@ scripts: if (json_response && json_response.token) { cv.set("customer_token", json_response.token); } + + // Requests that address the customer by id use {{customer_id}}; nothing set it. + cv.set("customer_id", json_response.id); language: text/javascript order: 1000 diff --git a/postman/collections/Fleetbase Storefront API/Products/Create Product.request.yaml b/postman/collections/Fleetbase Storefront API/Products/Create Product.request.yaml index f9f5775..03bdad3 100644 --- a/postman/collections/Fleetbase Storefront API/Products/Create Product.request.yaml +++ b/postman/collections/Fleetbase Storefront API/Products/Create Product.request.yaml @@ -13,4 +13,12 @@ body: "description": "Example storefront product", "price": 1000 } -order: 3000 +scripts: + - type: afterResponse + code: | + // Retrieve and Update Product address {{product_id}}; nothing set it. + var json_response = pm.response.json(); + let cv = pm.environment; + cv.set("product_id", json_response.id); + language: text/javascript +order: 2000 \ No newline at end of file diff --git a/postman/collections/Fleetbase Storefront API/Products/Retrieve a Product.request.yaml b/postman/collections/Fleetbase Storefront API/Products/Retrieve a Product.request.yaml index 717fbdd..f7f3741 100644 --- a/postman/collections/Fleetbase Storefront API/Products/Retrieve a Product.request.yaml +++ b/postman/collections/Fleetbase Storefront API/Products/Retrieve a Product.request.yaml @@ -5,4 +5,4 @@ url: "{{base_url}}/{{api_prefix}}/{{namespace}}/products/{id}" method: GET pathVariables: id: "" -order: 2000 +order: 3000 \ No newline at end of file diff --git a/postman/collections/Fleetbase Storefront API/Store/About Store.request.yaml b/postman/collections/Fleetbase Storefront API/Store/About Store.request.yaml index 45187e7..aaac125 100644 --- a/postman/collections/Fleetbase Storefront API/Store/About Store.request.yaml +++ b/postman/collections/Fleetbase Storefront API/Store/About Store.request.yaml @@ -2,4 +2,12 @@ $kind: http-request description: About Store url: "{{base_url}}/{{api_prefix}}/{{namespace}}/about" method: GET +scripts: + - type: afterResponse + code: | + // Lookup Store addresses {{store_id}}; nothing set it. + var json_response = pm.response.json(); + let cv = pm.environment; + cv.set("store_id", json_response.id); + language: text/javascript order: 2000