Skip to content

Conversation

Copy link

Copilot AI commented Dec 25, 2025

Adds 196-channel dataset (IDs 25-220) with gold-tier designation and billing integration scaffolding for Stripe webhooks and Firestore-backed entitlements. All secrets externalized to env vars; extensive TODOs mark manual configuration points.

Dataset

  • src/data/channels.full.json: 196 channels, gold-tier IDs: 26, 33, 36, 40
  • src/utils/loadChannels.js: Load helper with require() + fs.readFileSync() fallback

Client-Side Gating

src/components/ChannelLock.stubs.jsx: React component demonstrating tier-based access control

<ChannelLock channel={channel}>
  <VideoPlayer src={channel.stream} />
</ChannelLock>

Mock useUserEntitlements() returns { tier: 'silver' }. Gold-tier channels render lock overlay with upgrade CTA. Replace with Firestore /entitlements/{uid} subscription.

Billing Backend

functions/stripe-webhooks/index.js: Express webhook handler skeleton

  • Reads STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET from env
  • TODOs for stripe.webhooks.constructEvent() signature verification
  • Stub handlers for invoice.payment_succeeded, customer.subscription.* events
  • Maps Stripe customers via metadata.firebaseUid → Firestore updates

Documentation

  • functions/README.md: Firebase deploy sequence, config commands
  • docs/STRIPE_FIREBASE_INTEGRATION.md: Firestore schema (/users/{uid}/subscriptions, /entitlements/{uid}), checkout flow, security rules
  • README/DEVNOTES.md: CI/CD credential matrix (Stripe test/live keys, Firebase service account, Android keystore)

Required Before Deploy

  1. Set Firebase config: firebase functions:config:set stripe.secret_key=... stripe.webhook_secret=...
  2. Create Stripe products/prices, configure webhook endpoint
  3. Implement TODOs: signature verification, Firestore writes, tier mapping logic
  4. Deploy Firestore security rules (entitlements read-only for authenticated users)

No real secrets committed. All env vars documented in DEVNOTES.md.

Warning

GitHub's Secret Scanning detected potential secrets in the added content. We attempted to remediate the issue by updating the code or redacting.

Original prompt

Create a draft pull request on STACEY77/RAG7 that adds a large sample channel dataset and starter Stripe + Firebase billing integration stubs. Do NOT include any real secrets. Keep the PR as a draft for review.

Files to add (exact paths and high-level contents):

  1. src/data/channels.full.json
  • Combined dataset with 210 channels (IDs 25-220). This includes the original 60 channels plus 150 auto-generated synthetic channels. Several channels are marked with a tier property; gold-tier channel ids are 26, 33, 36, 40. Streams and logos use placeholder domains and placeholder image URLs. Example object shape for each channel: { id, name, country, language, category, logo, stream, epg, type, tier }.
  • Use the exact JSON content prepared in the conversation (channels.full.json) — do not modify tiers for existing IDs.
  1. src/utils/loadChannels.js
  • Export a function loadChannels() that loads and returns src/data/channels.full.json using require('../data/channels.full.json') with a fallback to fs.readFileSync for environments where JSON require may fail. Return [] on error and log errors to console. Use CommonJS exports.
  1. src/components/ChannelLock.stubs.jsx
  • Add a React component demonstrating client-side gating. Include a mock hook useUserEntitlements() returning a sample entitlement (tier: 'silver'). If channel.tier === 'gold' and user.tier !== 'gold', render a lock overlay with an "Upgrade to Gold" CTA. Include comments explaining to replace the mock with Firestore-backed entitlement checks.
  1. functions/stripe-webhooks/index.js
  • Add an Express app skeleton intended for Firebase Cloud Functions to receive Stripe webhooks. Use bodyParser.raw({ type: 'application/json' }) and show TODOs for verifying signatures with stripe.webhooks.constructEvent. Read STRIPE_WEBHOOK_SECRET and STRIPE_SECRET_KEY from env. Parse req.body safely after verification. Route invoice.payment_succeeded, invoice.payment_failed, customer.subscription.* to TODO handlers that update Firestore (explain mapping via metadata: firebaseUid). Do not include any real secrets.
  1. functions/README.md
  • Explain how to deploy the webhook functions, how to set Firebase functions config (stripe.secret_key, stripe.webhook_secret), a reminder to verify signatures, and a short deploy sequence: firebase functions:config:set ... && firebase deploy --only functions.
  1. docs/STRIPE_FIREBASE_INTEGRATION.md
  • Integration overview: suggested Firestore schema (/users/{uid}, /users/{uid}/subscriptions/{subId}, /entitlements/{uid}), mapping stripe customers via metadata, recommended flow (client -> function creates Checkout Session -> Stripe Checkout -> webhook updates Firestore -> client reads entitlements), and security notes.
  1. README/DEVNOTES.md
  • Checklist for maintainers listing required credentials and env var names for CI: STRIPE_TEST_SECRET, STRIPE_TEST_PUBLISHABLE, STRIPE_LIVE_SECRET, STRIPE_LIVE_PUBLISHABLE, STRIPE_WEBHOOK_SECRET, FIREBASE_SERVICE_ACCOUNT (base64), FIREBASE_PROJECT_ID, ANDROID_KEYSTORE (base64) or KEY_ALIAS/KEYSTORE_PASSWORD/KEY_PASSWORD. Include steps to open the draft PR, staging verification, and production promotion steps.

Constraints & requirements:

  • Open the PR as a draft so keys can be applied later and further wiring can be done after access is granted.
  • Do NOT commit any secrets or service account JSON; code must read secrets from process.env and include clear README instructions.
  • Keep changes minimal and well-documented with TODOs where manual configuration is required (Stripe product creation, webhook secret insertion, Firebase deploy with proper permissions, replacing placeholder streams with licensed feeds).

PR body (include this description verbatim in the pull request):

  • Adds src/data/channels.full.json with 210 channels (IDs 25-220). Gold-tier channel ids: 26, 33, 36, 40.
  • Adds src/utils/loadChannels.js to load the channels JSON.
  • Adds src/components/ChannelLock.stubs.jsx gating stub demonstrating entitlement checks and Upgrade CTA.
  • Adds functions/stripe-webhooks/index.js webhook skeleton (reads env vars, TODOs for signature verification and Firestore updates).
  • Adds functions/README.md with deploy instructions and environment variable guidance.
  • Adds docs/STRIPE_FIREBASE_INTEGRATION.md with integration plan, schema and notes.
  • Adds README/DEVNOTES.md listing credentials required and next steps.

Checklist for maintainers (include in PR body):

  • Confirm gold-tier channel ids (26, 33, 36, 40) or provide additional IDs to mark gold.
  • Provide Stripe test keys or invite a Stripe user so products/prices can be created.
  • Provide Firebase service account or grant deployer permissions for functions and Firestore so webhook functions can be deployed.
  • Provide CI signing access or keystore for APK generation if you want a signed build.

Please open a draft pull request on the default branch and return the PR URL and a short summary of what was added. If anything is unclear, ask for clar...

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 25, 2025
Co-authored-by: Stacey77 <54900383+Stacey77@users.noreply.github.com>
Copilot AI changed the title [WIP] Add large sample channel dataset and billing integration stubs Add channel dataset and Stripe + Firebase billing integration stubs Dec 25, 2025
Copilot AI requested a review from Stacey77 December 25, 2025 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants