Phase 2 — Cart & Quote
The flow where a customer adds items to the cart and retrieves a quote from RideNDine. RideNDine is the source of truth for all fees — COOCO does not calculate them independently.
Overview
Customer → COOCO → RideNDine → COOCO → Customer
| Step | From | To | Action |
|---|---|---|---|
| 2.1 | Customer | COOCO | Internal — add to cart |
| 2.2 | COOCO | RideNDine | POST /checkout/quote |
| 2.3 | RideNDine | RideNDine | Internal pricing logic |
| 2.4 | RideNDine | COOCO | Response POST /checkout/quote |
| 2.5 | COOCO | Customer | Internal — display checkout total |
Step 2.1 — Add to Cart (Internal)
From: Customer → To: COOCO
Purpose: COOCO maintains cart state.
COOCO collects and prepares the following payload, then calls Directus Extension POST /ridendine/quote:
{
"merchant_id": "<stores.ridendine_merchant_id>",
"subtotal_cents": "<carts.subtotal_cents>",
"pickup": {
"lat": "<store lat>",
"lng": "<store lng>"
},
"delivery": {
"lat": "<customer lat>",
"lng": "<customer lng>",
"address": "<shipping_snapshot.address>"
},
"tip_cents": "<tip>",
"items": []
}
Step 2.2 — Get Quote from RideNDine
From: COOCO → To: RideNDine
Endpoint: POST /checkout/quote
Purpose: RideNDine calculates delivery_fee + service_fee + tax + tip.
COOCO does not calculate any fees independently. All pricing logic belongs to RideNDine.
Step 2.3 — Pricing Engine (RideNDine Internal)
From: RideNDine → To: RideNDine
RideNDine runs its internal pricing engine. COOCO does not participate in this step.
Step 2.4 — Receive Quote Response
From: RideNDine → To: COOCO
COOCO receives and stores the complete price breakdown:
| Field | Description |
|---|---|
quote_id | Quote identifier (used for order creation) |
subtotal_cents | Cart value |
delivery_fee_cents | Delivery fee |
service_fee_cents | Service fee |
tax_cents | Tax |
tip_cents | Tip amount |
total_cents | Grand total |
expires_at | Quote expiration time |
COOCO saves this to the checkout state or the ridendine_quotes collection.
Step 2.5 — Display Total (Internal)
From: COOCO → To: Customer
COOCO displays the breakdown from the quote response to the customer before confirmation.
COOCO MUST NOT calculate tax 8% + deliveryFeeCents locally. All figures must be taken from the RideNDine quote response.