# 1. Discount Code Management — Test Cases

User Type: **Super Administrator**
Source: *Mi Digital Academy - Education CRM Features Document*
Spec: discount_code_management.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 |
|---------|--------------------|----------|
| 1.1 Create, Edit, and Deactivate Discount Codes | Code creation: the code (the string, the discount, the scope) | TC-SA-13-01-001 |
| 1.1 Create, Edit, and Deactivate Discount Codes | Code editing: the edit (the discount value, the scope, the limits) | TC-SA-13-01-002 |
| 1.1 Create, Edit, and Deactivate Discount Codes | Code deactivation: the deactivation (the code stops working) | TC-SA-13-01-003 |
| 1.1 Create, Edit, and Deactivate Discount Codes | Code uniqueness: the uniqueness (the code is unique) | TC-SA-13-01-004 |
| 1.1 Create, Edit, and Deactivate Discount Codes | Code scope: the scope (the code applies to the items, the plans, the courses) | TC-SA-13-01-005 |
| 1.1 Create, Edit, and Deactivate Discount Codes | Code status: the status (the active, the deactivated, the expired) | TC-SA-13-01-006 |
| 1.1 Create, Edit, and Deactivate Discount Codes | Audit logging of the code creation, editing, and deactivation | TC-SA-13-01-007 |
| 1.1 Create, Edit, and Deactivate Discount Codes | Rule: the code is unique (the code string is not used by another code); the uniqueness is enforced | TC-SA-13-01-004 |
| 1.1 Create, Edit, and Deactivate Discount Codes | Rule: the code scope is the application (the items, the plans, the courses); the scope is the control | TC-SA-13-01-005 |
| 1.1 Create, Edit, and Deactivate Discount Codes | Rule: the code status is the active, the deactivated, or the expired; the status is the control | TC-SA-13-01-006 |
| 1.1 Create, Edit, and Deactivate Discount Codes | Rule: a code edit (the discount value, the scope, the limits) is recorded (the new value, the new scope, the new limits); it is auditable | TC-SA-13-01-002 |
| 1.1 Create, Edit, and Deactivate Discount Codes | Rule: a code deactivation (the code stops working) is recorded (the status is deactivated); it is auditable | TC-SA-13-01-003 |
| 1.1 Create, Edit, and Deactivate Discount Codes | Rule: code creation, editing, and deactivation are audit-logged with the code, discount, and timestamp | TC-SA-13-01-007 |
| 1.2 Percentage and Fixed-Amount Discounts | Discount type: the type (the percentage, the fixed amount) | TC-SA-13-01-008 |
| 1.2 Percentage and Fixed-Amount Discounts | Discount value: the value (the percentage, e.g., 20%, or the fixed amount, e.g., 500) | TC-SA-13-01-009 |
| 1.2 Percentage and Fixed-Amount Discounts | Discount scope: the scope (the discount applies to the items, the plans, the courses) | TC-SA-13-01-010 |
| 1.2 Percentage and Fixed-Amount Discounts | Discount definition: the discount defined by the Super Admin (the type, the value, the scope) | TC-SA-13-01-008 |
| 1.2 Percentage and Fixed-Amount Discounts | Discount application: the discount applied (the discount is applied to the price) | TC-SA-13-01-011 |
| 1.2 Percentage and Fixed-Amount Discounts | Discount record: the discount recorded (the code, the type, the value, the scope) | TC-SA-13-01-012 |
| 1.2 Percentage and Fixed-Amount Discounts | Audit logging of the discount definition and the applications | TC-SA-13-01-013 |
| 1.2 Percentage and Fixed-Amount Discounts | Rule: the discount type is the percentage or the fixed amount; the type is the discount | TC-SA-13-01-008 |
| 1.2 Percentage and Fixed-Amount Discounts | Rule: the discount value is the amount (the percentage, e.g., 20%, or the fixed amount, e.g., 500); the value is the basis | TC-SA-13-01-009 |
| 1.2 Percentage and Fixed-Amount Discounts | Rule: the discount scope is the application (the items, the plans, the courses); the scope is the control | TC-SA-13-01-010 |
| 1.2 Percentage and Fixed-Amount Discounts | Rule: a discount change (the type, the value, the scope updated) is recorded (the new type, the new value, the new scope, the time); it is auditable | TC-SA-13-01-014 |
| 1.2 Percentage and Fixed-Amount Discounts | Rule: the discounts are visible (the codes, the types, the values, the scopes); the discount types are managed | TC-SA-13-01-015 |
| 1.2 Percentage and Fixed-Amount Discounts | Rule: discount definition and applications are audit-logged with the code, type, and timestamp | TC-SA-13-01-013 |
| 1.3 Usage Limits (Per User, Total Uses) | Per-user limit: the limit (the number of times a user can use the code) | TC-SA-13-01-016 |
| 1.3 Usage Limits (Per User, Total Uses) | Total-uses limit: the limit (the total number of times the code can be used) | TC-SA-13-01-017 |
| 1.3 Usage Limits (Per User, Total Uses) | Limit scope: the scope (the code, the limits) | TC-SA-13-01-018 |
| 1.3 Usage Limits (Per User, Total Uses) | Limit definition: the limits defined by the Super Admin (the per-user limit, the total-uses limit) | TC-SA-13-01-016 |
| 1.3 Usage Limits (Per User, Total Uses) | Limit enforcement: the limits enforced (the code is not used beyond the limits) | TC-SA-13-01-019 |
| 1.3 Usage Limits (Per User, Total Uses) | Limit record: the limits recorded (the code, the per-user limit, the total-uses limit, the uses) | TC-SA-13-01-020 |
| 1.3 Usage Limits (Per User, Total Uses) | Audit logging of the limit definition and the enforcement | TC-SA-13-01-021 |
| 1.3 Usage Limits (Per User, Total Uses) | Rule: the per-user limit is the per-user control (the number of times a user can use the code); the limit is the control | TC-SA-13-01-016 |
| 1.3 Usage Limits (Per User, Total Uses) | Rule: the total-uses limit is the total control (the total number of times the code can be used); the limit is the control | TC-SA-13-01-017 |
| 1.3 Usage Limits (Per User, Total Uses) | Rule: the limit scope is the code and the limits; the scope is the control | TC-SA-13-01-018 |
| 1.3 Usage Limits (Per User, Total Uses) | Rule: a limit change (the per-user limit, the total-uses limit updated) is recorded (the new per-user limit, the new total-uses limit, the time); it is auditable | TC-SA-13-01-022 |
| 1.3 Usage Limits (Per User, Total Uses) | Rule: the usage limits are visible (the codes, the per-user limits, the total-uses limits, the uses); the usage is managed | TC-SA-13-01-023 |
| 1.3 Usage Limits (Per User, Total Uses) | Rule: limit definition and enforcement are audit-logged with the code, limits, and timestamp | TC-SA-13-01-021 |
| 1.4 Validity Periods | Start date: the date (the date the code becomes valid) | TC-SA-13-01-024 |
| 1.4 Validity Periods | End date: the date (the date the code expires) | TC-SA-13-01-025 |
| 1.4 Validity Periods | Validity scope: the scope (the code, the period) | TC-SA-13-01-026 |
| 1.4 Validity Periods | Validity definition: the validity defined by the Super Admin (the start date, the end date) | TC-SA-13-01-024 |
| 1.4 Validity Periods | Validity enforcement: the validity enforced (the code is not used outside the period) | TC-SA-13-01-027 |
| 1.4 Validity Periods | Validity record: the validity recorded (the code, the start date, the end date, the status) | TC-SA-13-01-028 |
| 1.4 Validity Periods | Audit logging of the validity definition and the enforcement | TC-SA-13-01-029 |
| 1.4 Validity Periods | Rule: the start date is the start (the date the code becomes valid); the date is the control | TC-SA-13-01-024 |
| 1.4 Validity Periods | Rule: the end date is the end (the date the code expires); the date is the control | TC-SA-13-01-025 |
| 1.4 Validity Periods | Rule: the validity scope is the code and the period; the scope is the control | TC-SA-13-01-026 |
| 1.4 Validity Periods | Rule: a validity change (the start date, the end date updated) is recorded (the new start date, the new end date, the time); it is auditable | TC-SA-13-01-030 |
| 1.4 Validity Periods | Rule: the validity periods are visible (the codes, the start dates, the end dates, the statuses); the validity is managed | TC-SA-13-01-031 |
| 1.4 Validity Periods | Rule: validity definition and enforcement are audit-logged with the code, period, and timestamp | TC-SA-13-01-029 |

## 1.1 Create, Edit, and Deactivate Discount Codes

### TC-SA-13-01-001 — Code creation: the code (the string, the discount, the scope); the code is explicit
**Type:** Positive
**Covers:** 1.1 → Code creation: the code (the string, the discount, the scope)
**Preconditions:** The Super Admin opens the discount code management.
**Steps:**
1. Create the discount code: the code string (e.g., WELCOME20), the discount (the percentage or the fixed amount), and the scope (the items, the plans, the courses).
2. Save the code.
3. Verify the code is live (the status is active) and can be redeemed.
**Expected Result:** The discount code is created (the string, the discount, the scope) — the code is explicit and live.
**Priority:** Critical

### TC-SA-13-01-002 — Code editing: the edit (the discount value, the scope, the limits); the edit is recorded and auditable
**Type:** Positive
**Covers:** 1.1 → Code editing: the edit (the discount value, the scope, the limits); Rule: a code edit (the discount value, the scope, the limits) is recorded (the new value, the new scope, the new limits); it is auditable
**Preconditions:** A discount code is live.
**Steps:**
1. Edit the code: the new discount value, the new scope, the new limits.
2. Save the edit.
3. Verify the code reflects the new value, scope, and limits.
4. Verify the edit is recorded and auditable.
**Expected Result:** The code is edited (the new value, the new scope, the new limits) — the edit is recorded and auditable.
**Priority:** High

