The cart and checkout flow in La Casa del Bordadito ties together the menu, payment preferences, and order history into one seamless screen sequence. Items land in a live Firestore cart, a running total updates in real time, and completing a purchase generates a QR code that serves as the customer’s digital receipt — ready to be scanned at the counter.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AndresLopezCorrales/La-casa-del-bordadito/llms.txt
Use this file to discover all available pages before exploring further.
Adding items to the cart
Items can be added from two places:Café fragment quick-add
The + button (
btnAddCafe) on each card in the grid view calls anadirAlCarrito directly from FragmentCafe. The app selects the first key from the tamano map as the default size and writes the item to Firestore immediately.Detail screen add
Tapping any café item opens
DetalleCafeActivity. The customer picks a specific size from the RadioGroup, then taps Agregar to add the item with the chosen size and price.FragmentInicio) via CafeInicioAdapter.
CarritoItem model
| Field | Type | Description |
|---|---|---|
carritoItemId | String | Source item ID (Firestore cafes document ID, or bordado_{patronId}) |
nombre | String | Display name |
tamano | String | Selected size (e.g. "Mediano") |
precio | Double | Unit price in MXN |
cantidad | Int | Quantity; defaults to 1, incremented on duplicate adds |
imagenUrl | String | Image URL for the cart row |
Item ID format and quantity merging
The Firestore document ID for each cart item is constructed as"{carritoItemId}_{tamano}", for example "abc123_Mediano". Before writing, the app checks whether that document already exists:
- Exists → increments
cantidadby 1. - Does not exist → creates a new document with
cantidad = 1.
Firestore cart path
CarritoActivity attaches a snapshot listener to this subcollection via escucharCarrito(). Every change — including adds from other screens — is reflected live in the cart list and running total.
The cart badge in
MainActivity’s bottom navigation also updates in real time via a Firestore snapshot listener on the same carritos/{uid}/items path. The badge count equals the total number of distinct item documents in the subcollection.Cart screen
CarritoActivity presents a RecyclerView of cart items, a live txtTotal showing the running sum in MXN, and a MaterialButtonToggleGroup for selecting the payment method.
| Payment toggle | Behaviour |
|---|---|
| Efectivo (Cash) | Selected by default; calls procesarCompra("Efectivo") immediately on purchase |
| Card | Opens a card-selection dialog populated from saved payment methods in Realtime DB (Usuarios/{uid}/metodosPago) |
TarjetaAgregarActivity.
Order processing
Create order document
procesarCompra writes a new document to the ordenes Firestore collection containing the user’s email, total, timestamp, item list, and payment method. Firestore auto-generates the order ID.Clear the cart
After the order is confirmed, a Firestore batch delete removes every document from
carritos/{uid}/items.Sample Firestore orden document
QR receipt
QRActivity uses the ZXing library (BarcodeEncoder) to generate an 800 × 800 px QR code bitmap. The encoded JSON payload includes: