-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Feature: Implement 3ds flow #44321
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
Merged
blimpich
merged 18 commits into
Expensify:main
from
waterim:feat-42432-Implement_3ds_flow
Jul 23, 2024
Merged
Feature: Implement 3ds flow #44321
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d078648
add gbp auth stripe
waterim a5a8059
Merge remote-tracking branch 'upstream/main' into feat-42432-Implemen…
waterim 9f131d6
Merge remote-tracking branch 'upstream/main' into feat-42432-Implemen…
waterim 29edc5d
Merge remote-tracking branch 'upstream/main' into feat-42432-Implemen…
waterim 3898b2c
fixes
waterim 1cfac81
Merge remote-tracking branch 'upstream/main' into feat-42432-Implemen…
waterim 3ca9d86
fix ts lint
waterim 7bf7f0d
remove podfile
waterim be23e36
Merge remote-tracking branch 'upstream/main' into feat-42432-Implemen…
waterim d1613db
remove duplicates
waterim 010950c
Merge remote-tracking branch 'upstream/main' into feat-42432-Implemen…
waterim 680baca
revert changes from blimpich PR with removing GBP from the app
waterim 6f8eaf3
Merge remote-tracking branch 'upstream/main' into feat-42432-Implemen…
waterim 76a4258
Merge remote-tracking branch 'upstream/main' into feat-42432-Implemen…
waterim dc01b39
update flow with new API call and adjust modal to close after getting…
waterim ade7ac2
remove getBack
waterim 7e67295
add isVerifying param
waterim ee3d7d1
add clean-up for event listener
waterim 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 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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| type VerifySetupIntentParams = { | ||
| accountID: number; | ||
| isVerifying: boolean; | ||
| }; | ||
| export default VerifySetupIntentParams; |
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
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
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
96 changes: 96 additions & 0 deletions
96
src/pages/settings/Subscription/CardAuthenticationModal/index.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| import React, {useCallback, useEffect, useState} from 'react'; | ||
| import {View} from 'react-native'; | ||
| import {useOnyx} from 'react-native-onyx'; | ||
| import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; | ||
| import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
| import Modal from '@components/Modal'; | ||
| import ScreenWrapper from '@components/ScreenWrapper'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import * as PaymentMethods from '@userActions/PaymentMethods'; | ||
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import ROUTES from '@src/ROUTES'; | ||
|
|
||
| type CardAuthenticationModalProps = { | ||
| /** Title shown in the header of the modal */ | ||
| headerTitle?: string; | ||
| }; | ||
| function CardAuthenticationModal({headerTitle}: CardAuthenticationModalProps) { | ||
| const styles = useThemeStyles(); | ||
| const [authenticationLink] = useOnyx(ONYXKEYS.VERIFY_3DS_SUBSCRIPTION); | ||
| const [session] = useOnyx(ONYXKEYS.SESSION); | ||
| const [privateStripeCustomerID] = useOnyx(ONYXKEYS.NVP_PRIVATE_STRIPE_CUSTOMER_ID); | ||
| const [isLoading, setIsLoading] = useState(true); | ||
|
|
||
| useEffect(() => { | ||
| if (privateStripeCustomerID?.status !== CONST.STRIPE_GBP_AUTH_STATUSES.SUCCEEDED) { | ||
| return; | ||
| } | ||
| PaymentMethods.clearPaymentCard3dsVerification(); | ||
| Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION); | ||
| }, [privateStripeCustomerID]); | ||
|
|
||
| const handleGBPAuthentication = useCallback( | ||
| (event: MessageEvent<string>) => { | ||
| const message = event.data; | ||
| if (message === CONST.GBP_AUTHENTICATION_COMPLETE) { | ||
| PaymentMethods.verifySetupIntent(session?.accountID ?? -1, true); | ||
| } | ||
| }, | ||
| [session?.accountID], | ||
| ); | ||
|
|
||
| useEffect(() => { | ||
| window.addEventListener('message', handleGBPAuthentication); | ||
| return () => { | ||
| window.removeEventListener('message', handleGBPAuthentication); | ||
| }; | ||
| }, [handleGBPAuthentication]); | ||
|
|
||
| const onModalClose = () => { | ||
| PaymentMethods.clearPaymentCard3dsVerification(); | ||
| }; | ||
|
|
||
| return ( | ||
| <Modal | ||
| type={CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE} | ||
| isVisible={!!authenticationLink} | ||
| onClose={onModalClose} | ||
| onModalHide={onModalClose} | ||
| > | ||
| <ScreenWrapper | ||
| style={styles.pb0} | ||
| includePaddingTop={false} | ||
| includeSafeAreaPaddingBottom={false} | ||
| testID={CardAuthenticationModal.displayName} | ||
| > | ||
| <HeaderWithBackButton | ||
| title={headerTitle} | ||
| shouldShowBorderBottom | ||
| shouldShowCloseButton | ||
| onCloseButtonPress={onModalClose} | ||
| shouldShowBackButton={false} | ||
| /> | ||
| {isLoading && <FullScreenLoadingIndicator />} | ||
| <View style={[styles.flex1]}> | ||
| <iframe | ||
| src={authenticationLink} | ||
| title="Statements" | ||
| height="100%" | ||
| width="100%" | ||
| seamless | ||
| style={{border: 'none'}} | ||
| onLoad={() => { | ||
| setIsLoading(false); | ||
| }} | ||
| /> | ||
| </View> | ||
| </ScreenWrapper> | ||
| </Modal> | ||
| ); | ||
| } | ||
|
|
||
| CardAuthenticationModal.displayName = 'CardAuthenticationModal'; | ||
|
|
||
| export default CardAuthenticationModal; | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /** Model of private stripe customer ID */ | ||
| type PrivateStripeCustomer = { | ||
| /** Currency of the stripe payment */ | ||
| [currency: string]: string; | ||
| /** paymentMethodID of the stripe payment */ | ||
| paymentMethodID: string; | ||
| /** Status of the stripe payment */ | ||
| status: string; | ||
| }; | ||
|
|
||
| export default PrivateStripeCustomer; |
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.
This change caused this bug
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.
This component we were not rendering for the native, so while testing in mobile it wasn't crash for me.
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.
@Pujan92
Why no? We don't have native.tsx file
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.
Ahh I see. Thanks
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.
My bad 😄
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.
I mean it is from the place where we render this component, in this PR
PaymentCardcomponent is responsible for calling this and there we have this platform specific file. And if I remember correctly, in the doc it is mentioned that stripe flow won't be allowed in native.