Test Cases: Invoice Actions

Module: Billing & Invoicing - Invoice Actions

Backend Endpoints:

Frontend Page: frontend/pwa-app/src/pages/AdminInvoicesPage.tsx

Prerequisites

Test Data

InvoiceStatusMemberAction to Test
RCME-DUES-0002PENDINGAntonio Dela CruzMark as Paid, Void, Send
RCME-DUES-0003OVERDUEAntonio Dela CruzMark as Paid, Void, Send Reminder
RCME-DUES-0001PAIDMaria CruzDownload PDF only

Test Cases

TC-BIL-033: Mark Invoice as Paid

StepActionExpected Result
1Login as Ana Reyes (FINANCE_MANAGER).Dashboard displayed.
2Navigate to invoice RCME-DUES-0002 (PENDING).Invoice detail page displayed.
3Click "Mark as Paid" button.Payment modal/form opens.
4Select payment method: Bank Transfer.Method selected.
5Enter payment reference: BDO-987654321.Reference entered.
6Enter payment date: Today.Date populated.
7Click "Confirm Payment".API POST /api/billing/invoices/:id/mark-paid called.
8Verify API response.Status 200 OK. Invoice status updated.
9Verify invoice status.Status changed to "PAID".
10Verify payment record created.Payment entry visible in payment history.

TC-BIL-034: Mark Invoice as Paid - Partial Payment

StepActionExpected Result
1Open invoice with total PHP 15,000 (PENDING).Invoice displayed.
2Click "Mark as Paid".Payment form opens.
3Enter amount: PHP 5,000 (less than total).Partial amount entered.
4Confirm payment.Payment recorded.
5Verify invoice status.Status changed to "PARTIALLY_PAID".
6Verify balance.Balance due: PHP 10,000 displayed.

TC-BIL-035: Mark Already Paid Invoice

StepActionExpected Result
1Open RCME-DUES-0001 (PAID status).Invoice displayed.
2Look for "Mark as Paid" button.Button not visible or disabled.
3Attempt via direct API call.Status 400 Bad Request - "Invoice already paid".

TC-BIL-036: Void Invoice

StepActionExpected Result
1Login as ADMIN or FINANCE_MANAGER.-
2Open invoice RCME-DUES-0002 (PENDING).Invoice detail displayed.
3Click "Void Invoice" button.Confirmation modal opens.
4Enter void reason: "Duplicate invoice created in error".Reason entered.
5Confirm void action.API POST /api/billing/admin/invoices/:id/void called.
6Verify API response.Status 200 OK.
7Verify invoice status.Status changed to "VOIDED".
8Verify void reason recorded.Reason visible in invoice details.
9Verify audit log.Void action logged with user and timestamp.

TC-BIL-037: Void Invoice - Validation (Already Paid)

StepActionExpected Result
1Open RCME-DUES-0001 (PAID status).Invoice displayed.
2Attempt to void invoice.Error: "Cannot void paid invoice" or action blocked.
3Verify via API.Status 400 Bad Request - business rule violation.

TC-BIL-038: Void Invoice Without Reason

StepActionExpected Result
1Click "Void Invoice".Modal opens.
2Leave reason field empty.-
3Click confirm.Validation error: "Void reason is required".

TC-BIL-039: Send Invoice via Email

StepActionExpected Result
1Open invoice RCME-DUES-0002 (PENDING).Invoice displayed.
2Click "Send Invoice" or email icon.Confirmation dialog appears.
3Verify recipient email displayed.Shows: expired@demo.membervu.com
4Click "Send".API POST /api/billing/invoices/:id/send called.
5Verify success message."Invoice sent successfully" displayed.
6Verify email sent.Check email log or member's inbox.
7Verify email content.Contains invoice details, amount, due date, payment link.

TC-BIL-040: Send Payment Reminder

StepActionExpected Result
1Open RCME-DUES-0003 (OVERDUE).Invoice displayed.
2Click "Send Reminder".Confirmation dialog appears.
3Confirm send.Reminder email sent.
4Verify email.Contains "OVERDUE" emphasis, amount owed, payment link.
5Verify reminder count.Reminder count incremented in invoice record.

TC-BIL-041: Download Invoice PDF

StepActionExpected Result
1Open any invoice.Invoice displayed.
2Click "Download PDF" or PDF icon.API GET /api/billing/invoices/:id/pdf called.
3Verify download initiated.PDF file downloads to browser.
4Open downloaded PDF.PDF contains complete invoice information.
5Verify PDF content.Organization logo, invoice details, line items, total, payment instructions.

TC-BIL-042: Download PDF - Non-Existent Invoice

StepActionExpected Result
1Request PDF for non-existent invoice ID.Error response.
2Verify API response.Status 404 Not Found.

TC-BIL-043: Invoice Actions - Permission Denied (Member Role)

StepActionExpected Result
1Login as Maria Cruz (MEMBER).Member dashboard displayed.
2View own invoice RCME-DUES-0005.Invoice displayed.
3Verify available actions.Only "Pay Now" and "Download PDF" visible.
4Verify "Void" not available.No void button visible.
5Verify "Mark as Paid" not available.No mark paid button visible.
6Attempt direct API void call.Status 403 Forbidden.

TC-BIL-044: Bulk Actions - Send Multiple Invoices

StepActionExpected Result
1Login as ADMIN, go to invoice list.Invoice list displayed.
2Select checkbox for multiple pending invoices.Multiple rows selected.
3Click "Bulk Send" action.Confirmation dialog for bulk send.
4Confirm.All selected invoices sent via email.
5Verify success.Success message with count of sent invoices.

TC-BIL-045: Recompute Invoice Statuses

StepActionExpected Result
1Login as ADMIN.-
2Navigate to billing settings or invoice management.-
3Find "Recompute Statuses" action.Button/link available.
4Execute recompute.API POST /api/billing/admin/invoices/recompute-statuses called.
5Verify 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