Temă
Checkout, orders, reviews and promotions
Everything that involves money or couriers is simulated: no payment processor, no courier API, no cost.
Simulated card payments
| Card number | Result |
|---|---|
4242 4242 4242 4242 (any future expiry, any CVC) | approved |
4000 0000 0000 0002 | declined (PAYMENT_DECLINED, reason declined) |
4000 0000 0000 9995 | declined (reason: insufficient_funds) |
| any other valid number (Luhn) | approved |
Numbers are checked (Luhn, expiry, CVC) and never stored: the payment row keeps only the brand and a simulated reference. The same cards work for promotions. The checkout page lists them with one-click fill.
Order lifecycle
PAID → (seller) ship: a courier and AWB are generated → SHIPPED → courier event delivered → DELIVERED → (buyer) confirm or automatically after 48 h (listing_rules.autoConfirmHours) → COMPLETED, payout released. Before shipping, buyer or seller can cancel: card payments are refunded and the listing is for sale again. Cash on delivery: the payment is recorded when the courier delivers.
- The listing row is locked while an order is placed: two buyers at the same moment cannot both buy it (tested).
- An accepted offer can be used at checkout (
/checkout/:id?offer=…), only by the buyer it was made with. - There is no courier integration yet, so "delivered" is triggered by the button Simulează livrarea (or the
simulateDeliverymutation); both needDIAGNOSTICS_ENABLED=true.runOrderAutoConfirmruns the 48 h job now.
Messages sent by orders
| Moment | In-app + push | SMS (captured in Mailpit, tag sms) |
|---|---|---|
| Order placed | seller and buyer | seller's phone |
| Shipped | buyer | delivery phone, with courier and AWB |
| Delivered | buyer | delivery phone, with the confirmation link |
| Completed | seller | seller's phone, money released |
| Cancelled | the other person | — |
SMS texts are written without diacritics so they fit in one 160-character segment.
Reviews and promotions
- One review per completed order (buyer → seller). The seller's average and count are updated in one SQL statement, so existing totals (imported/demo accounts) are kept.
- Promotion packages come from
platform_settings.promotion_packages; "Urcare în listă" also moves the listing to the top of "Cele mai noi"; buying the same package again extends the running one.
Tests
tests/e2e/orders.e2e.mjs — 41 checks, including the race between two buyers and the SMS contents.