### TC-SA-13-01-003 — Code deactivation: the deactivation (the code stops working); the deactivation is recorded and auditable
**Type:** Negative
**Covers:** 1.1 → Code deactivation: the deactivation (the code stops working); Rule: a code deactivation (the code stops working) is recorded (the status is deactivated); it is auditable
**Preconditions:** A discount code is live and active.
**Steps:**
1. Deactivate the code (the status is deactivated).
2. As a learner, attempt to redeem the deactivated code.
3. Verify the code stops working (the redemption is rejected).
4. Verify the deactivation is recorded and auditable.
**Expected Result:** The code is deactivated — it stops working and the deactivation is recorded and auditable.
**Priority:** Critical

### TC-SA-13-01-004 — Code uniqueness: the code is unique; the uniqueness is enforced
**Type:** Negative
**Covers:** 1.1 → Code uniqueness: the uniqueness (the code is unique); Rule: the code is unique (the code string is not used by another code); the uniqueness is enforced
**Preconditions:** A discount code with the string WELCOME20 exists.
**Steps:**
1. Attempt to create a new discount code with the same string WELCOME20.
2. Verify the creation is rejected (the code string is not used by another code).
3. Verify the uniqueness is enforced.
**Expected Result:** The duplicate code is rejected — the code is unique and the uniqueness is enforced.
**Priority:** Critical

### TC-SA-13-01-005 — Code scope: the scope (the code applies to the items, the plans, the courses); the scope is the control
**Type:** Negative
**Covers:** 1.1 → Code scope: the scope (the code applies to the items, the plans, the courses); Rule: the code scope is the application (the items, the plans, the courses); the scope is the control
**Preconditions:** A discount code is live with a scope limited to specific plans.
**Steps:**
1. As a learner, apply the code to an item within the scope — verify the discount is applied.
2. As a learner, apply the code to an item outside the scope — verify the discount is not applied.
3. Verify the scope is the control (the code applies only to the scoped items, plans, courses).
**Expected Result:** The code scope is enforced — the code applies only to the scoped items, plans, and courses.
**Priority:** Critical

