Test Cases: Invoice Actions
Module: Billing & Invoicing - Invoice Actions
Backend Endpoints:
POST /api/billing/invoices/:id/mark-paidPOST /api/billing/admin/invoices/:id/voidPOST /api/billing/invoices/:id/sendGET /api/billing/invoices/:id/pdf
Frontend Page: frontend/pwa-app/src/pages/AdminInvoicesPage.tsx
Prerequisites
- User logged in with ADMIN or FINANCE_MANAGER role.
- Test invoices exist in various statuses.
- Email service configured and operational.
Test Data
| Invoice | Status | Member | Action to Test |
|---|---|---|---|
| RCME-DUES-0002 | PENDING | Antonio Dela Cruz | Mark as Paid, Void, Send |
| RCME-DUES-0003 | OVERDUE | Antonio Dela Cruz | Mark as Paid, Void, Send Reminder |
| RCME-DUES-0001 | PAID | Maria Cruz | Download PDF only |
Test Cases
TC-BIL-033: Mark Invoice as Paid
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as Ana Reyes (FINANCE_MANAGER). | Dashboard displayed. |
| 2 | Navigate to invoice RCME-DUES-0002 (PENDING). | Invoice detail page displayed. |
| 3 | Click "Mark as Paid" button. | Payment modal/form opens. |
| 4 | Select payment method: Bank Transfer. | Method selected. |
| 5 | Enter payment reference: BDO-987654321. | Reference entered. |
| 6 | Enter payment date: Today. | Date populated. |
| 7 | Click "Confirm Payment". | API POST /api/billing/invoices/:id/mark-paid called. |
| 8 | Verify API response. | Status 200 OK. Invoice status updated. |
| 9 | Verify invoice status. | Status changed to "PAID". |
| 10 | Verify payment record created. | Payment entry visible in payment history. |
TC-BIL-034: Mark Invoice as Paid - Partial Payment
| Step | Action | Expected Result |
|---|---|---|
| 1 | Open invoice with total PHP 15,000 (PENDING). | Invoice displayed. |
| 2 | Click "Mark as Paid". | Payment form opens. |
| 3 | Enter amount: PHP 5,000 (less than total). | Partial amount entered. |
| 4 | Confirm payment. | Payment recorded. |
| 5 | Verify invoice status. | Status changed to "PARTIALLY_PAID". |
| 6 | Verify balance. | Balance due: PHP 10,000 displayed. |
TC-BIL-035: Mark Already Paid Invoice
| Step | Action | Expected Result |
|---|---|---|
| 1 | Open RCME-DUES-0001 (PAID status). | Invoice displayed. |
| 2 | Look for "Mark as Paid" button. | Button not visible or disabled. |
| 3 | Attempt via direct API call. | Status 400 Bad Request - "Invoice already paid". |
TC-BIL-036: Void Invoice
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as ADMIN or FINANCE_MANAGER. | - |
| 2 | Open invoice RCME-DUES-0002 (PENDING). | Invoice detail displayed. |
| 3 | Click "Void Invoice" button. | Confirmation modal opens. |
| 4 | Enter void reason: "Duplicate invoice created in error". | Reason entered. |
| 5 | Confirm void action. | API POST /api/billing/admin/invoices/:id/void called. |
| 6 | Verify API response. | Status 200 OK. |
| 7 | Verify invoice status. | Status changed to "VOIDED". |
| 8 | Verify void reason recorded. | Reason visible in invoice details. |
| 9 | Verify audit log. | Void action logged with user and timestamp. |
TC-BIL-037: Void Invoice - Validation (Already Paid)
| Step | Action | Expected Result |
|---|---|---|
| 1 | Open RCME-DUES-0001 (PAID status). | Invoice displayed. |
| 2 | Attempt to void invoice. | Error: "Cannot void paid invoice" or action blocked. |
| 3 | Verify via API. | Status 400 Bad Request - business rule violation. |
TC-BIL-038: Void Invoice Without Reason
| Step | Action | Expected Result |
|---|---|---|
| 1 | Click "Void Invoice". | Modal opens. |
| 2 | Leave reason field empty. | - |
| 3 | Click confirm. | Validation error: "Void reason is required". |
TC-BIL-039: Send Invoice via Email
| Step | Action | Expected Result |
|---|---|---|
| 1 | Open invoice RCME-DUES-0002 (PENDING). | Invoice displayed. |
| 2 | Click "Send Invoice" or email icon. | Confirmation dialog appears. |
| 3 | Verify recipient email displayed. | Shows: expired@demo.membervu.com |
| 4 | Click "Send". | API POST /api/billing/invoices/:id/send called. |
| 5 | Verify success message. | "Invoice sent successfully" displayed. |
| 6 | Verify email sent. | Check email log or member's inbox. |
| 7 | Verify email content. | Contains invoice details, amount, due date, payment link. |
TC-BIL-040: Send Payment Reminder
| Step | Action | Expected Result |
|---|---|---|
| 1 | Open RCME-DUES-0003 (OVERDUE). | Invoice displayed. |
| 2 | Click "Send Reminder". | Confirmation dialog appears. |
| 3 | Confirm send. | Reminder email sent. |
| 4 | Verify email. | Contains "OVERDUE" emphasis, amount owed, payment link. |
| 5 | Verify reminder count. | Reminder count incremented in invoice record. |
TC-BIL-041: Download Invoice PDF
| Step | Action | Expected Result |
|---|---|---|
| 1 | Open any invoice. | Invoice displayed. |
| 2 | Click "Download PDF" or PDF icon. | API GET /api/billing/invoices/:id/pdf called. |
| 3 | Verify download initiated. | PDF file downloads to browser. |
| 4 | Open downloaded PDF. | PDF contains complete invoice information. |
| 5 | Verify PDF content. | Organization logo, invoice details, line items, total, payment instructions. |
TC-BIL-042: Download PDF - Non-Existent Invoice
| Step | Action | Expected Result |
|---|---|---|
| 1 | Request PDF for non-existent invoice ID. | Error response. |
| 2 | Verify API response. | Status 404 Not Found. |
TC-BIL-043: Invoice Actions - Permission Denied (Member Role)
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as Maria Cruz (MEMBER). | Member dashboard displayed. |
| 2 | View own invoice RCME-DUES-0005. | Invoice displayed. |
| 3 | Verify available actions. | Only "Pay Now" and "Download PDF" visible. |
| 4 | Verify "Void" not available. | No void button visible. |
| 5 | Verify "Mark as Paid" not available. | No mark paid button visible. |
| 6 | Attempt direct API void call. | Status 403 Forbidden. |
TC-BIL-044: Bulk Actions - Send Multiple Invoices
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as ADMIN, go to invoice list. | Invoice list displayed. |
| 2 | Select checkbox for multiple pending invoices. | Multiple rows selected. |
| 3 | Click "Bulk Send" action. | Confirmation dialog for bulk send. |
| 4 | Confirm. | All selected invoices sent via email. |
| 5 | Verify success. | Success message with count of sent invoices. |
TC-BIL-045: Recompute Invoice Statuses
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as ADMIN. | - |
| 2 | Navigate to billing settings or invoice management. | - |
| 3 | Find "Recompute Statuses" action. | Button/link available. |
| 4 | Execute recompute. | API POST /api/billing/admin/invoices/recompute-statuses called. |
| 5 | Verify results. | Invoices past due date changed from PENDING to OVERDUE. |
API Test Cases
TC-BIL-API-010: POST /api/billing/invoices/:id/mark-paid
Request:
{
"amount": 15000,
"paymentMethod": "BANK_TRANSFER",
"reference": "BDO-987654321",
"paidDate": "2024-01-27"
}
Expected Response: 200 OK
{
"invoice": {
"id": "...",
"status": "PAID",
"paidAt": "2024-01-27T00:00:00Z"
},
"payment": {
"id": "PAY-2024-XXXX",
"amount": 15000,
"method": "BANK_TRANSFER",
"reference": "BDO-987654321"
}
}
TC-BIL-API-011: POST /api/billing/admin/invoices/:id/void
Request:
{
"reason": "Duplicate invoice created in error"
}
Expected Response: 200 OK
{
"invoice": {
"id": "...",
"status": "VOIDED",
"voidedAt": "timestamp",
"voidReason": "Duplicate invoice created in error"
}
}
TC-BIL-API-012: POST /api/billing/invoices/:id/send
Expected Response: 200 OK
{
"success": true,
"message": "Invoice sent to expired@demo.membervu.com"
}
TC-BIL-API-013: GET /api/billing/invoices/:id/pdf
Expected Response: 200 OK
Content-Type: application/pdf
Body: Binary PDF data