Test Cases: Dues Invoicing
POST /api/billing/admin/members/:memberId/dues (preview GET .../dues/calculate); bulk dues = POST /api/billing/internal/dues/run. The /admin/dues/generate-bulk endpoint cited below never existed, and POST /dues/runs + GET /dues/summary are still 501 stubs (don't test them). There are no Founding / Corporate membership types and no exemption config — seeded types are only Regular ₱15k / Associate ₱10k / Student ₱5k, and the amount charged is the global TenantDuesSettings.annualAmountCents. Run bulk dues from the "Create dues run" action at /admin/reports/dues-summary (ADMIN only). Treat the steps below as outdated; follow the index.
Module: Dues Management - Invoicing
Backend Endpoints:
POST /api/billing/admin/members/:memberId/duesPOST /api/billing/internal/dues/run(bulk dues run — replaces the fictional/admin/dues/generate-bulk)
Frontend Page: frontend/pwa-app/src/pages/AdminDuesSummaryPage.tsx
Prerequisites
- Dues settings configured.
- Members without existing dues invoices for current period.
- Test data from
00_MASTER_TEST_DATA.mdis seeded.
Test Data
| Member | Type | Has 2024 Dues Invoice | Expected Action |
|---|---|---|---|
| Maria Cruz | Regular | No | Can create |
| Miguel Fernandez | Associate | No | Can create |
| Admin User | Founding | N/A | Cannot create (exempt) |
| Antonio Dela Cruz | Regular | Yes (Pending) | Cannot duplicate |
Test Cases
TC-DUES-031: Create Dues Invoice for Single Member
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as Ana Reyes (FINANCE_MANAGER). | Dashboard displayed. |
| 2 | Navigate to member: Maria Cruz. | Member details displayed. |
| 3 | Click "Generate Dues Invoice" or similar. | Invoice creation preview displayed. |
| 4 | Verify calculated amount. | PHP 15,000 (Regular Member dues). |
| 5 | Verify dues period. | Year 2024. |
| 6 | Confirm invoice creation. | API POST /api/billing/admin/members/:id/dues called. |
| 7 | Verify success message. | "Dues invoice created" displayed. |
| 8 | Verify invoice created. | RCME-DUES-XXXX created with PENDING status. |
| 9 | Verify invoice details. | Line item: "Annual Membership Dues 2024 - PHP 15,000". |
TC-DUES-032: Create Dues Invoice - Pro-Rated Amount
| Step | Action | Expected Result |
|---|---|---|
| 1 | Enable pro-rata in settings. | Setting saved. |
| 2 | Navigate to Miguel Fernandez (joined July). | Member displayed. |
| 3 | Generate dues invoice. | Preview displayed. |
| 4 | Verify pro-rata calculation. | PHP 5,000 (6 months of PHP 10,000). |
| 5 | Confirm creation. | Invoice created with pro-rated amount. |
TC-DUES-033: Cannot Create Dues Invoice - Exempt Member
| Step | Action | Expected Result |
|---|---|---|
| 1 | Navigate to Admin User (Founding Member). | Member displayed. |
| 2 | Look for "Generate Dues Invoice" option. | Option not visible or disabled. |
| 3 | Verify message. | "Member is exempt from dues" or similar. |
| 4 | Attempt via direct API. | Status 400 Bad Request - "Member is exempt". |
TC-DUES-034: Cannot Create Duplicate Dues Invoice
| Step | Action | Expected Result |
|---|---|---|
| 1 | Navigate to member with existing 2024 dues invoice. | Member displayed. |
| 2 | Attempt to generate dues invoice for 2024. | Warning displayed. |
| 3 | Verify message. | "Dues invoice for 2024 already exists". |
| 4 | Verify existing invoice shown. | Link to existing invoice RCME-DUES-XXXX. |
TC-DUES-035: Bulk Generate Dues Invoices
| Step | Action | Expected Result |
|---|---|---|
| 1 | Navigate to Dues Summary page. | Dashboard displayed. |
| 2 | Click "Generate Bulk Invoices" or similar. | Bulk generation form displayed. |
| 3 | Select year: 2024. | Year selected. |
| 4 | Select membership types: All non-exempt. | Types selected. |
| 5 | Preview bulk generation. | Shows: X invoices to be created, total amount. |
| 6 | Confirm bulk generation. | API POST /api/billing/admin/dues/generate-bulk called. |
| 7 | Verify progress. | Progress indicator shown (for large batches). |
| 8 | Verify completion. | "X invoices created successfully" message. |
| 9 | Verify invoices. | All applicable members have dues invoices. |
TC-DUES-036: Bulk Generate - Skip Existing
| Step | Action | Expected Result |
|---|---|---|
| 1 | Some members already have 2024 dues invoices. | - |
| 2 | Run bulk generation for 2024. | Processing starts. |
| 3 | Verify existing invoices skipped. | Only new invoices created for members without. |
| 4 | Verify summary. | "X created, Y skipped (already exists)". |
TC-DUES-037: Bulk Generate - Skip Exempt
| Step | Action | Expected Result |
|---|---|---|
| 1 | Run bulk generation. | Processing starts. |
| 2 | Verify exempt members skipped. | Founding Members not invoiced. |
| 3 | Verify summary. | "Z skipped (exempt)". |
TC-DUES-038: Bulk Generate - Filter by Membership Type
| Step | Action | Expected Result |
|---|---|---|
| 1 | Open bulk generation. | Form displayed. |
| 2 | Select only "Regular Member" type. | Type selected. |
| 3 | Generate invoices. | Only Regular Members invoiced. |
| 4 | Verify. | Associate, Student, Corporate members not invoiced. |
TC-DUES-039: Auto-Generate Dues on Approval
| Step | Action | Expected Result |
|---|---|---|
| 1 | Configure setting: Auto-generate dues on member approval. | Setting enabled. |
| 2 | Approve a pending member application. | Member approved. |
| 3 | Verify dues invoice auto-created. | Invoice created automatically. |
| 4 | Verify pro-rata if applicable. | Amount calculated based on approval date. |
TC-DUES-040: Send Dues Invoice via Email
| Step | Action | Expected Result |
|---|---|---|
| 1 | Create dues invoice for member. | Invoice created. |
| 2 | Click "Send Invoice" from dues summary. | Email sent. |
| 3 | Verify member receives email. | Email with dues invoice details received. |
| 4 | Verify email content. | Amount, due date, payment instructions. |
TC-DUES-041: Bulk Send Dues Invoices
| Step | Action | Expected Result |
|---|---|---|
| 1 | Select multiple members with pending dues. | Members selected. |
| 2 | Click "Send Invoices". | Bulk send initiated. |
| 3 | Verify. | All selected members receive invoice emails. |
TC-DUES-042: Dues Invoice Line Item Description
| Step | Action | Expected Result |
|---|---|---|
| 1 | Create dues invoice for 2024. | Invoice created. |
| 2 | View invoice line items. | Line item displayed. |
| 3 | Verify description. | "Annual Membership Dues 2024" or similar. |
| 4 | Verify amount. | Correct dues amount. |
TC-DUES-043: Create Dues Invoice - Pending Member
| Step | Action | Expected Result |
|---|---|---|
| 1 | Navigate to Miguel Fernandez (PENDING_APPROVAL status). | Member displayed. |
| 2 | Attempt to generate dues invoice. | May be blocked or allowed. |
| 3 | Verify business rule. | "Cannot invoice pending member" or allowed with warning. |
TC-DUES-044: Dues Invoice with Custom Notes
| Step | Action | Expected Result |
|---|---|---|
| 1 | Generate dues invoice. | Invoice form displayed. |
| 2 | Add notes: "Early bird discount if paid before Jan 15". | Notes entered. |
| 3 | Create invoice. | Invoice created with notes. |
| 4 | Verify notes on invoice. | Notes appear on member view. |
TC-DUES-045: Void Dues Invoice and Recreate
| Step | Action | Expected Result |
|---|---|---|
| 1 | Void an existing dues invoice. | Invoice voided. |
| 2 | Attempt to create new dues invoice for same period. | Should be allowed (since previous voided). |
| 3 | Create new invoice. | New invoice created. |
| 4 | Verify. | Member has new active dues invoice. |
API Test Cases
TC-DUES-API-008: POST /api/billing/admin/members/:memberId/dues
Request: POST /api/billing/admin/members/MEM-2024-0004/dues
{
"year": 2024,
"notes": "Annual membership dues",
"sendEmail": true
}
Expected Response: 201 Created
{
"invoice": {
"id": "RCME-DUES-XXXX",
"invoiceNumber": "RCME-DUES-XXXX",
"memberId": "MEM-2024-0004",
"type": "DUES",
"year": 2024,
"amount": 15000,
"status": "PENDING",
"dueDate": "2024-01-31",
"lines": [
{
"description": "Annual Membership Dues 2024",
"amount": 15000
}
]
},
"emailSent": true
}
TC-DUES-API-009: POST /api/billing/admin/members/:memberId/dues - Exempt
Request: POST /api/billing/admin/members/MEM-2024-0001/dues
Expected Response: 400 Bad Request
{
"error": "MEMBER_EXEMPT",
"message": "Member is exempt from dues (Founding Member)"
}
TC-DUES-API-010: POST /api/billing/admin/members/:memberId/dues - Duplicate
Request: POST /api/billing/admin/members/MEM-2024-0006/dues (already has 2024 invoice)
Expected Response: 400 Bad Request
{
"error": "DUPLICATE_INVOICE",
"message": "Dues invoice for 2024 already exists",
"existingInvoiceId": "RCME-DUES-0002"
}
TC-DUES-API-011: POST /api/billing/admin/dues/generate-bulk
Request:
{
"year": 2024,
"membershipTypes": ["TYPE_002", "TYPE_003", "TYPE_004", "TYPE_005"],
"sendEmails": false
}
Expected Response: 200 OK
{
"summary": {
"created": 45,
"skipped": {
"existing": 10,
"exempt": 5,
"pending": 3
},
"total": 63
},
"invoices": [
{ "invoiceId": "RCME-DUES-XXXX", "memberId": "...", "amount": 15000 }
]
}
TC-DUES-API-012: POST /api/billing/admin/dues/generate-bulk - Preview
Request:
{
"year": 2024,
"membershipTypes": ["TYPE_002"],
"preview": true
}
Expected Response: 200 OK
{
"preview": true,
"willCreate": 45,
"willSkip": {
"existing": 10,
"exempt": 0
},
"totalAmount": 675000,
"members": [
{ "id": "MEM-...", "name": "...", "amount": 15000 }
]
}