Files
rose-ash/cart
giles d53b9648a9
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m15s
Phase 6: Replace render_template() with s-expression rendering in all GET routes
Migrate ~52 GET route handlers across all 7 services from Jinja
render_template() to s-expression component rendering. Each service
gets a sexp_components.py with page/oob/cards render functions.

- Add per-service sexp_components.py (account, blog, cart, events,
  federation, market, orders) with full page, OOB, and pagination
  card rendering
- Add shared/sexp/helpers.py with call_url, root_header_html,
  full_page, oob_page utilities
- Update all GET routes to use get_template_context() + render fns
- Fix get_template_context() to inject Jinja globals (URL helpers)
- Add qs_filter to base_context for sexp filter URL building
- Mount sexp_components.py in docker-compose.dev.yml for all services
- Import sexp_components in app.py for Hypercorn --reload watching
- Fix route_prefix import (shared.utils not shared.infrastructure.urls)
- Fix federation choose-username missing actor in context
- Fix market page_markets missing post in context

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 23:19:33 +00:00
..
2026-02-24 20:13:00 +00:00

Cart App

Shopping cart, checkout, and order management service for the Rose Ash cooperative. Integrates with SumUp for payment processing.

Structure

app.py                  # Application factory (create_base_app + blueprints)
path_setup.py           # Adds project root + app dir to sys.path
entrypoint.sh           # Container entrypoint (Redis flush, start)
bp/
  cart/                 # Cart blueprint
    global_routes.py    #   Add to cart, checkout, webhooks, return page
    page_routes.py      #   Page-scoped cart and checkout
    overview_routes.py  #   Cart overview / summary page
    services/           #   Business logic
      checkout.py       #     Order creation, SumUp integration
      check_sumup_status.py  #  Payment status polling
      calendar_cart.py  #     Calendar entry cart queries
      page_cart.py      #     Page-scoped cart queries
      get_cart.py       #     Cart item queries
      identity.py       #     Cart identity (user_id / session_id)
      total.py          #     Price calculations
      clear_cart_for_order.py  # Soft-delete cart after checkout
  order/                # Single order detail view
  orders/               # Order listing view
  fragments/            # cart-mini fragment, account-nav-item fragment
models/                 # Re-export stubs (Order, OrderItem, PageConfig)
services/               # register_domain_services() — wires cart + calendar + market
templates/              # Cart-specific templates (override shared/)

Cart identity

Cart items are keyed by user_id (logged in) or session_id (anonymous). On login, anonymous cart items are adopted to the user's account.

Cross-domain communication

  • services.calendar.* — claim/confirm entries for orders, adopt on login
  • services.market.* — marketplace queries for page-scoped carts
  • services.blog.* — post lookup for page context

Fragments served

  • cart-mini — cart icon + badge count
  • account-nav-item — orders link for account nav

Checkout flow

  1. User clicks "Checkout"
  2. create_order_from_cart() creates Order + OrderItems
  3. services.calendar.claim_entries_for_order() marks entries as "ordered"
  4. Emits Create / rose:Order activity
  5. SumUp hosted checkout created, user redirected
  6. SumUp webhook / return page triggers check_sumup_status()
  7. If PAID: services.calendar.confirm_entries_for_order(), emits rose:OrderPaid