# 7. Billing History — Test Cases

User Type: **Super Administrator**
Source: *Mi Digital Academy - Education CRM Features Document*
Spec: billing_history.md — every feature, sub-feature, and rule covered

---

## Test Execution Policy
- Zero tolerance: any deviation from documented behavior = FAILED = bug
- Every bug is immediately logged/reported (Bug ID, feature, sub-feature,
  expected vs actual, severity) and fixed 100% before the group passes
- Feature group passes only at 100% test pass rate

## Coverage Matrix
| Feature | Sub-feature / Rule | Test IDs |
|---------|--------------------|----------|
| 7.1 View Billing History per User | Billing history: the history (the billing, the user, the amount, the date, the status) | TC-SA-15-07-001 |
| 7.1 View Billing History per User | User billing view: the view (the billing per user, the period) | TC-SA-15-07-002 |
| 7.1 View Billing History per User | Billing filter: the filter (the filter by the user, the amount, the date, the status) | TC-SA-15-07-003 |
| 7.1 View Billing History per User | Billing search: the search (the search by the user, the billing ID) | TC-SA-15-07-004 |
| 7.1 View Billing History per User | Billing export: the export (the billing, the format, the period) | TC-SA-15-07-005 |
| 7.1 View Billing History per User | Billing record: the record (the billing, the user, the amount, the date, the status) | TC-SA-15-07-006 |
| 7.1 View Billing History per User | Audit logging of the billing history viewing | TC-SA-15-07-007 |
| 7.1 View Billing History per User | Rule: the billing history is the record (the billing, the user, the amount, the date, the status); the history is the timeline | TC-SA-15-07-001 |
| 7.1 View Billing History per User | Rule: the user billing view is the detail (the billing per user, the period); the view is the access | TC-SA-15-07-002 |
| 7.1 View Billing History per User | Rule: the billing filter is the scope (the filter by the user, the amount, the date, the status); the filter is the control | TC-SA-15-07-003 |
| 7.1 View Billing History per User | Rule: the billing search is the lookup (the search by the user, the billing ID); the search is the access | TC-SA-15-07-004 |
| 7.1 View Billing History per User | Rule: the billing is visible (the billing, the filters, the period); the viewing is managed | TC-SA-15-07-001 |
| 7.1 View Billing History per User | Rule: billing history viewing is audit-logged with the billing, user, and timestamp | TC-SA-15-07-007 |
| 7.2 Payment History and Statements | Payment history: the history (the payment, the user, the amount, the date, the status) | TC-SA-15-07-008 |
| 7.2 Payment History and Statements | Payment statement: the statement (the statement, the period, the payments) | TC-SA-15-07-009 |
| 7.2 Payment History and Statements | Statement generation: the generation (the statement is generated, the period, the payments) | TC-SA-15-07-010 |
| 7.2 Payment History and Statements | History filter: the filter (the filter by the user, the amount, the date, the status) | TC-SA-15-07-011 |
| 7.2 Payment History and Statements | History export: the export (the history, the format, the period) | TC-SA-15-07-012 |
| 7.2 Payment History and Statements | History record: the record (the payment, the user, the amount, the date, the status) | TC-SA-15-07-013 |
| 7.2 Payment History and Statements | Audit logging of the payment history and statement management | TC-SA-15-07-014 |
| 7.2 Payment History and Statements | Rule: the payment history is the record (the payment, the user, the amount, the date, the status); the history is the timeline | TC-SA-15-07-008 |
| 7.2 Payment History and Statements | Rule: the payment statement is the document (the statement, the period, the payments); the statement is the summary | TC-SA-15-07-009 |
| 7.2 Payment History and Statements | Rule: the statement generation is the creation (the statement is generated, the period, the payments); the generation is the action | TC-SA-15-07-010 |
| 7.2 Payment History and Statements | Rule: the history filter is the scope (the filter by the user, the amount, the date, the status); the filter is the control | TC-SA-15-07-011 |
| 7.2 Payment History and Statements | Rule: the payments are visible (the payments, the filters, the period); the management is managed | TC-SA-15-07-008 |
| 7.2 Payment History and Statements | Rule: payment history and statement management is audit-logged with the payment, user, and timestamp | TC-SA-15-07-014 |
| 7.3 License Usage and Available Seats View | License usage: the usage (the usage, the institute, the count, the seats) | TC-SA-15-07-015 |
| 7.3 License Usage and Available Seats View | Available seats: the seats (the seats, the institute, the count) | TC-SA-15-07-016 |
| 7.3 License Usage and Available Seats View | Usage view: the view (the usage per institute, the period) | TC-SA-15-07-017 |
| 7.3 License Usage and Available Seats View | Seat view: the view (the seats per institute, the period) | TC-SA-15-07-018 |
| 7.3 License Usage and Available Seats View | Usage filter: the filter (the filter by the institute, the count, the period) | TC-SA-15-07-019 |
| 7.3 License Usage and Available Seats View | Usage export: the export (the usage, the format, the period) | TC-SA-15-07-020 |
| 7.3 License Usage and Available Seats View | Audit logging of the license usage and seat viewing | TC-SA-15-07-021 |
| 7.3 License Usage and Available Seats View | Rule: the license usage is the record (the usage, the institute, the count, the seats); the usage is the measure | TC-SA-15-07-015 |
| 7.3 License Usage and Available Seats View | Rule: the available seats are the availability (the seats, the institute, the count); the seats are the capacity | TC-SA-15-07-016 |
| 7.3 License Usage and Available Seats View | Rule: the usage view is the detail (the usage per institute, the period); the view is the access | TC-SA-15-07-017 |
| 7.3 License Usage and Available Seats View | Rule: the usage filter is the scope (the filter by the institute, the count, the period); the filter is the control | TC-SA-15-07-019 |
| 7.3 License Usage and Available Seats View | Rule: the usage is visible (the usage, the institutes, the period); the viewing is managed | TC-SA-15-07-017 |
| 7.3 License Usage and Available Seats View | Rule: license usage and seat viewing is audit-logged with the institute, usage, and timestamp | TC-SA-15-07-021 |

## 7.1 View Billing History per User

### TC-SA-15-07-001 — Billing history: the history (the billing, the user, the amount, the date, the status); the history is the timeline
**Type:** Positive
**Covers:** 7.1 → Billing history: the history (the billing, the user, the amount, the date, the status); Rule: the billing history is the record (the billing, the user, the amount, the date, the status); the history is the timeline; Rule: the billing is visible (the billing, the filters, the period); the viewing is managed
**Preconditions:** Billing exists for multiple users across multiple periods.
**Steps:**
1. View the billing history: the billing (the billing, the user, the amount, the date, the status), the filters (the user, the amount, the date, the status), and the period (the period of the billing).
2. Verify the history is the timeline and is complete for the period.
**Expected Result:** The billing history is shown — the billing, the user, the amount, the date, and the status are visible.
**Priority:** Critical

### TC-SA-15-07-002 — User billing view: the view (the billing per user, the period); the view is the access
**Type:** Positive
**Covers:** 7.1 → User billing view: the view (the billing per user, the period); Rule: the user billing view is the detail (the billing per user, the period); the view is the access
**Preconditions:** Billing exists for a specific user.
**Steps:**
1. View a user's billing: the view (the billing per user, the period) — verify the view is the detail.
2. Verify the user's billing is complete for the period.
**Expected Result:** The user billing view works — the billing per user for the period is visible.
**Priority:** High

