Fix: setup_payout_account returns error flash instead of Stripe Connect redirect (#274)#310
Open
Ishant5436 wants to merge 1 commit into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #274
Bug
When an existing user (who had already partially or fully completed Stripe onboarding) clicked the Update details button, they were greeted with a
Something went wrongerror flash instead of being redirected to Stripe Connect. This was because thesetup_payout_accounthandler unconditionally requested anaccount_onboardingaccount link type, which fails via the Stripe API if the account has already submitted its details. The API returned an error that was being swallowed by a catch-all{:error, _reason}match.Fix
Payments.create_account_link/3to accept atypeargument (defaulting to"account_onboarding").setup_payout_accountevent handlers in both the User and Orgtransactions_live.exmodules to dynamically checksocket.assigns.account.details_submitted. If true, the link type is correctly set to"account_update", restoring the ability for users to update their payout details.