Closed MitchExpensify closed 1 month ago
Triggered auto assignment to @puneetlath (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
Do you think this will solve the delay here @blimpich ? https://github.com/Expensify/App/issues/44904
When modifying the billing currency, the CVV code must be validated on the backend. The solution is to keep the form displayed with a loading indicator after clicking the Save button. If the API call succeeds, the form closes; otherwise, errors are displayed.
The same solution with this proposal.
First, we need to update: https://github.com/Expensify/App/blob/c973e622ac7bf94a537b01e75408aff782123db3/src/pages/settings/Subscription/PaymentCard/ChangeBillingCurrency/index.tsx#L23-L26 to:
if (values?.securityCode) {
PaymentMethods.updateBillingCurrency(currency ?? CONST.PAYMENT_CARD_CURRENCY.USD, values.securityCode);
return;
}
Navigation.goBack();
Then, add the logic:
const [formData] = useOnyx(ONYXKEYS.FORMS.CHANGE_BILLING_CURRENCY_FORM);
const formDataComplete = formData?.isLoading === false && !formData.errors;
const prevFormDataComplete = usePrevious(formDataComplete);
useEffect(() => {
if (isSecurityCodeRequired && formDataComplete && !prevFormDataComplete) {
Navigation.goBack();
}
}, [formDataComplete, prevFormDataComplete, isSecurityCodeRequired]);
to the PaymentCardChangeCurrencyForm
.
billingCurrencyForm
, but now in FE it is changeBillingCurrencyForm
. We should fix it.
For sure let's handle this in the same way as https://github.com/Expensify/App/issues/44904 when aligned.
Do you think this will solve the delay here @blimpich ? https://github.com/Expensify/App/issues/44904
It won't fix it but it'll be fixed in the same way, so we might as well handle them in 1 PR. See this comment.
Okay so looks like this is a backend bug. I briefly looked into this and its one of those problems that looks fairly straightforward at first but is more complicated than it seems.
When we call UpdateBillingCardCurrency
we aren't passing back any onyx data to the frontend, so the currency doesn't update unless the client does a full refresh, which then triggers a OpenSubscriptionPage
call which gets the updated fund. So naturally we could just add the onyx data to the auth command SetFundCurrency
, which is the Auth command that is triggered here, but its really just using CreateFund
under the hood. So fixing this "correctly" means moving Onyx updates from UserApi::addPaymentCard
in Web to CreateFund.cpp
, and then making sure that both adding a new payment card and changing the currency correctly update the onyx data and return it. Not insane stuff, but slightly more complicated than you would expect.
Marking this as an internal hotpick so that someone can pick up soon.
@blimpich Beside of the BE bug, this issue still need to implement solution to fix the original issue: The updated payment currency does not show without hard refresh and a small lag.
I think yes we will still need some frontend work, but lets come back to that once an Expensify engineer has fixed the backend bug. We'll handle this separately since this we have to wait for an Expensify engineer to have time to fix this.
@blimpich Can you re-assign me to this issue for easier to self keep track? Then I will create a PR to fix once the BE is fixed. Thanks
@blimpich Can you re-assign me to this issue for easier to self keep track? Then I will create a PR to fix once the BE is fixed. Thanks
Well actually this doesn't make sense really. This issue is now a backend issue. I'll create a separate frontend issue for making it wait for the request to finish.
Got an auth PR up to fix this. Will also need to get a web PR out to clean up onyx updates that are no longer needed in web. In review.
@blimpich Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
@blimpich Still overdue 6 days?! Let's take care of this!
Looks like web and auth PRs have been deployed. Closing.
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.0.5-10 Reproducible in staging?: Staging Reproducible in production?: If this was caught during regression testing, add the test name, ID and link from TestRail: NA Email or phone of affected tester (no customers): Logs: NA Expensify/Expensify Issue URL: NA Issue reported by: mitch@expensify.com Slack conversation: Internal: https://expensify.slack.com/archives/C036QM0SLJK/p1720560965872139?thread_ts=1720544914.651789&cid=C036QM0SLJK
Action Performed:
Expected Result:
You should see you payment currency update to the choice made at step 5
Actual Result:
The updated payment currency does not show without hard refresh and a small lag
Workaround:
Wait
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
https://github.com/Expensify/App/assets/36425901/abf5dd75-135e-44ad-b298-a0af513f9613
View all open jobs on GitHub