### TC-SA-15-07-003 — Billing filter: the filter (the filter by the user, the amount, the date, the status); the filter is the control
**Type:** Negative
**Covers:** 7.1 → Billing filter: the filter (the filter by the user, the amount, the date, the status); Rule: the billing filter is the scope (the filter by the user, the amount, the date, the status); the filter is the control
**Preconditions:** Billing exists for multiple users, amounts, dates, and statuses.
**Steps:**
1. Set the billing filter: the filter (the filter by the user, the amount, the date, the status).
2. Verify only the matching billing is shown.
3. Apply a filter combination that matches no billing — verify an empty result is shown (no error).
**Expected Result:** The billing filter works — only the matching billing is shown; an empty result is handled.
**Priority:** High

### TC-SA-15-07-004 — Billing search: the search (the search by the user, the billing ID); the search is the access
**Type:** Edge
**Covers:** 7.1 → Billing search: the search (the search by the user, the billing ID); Rule: the billing search is the lookup (the search by the user, the billing ID); the search is the access
**Preconditions:** Billing exists.
**Steps:**
1. Search a billing by the user — verify all the user's billing is found.
2. Search by the billing ID — verify the exact billing is found.
3. Search by a non-existent billing ID — verify no results are shown (no error).
**Expected Result:** The billing search works — the billing is found by the user or the billing ID; a non-existent ID returns no results.
**Priority:** High

### TC-SA-15-07-005 — Billing export: the export (the billing, the format, the period); the export is the record
**Type:** Positive
**Covers:** 7.1 → Billing export: the export (the billing, the format, the period)
**Preconditions:** Billing exists for a period.
**Steps:**
1. Export the billing: the export (the billing, the format, the period).
2. Verify the export is generated in the selected format.
3. Verify the exported data matches the billing view.
**Expected Result:** The billing is exported — the billing in the selected format for the period is generated.
**Priority:** Medium

### TC-SA-15-07-006 — Billing record: the record (the billing, the user, the amount, the date, the status); the record is the proof
**Type:** Positive
**Covers:** 7.1 → Billing record: the record (the billing, the user, the amount, the date, the status)
**Preconditions:** Billing exists.
**Steps:**
1. Open the billing record.
2. Verify it shows the billing, the user, the amount, the date, and the status.
**Expected Result:** The billing is recorded — the billing, the user, the amount, the date, and the status are shown.
**Priority:** High

### TC-SA-15-07-007 — Billing history viewing is audit-logged with the billing, user, and timestamp
**Type:** Positive
**Covers:** 7.1 → Audit logging of the billing history viewing; Rule: billing history viewing is audit-logged with the billing, user, and timestamp
**Preconditions:** Billing history viewing has occurred.
**Steps:**
1. Open the audit trail and filter by "billing history viewing".
2. Verify entries show the billing, the user, and the timestamp.
**Expected Result:** The billing history viewing is audit-logged with the billing, user, and timestamp.
**Priority:** Critical

## 7.2 Payment History and Statements

### TC-SA-15-07-008 — Payment history: the history (the payment, the user, the amount, the date, the status); the history is the timeline
**Type:** Positive
**Covers:** 7.2 → Payment history: the history (the payment, the user, the amount, the date, the status); Rule: the payment history is the record (the payment, the user, the amount, the date, the status); the history is the timeline; Rule: the payments are visible (the payments, the filters, the period); the management is managed
**Preconditions:** Payments exist for multiple users across multiple periods.
**Steps:**
1. View the payment history: the payments (the payment, the user, the amount, the date, the status), the filters (the user, the amount, the date, the status), and the period (the period of the payments).
2. Verify the history is the timeline and is complete for the period.
**Expected Result:** The payment history is shown — the payment, the user, the amount, the date, and the status are visible.
**Priority:** Critical

### TC-SA-15-07-009 — Payment statement: the statement (the statement, the period, the payments); the statement is the summary
**Type:** Positive
**Covers:** 7.2 → Payment statement: the statement (the statement, the period, the payments); Rule: the payment statement is the document (the statement, the period, the payments); the statement is the summary
**Preconditions:** Payments exist for a user across a period.
**Steps:**
1. View a statement: the statement (the statement, the period, the payments) — verify the statement is the summary.
2. Verify the statement shows all the payments for the period.
**Expected Result:** The payment statement is shown — the statement, the period, and the payments are visible.
**Priority:** High

