Skip to content

feat(deposit): fixes routing after user is authenticated#17393

Merged
wachunei merged 12 commits into
mainfrom
deposit-routing-fixes
Jul 22, 2025
Merged

feat(deposit): fixes routing after user is authenticated#17393
wachunei merged 12 commits into
mainfrom
deposit-routing-fixes

Conversation

@georgeweiler

@georgeweiler georgeweiler commented Jul 18, 2025

Copy link
Copy Markdown
Contributor

Description

Updates the useDepositRouting hook to correctly follow the rules needed for maintaining user state when routing. Pages now call routeAfterAuthentication when they are routing which will take care of fetching forms for updated kyc status.

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-money-movement issues related to Money Movement features label Jul 18, 2025
@georgeweiler georgeweiler changed the title feat(deposit): fixes route after authentication to check for forms co… feat(deposit): fixes route after user is authenticated Jul 21, 2025
@georgeweiler georgeweiler changed the title feat(deposit): fixes route after user is authenticated feat(deposit): fixes routing after user is authenticated Jul 21, 2025
@georgeweiler georgeweiler added No QA Needed Apply this label when your PR does not need any QA effort. Run Smoke E2E labels Jul 22, 2025
@georgeweiler georgeweiler marked this pull request as ready for review July 22, 2025 14:47
@georgeweiler georgeweiler requested a review from a team as a code owner July 22, 2025 14:47
@github-actions

github-actions Bot commented Jul 22, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: b4fec3e
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/d9eacf46-ae7e-4d73-a271-a42291d19180

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

cursor[bot]

This comment was marked as outdated.

@socket-security

socket-security Bot commented Jul 22, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​consensys/​native-ramps-sdk@​1.1.0 ⏵ 1.1.292 -810010099 -180 -19

View full report

cursor[bot]

This comment was marked as outdated.

@github-actions

github-actions Bot commented Jul 22, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: d241a07
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/aa6d4390-4460-4be6-869e-59c56412a33c

Note

  • You can rerun any failed steps by opening the Bitrise build, tapping Rebuild on the upper right then Rebuild unsuccessful Workflows
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: KYC Routing Flaws Cause Submission Errors

The KYC routing logic contains flaws in its form submission checks and recursive handling. Conditions like form?.isSubmitted === false or !form?.isSubmitted incorrectly evaluate when a form is not present in the requiredForms array, leading to missed routing (e.g., Basic Info, Additional Verification) or attempts to auto-submit non-existent forms (Purpose of Usage). Additionally, exceeding the recursive depth limit (5) for Purpose of Usage form submission causes routeAfterAuthentication to return early, leaving users stuck without further routing.

app/components/UI/Ramp/Deposit/hooks/useDepositRouting.ts#L402-L424

// auto-submit purpose of usage form and then recursive call to route again
if (!getForm(TransakFormId.PURPOSE_OF_USAGE)?.isSubmitted) {
if (depth < 5) {
await submitPurposeOfUsage([
'Buying/selling crypto for investments',
]);
await routeAfterAuthentication(quote, depth + 1);
} else {
Logger.error(
new Error(`Submit of purpose depth exceeded: ${depth}`),
);
}
return;
}
// if personal details or address form is not submitted, route to basic info
// SSN is always submitted with personal details for US users, so we don't need to check for it
const personalDetailsForm = getForm(TransakFormId.PERSONAL_DETAILS);
const addressForm = getForm(TransakFormId.ADDRESS);
if (
personalDetailsForm?.isSubmitted === false ||
addressForm?.isSubmitted === false
) {

app/components/UI/Ramp/Deposit/hooks/useDepositRouting.ts#L436-L437

const idProofForm = getForm(TransakFormId.ID_PROOF);
if (idProofForm?.isSubmitted === false) {

Fix in CursorFix in Web


Bug: Analytics Event Timing Error

The RAMPS_OTP_CONFIRMED success analytics event is incorrectly tracked before routeAfterAuthentication(quote). This leads to inaccurate analytics, as the event is sent even if routing subsequently fails. The event should only be tracked after successful routing.

app/components/UI/Ramp/Deposit/Views/OtpCode/OtpCode.tsx#L176-L188

try {
setIsLoading(true);
setError(null);
const response = await submitCode();
if (!response) {
throw new Error('No response from submitCode');
}
await setAuthToken(response);
trackEvent('RAMPS_OTP_CONFIRMED', {
ramp_type: 'DEPOSIT',
region: selectedRegion?.isoCode || '',
});
await routeAfterAuthentication(quote);

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@georgeweiler georgeweiler enabled auto-merge July 22, 2025 19:46
@sonarqubecloud

Copy link
Copy Markdown

@georgeweiler georgeweiler added this pull request to the merge queue Jul 22, 2025
@wachunei wachunei removed this pull request from the merge queue due to a manual request Jul 22, 2025
@wachunei

Copy link
Copy Markdown
Member

Skipping e2e after 3 attemps

@wachunei wachunei added this pull request to the merge queue Jul 22, 2025
Merged via the queue into main with commit 0ef5a5d Jul 22, 2025
77 of 80 checks passed
@wachunei wachunei deleted the deposit-routing-fixes branch July 22, 2025 21:41
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 22, 2025
@metamaskbot metamaskbot added the release-7.53.0 Issue or pull request that will be included in release 7.53.0 label Jul 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

No QA Needed Apply this label when your PR does not need any QA effort. release-7.53.0 Issue or pull request that will be included in release 7.53.0 team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants