# 4. Commission Calculation — Test Cases

User Type: **Super Administrator**
Source: *Mi Digital Academy - Education CRM Features Document*
Spec: commission_calculation.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 |
|---------|--------------------|----------|
| 4.1 Commission Calculation for Affiliates | Commission: the commission (the commission, the affiliate, the rate, the amount) | TC-SA-16-04-001 |
| 4.1 Commission Calculation for Affiliates | Commission rate: the rate (the rate of the commission, e.g., the 20%) | TC-SA-16-04-002 |
| 4.1 Commission Calculation for Affiliates | Referral: the referral (the referral, the purchase, the amount) | TC-SA-16-04-003 |
| 4.1 Commission Calculation for Affiliates | Commission calculation: the calculation (the commission is calculated on the referral, the amount) | TC-SA-16-04-004 |
| 4.1 Commission Calculation for Affiliates | Calculation configuration: the configuration (the affiliate, the rate, the amount, the referral) | TC-SA-16-04-005 |
| 4.1 Commission Calculation for Affiliates | Calculation record: the record (the commission, the affiliate, the rate, the amount, the date) | TC-SA-16-04-006 |
| 4.1 Commission Calculation for Affiliates | Calculation view: the view (the commissions, the affiliates, the period) | TC-SA-16-04-007 |
| 4.1 Commission Calculation for Affiliates | Audit logging of the commission calculation | TC-SA-16-04-008 |
| 4.1 Commission Calculation for Affiliates | Rule: the commission is the earning (the commission, the affiliate, the rate, the amount); the commission is the value | TC-SA-16-04-001 |
| 4.1 Commission Calculation for Affiliates | Rule: the commission rate is the percentage (the rate of the commission, e.g., the 20%); the rate is the measure | TC-SA-16-04-002 |
| 4.1 Commission Calculation for Affiliates | Rule: the referral is the trigger (the referral, the purchase, the amount); the referral is the origin | TC-SA-16-04-003 |
| 4.1 Commission Calculation for Affiliates | Rule: a calculation change (the rate updated) is recorded (the new rate, the time); it is auditable | TC-SA-16-04-008 |
| 4.1 Commission Calculation for Affiliates | Rule: the commissions are visible (the commissions, the affiliates, the period); the calculation is managed | TC-SA-16-04-007 |
| 4.1 Commission Calculation for Affiliates | Rule: commission calculation is audit-logged with the affiliate, rate, and timestamp | TC-SA-16-04-008 |
| 4.2 Commission Accrual and Settlement Tracking | Commission accrual: the accrual (the accrual, the affiliate, the amount, the date) | TC-SA-16-04-009 |
| 4.2 Commission Accrual and Settlement Tracking | Commission settlement: the settlement (the settlement, the affiliate, the amount, the date) | TC-SA-16-04-010 |
| 4.2 Commission Accrual and Settlement Tracking | Accrual status: the status (the accrued, the settled, the pending) | TC-SA-16-04-011 |
| 4.2 Commission Accrual and Settlement Tracking | Settlement status: the status (the settled, the pending, the paid) | TC-SA-16-04-012 |
| 4.2 Commission Accrual and Settlement Tracking | Tracking record: the record (the affiliate, the accrual, the settlement, the amount, the date) | TC-SA-16-04-013 |
| 4.2 Commission Accrual and Settlement Tracking | Tracking view: the view (the accruals, the settlements, the affiliates, the period) | TC-SA-16-04-014 |
| 4.2 Commission Accrual and Settlement Tracking | Tracking export: the export (the tracking, the format, the period) | TC-SA-16-04-015 |
| 4.2 Commission Accrual and Settlement Tracking | Audit logging of the commission accrual and settlement tracking | TC-SA-16-04-016 |
| 4.2 Commission Accrual and Settlement Tracking | Rule: the commission accrual is the earning (the accrual, the affiliate, the amount, the date); the accrual is the accumulation | TC-SA-16-04-009 |
| 4.2 Commission Accrual and Settlement Tracking | Rule: the commission settlement is the payment (the settlement, the affiliate, the amount, the date); the settlement is the completion | TC-SA-16-04-010 |
| 4.2 Commission Accrual and Settlement Tracking | Rule: the accrual status is the state (the accrued, the settled, the pending); the status is the control | TC-SA-16-04-011 |
| 4.2 Commission Accrual and Settlement Tracking | Rule: the settlement status is the state (the settled, the pending, the paid); the status is the control | TC-SA-16-04-012 |
| 4.2 Commission Accrual and Settlement Tracking | Rule: the commissions are visible (the accruals, the settlements, the affiliates, the period); the tracking is managed | TC-SA-16-04-014 |
| 4.2 Commission Accrual and Settlement Tracking | Rule: commission accrual and settlement tracking is audit-logged with the affiliate, accrual, and timestamp | TC-SA-16-04-016 |

## 4.1 Commission Calculation for Affiliates

### TC-SA-16-04-001 — Commission: the commission (the commission, the affiliate, the rate, the amount); the commission is the value
**Type:** Positive
**Covers:** 4.1 → Commission: the commission (the commission, the affiliate, the rate, the amount); Rule: the commission is the earning (the commission, the affiliate, the rate, the amount); the commission is the value
**Preconditions:** An affiliate has made a referral that resulted in a purchase.
**Steps:**
1. Configure the commission calculation: the commission (the commission, the affiliate, the rate, the amount), the rate (the rate of the commission, e.g., the 20%), and the referral (the referral, the purchase, the amount).
2. A referral purchase is made — verify the commission is calculated (the commission is computed, the rate is applied, the amount is earned).
3. Verify the commission is the earning and is the value.
**Expected Result:** The commission is calculated — the commission, the affiliate, the rate, and the amount are the value.
**Priority:** Critical

### TC-SA-16-04-002 — Commission rate: the rate (the rate of the commission, e.g., the 20%); the rate is the measure
**Type:** Edge
**Covers:** 4.1 → Commission rate: the rate (the rate of the commission, e.g., the 20%); Rule: the commission rate is the percentage (the rate of the commission, e.g., the 20%); the rate is the measure
**Preconditions:** Super Admin is logged in.
**Steps:**
1. Set the commission rate: the rate (the rate of the commission, e.g., the 20%) — verify the rate is the percentage.
2. Set a rate of 0% — verify it is accepted (no commission).
3. Set a rate above 100% — verify it is rejected with a validation error.
**Expected Result:** The commission rate is set — the rate of the commission is the measure; invalid rates are rejected.
**Priority:** Critical

### TC-SA-16-04-003 — Referral: the referral (the referral, the purchase, the amount); the referral is the origin
**Type:** Positive
**Covers:** 4.1 → Referral: the referral (the referral, the purchase, the amount); Rule: the referral is the trigger (the referral, the purchase, the amount); the referral is the origin
**Preconditions:** An affiliate has a referral link.
**Steps:**
1. Set the referral: the referral (the referral, the purchase, the amount) — verify the referral is the trigger.
2. A user purchases via the affiliate's referral — verify the referral is recorded with the purchase and the amount.
3. Verify the referral is the origin of the commission.
**Expected Result:** The referral is recorded — the referral, the purchase, and the amount are the origin.
**Priority:** Critical

### TC-SA-16-04-004 — Commission calculation: the calculation (the commission is calculated on the referral, the amount); the calculation is the earning
**Type:** Positive
**Covers:** 4.1 → Commission calculation: the calculation (the commission is calculated on the referral, the amount)
**Preconditions:** The commission calculation is live; a referral purchase is made.
**Steps:**
1. A referral purchase is made — verify the commission is calculated (the commission is computed, the rate is applied, the amount is earned).
2. Verify the commission amount is correct per the rate (e.g., 20% of the purchase amount).
3. Verify the calculation is recorded.
**Expected Result:** The commission calculation works — the commission is calculated on the referral and the amount is earned.
**Priority:** Critical

### TC-SA-16-04-005 — Calculation configuration: the configuration (the affiliate, the rate, the amount, the referral); the calculation is explicit
**Type:** Positive
**Covers:** 4.1 → Calculation configuration: the configuration (the affiliate, the rate, the amount, the referral)
**Preconditions:** Super Admin is logged in.
**Steps:**
1. Configure the commission calculation: the configuration (the affiliate, the rate, the amount, the referral).
2. Save; verify the commission calculation is live and the commissions are calculated on the referrals.
3. View the calculation configuration — verify the affiliate, the rate, the amount, and the referral are shown.
**Expected Result:** The calculation configuration is saved — the affiliate, the rate, the amount, and the referral are configured and live.
**Priority:** Critical

### TC-SA-16-04-006 — Calculation record: the record (the commission, the affiliate, the rate, the amount, the date); the record is the proof
**Type:** Positive
**Covers:** 4.1 → Calculation record: the record (the commission, the affiliate, the rate, the amount, the date)
**Preconditions:** A commission has been calculated.
**Steps:**
1. Open the calculation record.
2. Verify it shows the commission, the affiliate, the rate, the amount, and the date.
**Expected Result:** The calculation is recorded — the commission, the affiliate, the rate, the amount, and the date are shown.
**Priority:** High

### TC-SA-16-04-007 — Calculation view: the view (the commissions, the affiliates, the period); the calculation is managed
**Type:** Positive
**Covers:** 4.1 → Calculation view: the view (the commissions, the affiliates, the period); Rule: the commissions are visible (the commissions, the affiliates, the period); the calculation is managed
**Preconditions:** Commissions have been calculated for multiple affiliates across a period.
**Steps:**
1. View the commissions: the commissions, the affiliates, the period — verify the commissions are visible.
2. Verify the view is complete for the period.
**Expected Result:** The calculation view works — the commissions for the affiliates and the period are visible.
**Priority:** High

### TC-SA-16-04-008 — Commission calculation is audit-logged with the affiliate, rate, and timestamp
**Type:** Positive
**Covers:** 4.1 → Audit logging of the commission calculation; Rule: a calculation change (the rate updated) is recorded (the new rate, the time); it is auditable; Rule: commission calculation is audit-logged with the affiliate, rate, and timestamp
**Preconditions:** Commissions have been calculated and a rate has been updated.
**Steps:**
1. Open the audit trail and filter by "commission".
2. Verify entries show the affiliate, the rate, and the timestamp for the calculation.
3. For a calculation change (the rate updated), verify the change is recorded (the new rate, the time) and is auditable.
**Expected Result:** The commission calculation is audit-logged with the affiliate, rate, and timestamp.
**Priority:** Critical

## 4.2 Commission Accrual and Settlement Tracking

### TC-SA-16-04-009 — Commission accrual: the accrual (the accrual, the affiliate, the amount, the date); the accrual is the accumulation
**Type:** Positive
**Covers:** 4.2 → Commission accrual: the accrual (the accrual, the affiliate, the amount, the date); Rule: the commission accrual is the earning (the accrual, the affiliate, the amount, the date); the accrual is the accumulation
**Preconditions:** Commissions have been calculated for affiliates.
**Steps:**
1. View the accrual and settlement tracking: the accruals (the accrual, the affiliate, the amount, the date), the settlements (the settlement, the affiliate, the amount, the date), and the period (the period of the tracking).
2. View the accrued commissions: the accrual (the accrual, the affiliate, the amount, the date) — verify the accrual is the earning.
3. Verify the accrual is the accumulation of the commissions.
**Expected Result:** The commission accrual is shown — the accrual, the affiliate, the amount, and the date are the accumulation.
**Priority:** Critical

### TC-SA-16-04-010 — Commission settlement: the settlement (the settlement, the affiliate, the amount, the date); the settlement is the completion
**Type:** Positive
**Covers:** 4.2 → Commission settlement: the settlement (the settlement, the affiliate, the amount, the date); Rule: the commission settlement is the payment (the settlement, the affiliate, the amount, the date); the settlement is the completion
**Preconditions:** Commissions have been accrued for an affiliate.
**Steps:**
1. View the settled commissions: the settlement (the settlement, the affiliate, the amount, the date) — verify the settlement is the payment.
2. Verify the settlement is the completion of the accrual.
3. Verify the settlement amount matches the accrued amount.
**Expected Result:** The commission settlement is shown — the settlement, the affiliate, the amount, and the date are the completion.
**Priority:** Critical

### TC-SA-16-04-011 — Accrual status: the status (the accrued, the settled, the pending); the status is the control
**Type:** Positive
**Covers:** 4.2 → Accrual status: the status (the accrued, the settled, the pending); Rule: the accrual status is the state (the accrued, the settled, the pending); the status is the control
**Preconditions:** Commissions exist in all three accrual statuses.
**Steps:**
1. View the accrual status: the status (the accrued, the settled, the pending) — verify the status is the state.
2. Verify each accrual shows its status (the accrued, the settled, or the pending).
3. Verify the status transitions are correct (pending → accrued → settled).
**Expected Result:** The accrual status is shown — the accrued, the settled, or the pending state is visible for each accrual.
**Priority:** High

### TC-SA-16-04-012 — Settlement status: the status (the settled, the pending, the paid); the status is the control
**Type:** Positive
**Covers:** 4.2 → Settlement status: the status (the settled, the pending, the paid); Rule: the settlement status is the state (the settled, the pending, the paid); the status is the control
**Preconditions:** Settlements exist in all three statuses.
**Steps:**
1. View the settlement status: the status (the settled, the pending, the paid) — verify the status is the state.
2. Verify each settlement shows its status (the settled, the pending, or the paid).
3. Verify the status transitions are correct (pending → settled → paid).
**Expected Result:** The settlement status is shown — the settled, the pending, or the paid state is visible for each settlement.
**Priority:** High

### TC-SA-16-04-013 — Tracking record: the record (the affiliate, the accrual, the settlement, the amount, the date); the record is the proof
**Type:** Positive
**Covers:** 4.2 → Tracking record: the record (the affiliate, the accrual, the settlement, the amount, the date)
**Preconditions:** Commission accruals and settlements exist.
**Steps:**
1. Open the tracking record.
2. Verify it shows the affiliate, the accrual, the settlement, the amount, and the date.
**Expected Result:** The tracking is recorded — the affiliate, the accrual, the settlement, the amount, and the date are shown.
**Priority:** High

### TC-SA-16-04-014 — Tracking view: the view (the accruals, the settlements, the affiliates, the period); the tracking is managed
**Type:** Positive
**Covers:** 4.2 → Tracking view: the view (the accruals, the settlements, the affiliates, the period); Rule: the commissions are visible (the accruals, the settlements, the affiliates, the period); the tracking is managed
**Preconditions:** Commission accruals and settlements exist for multiple affiliates across a period.
**Steps:**
1. View the tracking: the accruals, the settlements, the affiliates, the period — verify the commissions are visible.
2. Verify the view is complete for the period.
**Expected Result:** The tracking view works — the accruals and the settlements for the affiliates and the period are visible.
**Priority:** High

### TC-SA-16-04-015 — Tracking export: the export (the tracking, the format, the period); the export is the record
**Type:** Positive
**Covers:** 4.2 → Tracking export: the export (the tracking, the format, the period)
**Preconditions:** Commission tracking exists for a period.
**Steps:**
1. Export the tracking: the export (the tracking, the format, the period).
2. Verify the export is generated in the selected format.
3. Verify the exported data matches the tracking view.
**Expected Result:** The tracking is exported — the tracking in the selected format for the period is generated.
**Priority:** Medium

### TC-SA-16-04-016 — Commission accrual and settlement tracking is audit-logged with the affiliate, accrual, and timestamp
**Type:** Positive
**Covers:** 4.2 → Audit logging of the commission accrual and settlement tracking; Rule: commission accrual and settlement tracking is audit-logged with the affiliate, accrual, and timestamp
**Preconditions:** Commission accrual and settlement tracking events have occurred.
**Steps:**
1. Open the audit trail and filter by "commission tracking".
2. Verify entries show the affiliate, the accrual, and the timestamp.
**Expected Result:** The commission accrual and settlement tracking is audit-logged with the affiliate, accrual, and timestamp.
**Priority:** Critical
