# shaswift324/mapuma-pays architecture

> Architecture diagram of the GitHub repository shaswift324/mapuma-pays, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shaswift324/mapuma-pays
- Repository: https://github.com/shaswift324/mapuma-pays

## Overview

MarketPay is a server-rendered Laravel system for public-market stall rentals: administrators manage vendors, stalls and fee rates; collectors record payments; vendors and staff can review billing and receipts. The principal collection path routes a collector’s submitted payment through validation and balance checks, creates payment/transaction/ticket records, and returns a ticket response. The README also documents reporting/export, audit history, notifications and role-based access. Edges reflect shown calls or README claims; unsampled implementations and integrations are not inferred.

Main entry points: [`routes/web.php`](https://github.com/shaswift324/mapuma-pays/blob/main/routes/web.php) (Role-based routes), [`app/Http/Controllers/PaymentController.php`](https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/PaymentController.php) (Payment recording), [`app/Models/Stall.php`](https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/Stall.php) (Stall billing rules), [`app/Http/Controllers/Auth/AuthenticatedSessionController.php`](https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php) (Session authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and routing"]
  node_web_routes["Role-based routes<br/>[web.php]"]
  node_auth["Session authentication"]
  node_login_form["Login form<br/>[login.blade.php]"]
  node_roles["Role and device access"]
end

subgraph group_market["Market administration"]
  node_vendors["Vendor management"]
  node_stalls["Stall registry"]
  node_fee_admin["Fee-rate management"]
  node_fee_rates[("Fee rates<br/>[FeeRate.php]")]
  node_stall_model["Stall billing rules<br/>[Stall.php]"]
  node_billing_calendar["Calendar billing"]
end

subgraph group_collection["Fee collection"]
  node_payment_entry["Payment recording"]
  node_payment_validation["Payment validation"]
  node_payments[("Payments<br/>[Payment.php]")]
  node_transactions[("Transactions<br/>[Transaction.php]")]
  node_tickets[("Tickets and QR<br/>[Ticket.php]")]
  node_receipts[("Receipts<br/>[Receipt.php]")]
  node_receipt_view["Ticket and receipt views<br/>[show.blade.php]"]
  node_offline["Offline collection sync"]
end

subgraph group_insights["Reporting and oversight"]
  node_dashboards["Role dashboards"]
  node_reports["Report generation<br/>[ReportService.php]"]
  node_report_export["Report exports"]
  node_audit["Audit history"]
  node_audit_store[("Audit log records<br/>[AuditLog.php]")]
  node_announcements["Announcements"]
  node_notifications[("User notifications")]
end

node_user(("Admin, collector, vendor"))

node_user -->|"requests pages"| node_web_routes
node_web_routes -->|"routes login"| node_auth
node_auth -->|"renders"| node_login_form
node_web_routes -->|"applies access"| node_roles
node_web_routes -->|"routes vendor admin"| node_vendors
node_web_routes -->|"routes stall admin"| node_stalls
node_web_routes -->|"routes fee admin"| node_fee_admin
node_web_routes -->|"routes payment entry"| node_payment_entry
node_web_routes -->|"routes reports"| node_reports
node_web_routes -->|"routes announcements"| node_announcements
node_fee_admin -->|"manages rates"| node_fee_rates
node_stalls -->|"selects rates"| node_fee_rates
node_stall_model -->|"resolves applicable rate"| node_fee_rates
node_stall_model -->|"calculates monthly fee"| node_billing_calendar
node_vendors -->|"computes vendor billing"| node_stall_model
node_payment_entry -->|"validates input"| node_payment_validation
node_payment_entry -->|"checks monthly fee"| node_stall_model
node_payment_entry -->|"records payment"| node_payments
node_payment_entry -->|"creates transaction"| node_transactions
node_payment_entry -->|"issues ticket"| node_tickets
node_payment_entry -->|"records collection action"| node_audit
node_payment_entry -.->|"returns ticket response"| node_receipt_view
node_offline -.->|"syncs collected payments"| node_payment_entry
node_web_routes -->|"routes ticket pages"| node_receipt_view
node_reports -->|"exports reports"| node_report_export
node_reports -->|"reads collection data"| node_payments
node_vendors -->|"reads payment history"| node_payments
node_auth -->|"records login"| node_audit
node_audit -->|"writes audit entries"| node_audit_store
node_announcements -->|"creates announcements"| node_notifications
node_web_routes -->|"routes dashboard"| node_dashboards

click node_web_routes "https://github.com/shaswift324/mapuma-pays/blob/main/routes/web.php"
click node_auth "https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_login_form "https://github.com/shaswift324/mapuma-pays/blob/main/resources/views/auth/login.blade.php"
click node_roles "https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Middleware/EnsureUserHasRole.php"
click node_vendors "https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/Admin/VendorController.php"
click node_stalls "https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/Admin/StallController.php"
click node_fee_admin "https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/Admin/FeeRateController.php"
click node_fee_rates "https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/FeeRate.php"
click node_stall_model "https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/Stall.php"
click node_billing_calendar "https://github.com/shaswift324/mapuma-pays/blob/main/app/Support/BillingCalendar.php"
click node_payment_entry "https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/PaymentController.php"
click node_payment_validation "https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Requests/StorePaymentRequest.php"
click node_payments "https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/Payment.php"
click node_transactions "https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/Transaction.php"
click node_tickets "https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/Ticket.php"
click node_receipts "https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/Receipt.php"
click node_receipt_view "https://github.com/shaswift324/mapuma-pays/blob/main/resources/views/tickets/show.blade.php"
click node_offline "https://github.com/shaswift324/mapuma-pays/blob/main/public/marketpay-offline.js"
click node_dashboards "https://github.com/shaswift324/mapuma-pays/blob/main/app/Services/DashboardAnalyticsService.php"
click node_reports "https://github.com/shaswift324/mapuma-pays/blob/main/app/Services/ReportService.php"
click node_report_export "https://github.com/shaswift324/mapuma-pays/blob/main/app/Services/ReportExportService.php"
click node_audit "https://github.com/shaswift324/mapuma-pays/blob/main/app/Services/AuditLogService.php"
click node_audit_store "https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/AuditLog.php"
click node_announcements "https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/Admin/AnnouncementController.php"
click node_notifications "https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/SystemNotification.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_routes,node_auth,node_login_form,node_roles toneBlue
class node_vendors,node_stalls,node_fee_admin,node_fee_rates,node_stall_model,node_billing_calendar toneAmber
class node_payment_entry,node_payment_validation,node_payments,node_transactions,node_tickets,node_receipts,node_receipt_view,node_offline toneMint
class node_dashboards,node_reports,node_report_export,node_audit,node_audit_store,node_announcements,node_notifications toneRose
class node_user toneIndigo
```

## Components

### Access and routing

- [Role-based routes](https://github.com/shaswift324/mapuma-pays/blob/main/routes/web.php): `routes/web.php`
- [Session authentication](https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php): `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [Login form](https://github.com/shaswift324/mapuma-pays/blob/main/resources/views/auth/login.blade.php): `resources/views/auth/login.blade.php`
- [Role and device access](https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Middleware/EnsureUserHasRole.php): `app/Http/Middleware/EnsureUserHasRole.php`

### Market administration

- [Vendor management](https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/Admin/VendorController.php): `app/Http/Controllers/Admin/VendorController.php`
- [Stall registry](https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/Admin/StallController.php): `app/Http/Controllers/Admin/StallController.php`
- [Fee-rate management](https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/Admin/FeeRateController.php): `app/Http/Controllers/Admin/FeeRateController.php`
- [Fee rates](https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/FeeRate.php): `app/Models/FeeRate.php`
- [Stall billing rules](https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/Stall.php): `app/Models/Stall.php`
- [Calendar billing](https://github.com/shaswift324/mapuma-pays/blob/main/app/Support/BillingCalendar.php): `app/Support/BillingCalendar.php`

### Fee collection

- [Payment recording](https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/PaymentController.php): `app/Http/Controllers/PaymentController.php`
- [Payment validation](https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Requests/StorePaymentRequest.php): `app/Http/Requests/StorePaymentRequest.php`
- [Payments](https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/Payment.php): `app/Models/Payment.php`
- [Transactions](https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/Transaction.php): `app/Models/Transaction.php`
- [Tickets and QR](https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/Ticket.php): `app/Models/Ticket.php`
- [Receipts](https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/Receipt.php): `app/Models/Receipt.php`
- [Ticket and receipt views](https://github.com/shaswift324/mapuma-pays/blob/main/resources/views/tickets/show.blade.php): `resources/views/tickets/show.blade.php`
- [Offline collection sync](https://github.com/shaswift324/mapuma-pays/blob/main/public/marketpay-offline.js): `public/marketpay-offline.js`

### Reporting and oversight

- [Role dashboards](https://github.com/shaswift324/mapuma-pays/blob/main/app/Services/DashboardAnalyticsService.php): `app/Services/DashboardAnalyticsService.php`
- [Report generation](https://github.com/shaswift324/mapuma-pays/blob/main/app/Services/ReportService.php): `app/Services/ReportService.php`
- [Report exports](https://github.com/shaswift324/mapuma-pays/blob/main/app/Services/ReportExportService.php): `app/Services/ReportExportService.php`
- [Audit history](https://github.com/shaswift324/mapuma-pays/blob/main/app/Services/AuditLogService.php): `app/Services/AuditLogService.php`
- [Audit log records](https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/AuditLog.php): `app/Models/AuditLog.php`
- [Announcements](https://github.com/shaswift324/mapuma-pays/blob/main/app/Http/Controllers/Admin/AnnouncementController.php): `app/Http/Controllers/Admin/AnnouncementController.php`
- [User notifications](https://github.com/shaswift324/mapuma-pays/blob/main/app/Models/SystemNotification.php): `app/Models/SystemNotification.php`

### Other components

- **Admin, collector, vendor**

## Connections

- Admin, collector, vendor → Role-based routes: requests pages (evidence: `routes/web.php`)
- Role-based routes → Session authentication: routes login (evidence: `routes/web.php`)
- Session authentication → Login form: renders (evidence: `app/Http/Controllers/Auth/AuthenticatedSessionController.php`)
- Role-based routes → Role and device access: applies access (evidence: `routes/web.php`)
- Role-based routes → Vendor management: routes vendor admin (evidence: `routes/web.php`)
- Role-based routes → Stall registry: routes stall admin (evidence: `routes/web.php`)
- Role-based routes → Fee-rate management: routes fee admin (evidence: `routes/web.php`)
- Role-based routes → Payment recording: routes payment entry (evidence: `routes/web.php`)
- Role-based routes → Report generation: routes reports (evidence: `routes/web.php`)
- Role-based routes → Announcements: routes announcements (evidence: `routes/web.php`)
- Fee-rate management → Fee rates: manages rates (evidence: `app/Http/Controllers/Admin/FeeRateController.php`)
- Stall registry → Fee rates: selects rates (evidence: `app/Http/Controllers/Admin/StallController.php`)
- Stall billing rules → Fee rates: resolves applicable rate (evidence: `app/Models/Stall.php`)
- Stall billing rules → Calendar billing: calculates monthly fee (evidence: `app/Models/Stall.php`)
- Vendor management → Stall billing rules: computes vendor billing (evidence: `app/Http/Controllers/Admin/VendorController.php`)
- Payment recording → Payment validation: validates input (evidence: `app/Http/Controllers/PaymentController.php`)
- Payment recording → Stall billing rules: checks monthly fee (evidence: `app/Http/Controllers/PaymentController.php`)
- Payment recording → Payments: records payment (evidence: `app/Http/Controllers/PaymentController.php`)
- Payment recording → Transactions: creates transaction (evidence: `app/Http/Controllers/PaymentController.php`)
- Payment recording → Tickets and QR: issues ticket (evidence: `app/Http/Controllers/PaymentController.php`)
- Payment recording → Audit history: records collection action (evidence: `app/Http/Controllers/PaymentController.php`)
- Payment recording → Ticket and receipt views: returns ticket response
- Offline collection sync → Payment recording: syncs collected payments
- Role-based routes → Ticket and receipt views: routes ticket pages (evidence: `routes/web.php`)
- Report generation → Report exports: exports reports (evidence: `app/Http/Controllers/Admin/ReportController.php`)
- Report generation → Payments: reads collection data (evidence: `app/Services/ReportService.php`)
- Vendor management → Payments: reads payment history (evidence: `app/Http/Controllers/Admin/VendorController.php`)
- Session authentication → Audit history: records login (evidence: `app/Http/Controllers/Auth/AuthenticatedSessionController.php`)
- Audit history → Audit log records: writes audit entries (evidence: `app/Services/AuditLogService.php`)
- Announcements → User notifications: creates announcements (evidence: `app/Http/Controllers/Admin/AnnouncementController.php`)
- Role-based routes → Role dashboards: routes dashboard (evidence: `routes/web.php`)