### TC-SA-15-07-010 — Statement generation: the generation (the statement is generated, the period, the payments); the generation is the action
**Type:** Edge
**Covers:** 7.2 → Statement generation: the generation (the statement is generated, the period, the payments); Rule: the statement generation is the creation (the statement is generated, the period, the payments); the generation is the action
**Preconditions:** Payments exist for a user across a period; a user with no payments in a period also exists.
**Steps:**
1. Generate a statement: the generation (the statement is generated, the period, the payments) — verify the generation is the action.
2. Verify the statement is generated with all the payments for the period.
3. Generate a statement for a user with no payments in the period — verify an empty statement is generated (no error).
**Expected Result:** The statement generation works — the statement is generated for the period with the payments; an empty period is handled.
**Priority:** High

### TC-SA-15-07-011 — History filter: the filter (the filter by the user, the amount, the date, the status); the filter is the control
**Type:** Negative
**Covers:** 7.2 → History filter: the filter (the filter by the user, the amount, the date, the status); Rule: the history filter is the scope (the filter by the user, the amount, the date, the status); the filter is the control
**Preconditions:** Payments exist for multiple users, amounts, dates, and statuses.
**Steps:**
1. Set the history filter: the filter (the filter by the user, the amount, the date, the status).
2. Verify only the matching payments are shown.
3. Apply a filter combination that matches no payments — verify an empty result is shown (no error).
**Expected Result:** The history filter works — only the matching payments are shown; an empty result is handled.
**Priority:** High

### TC-SA-15-07-012 — History export: the export (the history, the format, the period); the export is the record
**Type:** Positive
**Covers:** 7.2 → History export: the export (the history, the format, the period)
**Preconditions:** Payments exist for a period.
**Steps:**
1. Export the history: the export (the history, the format, the period).
2. Verify the export is generated in the selected format.
3. Verify the exported data matches the payment history view.
**Expected Result:** The history is exported — the history in the selected format for the period is generated.
**Priority:** Medium

### TC-SA-15-07-013 — History record: the record (the payment, the user, the amount, the date, the status); the record is the proof
**Type:** Positive
**Covers:** 7.2 → History record: the record (the payment, the user, the amount, the date, the status)
**Preconditions:** Payments exist.
**Steps:**
1. Open the history record.
2. Verify it shows the payment, the user, the amount, the date, and the status.
**Expected Result:** The history is recorded — the payment, the user, the amount, the date, and the status are shown.
**Priority:** High

### TC-SA-15-07-014 — Payment history and statement management is audit-logged with the payment, user, and timestamp
**Type:** Positive
**Covers:** 7.2 → Audit logging of the payment history and statement management; Rule: payment history and statement management is audit-logged with the payment, user, and timestamp
**Preconditions:** Payment history and statement management events have occurred.
**Steps:**
1. Open the audit trail and filter by "payment history".
2. Verify entries show the payment, the user, and the timestamp.
**Expected Result:** The payment history and statement management is audit-logged with the payment, user, and timestamp.
**Priority:** Critical

## 7.3 License Usage and Available Seats View

### TC-SA-15-07-015 — License usage: the usage (the usage, the institute, the count, the seats); the usage is the measure
**Type:** Positive
**Covers:** 7.3 → License usage: the usage (the usage, the institute, the count, the seats); Rule: the license usage is the record (the usage, the institute, the count, the seats); the usage is the measure
**Preconditions:** Institutes have bulk licenses with usage.
**Steps:**
1. View the license usage: the usage (the usage, the institute, the count, the seats) — verify the usage is the measure.
2. Verify the usage is shown per institute.
**Expected Result:** The license usage is shown — the usage, the institute, the count, and the seats are visible.
**Priority:** Critical

