codesydney / marketplace-app-for-good

1 stars 1 forks source link

feat: migrate service-provider onboarding links to separate endpoint and handle stripe connect webhooks #34

Closed davidtaing closed 5 months ago

davidtaing commented 5 months ago

Summary

Database

New Endpoints

New Postgres Functions

Other

Diagrams

Service Provider Onboarding mermaid-diagram-2024-06-12-135344

Stripe Connect Webhook Handler This starts once the onboarding has been completed and will update the onboarding status on both the stripe_users and service_providers tables. We use a postgres function since it implicitly wraps the two updates into a single transaction. mermaid-diagram-2024-06-12-135707

Note: Stripe Payment webhooks will be handled by a separate endpoint.

Related

Testing Instructions

Automated Testing

Manual Testing

As a Service Provider

  1. Create a service provider account and navigate to /api/v1/service-providers/authorize.
  2. This should return a redirect link to Stripe. Complete onboarding with Stripe. Keep an eye out for the prompts to use the Test Phone, Account Details, etc.
  3. This should trigger a webhook which we will use to update the onboarding status on both of the stripe_users & service_providers tables

Note: Testing the webhook requires ngrok to be running as a reverse proxy and a webhook to be setup with Stripe.

As a Customer User

  1. Sign up as a new user and navigate to /api/v1/service-providers/authorize.
  2. This should return a 403 Forbidden response