# Digital Product Treatment & Marketplace Cleanup

## Goal

Keep physical products as a pure classified ads flow (contact seller, no online payment,
no escrow, no renewal), while making DIGITAL products a distinct online-purchase flow that
pays the seller wallet immediately.

## Locked decisions

- Only DIGITAL products show a "Buy Now" / "Access" online payment button.
- Digital purchase auto-completes: buyer pays, content unlocks instantly, seller wallet is
  credited immediately, and referral commission is credited immediately. No manual
  confirmation step.
- Digital products never expire and never enter the renewal/deactivation lifecycle.
- Digital content can be online-access (tutorial/video) OR downloadable (scripts/documents).
  Reuse existing `downloadUrl` and `videoUrl` fields to avoid a migration.
- Digital products keep an affiliate share button that propagates the referrer code.

## New digital flow

```mermaid
flowchart TD
    A[Buyer opens product] --> B{productType DIGITAL}
    B -->|No| C[Physical classified CTA phone and chat]
    B -->|Yes| D[Buy Now or Access Online CTA]
    D --> E[Initialize marketplace payment Flutterwave primary Paystack fallback]
    E --> F[Provider redirects to verify-purchase]
    F --> G[Verify payment]
    G --> H[Create marketplaceOrder status COMPLETED]
    H --> I[Credit SellerProfile walletBalance]
    H --> J[Credit referrer totalEarnings]
    H --> K[Unlock online access or download link]
    I --> L[Account page Seller Wallet]
    L --> M[Seller withdraws]
```

## Implementation notes

1. Lifecycle exemption: add `productType` to `checkProductLifecycle` select and return
   early for DIGITAL. Also skip DIGITAL in `checkSellerProductsLifecycle`, `renewProduct`,
   `getProductRenewalInfo`, the lifecycle/renew API routes, and `init-product-lifecycle`.
2. Payment guards: both marketplace payment routes reject PHYSICAL and only process DIGITAL.
3. Auto-complete: reuse the release calculation already present in the confirm route so
   admin commission, referral fee, wallet credit, and notifications stay consistent.
4. Buyer access: completed digital orders expose their `downloadUrl` or `videoUrl` from
   My Orders / My Purchases instead of a manual confirm-receipt button.
5. Wallet: the Account overview already renders a Seller Wallet card from
   `sellerProfile.walletBalance`. Instant digital credits flow there automatically; add a
   clearer withdraw affordance where needed.
