-
Notifications
You must be signed in to change notification settings - Fork 2
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
[READY] 456 Create UI for BRLa offramp KYC #493
base: staging
Are you sure you want to change the base?
Conversation
… 456-create-a-ui-for-brl-offramp-kyc
✅ Deploy Preview for pendulum-pay ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -35,6 +37,7 @@ const TermsAndConditionsContent = ({ | |||
className="checkbox checkbox-primary checkbox-sm" | |||
checked={termsChecked} | |||
onChange={() => { | |||
setTermsAccepted(true); |
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.
?
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 think it's better if we don't immediately hide the terms and conditions as soon as the user clicks on the checkbox but keep them visible until they click on the 'Confirm' button. Otherwise they might hastily toggle the checkbox and might wonder what exactly they just toggled and is now gone.
@pendulum-chain/devs Ready for review 💚 |
<PIXKYCForm | ||
feeComparisonRef={feeComparisonRef} | ||
setIsOfframpSummaryDialogVisible={setIsOfframpSummaryDialogVisible} | ||
onSwapConfirm={onSwapConfirm} |
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.
We're not using onSwapConfirm
right? It will directly call const proceedWithOfframp = useOfframpSubmission
after the KYC passes.
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 skimmed through the code. Most of the changes look reasonable to me. Also the look and feel and animations are really nice, great job with that @Sharqiewicz 👌
I tested this locally a bit and found that we are missing the call to create the subaccount when all the data is filled in on the KYC form. We should add that.
const query = `taxId=${encodeURIComponent(taxId)}`; | ||
const response = await this.sendRequest(endpoint, 'GET', query); | ||
const response = await this.sendRequest('/subaccounts', 'GET', query); |
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.
There is no right or wrong here but looking at the other functions we should make sure they are also using the same format. The other functions define the endpoint as an extra const
so either we do it on all of them, or remove the extra const endpoint
on all of them.
FAILED = 'FAILED', | ||
} | ||
|
||
const STATUS_MESSAGES = { |
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.
It's a nice idea to already show these messages in portuguese but to me as a user, this is more off-putting than helpful. Because a) I already use the translate function of my browser to translate from English to Portuguese or b) I can understand English well enough and am suddenly seeing content in a different language which would seem to me like a bug.
}), | ||
pixId: Yup.string().when('to', { | ||
is: 'brl', | ||
then: (schema) => schema.required('PIX ID is required when converting to BRL'), |
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.
Let's call it 'selling' instead of 'converting'.
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.
Also, I think Brazilian are more familiar with the term 'Pix key' over 'PIX ID' so let's also adjust that.
@@ -24,6 +26,16 @@ const schema = Yup.object<SwapFormValues>().shape({ | |||
toAmount: Yup.string().required(), | |||
slippage: Yup.number().nullable().transform(transformNumber), | |||
deadline: Yup.number().nullable().transform(transformNumber), | |||
taxId: Yup.string().when('to', { | |||
is: 'brl', | |||
then: (schema) => schema.required('Tax ID is required when converting to BRL'), |
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.
Same here.
@@ -35,6 +37,7 @@ const TermsAndConditionsContent = ({ | |||
className="checkbox checkbox-primary checkbox-sm" | |||
checked={termsChecked} | |||
onChange={() => { | |||
setTermsAccepted(true); |
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 think it's better if we don't immediately hide the terms and conditions as soon as the user clicks on the checkbox but keep them visible until they click on the 'Confirm' button. Otherwise they might hastily toggle the checkbox and might wonder what exactly they just toggled and is now gone.
|
||
const proceedWithOfframp = useOfframpSubmission(handleError, setIsOfframpSummaryDialogVisible); | ||
|
||
const handleFormSubmit = useCallback( |
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 function is missing a call to the createSubaccount()
endpoint of our signer service with the relevant fields. Only then, can we query the KYC status of the user and expect to get a meaningful response.
return false; | ||
}, | ||
retry: 3, | ||
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 30000), |
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 think using a constant delay would be fine. Let's choose a delay of 5 seconds and up to 5 retries. I'm not sure how long the BRLA api takes to approve the KYC data but it might take some time.
return; | ||
} | ||
throw new Error('Error while fetching funding account signature'); | ||
} | ||
const { evmAddress: brlaEvmAddress } = await response.json(); | ||
const brlaOfframpExecution = { ...executionInput, brlaEvmAddress }; | ||
setOfframpExecutionInput(brlaOfframpExecution); | ||
//const brlaEvmAddress = '0x7Ba99e99Bc669B3508AFf9CC0A898E869459F877' |
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.
Nit: remove comment
…ulum-chain/vortex into 456-create-a-ui-for-brl-offramp-kyc
resetToDefault(); | ||
handleBackClick(); | ||
}, | ||
[KYCResponseStatus.PENDING]: async () => undefined, | ||
[KYCResponseStatus.PENDING]: async () => { | ||
undefined; |
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.
?
💚 Ready
Implement KYC Form (and additional fields to Swap Form) for BRLA.
Changes:
Updates
Full KYC
BrlaExtendedForm
component to manage logic of showing KYC Form/Loading/Error/Successbrla/KYCForm
component for BRLA full KYC formbrla/useKYCForm
for handling BrlaExtendedForm logicVerificationStatus
component to handle KYCStatususeBRLAKYCProcess
hook for handling BRLA KYC submit logicuseKYCStatusQuery
hook for handling BRLA KYC request logicComponents
BrlaField
component for handling Brla-related (react-hook-form) fields/inputsField
component for handling (react-hook-form) inputSwap
BrlaSwapFields
which are injected to the Swap form whenBRLA
is chosenSwap
component from theSwapPage
brla/useOfframpSubmission
for BRLA Offramp submisssion