Skip to content

feat(mobile-api): GET /api/mobile/invoices, GET /api/mobile/invoices/:id — invoice CRUD (P0, blocks iOS FEE-003/004) #278

Description

@abdout

Why

Guardians need to view their child's invoices on iOS to know what to pay. Accountants need access to record payments. Backend already has Invoice Prisma model + web UI; mobile endpoints missing.

Contract

GET /api/mobile/invoices
Authorization: Bearer <jwt>
Query: ?student_id=<id>&status=open|paid|overdue&page=1&page_size=20

Response 200:
{
  "data": [
    {
      "id": "<id>",
      "student_id": "<id>",
      "student_name": "<string>",
      "status": "open" | "paid" | "partial" | "overdue",
      "currency": "USD" | "SAR" | "SDG",  // from school config
      "amount_total": 1000.00,
      "amount_paid": 0.00,
      "balance": 1000.00,
      "due_date": "<ISO8601>",
      "issued_date": "<ISO8601>",
      "lang": "ar" | "en"
    }
  ],
  "meta": { "page": 1, "page_size": 20, "total": 12 }
}

GET /api/mobile/invoices/:id
Response: full detail with line_items[]

Implementation

  • Scope by JWT.schoolId
  • Guardian: only their children's invoices (via StudentGuardian join)
  • Accountant: all in school
  • Student: only their own
  • Currency from School.currency per tenant

iOS stories blocked

  • FEE-003 invoice-list
  • FEE-004 invoice-detail
  • PAY-005 payment-history (uses invoices)
  • M1 phase pilot expansion blocked without these

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Critical - drop everythingarea: financeFinance moduleenhancementNew feature or requestmobile-apiiOS / mobile app API endpointstaleStale issue/PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions