Conversation
Older cmux preview screenshots (latest comment is below)Preview Screenshots⏳ Preview screenshots are being captured... Workspace and dev browser links will appear here once the preview environment is ready. Generated by cmux preview system |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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. Comment |
Greptile OverviewGreptile SummaryAdds subscription cancellation functionality with a new DELETE endpoint that allows users to cancel their own subscriptions and team admins to cancel team subscriptions. Key Changes:
Potential Issue:
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client as Client App
participant API as DELETE /payments/products
participant Auth as Permission Check
participant DB as Database
participant Stripe as Stripe API
participant Webhook as Stripe Webhook
Client->>API: DELETE request with product_id
API->>Auth: Verify client permissions
alt User subscription
Auth->>Auth: Check user owns subscription
else Team subscription
Auth->>DB: Check user has team_admin permission
end
API->>DB: Get owned products
API->>API: Validate product type (not one_time)
API->>DB: Find active/trialing subscription
alt Stripe subscription exists
API->>Stripe: stripe.subscriptions.cancel()
Stripe-->>API: Cancellation confirmed
Note over Stripe,Webhook: Stripe triggers webhook event
Webhook->>DB: syncStripeSubscriptions() updates status
end
API->>DB: Update subscription status to canceled
Note over API,DB: Potential race condition with webhook
API-->>Client: Return success response
Client->>Client: Invalidate product cache
|
apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/route.ts
Outdated
Show resolved
Hide resolved
apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/route.ts
Outdated
Show resolved
Hide resolved
apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/route.ts
Outdated
Show resolved
Hide resolved
apps/backend/src/app/api/latest/payments/products/[customer_type]/[customer_id]/route.ts
Outdated
Show resolved
Hide resolved
Older cmux preview screenshots (latest comment is below)Preview Screenshots⏳ Preview screenshots are being captured... Workspace and dev browser links will appear here once the preview environment is ready. Generated by cmux preview system |
Older cmux preview screenshots (latest comment is below)Preview Screenshots⏳ Preview screenshots are being captured... Workspace and dev browser links will appear here once the preview environment is ready. Generated by cmux preview system |
Older cmux preview screenshots (latest comment is below)Preview Screenshots⏳ Preview screenshots are being captured... Workspace and dev browser links will appear here once the preview environment is ready. Generated by cmux preview system |
Older cmux preview screenshots (latest comment is below)Preview Screenshots⏳ Preview screenshots are being captured... Workspace and dev browser links will appear here once the preview environment is ready. Generated by cmux preview system |
Preview ScreenshotsOpen Workspace (1 hr expiry) · Open Dev Browser (1 hr expiry) · Open Diff Heatmap Screenshot capture was skipped.
Generated by cmux preview system |
No description provided.