-
Notifications
You must be signed in to change notification settings - Fork 512
payments schema changes, ledger algo, stackable items #862
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
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
a30a864
type fix
BilalG1 d6397fa
custom customer type
BilalG1 5e5c0ae
merge dev
BilalG1 d0e4e09
small fixes
BilalG1 1018ee5
fix test
BilalG1 553ffe0
fix issues
BilalG1 7e95b6b
revert import changes
BilalG1 da6f000
fix test
BilalG1 4b79dd1
offer and item pages, edits, deletes
BilalG1 4c546b8
fix lint
BilalG1 c22bf3c
small fixes
BilalG1 2b19be0
fix copy
BilalG1 03c06a2
payments test mode
BilalG1 19d1d52
revoke codes
BilalG1 582f876
fix test
BilalG1 8626012
stackable purchases
BilalG1 d5f0dd4
server only offers
BilalG1 82ff799
seed extra-admins, small fixes
BilalG1 eb7ee91
wip
BilalG1 1a3b465
updated schema
N2D4 40ff247
Include by default price
N2D4 4645d09
Combine subscriptions from DB and include-by-default
N2D4 3488427
wip updated schema
BilalG1 101c98a
schema fixes, ledger transactions
BilalG1 b27c7c8
merge dev
BilalG1 e537f6b
type fixes
BilalG1 2198b63
Separate Stripe account ID from schema
N2D4 9a5ac32
Merge branch 'payments-tx-ledger-algo' into payments-separate-stripe-…
N2D4 54bdf9a
Update AGENTS.md
N2D4 d10452d
Make CLAUDE.md an alias
N2D4 5e2b22a
fix tests and getSubscriptions
BilalG1 90c0b24
Merge remote-tracking branch 'origin/payments-separate-stripe-account…
BilalG1 dfdd231
type fix
BilalG1 8545274
fix stripe account info
BilalG1 59d375b
fix tests
BilalG1 4b7f823
fix tests
BilalG1 ee93553
fix tests
BilalG1 6e1a689
Merge dev into payments-tx-ledger-algo
N2D4 0420aa3
fix tests
BilalG1 f01efbb
Merge branch 'payments-tx-ledger-algo' of https://github.com/stack-au…
BilalG1 b36ed7e
fix createCheckoutUrl
BilalG1 157c024
payments fixes
BilalG1 7b2ac57
validate-code extra info
BilalG1 c878b3f
Merge branch 'dev' into payments-tx-ledger-algo
N2D4 dc37b10
fix test
BilalG1 2645635
fix conflicts
BilalG1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
apps/backend/prisma/migrations/20250821212828_subscription_quantity/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| -- AlterTable | ||
| ALTER TABLE "Subscription" ADD COLUMN "quantity" INTEGER NOT NULL DEFAULT 1; |
2 changes: 2 additions & 0 deletions
2
apps/backend/prisma/migrations/20250822203223_subscription_offer_id/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| -- AlterTable | ||
| ALTER TABLE "Subscription" ADD COLUMN "offerId" TEXT; |
2 changes: 2 additions & 0 deletions
2
apps/backend/prisma/migrations/20250825221947_stripe_account_id/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| -- AlterTable | ||
| ALTER TABLE "Project" ADD COLUMN "stripeAccountId" TEXT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
apps/backend/src/app/api/latest/internal/payments/stripe/account-info/route.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { getStackStripe } from "@/lib/stripe"; | ||
| import { globalPrismaClient } from "@/prisma-client"; | ||
| import { createSmartRouteHandler } from "@/route-handlers/smart-route-handler"; | ||
| import { adaptSchema, adminAuthTypeSchema, yupBoolean, yupNumber, yupObject, yupString } from "@stackframe/stack-shared/dist/schema-fields"; | ||
| import { StatusError } from "@stackframe/stack-shared/dist/utils/errors"; | ||
|
|
||
| export const GET = createSmartRouteHandler({ | ||
| metadata: { | ||
| hidden: true, | ||
| }, | ||
| request: yupObject({ | ||
| auth: yupObject({ | ||
| type: adminAuthTypeSchema.defined(), | ||
| project: adaptSchema.defined(), | ||
| tenancy: adaptSchema.defined(), | ||
| }).defined(), | ||
| }), | ||
| response: yupObject({ | ||
| statusCode: yupNumber().oneOf([200]).defined(), | ||
| bodyType: yupString().oneOf(["json"]).defined(), | ||
| body: yupObject({ | ||
| account_id: yupString().defined(), | ||
| charges_enabled: yupBoolean().defined(), | ||
| details_submitted: yupBoolean().defined(), | ||
| payouts_enabled: yupBoolean().defined(), | ||
| }).nullable(), | ||
| }), | ||
| handler: async ({ auth }) => { | ||
| const project = await globalPrismaClient.project.findUnique({ | ||
| where: { id: auth.project.id }, | ||
| select: { stripeAccountId: true }, | ||
| }); | ||
|
|
||
| if (!project?.stripeAccountId) { | ||
| return { | ||
| statusCode: 200, | ||
| bodyType: "json", | ||
| body: null, | ||
| }; | ||
| } | ||
|
|
||
| const stripe = getStackStripe(); | ||
| const account = await stripe.accounts.retrieve(project.stripeAccountId); | ||
|
|
||
| return { | ||
| statusCode: 200, | ||
| bodyType: "json", | ||
| body: { | ||
| account_id: account.id, | ||
| charges_enabled: account.charges_enabled || false, | ||
| details_submitted: account.details_submitted || false, | ||
| payouts_enabled: account.payouts_enabled || false, | ||
| }, | ||
| }; | ||
|
BilalG1 marked this conversation as resolved.
|
||
| }, | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.