From 6c6682cd55590fab73f1c353e791b7b74c5a10f0 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Thu, 13 Aug 2026 12:24:23 +0800 Subject: [PATCH] fix(storefront): capture the service quote from a single-object response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /service-quotes/from-cart answers with ONE quote object, not a list. The capture script only handled an array, so {{service_quote_id}} was never set and Checkout/Before failed with "The service quote field is required." The quote itself was fine — the run returns 201 with quote_dmyz2iygqj priced from the seeded service rate. Only the capture was wrong. Both shapes are accepted so a future multi-quote response keeps working, and the quote is now asserted rather than silently skipped when absent. This is the head of the checkout chain: Before, Capture checkout as order, Get Checkout Status, Update Stripe Payment Intent, and behind those Complete Order Pickup and Get Order Receipt all wait on this id. Co-Authored-By: Claude Opus 5 --- ...ivery Service Quote \342\235\227.request.yaml" | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git "a/postman/collections/Fleetbase Storefront API/Delivery Service Quote/Retrieve a Delivery Service Quote \342\235\227.request.yaml" "b/postman/collections/Fleetbase Storefront API/Delivery Service Quote/Retrieve a Delivery Service Quote \342\235\227.request.yaml" index 7ca2162..c3fdf56 100644 --- "a/postman/collections/Fleetbase Storefront API/Delivery Service Quote/Retrieve a Delivery Service Quote \342\235\227.request.yaml" +++ "b/postman/collections/Fleetbase Storefront API/Delivery Service Quote/Retrieve a Delivery Service Quote \342\235\227.request.yaml" @@ -14,10 +14,21 @@ scripts: - type: afterResponse code: |- // Checkout/Before addresses {{service_quote_id}}; nothing set it. + // + // from-cart answers with a SINGLE quote object, not a list — an earlier version of + // this script only handled an array, so the id was never captured and Before failed + // with "The service quote field is required." Both shapes are accepted here so a + // future multi-quote response keeps working. var json_response = pm.response.json(); + var quote = Array.isArray(json_response) ? json_response[0] : json_response; - if (Array.isArray(json_response) && json_response.length) { - pm.environment.set("service_quote_id", json_response[0].id); + pm.test("Retrieve a Delivery Service Quote returns a quote", function () { + pm.expect(quote, "no quote returned").to.be.an('object'); + pm.expect(quote.id, "quote has no id").to.be.a('string').and.not.empty; + }); + + if (quote && quote.id) { + pm.environment.set("service_quote_id", quote.id); } language: text/javascript order: 1000