-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: Add ACH payment flows #3673
Draft
suejung-sentry
wants to merge
6
commits into
main
Choose a base branch
from
sshin/stripe-3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+223
−14
Draft
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7f4797b
feat: Add ACH payment flows
suejung-sentry 9c51adb
wip
suejung-sentry 6c42961
handle upgrade flow
suejung-sentry b9ff2e2
Merge remote-tracking branch 'origin/main' into sshin/stripe-3
suejung-sentry fb74dde
cleanup
suejung-sentry 23f48e8
Merge remote-tracking branch 'origin/main' into sshin/stripe-3
suejung-sentry 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 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 |
---|---|---|
|
@@ -8,7 +8,11 @@ import config from 'config' | |
|
||
import { SentryRoute } from 'sentry' | ||
|
||
import { useAccountDetails } from 'services/account' | ||
import { Provider } from 'shared/api/helpers' | ||
import { Theme, useThemeContext } from 'shared/ThemeContext' | ||
import A from 'ui/A' | ||
import { Alert } from 'ui/Alert' | ||
import LoadingLogo from 'ui/LoadingLogo' | ||
|
||
import { PlanProvider } from './context' | ||
|
@@ -35,17 +39,29 @@ const Loader = () => ( | |
</div> | ||
) | ||
|
||
interface URLParams { | ||
owner: string | ||
provider: Provider | ||
} | ||
|
||
function PlanPage() { | ||
const { owner, provider } = useParams() | ||
const { owner, provider } = useParams<URLParams>() | ||
const { data: ownerData } = useSuspenseQueryV5( | ||
PlanPageDataQueryOpts({ owner, provider }) | ||
) | ||
const { data: accountDetails } = useAccountDetails({ | ||
provider, | ||
owner, | ||
}) | ||
|
||
const { theme } = useThemeContext() | ||
const isDarkMode = theme !== Theme.LIGHT | ||
|
||
if (config.IS_SELF_HOSTED || !ownerData?.isCurrentUserPartOfOrg) { | ||
return <Redirect to={`/${provider}/${owner}`} /> | ||
} | ||
const hasUnverifiedPaymentMethods = | ||
accountDetails?.unverifiedPaymentMethods?.length | ||
|
||
return ( | ||
<div className="flex flex-col gap-4"> | ||
|
@@ -61,6 +77,14 @@ function PlanPage() { | |
> | ||
<PlanProvider> | ||
<PlanBreadcrumb /> | ||
{hasUnverifiedPaymentMethods ? ( | ||
<UnverifiedPaymentMethodAlert | ||
url={ | ||
accountDetails?.unverifiedPaymentMethods?.[0] | ||
?.hostedVerificationLink | ||
} | ||
/> | ||
) : null} | ||
<Suspense fallback={<Loader />}> | ||
<Switch> | ||
<SentryRoute path={path} exact> | ||
|
@@ -90,4 +114,27 @@ function PlanPage() { | |
) | ||
} | ||
|
||
const UnverifiedPaymentMethodAlert = ({ url }: { url?: string }) => { | ||
return ( | ||
<> | ||
<Alert variant={'warning'}> | ||
<Alert.Title>New Payment Method Awaiting Verification</Alert.Title> | ||
<Alert.Description> | ||
Your new payment method requires verification.{' '} | ||
<A | ||
href={url} | ||
isExternal={true} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: can just put isExternal |
||
hook="stripe-payment-method-verification" | ||
to={undefined} | ||
> | ||
Click here | ||
</A>{' '} | ||
to complete the verification process. | ||
</Alert.Description> | ||
</Alert> | ||
<br /> | ||
</> | ||
) | ||
} | ||
|
||
export default PlanPage |
This file contains 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 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 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 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
12 changes: 10 additions & 2 deletions
12
...PlanPage/subRoutes/CurrentOrgPlan/InfoMessageStripeCallback/InfoMessageStripeCallback.tsx
This file contains 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 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
73 changes: 73 additions & 0 deletions
73
src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeFormModal.tsx
This file contains 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,73 @@ | ||
import A from 'ui/A' | ||
import Button from 'ui/Button' | ||
import Icon from 'ui/Icon' | ||
import Modal from 'ui/Modal' | ||
|
||
interface UpgradeModalProps { | ||
isOpen: boolean | ||
onClose: () => void | ||
onConfirm: () => void | ||
url: string | ||
isUpgrading?: boolean | ||
} | ||
|
||
const UpgradeFormModal = ({ | ||
isOpen, | ||
onClose, | ||
onConfirm, | ||
url, | ||
isUpgrading = false, | ||
}: UpgradeModalProps) => ( | ||
<Modal | ||
isOpen={isOpen} | ||
onClose={onClose} | ||
title={ | ||
<p className="flex items-center gap-2 text-base"> | ||
<Icon | ||
name="exclamationTriangle" | ||
size="sm" | ||
className="fill-ds-primary-yellow" | ||
/> | ||
Incomplete Plan Upgrade | ||
</p> | ||
} | ||
body={ | ||
<div className="flex flex-col gap-4"> | ||
<div> | ||
You have an incomplete plan upgrade that is awaiting payment | ||
verification{' '} | ||
<A | ||
href={url} | ||
isExternal | ||
hook={'verify-payment-method'} | ||
to={undefined} | ||
> | ||
here | ||
</A> | ||
. | ||
</div> | ||
<p> | ||
Are you sure you wish to abandon the pending upgrade and start a new | ||
one? | ||
</p> | ||
</div> | ||
} | ||
footer={ | ||
<div className="flex gap-2"> | ||
<Button hook="cancel-upgrade" onClick={onClose} disabled={isUpgrading}> | ||
Cancel | ||
</Button> | ||
<Button | ||
hook="confirm-upgrade" | ||
variant="primary" | ||
onClick={onConfirm} | ||
disabled={isUpgrading} | ||
> | ||
{isUpgrading ? 'Processing...' : 'Yes, Start New Upgrade'} | ||
</Button> | ||
</div> | ||
} | ||
/> | ||
) | ||
|
||
export default UpgradeFormModal |
This file contains 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: don't need to wrap that in {}