# 2. Discount Codes & Sharing — Test Cases

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

## Test Execution Policy

- Zero tolerance: any deviation from the documented behavior is a defect.
- Every failed test is logged with a Bug ID, the feature, the sub-feature, the expected vs actual result, and the severity; 100% of bugs are fixed before the group passes.
- 100% pass rate is required for the group to be marked complete.

## Coverage Matrix

| Feature | Sub-feature / Rule | Test IDs |
|---------|--------------------|----------|
| 2.1 | Create a discount code (if permitted) | TC-AF-3-02-001 |
| 2.1 | Set the discount value | TC-AF-3-02-002 |
| 2.1 | Set the code expiry | TC-AF-3-02-003 |
| 2.1 | Set the usage limit | TC-AF-3-02-004 |
| 2.1 | Code generated and attributed to the Affiliate | TC-AF-3-02-005 |
| 2.1 | Code usage tracking | TC-AF-3-02-006 |
| 2.1 | Codes available on web and mobile | TC-AF-3-02-007 |
| 2.1 | Codes event logging (created, used) | TC-AF-3-02-008 |
| 2.1 | Audit logging of the discount code creation | TC-AF-3-02-009 |
| 2.1 | Rule: The code creation is permitted by the program tier. | TC-AF-3-02-001 |
| 2.1 | Rule: The code has a value, expiry, and usage limit. | TC-AF-3-02-002 |
| 2.1 | Rule: The code is attributed to the Affiliate. | TC-AF-3-02-003 |
| 2.1 | Rule: Codes events (created, used) are logged with the account and the timestamp. | TC-AF-3-02-004 |
| 2.1 | Rule: The discount code creation is audit-logged with the account and the timestamp. | TC-AF-3-02-005 |
| 2.2 | Share the referral link to a messaging app | TC-AF-3-02-010 |
| 2.2 | Share the referral link to email | TC-AF-3-02-011 |
| 2.2 | Share the referral link to a social channel | TC-AF-3-02-012 |
| 2.2 | Copy the referral link | TC-AF-3-02-013 |
| 2.2 | Share options shown | TC-AF-3-02-014 |
| 2.2 | Share tracking | TC-AF-3-02-015 |
| 2.2 | Sharing available on web and mobile | TC-AF-3-02-016 |
| 2.2 | Sharing event logging (shared, copied) | TC-AF-3-02-017 |
| 2.2 | Audit logging of the share referral link | TC-AF-3-02-018 |
| 2.2 | Rule: The share options include messaging, email, and social. | TC-AF-3-02-010 |
| 2.2 | Rule: The share is tracked. | TC-AF-3-02-011 |
| 2.2 | Rule: Sharing events (shared, copied) are logged with the account and the timestamp. | TC-AF-3-02-012 |
| 2.2 | Rule: The share referral link is audit-logged with the account and the timestamp. | TC-AF-3-02-013 |
| 2.3 | Create a tracked referral link | TC-AF-3-02-019 |
| 2.3 | Label the link by campaign or channel | TC-AF-3-02-020 |
| 2.3 | View the link's performance separately | TC-AF-3-02-021 |
| 2.3 | List of tracked links | TC-AF-3-02-022 |
| 2.3 | Delete a tracked link | TC-AF-3-02-023 |
| 2.3 | Tracked links available on web and mobile | TC-AF-3-02-024 |
| 2.3 | Tracked links event logging (created, deleted) | TC-AF-3-02-025 |
| 2.3 | Audit logging of the referral tracking links | TC-AF-3-02-026 |
| 2.3 | Rule: The tracked links are labeled by campaign or channel. | TC-AF-3-02-019 |
| 2.3 | Rule: The performance is shown per link. | TC-AF-3-02-020 |
| 2.3 | Rule: A tracked link can be deleted. | TC-AF-3-02-021 |
| 2.3 | Rule: Tracked links events (created, deleted) are logged with the account and the timestamp. | TC-AF-3-02-022 |
| 2.3 | Rule: The referral tracking links is audit-logged with the account and the timestamp. | TC-AF-3-02-023 |

## 2.1 Discount Code Creation

### TC-AF-3-02-001 — Create a discount code (if permitted)
**Type:** Positive
**Covers:** 2.1 → Create a discount code (if permitted); Rule: The code creation is permitted by the program tier.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Create a discount code (if permitted).
2. Observe the result and verify the full behavior: Create a discount code (if permitted).
**Expected Result:** Create a discount code (if permitted) — delivered exactly as documented.
**Priority:** Critical

### TC-AF-3-02-002 — Set the discount value
**Type:** Positive
**Covers:** 2.1 → Set the discount value; Rule: The code has a value, expiry, and usage limit.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Set the discount value.
2. Observe the result and verify the full behavior: Set the discount value.
**Expected Result:** Set the discount value — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-003 — Set the code expiry
**Type:** Edge
**Covers:** 2.1 → Set the code expiry; Rule: The code is attributed to the Affiliate.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Set the code expiry.
2. Observe the result and verify the full behavior: Set the code expiry.
**Expected Result:** Set the code expiry — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-004 — Set the usage limit
**Type:** Edge
**Covers:** 2.1 → Set the usage limit; Rule: Codes events (created, used) are logged with the account and the timestamp.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Set the usage limit.
2. Observe the result and verify the full behavior: Set the usage limit.
**Expected Result:** Set the usage limit — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-005 — Code generated and attributed to the Affiliate
**Type:** Positive
**Covers:** 2.1 → Code generated and attributed to the Affiliate; Rule: The discount code creation is audit-logged with the account and the timestamp.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Code generated and attributed to the Affiliate.
2. Observe the result and verify the full behavior: Code generated and attributed to the Affiliate.
**Expected Result:** Code generated and attributed to the Affiliate — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-006 — Code usage tracking
**Type:** Positive
**Covers:** 2.1 → Code usage tracking
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Code usage tracking.
2. Observe the result and verify the full behavior: Code usage tracking.
**Expected Result:** Code usage tracking — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-007 — Codes available on web and mobile
**Type:** Positive
**Covers:** 2.1 → Codes available on web and mobile
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Codes available on web and mobile.
2. Observe the result and verify the full behavior: Codes available on web and mobile.
**Expected Result:** Codes available on web and mobile — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-008 — Codes event logging (created, used)
**Type:** Positive
**Covers:** 2.1 → Codes event logging (created, used)
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Codes event logging (created, used).
2. Observe the result and verify the full behavior: Codes event logging (created, used).
**Expected Result:** Codes event logging (created, used) — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-009 — Audit logging of the discount code creation
**Type:** Positive
**Covers:** 2.1 → Audit logging of the discount code creation
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, perform the discount code creation action.
2. Open the audit log and verify the entry for the action.
**Expected Result:** The discount code creation action is recorded in the audit log with the account and the timestamp.
**Priority:** Critical


## 2.2 Share Referral Link

### TC-AF-3-02-010 — Share the referral link to a messaging app
**Type:** Positive
**Covers:** 2.2 → Share the referral link to a messaging app; Rule: The share options include messaging, email, and social.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Share the referral link to a messaging app.
2. Observe the result and verify the full behavior: Share the referral link to a messaging app.
**Expected Result:** Share the referral link to a messaging app — delivered exactly as documented.
**Priority:** Critical

### TC-AF-3-02-011 — Share the referral link to email
**Type:** Positive
**Covers:** 2.2 → Share the referral link to email; Rule: The share is tracked.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Share the referral link to email.
2. Observe the result and verify the full behavior: Share the referral link to email.
**Expected Result:** Share the referral link to email — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-012 — Share the referral link to a social channel
**Type:** Positive
**Covers:** 2.2 → Share the referral link to a social channel; Rule: Sharing events (shared, copied) are logged with the account and the timestamp.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Share the referral link to a social channel.
2. Observe the result and verify the full behavior: Share the referral link to a social channel.
**Expected Result:** Share the referral link to a social channel — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-013 — Copy the referral link
**Type:** Positive
**Covers:** 2.2 → Copy the referral link; Rule: The share referral link is audit-logged with the account and the timestamp.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Copy the referral link.
2. Observe the result and verify the full behavior: Copy the referral link.
**Expected Result:** Copy the referral link — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-014 — Share options shown
**Type:** Positive
**Covers:** 2.2 → Share options shown
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Share options shown.
2. Observe the result and verify the full behavior: Share options shown.
**Expected Result:** Share options shown — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-015 — Share tracking
**Type:** Positive
**Covers:** 2.2 → Share tracking
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Share tracking.
2. Observe the result and verify the full behavior: Share tracking.
**Expected Result:** Share tracking — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-016 — Sharing available on web and mobile
**Type:** Positive
**Covers:** 2.2 → Sharing available on web and mobile
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Sharing available on web and mobile.
2. Observe the result and verify the full behavior: Sharing available on web and mobile.
**Expected Result:** Sharing available on web and mobile — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-017 — Sharing event logging (shared, copied)
**Type:** Positive
**Covers:** 2.2 → Sharing event logging (shared, copied)
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Sharing event logging (shared, copied).
2. Observe the result and verify the full behavior: Sharing event logging (shared, copied).
**Expected Result:** Sharing event logging (shared, copied) — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-018 — Audit logging of the share referral link
**Type:** Positive
**Covers:** 2.2 → Audit logging of the share referral link
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, perform the share referral link action.
2. Open the audit log and verify the entry for the action.
**Expected Result:** The share referral link action is recorded in the audit log with the account and the timestamp.
**Priority:** Critical


## 2.3 Referral Tracking Links

### TC-AF-3-02-019 — Create a tracked referral link
**Type:** Positive
**Covers:** 2.3 → Create a tracked referral link; Rule: The tracked links are labeled by campaign or channel.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Create a tracked referral link.
2. Observe the result and verify the full behavior: Create a tracked referral link.
**Expected Result:** Create a tracked referral link — delivered exactly as documented.
**Priority:** Critical

### TC-AF-3-02-020 — Label the link by campaign or channel
**Type:** Positive
**Covers:** 2.3 → Label the link by campaign or channel; Rule: The performance is shown per link.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Label the link by campaign or channel.
2. Observe the result and verify the full behavior: Label the link by campaign or channel.
**Expected Result:** Label the link by campaign or channel — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-021 — View the link's performance separately
**Type:** Positive
**Covers:** 2.3 → View the link's performance separately; Rule: A tracked link can be deleted.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: View the link's performance separately.
2. Observe the result and verify the full behavior: View the link's performance separately.
**Expected Result:** View the link's performance separately — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-022 — List of tracked links
**Type:** Positive
**Covers:** 2.3 → List of tracked links; Rule: Tracked links events (created, deleted) are logged with the account and the timestamp.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: List of tracked links.
2. Observe the result and verify the full behavior: List of tracked links.
**Expected Result:** List of tracked links — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-023 — Delete a tracked link
**Type:** Positive
**Covers:** 2.3 → Delete a tracked link; Rule: The referral tracking links is audit-logged with the account and the timestamp.
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Delete a tracked link.
2. Observe the result and verify the full behavior: Delete a tracked link.
**Expected Result:** Delete a tracked link — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-024 — Tracked links available on web and mobile
**Type:** Positive
**Covers:** 2.3 → Tracked links available on web and mobile
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Tracked links available on web and mobile.
2. Observe the result and verify the full behavior: Tracked links available on web and mobile.
**Expected Result:** Tracked links available on web and mobile — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-025 — Tracked links event logging (created, deleted)
**Type:** Positive
**Covers:** 2.3 → Tracked links event logging (created, deleted)
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, set up the precondition and perform: Tracked links event logging (created, deleted).
2. Observe the result and verify the full behavior: Tracked links event logging (created, deleted).
**Expected Result:** Tracked links event logging (created, deleted) — delivered exactly as documented.
**Priority:** High

### TC-AF-3-02-026 — Audit logging of the referral tracking links
**Type:** Positive
**Covers:** 2.3 → Audit logging of the referral tracking links
**Preconditions:** A Affiliate account is active and the Affiliate is in the state required for this behavior.
**Steps:**
1. As a Affiliate, perform the referral tracking links action.
2. Open the audit log and verify the entry for the action.
**Expected Result:** The referral tracking links action is recorded in the audit log with the account and the timestamp.
**Priority:** Critical
