diff --git "a/postman/collections/Fleetbase Storefront API/Checkout/Before \342\235\227.request.yaml" "b/postman/collections/Fleetbase Storefront API/Checkout/Before \342\235\227.request.yaml" index ea8dcd7..d898386 100644 --- "a/postman/collections/Fleetbase Storefront API/Checkout/Before \342\235\227.request.yaml" +++ "b/postman/collections/Fleetbase Storefront API/Checkout/Before \342\235\227.request.yaml" @@ -4,12 +4,22 @@ description: |- url: "{{base_url}}/{{api_prefix}}/{{namespace}}/checkouts/before" method: GET queryParams: - gateway: "" - customer: "" - cart: "" - service_quote: "" - cash: "" - pickup: "" - tip: "" - delivery_tip: "" + # `gateway` is the gateway CODE, not an id — "stripe", "cash", or whichever code the + # store has configured. CheckoutController resolves it with Storefront::findGateway(). + gateway: "stripe" + customer: "{{customer_id}}" + cart: "{{cart_id}}" + service_quote: "{{service_quote_id}}" + pickup: "false" +scripts: + - type: afterResponse + code: |- + // Capture checkout as order and Get Checkout Status both address + // {{checkout_token}}; nothing set it. + var json_response = pm.response.json(); + + if (json_response && json_response.token) { + pm.environment.set("checkout_token", json_response.token); + } + language: text/javascript order: 1000 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 debc90c..7ca2162 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" @@ -4,7 +4,20 @@ description: |- url: "{{base_url}}/{{api_prefix}}/{{namespace}}/service-quotes/from-cart" method: GET queryParams: - origin: "" - destination: "" - cart: "" + # origin and destination accept a place id, a store_location id, a vehicle id, a + # food_truck id, or a "lat,lng" pair. Coordinates are shown because that is what a + # storefront client usually has: the store's position and the customer's address. + origin: "1.3521,103.8198" + destination: "1.3644,103.9915" + cart: "{{cart_id}}" +scripts: + - type: afterResponse + code: |- + // Checkout/Before addresses {{service_quote_id}}; nothing set it. + var json_response = pm.response.json(); + + if (Array.isArray(json_response) && json_response.length) { + pm.environment.set("service_quote_id", json_response[0].id); + } + language: text/javascript order: 1000