Skip to content

Add stripe billing logic #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
23f3c60
add side bar nav in settings page
msukkari Feb 11, 2025
04991fd
improve styling of members page
msukkari Feb 11, 2025
fde2179
wip adding stripe checkout button
msukkari Feb 11, 2025
9665f14
wip onboarding flow
msukkari Feb 12, 2025
33ae585
add stripe subscription id to org
msukkari Feb 12, 2025
e7f8f51
save stripe session id and add manage subscription button in settings
msukkari Feb 12, 2025
3ad6c2d
properly block access to pages if user isn't in an org
msukkari Feb 12, 2025
0a79f7c
wip add paywall
msukkari Feb 12, 2025
8d2c731
Domain support
brendan-kellam Feb 12, 2025
53dac38
merge domain changes
msukkari Feb 12, 2025
6caed35
add back paywall and also add support for incrememnting seat count on…
msukkari Feb 13, 2025
8ad6ba7
prevent self invite
msukkari Feb 13, 2025
258585e
action button styling in settings and toast on copy
msukkari Feb 13, 2025
84e8ec2
add ability to remove member from org
msukkari Feb 13, 2025
0b4140f
move stripe product id to env var
msukkari Feb 13, 2025
875f9b8
add await for blocking loop in backend
msukkari Feb 13, 2025
193c7e0
add subscription info to billing page
msukkari Feb 13, 2025
e2c90b8
handle trial case in billing info page
msukkari Feb 13, 2025
8929d05
add trial duration indicator to nav bar
msukkari Feb 13, 2025
a70c577
merge v3 changes into billing branch
msukkari Feb 13, 2025
5a3eab2
check if domain starts or ends with dash
msukkari Feb 13, 2025
e369925
remove unused no org component
msukkari Feb 13, 2025
b0cbcf0
remove package lock file and fix prisma dep version
msukkari Feb 13, 2025
d463748
revert dep version updates
msukkari Feb 13, 2025
4c0805c
fix yarn.lock
brendan-kellam Feb 13, 2025
0f43c00
add auth and membership check to fetchSubscription
msukkari Feb 13, 2025
cf97955
properly handle invite redeem with no valid subscription case
msukkari Feb 13, 2025
ea4c29d
change back fetch subscription to not require org membership
msukkari Feb 13, 2025
87efbf7
add back subscription check in invite redeem page
msukkari Feb 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ export const main = async (db: PrismaClient, context: AppContext) => {
connectionManager.registerPollingCallback();

const repoManager = new RepoManager(db, DEFAULT_SETTINGS, redis, context);
repoManager.blockingPollLoop();
await repoManager.blockingPollLoop();
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling for the async poll loop.

Converting to async/await is good, but consider adding error handling:

-    await repoManager.blockingPollLoop();
+    try {
+        await repoManager.blockingPollLoop();
+    } catch (error) {
+        logger.error('Poll loop failed');
+        console.error(error);
+        process.exit(1);
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await repoManager.blockingPollLoop();
try {
await repoManager.blockingPollLoop();
} catch (error) {
logger.error('Poll loop failed');
console.error(error);
process.exit(1);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Org" ADD COLUMN "stripeCustomerId" TEXT;
22 changes: 12 additions & 10 deletions packages/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,20 @@ model Invite {
}

model Org {
id Int @id @default(autoincrement())
name String
domain String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
members UserToOrg[]
connections Connection[]
repos Repo[]
secrets Secret[]
id Int @id @default(autoincrement())
name String
domain String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
members UserToOrg[]
connections Connection[]
repos Repo[]
secrets Secret[]

stripeCustomerId String?

/// List of pending invites to this organization
invites Invite[]
invites Invite[]
}

enum OrgRole {
Expand Down
3 changes: 3 additions & 0 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
"@sourcebot/db": "^0.1.0",
"@sourcebot/schemas": "^0.1.0",
"@ssddanbrown/codemirror-lang-twig": "^1.0.0",
"@stripe/react-stripe-js": "^3.1.1",
"@stripe/stripe-js": "^5.6.0",
"@tanstack/react-query": "^5.53.3",
"@tanstack/react-table": "^8.20.5",
"@tanstack/react-virtual": "^3.10.8",
Expand Down Expand Up @@ -113,6 +115,7 @@
"react-resizable-panels": "^2.1.1",
"server-only": "^0.0.1",
"sharp": "^0.33.5",
"stripe": "^17.6.0",
"tailwind-merge": "^2.5.2",
"tailwind-scrollbar-hide": "^1.1.7",
"tailwindcss-animate": "^1.0.7",
Expand Down
Loading