Avanzar In Time Shop uses a province-based lookup table for shipping costs, designed around Cuba’s geographic and administrative structure. Rather than a complex real-time carrier integration, each combination of destination province and billing currency maps to a flat rate stored in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ItsJhonAlex/Ecommerce/llms.txt
Use this file to discover all available pages before exploring further.
shipping_rates table. At checkout, the backend resolves the correct rate automatically from the recipient’s declared province and the order currency.
Shipping Rate Fields
Theshipping_rates table has a unique constraint on (province, currency) — there can only be one active rate per province-currency pair at any time.
| Column | Type | Notes |
|---|---|---|
id | UUID | Primary key, generated by the database |
province | text | Destination province name (must match exactly the value supplied at checkout) |
currency | text | ISO 4217 currency code (e.g., "USD", "CUP") |
amountMinor | integer | Shipping cost in the currency’s minor units (cents) |
active | boolean (default true) | Only active = true rates are used during checkout; set to false to temporarily suspend a rate without deleting it |
Order Recipient vs. Buyer
Avanzar explicitly separates the buyer from the recipient, a distinction that reflects how overseas customers commonly shop for family members in Cuba.Buyer
The person paying for the order. May be located abroad (e.g., sending USD via Zelle from the United States). Captured as a snapshot on the order via
buyerName, buyerEmail, and buyerPhone.Recipient
The person receiving the shipment in Cuba. Captured as a full address snapshot on the order. This is the address used to calculate the shipping rate.
orders row as a snapshot, not as a foreign key to the addresses table. This means the delivery details are permanently frozen at the moment of purchase — if the customer later edits their address book, past order history is unaffected.
Recipient fields on the orders table:
| Field | Description |
|---|---|
shipRecipient | Full name of the recipient |
shipPhone | Contact phone number for the recipient |
shipProvince | Destination province (used for shipping rate lookup) |
shipMunicipality | Destination municipality |
shipAddressLine | Street address and house number |
shipReference | Optional delivery landmark or gate reference |
Checkout Shipping Resolution
Checkout payload includes recipient province and currency
The storefront sends a
CheckoutInput payload containing recipient.province and currency (validated as a 3-character ISO 4217 code via Zod schema).Missing rate → 422 error
If no matching active rate is found, the checkout is aborted immediately with HTTP
422 Unprocessable Entity and error code SHIPPING_NOT_SUPPORTED. The order is not created.Order Totals
Order totals are computed server-side bycomputeOrderTotals from the backend checkout service and stored as four integer fields on the orders row:
| Field | Description |
|---|---|
subtotalMinor | Sum of all line totals: unitAmountMinor × quantity for every item |
shippingMinor | Shipping cost resolved from the shipping_rates lookup |
discountMinor | Reserved for future discount/coupon codes; always 0 in V1 |
totalMinor | Final amount: subtotal + shipping − discount |
All order totals are calculated server-side from prices stored in the database. The checkout endpoint ignores any price or total values that the client may include in the request body — only
productId, quantity, currency, and recipient/buyer details are accepted from the client. This prevents price-tampering attacks.Address Book
Authenticated customers can maintain a personal address book using theaddresses table. These saved addresses are independent from order snapshots and can be managed via the addresses API:
| Endpoint | Action |
|---|---|
GET /api/v1/addresses | List all addresses for the authenticated user |
POST /api/v1/addresses | Create a new saved address |
PATCH /api/v1/addresses/:id | Update an existing saved address |
DELETE /api/v1/addresses/:id | Delete a saved address |
addresses table is scoped to userId with a CASCADE delete — all saved addresses are removed if the user account is deleted. Guest checkouts (where userId is null on the order) do not create address book entries.