From 107b38fc88292385b0d5492e8cbabeb702f8ba47 Mon Sep 17 00:00:00 2001 From: Rodrigo Lino da Costa Date: Wed, 13 Aug 2025 13:13:55 -0300 Subject: [PATCH 1/5] checking tranaction type before navgitaing --- Mobile-Expensify | 2 +- src/CONST/index.ts | 1 + .../settings/Subscription/CardSection/CardSection.tsx | 11 +++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Mobile-Expensify b/Mobile-Expensify index afe6b84f3b8e..283f63ade0aa 160000 --- a/Mobile-Expensify +++ b/Mobile-Expensify @@ -1 +1 @@ -Subproject commit afe6b84f3b8e2d6283a9bb2c20750fe33cc2a9a0 +Subproject commit 283f63ade0aa4bc7ec7a8e2a47a704b9793e9378 diff --git a/src/CONST/index.ts b/src/CONST/index.ts index de44ae98d2f7..c22d52948055 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -6952,6 +6952,7 @@ const CONST = { BILLING: { TYPE_FAILED_2018: 'failed_2018', + TYPE_STRIPE_FAILED_AUTHENTICATION: 'failed_stripe_authentication', }, ONBOARDING_HELP: { diff --git a/src/pages/settings/Subscription/CardSection/CardSection.tsx b/src/pages/settings/Subscription/CardSection/CardSection.tsx index 20762eed2ec5..563f7b04c21c 100644 --- a/src/pages/settings/Subscription/CardSection/CardSection.tsx +++ b/src/pages/settings/Subscription/CardSection/CardSection.tsx @@ -59,6 +59,10 @@ function CardSection() { const {isOffline} = useNetwork(); const defaultCard = useMemo(() => Object.values(fundList ?? {}).find((card) => card.accountData?.additionalData?.isBillingCard), [fundList]); const cardMonth = useMemo(() => DateUtils.getMonthNames()[(defaultCard?.accountData?.cardMonth ?? 1) - 1], [defaultCard?.accountData?.cardMonth]); + const hasFailedBillingWithAuthenticationRequired = useMemo( + () => purchaseList?.[0].message.billingType === CONST.BILLING.TYPE_STRIPE_FAILED_AUTHENTICATION, + [purchaseList], + ); const requestRefund = useCallback(() => { requestRefundByUser(); @@ -102,11 +106,14 @@ function CardSection() { }; useEffect(() => { - if (!authenticationLink || privateStripeCustomerID?.status !== CONST.STRIPE_SCA_AUTH_STATUSES.CARD_AUTHENTICATION_REQUIRED) { + if ( + !authenticationLink || + (privateStripeCustomerID?.status !== CONST.STRIPE_SCA_AUTH_STATUSES.CARD_AUTHENTICATION_REQUIRED && !hasFailedBillingWithAuthenticationRequired) + ) { return; } Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION_ADD_PAYMENT_CARD); - }, [authenticationLink, privateStripeCustomerID?.status]); + }, [authenticationLink, privateStripeCustomerID?.status, hasFailedBillingWithAuthenticationRequired]); const handleAuthenticatePayment = () => { verifySetupIntent(session?.accountID ?? CONST.DEFAULT_NUMBER_ID, false); From 653d80a921baa73baf533011a5192581a98560eb Mon Sep 17 00:00:00 2001 From: Rodrigo Lino da Costa Date: Wed, 13 Aug 2025 13:19:43 -0300 Subject: [PATCH 2/5] update mobile-exepnsify --- Mobile-Expensify | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mobile-Expensify b/Mobile-Expensify index 283f63ade0aa..cf1b9e864aa7 160000 --- a/Mobile-Expensify +++ b/Mobile-Expensify @@ -1 +1 @@ -Subproject commit 283f63ade0aa4bc7ec7a8e2a47a704b9793e9378 +Subproject commit cf1b9e864aa7900a46b23f15bcc06a1e654d7a33 From 9b9ca0076823d6135014904f3a56d0c2477dfc0c Mon Sep 17 00:00:00 2001 From: Rodrigo Lino da Costa <5201282+rlinoz@users.noreply.github.com> Date: Thu, 14 Aug 2025 13:34:40 -0300 Subject: [PATCH 3/5] Update src/pages/settings/Subscription/CardSection/CardSection.tsx Co-authored-by: Amy Evans --- src/pages/settings/Subscription/CardSection/CardSection.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/Subscription/CardSection/CardSection.tsx b/src/pages/settings/Subscription/CardSection/CardSection.tsx index 563f7b04c21c..22edbacef6d6 100644 --- a/src/pages/settings/Subscription/CardSection/CardSection.tsx +++ b/src/pages/settings/Subscription/CardSection/CardSection.tsx @@ -60,7 +60,7 @@ function CardSection() { const defaultCard = useMemo(() => Object.values(fundList ?? {}).find((card) => card.accountData?.additionalData?.isBillingCard), [fundList]); const cardMonth = useMemo(() => DateUtils.getMonthNames()[(defaultCard?.accountData?.cardMonth ?? 1) - 1], [defaultCard?.accountData?.cardMonth]); const hasFailedBillingWithAuthenticationRequired = useMemo( - () => purchaseList?.[0].message.billingType === CONST.BILLING.TYPE_STRIPE_FAILED_AUTHENTICATION, + () => purchaseList?.[0]?.message.billingType === CONST.BILLING.TYPE_STRIPE_FAILED_AUTHENTICATION, [purchaseList], ); From ffae6755612b8a58ac423a3697d6a9a604a62678 Mon Sep 17 00:00:00 2001 From: Rodrigo Lino da Costa Date: Thu, 14 Aug 2025 16:49:37 -0300 Subject: [PATCH 4/5] use both failed status --- .../settings/Subscription/CardSection/CardSection.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/settings/Subscription/CardSection/CardSection.tsx b/src/pages/settings/Subscription/CardSection/CardSection.tsx index 22edbacef6d6..3123e051d22b 100644 --- a/src/pages/settings/Subscription/CardSection/CardSection.tsx +++ b/src/pages/settings/Subscription/CardSection/CardSection.tsx @@ -59,8 +59,9 @@ function CardSection() { const {isOffline} = useNetwork(); const defaultCard = useMemo(() => Object.values(fundList ?? {}).find((card) => card.accountData?.additionalData?.isBillingCard), [fundList]); const cardMonth = useMemo(() => DateUtils.getMonthNames()[(defaultCard?.accountData?.cardMonth ?? 1) - 1], [defaultCard?.accountData?.cardMonth]); - const hasFailedBillingWithAuthenticationRequired = useMemo( - () => purchaseList?.[0]?.message.billingType === CONST.BILLING.TYPE_STRIPE_FAILED_AUTHENTICATION, + const hasFailedLastBilling = useMemo( + () => purchaseList?.[0]?.message.billingType === CONST.BILLING.TYPE_STRIPE_FAILED_AUTHENTICATION + || purchaseList?.[0]?.message.billingType === CONST.BILLING.TYPE_FAILED_2018, [purchaseList], ); @@ -108,12 +109,12 @@ function CardSection() { useEffect(() => { if ( !authenticationLink || - (privateStripeCustomerID?.status !== CONST.STRIPE_SCA_AUTH_STATUSES.CARD_AUTHENTICATION_REQUIRED && !hasFailedBillingWithAuthenticationRequired) + (privateStripeCustomerID?.status !== CONST.STRIPE_SCA_AUTH_STATUSES.CARD_AUTHENTICATION_REQUIRED && !hasFailedLastBilling) ) { return; } Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION_ADD_PAYMENT_CARD); - }, [authenticationLink, privateStripeCustomerID?.status, hasFailedBillingWithAuthenticationRequired]); + }, [authenticationLink, privateStripeCustomerID?.status, hasFailedLastBilling]); const handleAuthenticatePayment = () => { verifySetupIntent(session?.accountID ?? CONST.DEFAULT_NUMBER_ID, false); From a563e5f2c45a32b1a18c86f4ca791645dc4821a9 Mon Sep 17 00:00:00 2001 From: Rodrigo Lino da Costa Date: Thu, 14 Aug 2025 16:51:00 -0300 Subject: [PATCH 5/5] prettier --- .../settings/Subscription/CardSection/CardSection.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/pages/settings/Subscription/CardSection/CardSection.tsx b/src/pages/settings/Subscription/CardSection/CardSection.tsx index 3123e051d22b..f61b30fb9d05 100644 --- a/src/pages/settings/Subscription/CardSection/CardSection.tsx +++ b/src/pages/settings/Subscription/CardSection/CardSection.tsx @@ -60,8 +60,7 @@ function CardSection() { const defaultCard = useMemo(() => Object.values(fundList ?? {}).find((card) => card.accountData?.additionalData?.isBillingCard), [fundList]); const cardMonth = useMemo(() => DateUtils.getMonthNames()[(defaultCard?.accountData?.cardMonth ?? 1) - 1], [defaultCard?.accountData?.cardMonth]); const hasFailedLastBilling = useMemo( - () => purchaseList?.[0]?.message.billingType === CONST.BILLING.TYPE_STRIPE_FAILED_AUTHENTICATION - || purchaseList?.[0]?.message.billingType === CONST.BILLING.TYPE_FAILED_2018, + () => purchaseList?.[0]?.message.billingType === CONST.BILLING.TYPE_STRIPE_FAILED_AUTHENTICATION || purchaseList?.[0]?.message.billingType === CONST.BILLING.TYPE_FAILED_2018, [purchaseList], ); @@ -107,10 +106,7 @@ function CardSection() { }; useEffect(() => { - if ( - !authenticationLink || - (privateStripeCustomerID?.status !== CONST.STRIPE_SCA_AUTH_STATUSES.CARD_AUTHENTICATION_REQUIRED && !hasFailedLastBilling) - ) { + if (!authenticationLink || (privateStripeCustomerID?.status !== CONST.STRIPE_SCA_AUTH_STATUSES.CARD_AUTHENTICATION_REQUIRED && !hasFailedLastBilling)) { return; } Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION_ADD_PAYMENT_CARD);