Skip to content

Improve kyc level 2 ux#677

Merged
gianfra-t merged 21 commits into
stagingfrom
improve-kyc-level-2-ux
Jun 12, 2025
Merged

Improve kyc level 2 ux#677
gianfra-t merged 21 commits into
stagingfrom
improve-kyc-level-2-ux

Conversation

@gianfra-t
Copy link
Copy Markdown
Contributor

@gianfra-t gianfra-t commented May 28, 2025

Issues: #630 and #673.

Changes

  • Adds a new taxId field to KYC level 1 form that is connected to the main taxId state. If taxId is detected invalid, it displays a message on the field and allows for change.
  • Validation screens for both levels do not close automatically anymore, and require user interaction. For accepted and for rejected, showing the error message for the later.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 28, 2025

Deploy Preview for pendulum-pay ready!

Name Link
🔨 Latest commit 8d80551
🔍 Latest deploy log https://app.netlify.com/projects/pendulum-pay/deploys/684b106cae269e0008761b24
😎 Deploy Preview https://deploy-preview-677--pendulum-pay.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

case 'face match failure':
return KycFailureReason.FACE;
case 'name does not match':
return KycFailureReason.NAME;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There may be others, I'm not entirely sure as we don't see much failures. There is one with the birthdate but I believe we agreed at some point not to show too much.

useEffect(() => {
if (error) {
handleError(error.message);
const threshold = 60000;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This effect is for not failing immediately if a connection error happens. But > 60 seconds it will in fact show a network error failure.
We can adjust this threshold.

@gianfra-t gianfra-t changed the title [In-Development] Improve kyc level 2 ux Improve kyc level 2 ux Jun 4, 2025
assetSymbol: fromToken?.assetSymbol,
});
}
// if (Big(userInputTokenBalance).lt(inputAmount ?? 0)) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leaving this for testing. So it's easier to trigger a level 2.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Okay, you can uncomment it again now.

@gianfra-t gianfra-t requested review from a team and Copilot June 4, 2025 15:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the KYC level 2 user experience by introducing a new taxId field, updating failure handling, and modifying the KYC validation and UI interactions. Key changes include:

  • Adding a new taxId field and corresponding validation logic in the KYC form.
  • Updating failure handling and status messaging logic in the KYC process.
  • Adjusting API response payloads and mapping of KYC failure reasons.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
shared/src/endpoints/brla.endpoints.ts Added KycFailureReason enum and updated GetKycStatusResponse properties.
frontend/src/translations/pt.json Added taxId translations and KYC failure reason messages in Portuguese.
frontend/src/translations/en.json Added taxId translations and KYC failure reason messages in English.
frontend/src/services/signingService.tsx Updated type usage for KYC status response.
frontend/src/hooks/** Adjusted form schema, state synchronization, and status update logic for KYC process.
frontend/src/components/BrlaComponents/** Updated components to integrate the new taxId field and failure messaging UI.
api/src/api/controllers/brla.controller.ts Updated event threshold and added failure reason mapping for API responses.
Comments suppressed due to low confidence (1)

api/src/api/controllers/brla.controller.ts:350

  • The event threshold was changed from 60000ms to 2000ms; please confirm that this reduction is intentional and review its impact on event freshness criteria.
if (lastInteraction && lastEventCached.createdAt <= lastInteraction - 2000) {

Comment thread shared/src/endpoints/brla.endpoints.ts Outdated
Comment thread frontend/src/translations/pt.json Outdated
Comment thread frontend/src/translations/en.json Outdated
Copy link
Copy Markdown
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

Great stuff 👌

When testing locally using the BRLA sandbox environment, I did the following:

  • Generated a random CPF and changed the last digit to a different one.
  • I was able to proceed to the KYC form 1 (totally fine)
  • I filled in all the other fields with dummy data and proceeded by clicking on the button.
  • I was quickly taken back to KYC form 1 telling me that my CPF was invalid.
    Perfect flow, I love it.

I noticed you changed the form field validation to trigger onChange and not onBlur. Is there a reason for this change? I think onBlur is better because otherwise the user would often times see an error already when they try to fill in the field for the first time.

I noticed one bug though. Once I used a 'valid' dummy CPF, the KYC verification for level 1 succeeded, at least the UI told me so, and I clicked on the 'Confirm' button. I was taken back to the base swap page and immediately presented with the ramp summary dialog. All good, so far. Now the proplem is that I never saw a pix key and the button stays at processing because apparently the registration of the ramp failed because the subaccount does not exist. This doesn't really make sense because in the KYC verification, the subaccount must have been created a very long time ago. My assumption would be that for some reason, not an up-to-date subacount or taxID was used, maybe the invalid one I originally entered with the other digit. I only corrected it to a 'correct' CPF on the KYC form 1 and not the base swap page, so maybe it was not correctly applied to the overall state again? It worked fine after I closed and reopened the ramp summary dialog again.
image

Comment on lines +350 to +351
if (lastInteraction && lastEventCached.createdAt <= lastInteraction - 2000) {
// If the last event is older than 2 seconds from the last interaction, we assume it's not a new event.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why are we reducing this to 2 seconds?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This one is tricky. Because of our choice and how both KYC levels use the same endpoint, we need to ensure they don't get mixed, that's the whole idea of this "last interaction" thing.

The delay was initially added because sometimes, there is a small delay between the call and creation of this state. But 60 seconds was too much, and I experienced a bug where a previous event was taken as valid. I agree 2 seconds is rather arbitrary.

Comment thread frontend/src/components/BrlaComponents/BrlaExtendedForm.tsx Outdated
Comment thread frontend/src/components/BrlaComponents/VerificationStatus/index.tsx Outdated
Comment thread frontend/src/components/BrlaComponents/VerificationStatus/index.tsx Outdated
assetSymbol: fromToken?.assetSymbol,
});
}
// if (Big(userInputTokenBalance).lt(inputAmount ?? 0)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Okay, you can uncomment it again now.

@gianfra-t gianfra-t requested a review from ebma June 11, 2025 22:59
Copy link
Copy Markdown
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

I didn't test it again but looks good to me 👍

Comment thread apps/frontend/src/hooks/brla/useBRLAKYCProcess/index.tsx Outdated
Co-authored-by: Marcel Ebert <mail@marcel-ebert.de>
@gianfra-t gianfra-t merged commit d804e3c into staging Jun 12, 2025
4 of 5 checks passed
@gianfra-t gianfra-t deleted the improve-kyc-level-2-ux branch June 12, 2025 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants