Skip to content

Conversation

@parthshr370
Copy link
Contributor

@parthshr370 parthshr370 commented Jul 25, 2025

🏷️ Ticket

Fixed ability to add coupons for discount Stripe

📝 Description

how to replicate results -

docker compose down
docker compose up -d
docker compose exec runner python -m aci.cli populate-subscription-plans --skip-dry-run

Terminal 2: Start Stripe webhook forwarding

stripe listen --forward-to localhost:8000/v1/billing/webhook

cd /frontend

pnpm install
pnpm run dev
( make sure to populate the env with SERVER_PROPELAUTH_AUTH_URL , SERVER_PROPELAUTH_API_KEY )

🎥 Demo (if applicable)

📸 Screenshots (if applicable)

Screenshot_20250725_154713 Screenshot_20250805_203329

✅ Checklist

  • I have signed the Contributor License Agreement (CLA) and read the contributing guide (required)
  • I have linked this PR to an issue or a ticket (required)
  • I have updated the documentation related to my change if needed
  • I have updated the tests accordingly (required for a bug fix or a new feature)
  • All checks on CI passed

Summary by cubic

Enabled support for Stripe coupons during checkout, allowing users to apply promotion codes for discounts.

Summary by CodeRabbit

  • New Features
    • Enabled support for promotion codes during the subscription checkout process. Users can now apply promotion codes when making a purchase.
  • Bug Fixes
    • Updated subscription plan redirects to send users to the settings page instead of the account page.

@parthshr370 parthshr370 had a problem deploying to CICD_FOR_FORKED_REPO July 25, 2025 12:21 — with GitHub Actions Failure
@parthshr370 parthshr370 had a problem deploying to CICD_FOR_FORKED_REPO July 25, 2025 12:21 — with GitHub Actions Failure
@vercel
Copy link

vercel bot commented Jul 25, 2025

@parthshr370 is attempting to deploy a commit to the Proxy Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 25, 2025

Walkthrough

The change updates the Stripe checkout session creation in the billing API to include the allow_promotion_codes=True parameter, enabling promotion codes during subscription purchases. It also modifies a mock authentication method to return a static empty user list for local development, and changes a frontend redirect from "/account" to "/settings" for subscribed users. No other logic or error handling is altered.

Changes

Cohort / File(s) Change Summary
Billing API
backend/aci/server/routes/billing.py
Added allow_promotion_codes=True to Stripe checkout session creation to enable promotion codes.
Mock Authentication
backend/mock/propelauth_fastapi_mock.py
Modified fetch_users_in_org to return a mocked empty UsersPagedResponse instead of calling real API.
Frontend Pricing Page
frontend/src/app/pricing/page.tsx
Changed redirect in PricingPage from "/account" to "/settings" when user has a non-free subscription plan.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • thisisfixer

Poem

In the warren’s code, a feature hops in,
Promotion codes now join the billing spin.
Mocked users vanish, empty and neat,
Redirects changed for a smoother seat.
With a twitch of the nose and a hop so light,
Checkout and settings now feel just right! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3178bdb and 0a7f70e.

📒 Files selected for processing (2)
  • backend/mock/propelauth_fastapi_mock.py (1 hunks)
  • frontend/src/app/pricing/page.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • frontend/src/app/pricing/page.tsx
🧰 Additional context used
📓 Path-based instructions (1)
backend/**/*.py

📄 CodeRabbit Inference Engine (CLAUDE.md)

backend/**/*.py: Backend Python code must be compatible with Python 3.12+
Backend must use ruff for formatting and linting
Backend must use mypy for type checking

Files:

  • backend/mock/propelauth_fastapi_mock.py
🧠 Learnings (2)
📚 Learning: propelauth's sdk (auth.fetch_users_in_org and related methods) already handles errors internally and...
Learnt from: alex-aipolabs
PR: aipotheosis-labs/aci#453
File: backend/aci/server/routes/organizations.py:87-117
Timestamp: 2025-06-04T17:34:14.865Z
Learning: PropelAuth's SDK (auth.fetch_users_in_org and related methods) already handles errors internally and provides reliable data structures, so additional try-catch blocks and getattr() calls for property access are not needed in PropelAuth API calls.

Applied to files:

  • backend/mock/propelauth_fastapi_mock.py
📚 Learning: propelauth's `remove_user_from_org` method already handles member existence validation and error cas...
Learnt from: alex-aipolabs
PR: aipotheosis-labs/aci#453
File: backend/aci/server/routes/organizations.py:49-85
Timestamp: 2025-06-04T17:36:56.520Z
Learning: PropelAuth's `remove_user_from_org` method already handles member existence validation and error cases internally, so additional error handling and member existence checks are not needed when using this method in backend/aci/server/routes/organizations.py.

Applied to files:

  • backend/mock/propelauth_fastapi_mock.py
🔇 Additional comments (1)
backend/mock/propelauth_fastapi_mock.py (1)

273-281: Mock implementation looks appropriate for local development.

The mock correctly returns an empty UsersPagedResponse with proper pagination metadata, preserving the expected return type and structure. The local import within the method is appropriate for a mock implementation.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@recurseml
Copy link

recurseml bot commented Jul 25, 2025

✨ No issues found! Your code is sparkling clean! ✨

Need help? Join our Discord for support!
https://discord.gg/qEjHQk64Z9

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

No issues found across 1 file. Review in cubic

Copy link
Contributor

@jiwei-aipolabs jiwei-aipolabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@parthshr370 parthshr370 had a problem deploying to CICD_FOR_FORKED_REPO August 5, 2025 08:06 — with GitHub Actions Failure
@parthshr370 parthshr370 had a problem deploying to CICD_FOR_FORKED_REPO August 5, 2025 08:06 — with GitHub Actions Failure
@parthshr370 parthshr370 had a problem deploying to CICD_FOR_FORKED_REPO August 5, 2025 15:31 — with GitHub Actions Failure
@parthshr370 parthshr370 had a problem deploying to CICD_FOR_FORKED_REPO August 5, 2025 15:31 — with GitHub Actions Failure
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