Skip to main content

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.

Every completed order in La Casa del Bordadito is saved to Firestore and can be reviewed at any time from the order history screen. The history gives you a timestamped receipt for each purchase, including all items, their sizes, quantities, the grand total, and how the order was paid.

Accessing your order history

Tap the history icon in the MainActivity toolbar. This launches HistorialActivity, which immediately queries Firestore for your orders.

How orders are loaded

HistorialActivity.cargarHistorial() fetches all documents from the ordenes Firestore collection where the usuario field equals the current user’s email address:
private fun cargarHistorial() {
    val user = FirebaseAuth.getInstance().currentUser ?: return
    val db = FirebaseFirestore.getInstance()

    db.collection("ordenes")
        .whereEqualTo("usuario", user.email)
        .get()
        .addOnSuccessListener { result ->
            listaOrdenes.clear()
            for (doc in result) {
                val orden = doc.toObject(Orden::class.java)
                orden.id = doc.id
                listaOrdenes.add(orden)
            }

            listaOrdenes.sortByDescending { it.fecha }
            adapter.notifyDataSetChanged()
        }
}
After loading, the list is sorted descending by the fecha timestamp so your most recent purchase always appears at the top.

The Orden data model

Each document in the ordenes collection maps to the Orden data class:
data class Orden(
    var id: String = "",
    var usuario: String = "",
    var total: String = "",
    var fecha: Long = 0,
    var items: List<CarritoItem> = emptyList(),
    var metodoPago: String = ""
) : Serializable
FieldTypeDescription
idStringFirestore document ID (assigned automatically)
usuarioStringAccount email used to look up this user’s orders
totalStringOrder grand total, e.g. "$185.00"
fechaLongSystem.currentTimeMillis() at checkout time
itemsList<CarritoItem>All products in the order
metodoPagoStringPayment description, e.g. "Efectivo" or "Visa **** 4242"

CarritoItem fields

Each item in the items list is a CarritoItem:
data class CarritoItem(
    var carritoItemId: String = "",
    var nombre: String = "",
    var tamano: String = "",
    var precio: Double = 0.0,
    var cantidad: Int = 1,
    var imagenUrl: String = ""
) : Serializable
FieldDescription
carritoItemIdProduct identifier
nombreProduct name
tamanoSize selected at the time of purchase
precioUnit price
cantidadQuantity ordered
imagenUrlFirebase Storage URL for the product thumbnail

Viewing order details

Tap any row in HistorialActivity to open HistorialDetalleActivity. The order is passed as a serializable extra:
val intent = Intent(this, HistorialDetalleActivity::class.java)
intent.putExtra("orden", orden)
startActivity(intent)
HistorialDetalleActivity.mostrarDatos() displays:
  • Folio: last 8 characters of the Firestore document ID, uppercased.
  • Date and time: formatted with SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.getDefault()) applied to orden.fecha.
  • Payment method: the metodoPago string.
  • Total: the total string.
  • Product list: rendered in a read-only RecyclerView using CarritoAdapter(orden.items, isReadOnly = true).

Sample Firestore order document

{
  "usuario": "ana@example.com",
  "total": "$245.00",
  "fecha": 1718300000000,
  "metodoPago": "Visa **** **** **** 4242",
  "items": [
    {
      "carritoItemId": "cafe_001",
      "nombre": "Café de olla",
      "tamano": "Grande",
      "precio": 65.0,
      "cantidad": 2,
      "imagenUrl": "https://firebasestorage.googleapis.com/..."
    },
    {
      "carritoItemId": "bordado_012",
      "nombre": "Patrón floral (kit)",
      "tamano": "Mediano",
      "precio": 115.0,
      "cantidad": 1,
      "imagenUrl": "https://firebasestorage.googleapis.com/..."
    }
  ]
}
The QR code generated on the confirmation screen at the end of checkout acts as your receipt. Take a screenshot of it before leaving that screen — the QR is not stored inside HistorialDetalleActivity and cannot be regenerated from the history view.

Build docs developers (and LLMs) love