### TC-SA-13-01-006 — Code status: the status (the active, the deactivated, the expired); the status is the control
**Type:** Positive
**Covers:** 1.1 → Code status: the status (the active, the deactivated, the expired); Rule: the code status is the active, the deactivated, or the expired; the status is the control
**Preconditions:** Discount codes exist in each status (active, deactivated, expired).
**Steps:**
1. Open the codes view and verify each code shows its status (the active, the deactivated, the expired).
2. Verify only the active codes can be redeemed.
3. Verify the status is the control (the status determines redeemability).
**Expected Result:** The code status is shown (the active, the deactivated, the expired) — the status is the control.
**Priority:** High

### TC-SA-13-01-007 — Code creation, editing, and deactivation are audit-logged with the code, discount, and timestamp
**Type:** Positive
**Covers:** 1.1 → Audit logging of the code creation, editing, and deactivation; Rule: code creation, editing, and deactivation are audit-logged with the code, discount, and timestamp
**Preconditions:** Code creation, editing, and deactivation events have occurred.
**Steps:**
1. Open the audit trail and filter by "discount code".
2. Verify entries show the code, the discount, and the timestamp for each event.
**Expected Result:** The code creation, editing, and deactivation are audit-logged with the code, discount, and timestamp.
**Priority:** Critical

## 1.2 Percentage and Fixed-Amount Discounts

### TC-SA-13-01-008 — Discount definition: the discount defined by the Super Admin (the type, the value, the scope); the type is the percentage or the fixed amount
**Type:** Positive
**Covers:** 1.2 → Discount type: the type (the percentage, the fixed amount); Discount definition: the discount defined by the Super Admin (the type, the value, the scope); Rule: the discount type is the percentage or the fixed amount; the type is the discount
**Preconditions:** The Super Admin opens the discount code management.
**Steps:**
1. Define the discount: the type (the percentage, the fixed amount), the value, and the scope.
2. Save the discount.
3. Verify the discount is live and the type is the percentage or the fixed amount.
**Expected Result:** The discount is defined (the type, the value, the scope) — the type is the percentage or the fixed amount.
**Priority:** Critical

### TC-SA-13-01-009 — Discount value: the value (the percentage, e.g., 20%, or the fixed amount, e.g., 500); the value is the basis
**Type:** Positive
**Covers:** 1.2 → Discount value: the value (the percentage, e.g., 20%, or the fixed amount, e.g., 500); Rule: the discount value is the amount (the percentage, e.g., 20%, or the fixed amount, e.g., 500); the value is the basis
**Preconditions:** A discount is defined with a value.
**Steps:**
1. Open the discount value.
2. Verify the value is the percentage (e.g., 20%) or the fixed amount (e.g., 500).
3. Verify the value is the basis for the discount application.
**Expected Result:** The discount value is the percentage or the fixed amount — the value is the basis.
**Priority:** High

### TC-SA-13-01-010 — Discount scope: the scope (the discount applies to the items, the plans, the courses); the scope is the control
**Type:** Positive
**Covers:** 1.2 → Discount scope: the scope (the discount applies to the items, the plans, the courses); Rule: the discount scope is the application (the items, the plans, the courses); the scope is the control
**Preconditions:** A discount is defined with a scope.
**Steps:**
1. Open the discount scope.
2. Verify the scope is the items, the plans, the courses the discount applies to.
3. Verify the scope is the control.
**Expected Result:** The discount scope is the application — the scope is the control.
**Priority:** High

### TC-SA-13-01-011 — Discount application: the discount applied (the discount is applied to the price, the total is reduced)
**Type:** Positive
**Covers:** 1.2 → Discount application: the discount applied (the discount is applied to the price)
**Preconditions:** A percentage discount (e.g., 20%) and a fixed-amount discount (e.g., 500) are live.
**Steps:**
1. As a learner, redeem the percentage code on a price — verify the total is reduced by 20%.
2. As a learner, redeem the fixed-amount code on a price — verify the total is reduced by 500.
3. Verify the discount is applied to the price in both cases.
**Expected Result:** The discount is applied — the total is reduced by the percentage or the fixed amount.
**Priority:** Critical

### TC-SA-13-01-012 — Discount record: the discount recorded (the code, the type, the value, the scope); the record is the proof
**Type:** Positive
**Covers:** 1.2 → Discount record: the discount recorded (the code, the type, the value, the scope)
**Preconditions:** A discount has been applied to a purchase.
**Steps:**
1. Open the discount record.
2. Verify it shows the code, the type, the value, and the scope.
**Expected Result:** The discount is recorded — the code, the type, the value, and the scope are shown.
**Priority:** High

### TC-SA-13-01-013 — Discount definition and applications are audit-logged with the code, type, and timestamp
**Type:** Positive
**Covers:** 1.2 → Audit logging of the discount definition and the applications; Rule: discount definition and applications are audit-logged with the code, type, and timestamp
**Preconditions:** Discount definition and application events have occurred.
**Steps:**
1. Open the audit trail and filter by "discount".
2. Verify entries show the code, the type, and the timestamp.
**Expected Result:** The discount definition and applications are audit-logged with the code, type, and timestamp.
**Priority:** Critical

### TC-SA-13-01-014 — A discount change (the type, the value, the scope updated) is recorded (the new type, the new value, the new scope, the time); it is auditable
**Type:** Positive
**Covers:** 1.2 → Rule: a discount change (the type, the value, the scope updated) is recorded (the new type, the new value, the new scope, the time); it is auditable
**Preconditions:** A discount is live.
**Steps:**
1. Change the discount (the new type, the new value, the new scope, the time).
2. Verify the discount is updated.
3. Verify the change is recorded and auditable.
**Expected Result:** The discount change is recorded (the new type, the new value, the new scope, the time) — it is auditable.
**Priority:** High

### TC-SA-13-01-015 — The discounts are visible (the codes, the types, the values, the scopes); the discount types are managed
**Type:** Positive
**Covers:** 1.2 → Rule: the discounts are visible (the codes, the types, the values, the scopes); the discount types are managed
**Preconditions:** Multiple discounts are defined.
**Steps:**
1. Open the discounts view.
2. Verify the codes, the types, the values, and the scopes are visible.
3. Verify the discount types are managed.
**Expected Result:** The discounts are visible — the codes, the types, the values, and the scopes are shown.
**Priority:** Medium

## 1.3 Usage Limits (Per User, Total Uses)

### TC-SA-13-01-016 — Limit definition: the limits defined by the Super Admin (the per-user limit, the total-uses limit); the per-user limit is the per-user control
**Type:** Positive
**Covers:** 1.3 → Per-user limit: the limit (the number of times a user can use the code); Limit definition: the limits defined by the Super Admin (the per-user limit, the total-uses limit); Rule: the per-user limit is the per-user control; the limit is the control
**Preconditions:** The Super Admin opens the discount code management.
**Steps:**
1. Define the usage limits: the per-user limit (the number of times a user can use the code) and the total-uses limit.
2. Save the limits.
3. Verify the per-user limit is the per-user control.
**Expected Result:** The usage limits are defined — the per-user limit is the per-user control.
**Priority:** Critical

### TC-SA-13-01-017 — Total-uses limit: the limit (the total number of times the code can be used); the limit is the total control
**Type:** Positive
**Covers:** 1.3 → Total-uses limit: the limit (the total number of times the code can be used); Rule: the total-uses limit is the total control (the total number of times the code can be used); the limit is the control
**Preconditions:** The usage limits are defined.
**Steps:**
1. Open the total-uses limit.
2. Verify the limit is the total number of times the code can be used.
3. Verify the limit is the total control.
**Expected Result:** The total-uses limit is the total control — the total number of times the code can be used.
**Priority:** High

### TC-SA-13-01-018 — Limit scope: the scope (the code, the limits); the scope is the control
**Type:** Positive
**Covers:** 1.3 → Limit scope: the scope (the code, the limits); Rule: the limit scope is the code and the limits; the scope is the control
**Preconditions:** The usage limits are defined.
**Steps:**
1. Open the limit scope.
2. Verify the scope is the code and the limits.
3. Verify the scope is the control.
**Expected Result:** The limit scope is the code and the limits — the scope is the control.
**Priority:** Medium