### TC-SA-15-07-016 — Available seats: the seats (the seats, the institute, the count); the seats are the capacity
**Type:** Edge
**Covers:** 7.3 → Available seats: the seats (the seats, the institute, the count); Rule: the available seats are the availability (the seats, the institute, the count); the seats are the capacity
**Preconditions:** An institute has 100 licenses with 95 in use; another institute has 100 licenses with 100 in use.
**Steps:**
1. View the available seats: the seats (the seats, the institute, the count) — verify the seats are the availability.
2. Verify the first institute shows 5 available seats (100 - 95).
3. Verify the second institute shows 0 available seats (fully utilized) without an error.
**Expected Result:** The available seats are shown — the seats per institute are the capacity, with the fully-utilized case handled.
**Priority:** High

### TC-SA-15-07-017 — Usage view: the view (the usage per institute, the period); the viewing is managed
**Type:** Positive
**Covers:** 7.3 → Usage view: the view (the usage per institute, the period); Rule: the usage view is the detail (the usage per institute, the period); the view is the access; Rule: the usage is visible (the usage, the institutes, the period); the viewing is managed
**Preconditions:** License usage exists for multiple institutes across a period.
**Steps:**
1. View an institute's usage: the view (the usage per institute, the period) — verify the view is the detail.
2. View the usage for all institutes — verify the usage is visible for the period.
**Expected Result:** The usage view works — the usage per institute for the period is visible.
**Priority:** High

### TC-SA-15-07-018 — Seat view: the view (the seats per institute, the period); the seats are the availability
**Type:** Positive
**Covers:** 7.3 → Seat view: the view (the seats per institute, the period)
**Preconditions:** Institutes have bulk licenses with available seats.
**Steps:**
1. View the seats per institute: the view (the seats per institute, the period) — verify the seats are the availability.
2. Verify the seat counts are correct per institute.
**Expected Result:** The seat view works — the seats per institute for the period are visible.
**Priority:** High

### TC-SA-15-07-019 — Usage filter: the filter (the filter by the institute, the count, the period); the filter is the control
**Type:** Negative
**Covers:** 7.3 → Usage filter: the filter (the filter by the institute, the count, the period); Rule: the usage filter is the scope (the filter by the institute, the count, the period); the filter is the control
**Preconditions:** License usage exists for multiple institutes, counts, and periods.
**Steps:**
1. Set the usage filter: the filter (the filter by the institute, the count, the period).
2. Verify only the matching usage is shown.
3. Apply a filter combination that matches no usage — verify an empty result is shown (no error).
**Expected Result:** The usage filter works — only the matching usage is shown; an empty result is handled.
**Priority:** High

### TC-SA-15-07-020 — Usage export: the export (the usage, the format, the period); the export is the record
**Type:** Positive
**Covers:** 7.3 → Usage export: the export (the usage, the format, the period)
**Preconditions:** License usage exists for a period.
**Steps:**
1. Export the usage: the export (the usage, the format, the period).
2. Verify the export is generated in the selected format.
3. Verify the exported data matches the usage view.
**Expected Result:** The usage is exported — the usage in the selected format for the period is generated.
**Priority:** Medium

### TC-SA-15-07-021 — License usage and seat viewing is audit-logged with the institute, usage, and timestamp
**Type:** Positive
**Covers:** 7.3 → Audit logging of the license usage and seat viewing; Rule: license usage and seat viewing is audit-logged with the institute, usage, and timestamp
**Preconditions:** License usage and seat viewing events have occurred.
**Steps:**
1. Open the audit trail and filter by "license usage viewing".
2. Verify entries show the institute, the usage, and the timestamp.
**Expected Result:** The license usage and seat viewing is audit-logged with the institute, usage, and timestamp.
**Priority:** Critical
