-
Notifications
You must be signed in to change notification settings - Fork 23
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
[SDP-962] Change SEP-24 Flow to display different verifications based on Disbursement's verification type #116
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0a86ba6
wip
ziyliu e76d74c
wip
ziyliu cfb8bb4
verification works e2e
ziyliu 03554dd
tests
ziyliu 2cfe012
clean up
ziyliu b7dc98a
oops
ziyliu 46e2803
naming
ziyliu da8dddf
fix
ziyliu ccf965e
add backend verification
ziyliu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,9 +51,9 @@ async function sendSms(phoneNumber, reCAPTCHAToken, onSuccess, onError) { | |
recaptcha_token: reCAPTCHAToken, | ||
}), | ||
}); | ||
await request.json(); | ||
const resp = await request.json(); | ||
|
||
onSuccess(); | ||
onSuccess(resp.verification_field); | ||
} catch (error) { | ||
onError(error); | ||
} | ||
|
@@ -96,6 +96,8 @@ async function submitPhoneNumber(event) { | |
"#g-recaptcha-response" | ||
); | ||
const buttonEls = phoneNumberSectionEl.querySelectorAll("[data-button]"); | ||
const verificationFieldTitle = document.querySelector("label[for='verification']"); | ||
const verificationFieldInput = document.querySelector("#verification"); | ||
|
||
if (!reCAPTCHATokenEl || !reCAPTCHATokenEl.value) { | ||
toggleErrorNotification( | ||
|
@@ -133,7 +135,22 @@ async function submitPhoneNumber(event) { | |
return; | ||
} | ||
|
||
function showNextPage() { | ||
function showNextPage(verificationField) { | ||
verificationFieldInput.type = "text"; | ||
if(verificationField === "DATE_OF_BIRTH") { | ||
verificationFieldTitle.textContent = "Date of birth"; | ||
verificationFieldInput.name = "date_of_birth"; | ||
verificationFieldInput.type = "date"; | ||
} | ||
else if(verificationField === "NATIONAL_ID_NUMBER") { | ||
verificationFieldTitle.textContent = "National ID number"; | ||
verificationFieldInput.name = "national_id_number"; | ||
} | ||
else if(verificationField === "PIN") { | ||
verificationFieldTitle.textContent = "Pin"; | ||
verificationFieldInput.name = "pin"; | ||
} | ||
|
||
phoneNumberSectionEl.style.display = "none"; | ||
reCAPTCHATokenEl.style.display = "none"; | ||
passcodeSectionEl.style.display = "flex"; | ||
|
@@ -169,6 +186,7 @@ async function submitOtp(event) { | |
); | ||
const otpEl = document.getElementById("otp"); | ||
const verificationEl = document.getElementById("verification"); | ||
const verificationField = verificationEl.getAttribute("name"); | ||
|
||
const buttonEls = passcodeSectionEl.querySelectorAll("[data-button]"); | ||
|
||
|
@@ -213,7 +231,7 @@ async function submitOtp(event) { | |
phone_number: phoneNumber, | ||
otp: otp, | ||
verification: verification, | ||
verification_type: "date_of_birth", | ||
verification_type: verificationField, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should think about making the vocabulary around this more consistent |
||
recaptcha_token: reCAPTCHATokenEl.value, | ||
}), | ||
}); | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@quietbits or @ceciliaromao can you help review this part please ? I can't help much with JS.
@ziyliu did we check with Tori about validation of these fields ? I think there should be some sort of front-end validation for this, especially the PIN.
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.
These updates look good to me. 👍
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 forgot to add the backend validation too, but I did just now! I confirmed with Tori when I worked on the disbursement file validations about the requirements. (I also performed the manual validations again)