### TC-SA-13-01-019 — Limit enforcement: the limits enforced (the code is not used beyond the limits)
**Type:** Negative
**Covers:** 1.3 → Limit enforcement: the limits enforced (the code is not used beyond the limits)
**Preconditions:** A code is live with a per-user limit of 1 and a total-uses limit of 2.
**Steps:**
1. As user A, redeem the code once — verify it succeeds.
2. As user A, redeem the code again — verify it is rejected (the per-user limit is enforced).
3. As user B, redeem the code — verify it succeeds (total uses = 2).
4. As user C, redeem the code — verify it is rejected (the total-uses limit is enforced).
**Expected Result:** The limits are enforced — the code is not used beyond the per-user or total-uses limits.
**Priority:** Critical

### TC-SA-13-01-020 — Limit record: the limits recorded (the code, the per-user limit, the total-uses limit, the uses); the record is the proof
**Type:** Positive
**Covers:** 1.3 → Limit record: the limits recorded (the code, the per-user limit, the total-uses limit, the uses)
**Preconditions:** A code with usage limits has been redeemed.
**Steps:**
1. Open the limit record.
2. Verify it shows the code, the per-user limit, the total-uses limit, and the uses.
**Expected Result:** The limits are recorded — the code, the per-user limit, the total-uses limit, and the uses are shown.
**Priority:** High

### TC-SA-13-01-021 — Limit definition and enforcement are audit-logged with the code, limits, and timestamp
**Type:** Positive
**Covers:** 1.3 → Audit logging of the limit definition and the enforcement; Rule: limit definition and enforcement are audit-logged with the code, limits, and timestamp
**Preconditions:** Limit definition and enforcement events have occurred.
**Steps:**
1. Open the audit trail and filter by "usage limit".
2. Verify entries show the code, the limits, and the timestamp.
**Expected Result:** The limit definition and enforcement are audit-logged with the code, limits, and timestamp.
**Priority:** Critical

### TC-SA-13-01-022 — A limit change (the per-user limit, the total-uses limit updated) is recorded (the new per-user limit, the new total-uses limit, the time); it is auditable
**Type:** Positive
**Covers:** 1.3 → Rule: a limit change (the per-user limit, the total-uses limit updated) is recorded (the new per-user limit, the new total-uses limit, the time); it is auditable
**Preconditions:** The usage limits are live.
**Steps:**
1. Change the limits (the new per-user limit, the new total-uses limit, the time).
2. Verify the limits are updated.
3. Verify the change is recorded and auditable.
**Expected Result:** The limit change is recorded (the new per-user limit, the new total-uses limit, the time) — it is auditable.
**Priority:** High

### TC-SA-13-01-023 — The usage limits are visible (the codes, the per-user limits, the total-uses limits, the uses); the usage is managed
**Type:** Positive
**Covers:** 1.3 → Rule: the usage limits are visible (the codes, the per-user limits, the total-uses limits, the uses); the usage is managed
**Preconditions:** Multiple codes with usage limits are defined.
**Steps:**
1. Open the usage limits view.
2. Verify the codes, the per-user limits, the total-uses limits, and the uses are visible.
3. Verify the usage is managed.
**Expected Result:** The usage limits are visible — the codes, the per-user limits, the total-uses limits, and the uses are shown.
**Priority:** Medium

## 1.4 Validity Periods

### TC-SA-13-01-024 — Validity definition: the validity defined by the Super Admin (the start date, the end date); the start date is the start
**Type:** Positive
**Covers:** 1.4 → Start date: the date (the date the code becomes valid); Validity definition: the validity defined by the Super Admin (the start date, the end date); Rule: the start date is the start (the date the code becomes valid); the date is the control
**Preconditions:** The Super Admin opens the discount code management.
**Steps:**
1. Define the validity period: the start date (the date the code becomes valid) and the end date (the date the code expires).
2. Save the validity.
3. Verify the start date is the date the code becomes valid.
**Expected Result:** The validity is defined (the start date, the end date) — the start date is the start.
**Priority:** Critical

### TC-SA-13-01-025 — End date: the date (the date the code expires); the date is the control
**Type:** Positive
**Covers:** 1.4 → End date: the date (the date the code expires); Rule: the end date is the end (the date the code expires); the date is the control
**Preconditions:** The validity period is defined.
**Steps:**
1. Open the end date.
2. Verify the date is the date the code expires.
3. Verify the date is the control.
**Expected Result:** The end date is the date the code expires — the date is the control.
**Priority:** High

### TC-SA-13-01-026 — Validity scope: the scope (the code, the period); the scope is the control
**Type:** Positive
**Covers:** 1.4 → Validity scope: the scope (the code, the period); Rule: the validity scope is the code and the period; the scope is the control
**Preconditions:** The validity period is defined.
**Steps:**
1. Open the validity scope.
2. Verify the scope is the code and the period.
3. Verify the scope is the control.
**Expected Result:** The validity scope is the code and the period — the scope is the control.
**Priority:** Medium

### TC-SA-13-01-027 — Validity enforcement: the validity enforced (the code is not used outside the period)
**Type:** Negative
**Covers:** 1.4 → Validity enforcement: the validity enforced (the code is not used outside the period)
**Preconditions:** A code is defined with a validity period (start date in the future, end date later).
**Steps:**
1. Before the start date, attempt to redeem the code — verify it is rejected (not yet valid).
2. Within the period, redeem the code — verify it succeeds.
3. After the end date, attempt to redeem the code — verify it is rejected (expired).
**Expected Result:** The validity is enforced — the code is not used outside the period.
**Priority:** Critical

### TC-SA-13-01-028 — Validity record: the validity recorded (the code, the start date, the end date, the status); the record is the proof
**Type:** Positive
**Covers:** 1.4 → Validity record: the validity recorded (the code, the start date, the end date, the status)
**Preconditions:** A code with a validity period exists.
**Steps:**
1. Open the validity record.
2. Verify it shows the code, the start date, the end date, and the status.
**Expected Result:** The validity is recorded — the code, the start date, the end date, and the status are shown.
**Priority:** High

### TC-SA-13-01-029 — Validity definition and enforcement are audit-logged with the code, period, and timestamp
**Type:** Positive
**Covers:** 1.4 → Audit logging of the validity definition and the enforcement; Rule: validity definition and enforcement are audit-logged with the code, period, and timestamp
**Preconditions:** Validity definition and enforcement events have occurred.
**Steps:**
1. Open the audit trail and filter by "validity".
2. Verify entries show the code, the period, and the timestamp.
**Expected Result:** The validity definition and enforcement are audit-logged with the code, period, and timestamp.
**Priority:** Critical

### TC-SA-13-01-030 — A validity change (the start date, the end date updated) is recorded (the new start date, the new end date, the time); it is auditable
**Type:** Positive
**Covers:** 1.4 → Rule: a validity change (the start date, the end date updated) is recorded (the new start date, the new end date, the time); it is auditable
**Preconditions:** The validity period is live.
**Steps:**
1. Change the validity (the new start date, the new end date, the time).
2. Verify the validity is updated.
3. Verify the change is recorded and auditable.
**Expected Result:** The validity change is recorded (the new start date, the new end date, the time) — it is auditable.
**Priority:** High

### TC-SA-13-01-031 — The validity periods are visible (the codes, the start dates, the end dates, the statuses); the validity is managed
**Type:** Positive
**Covers:** 1.4 → Rule: the validity periods are visible (the codes, the start dates, the end dates, the statuses); the validity is managed
**Preconditions:** Multiple codes with validity periods are defined.
**Steps:**
1. Open the validity periods view.
2. Verify the codes, the start dates, the end dates, and the statuses are visible.
3. Verify the validity is managed.
**Expected Result:** The validity periods are visible — the codes, the start dates, the end dates, and the statuses are shown.
**Priority:** Medium
