From fa13d34ac03e06e11b084b8cbc307b4b8be24738 Mon Sep 17 00:00:00 2001
From: Winston Hsiao <96440583+Winston-Hsiao@users.noreply.github.com>
Date: Thu, 14 Nov 2024 20:43:20 -0500
Subject: [PATCH] Refine Preorder (#605)
* No longer duplicate save payment methods
* Save multiple cards/payment methods, fixed standard checkout
* Stripe connect specific webhook endpoint
* UI improvements
---
.github/workflows/test.yml | 1 +
CONTRIBUTING.md | 9 +-
env.sh.example | 2 +
frontend/src/components/pages/Profile.tsx | 16 +-
.../src/components/pages/SellerDashboard.tsx | 16 +-
frontend/src/components/ui/Input/Input.tsx | 8 +
frontend/src/gen/api.ts | 57 ++++++-
store/app/model.py | 5 +
store/app/routers/stripe.py | 152 ++++++++++++------
store/settings/environment.py | 1 +
10 files changed, 200 insertions(+), 67 deletions(-)
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 0727ad8a..85c6ada0 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -32,6 +32,7 @@ env:
VITE_STRIPE_PUBLISHABLE_KEY: ${{ secrets.VITE_STRIPE_PUBLISHABLE_KEY }}
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }}
STRIPE_WEBHOOK_SECRET: ${{ secrets.STRIPE_WEBHOOK_SECRET }}
+ STRIPE_CONNECT_WEBHOOK_SECRET: ${{ secrets.STRIPE_CONNECT_WEBHOOK_SECRET }}
jobs:
run-tests:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4912fd3c..07674007 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -85,6 +85,7 @@ export ONSHAPE_SECRET_KEY=''
export VITE_STRIPE_PUBLISHABLE_KEY=''
export STRIPE_SECRET_KEY=''
export STRIPE_WEBHOOK_SECRET=''
+export STRIPE_CONNECT_WEBHOOK_SECRET=''
```
### Google OAuth Configuration
@@ -264,7 +265,13 @@ Run this to recieve stripe webhooks locally:
stripe listen --forward-to localhost:8080/stripe/webhook
```
-Make sure to set the `STRIPE_WEBHOOK_SECRET` environment variable to the value
+Run this to recieve stripe connect webhooks locally:
+
+```bash
+stripe listen --forward-connect-to localhost:8080/stripe/connect/webhook
+```
+
+Make sure to set the `STRIPE_WEBHOOK_SECRET` and `STRIPE_CONNECT_WEBHOOK_SECRET` environment variables to the values
shown in the terminal and source it to the terminal you are running
`make start-backend` in.
diff --git a/env.sh.example b/env.sh.example
index 331098fc..70696eb7 100644
--- a/env.sh.example
+++ b/env.sh.example
@@ -34,3 +34,5 @@ export ONSHAPE_SECRET_KEY=''
export VITE_STRIPE_PUBLISHABLE_KEY=''
export STRIPE_SECRET_KEY=''
export STRIPE_WEBHOOK_SECRET=''
+export STRIPE_CONNECT_WEBHOOK_SECRET=''
+
diff --git a/frontend/src/components/pages/Profile.tsx b/frontend/src/components/pages/Profile.tsx
index 4a5db159..5e4e609c 100644
--- a/frontend/src/components/pages/Profile.tsx
+++ b/frontend/src/components/pages/Profile.tsx
@@ -293,13 +293,15 @@ export const RenderProfile = (props: RenderProfileProps) => {
You must complete seller onboarding to sell robots
)}
-
-
+
+
+
+
{!user.stripe_connect_account_id ? (