feat: integrate Stripe customer creation in organization action#280
Conversation
- Added `createStripeCustomer` function to handle Stripe customer creation. - Updated `createOrganizationAction` to create a Stripe customer upon organization creation and store the customer ID in the database. - Introduced new `stripe.ts` file for Stripe configuration and error handling. - Updated the `Organization` model to include `stripeCustomerId` field. - Removed outdated seeding scripts to streamline database management.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
|
Caution Review failedThe pull request is closed. WalkthroughThis pull request introduces a new Stripe customer creation workflow during the organization creation process. It adds a helper function to interact with the Stripe API, integrates error handling into the action, and updates the database with the newly obtained Stripe customer ID. Additional changes include adding environment variable checks for Stripe configuration and modifying the database schema by introducing a new column in the Organization table. The accompanying Prisma schema is updated accordingly, and obsolete seeding scripts have been removed from the database package. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant A as CreateOrganizationAction
participant S as createStripeCustomer
participant API as Stripe API
participant DB as Database
U->>A: Request to create organization
A->>S: Invoke createStripeCustomer(name, email, orgID)
S->>API: Call Stripe API to create customer (with orgID metadata)
API-->>S: Respond with customer id (or error)
alt Customer creation successful
S-->>A: Return stripeCustomerId
A->>DB: Update organization record with stripeCustomerId
else Customer creation fails
S-->>A: Return error/undefined
A->>A: Throw error "Stripe customer creation failed"
end
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (8)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
createStripeCustomerfunction to handle Stripe customer creation.createOrganizationActionto create a Stripe customer upon organization creation and store the customer ID in the database.stripe.tsfile for Stripe configuration and error handling.Organizationmodel to includestripeCustomerIdfield.Summary by CodeRabbit
New Features
Chores