-
Notifications
You must be signed in to change notification settings - Fork 0
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
likhith/feat: ✨ incorporated IDV in Personal details for Real account signup #2
Changes from 2 commits
7867244
27fae52
1529c16
1b9270d
2c0c4b5
eaba2b0
766381c
40418c9
5d6ba47
da69b7c
bc20c77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// [TODO]: Remove duplicated functions from this file and use the ones in Helpers/utils.js | ||
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. Why do you need to add a TODO? is this a draft PR? 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. No this is not a draft PR. Currently some functions from this file are moved to Helper/utils, so they can be used across components rather than having them specific to idv-document-submit component. Once the new flow for CR is fully implemented this will be removed. |
||
|
||
import { getUrlBase } from '@deriv/shared'; | ||
|
||
export const documentAdditionalError = (document_additional, document_additional_format) => { | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,157 @@ | ||||||
import { getUrlBase } from '@deriv/shared'; | ||||||
|
||||||
const getImageLocation = image_name => getUrlBase(`/public/images/common/${image_name}`); | ||||||
|
||||||
// Note: Ensure that the object keys matches BE API's keys. This is simply a mapping for FE templates | ||||||
const idv_document_data = { | ||||||
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. Good job on this file, please help to write tests cases for it as well 🙏🏼 |
||||||
ke: { | ||||||
alien_card: { | ||||||
new_display_name: '', | ||||||
example_format: '123456', | ||||||
sample_image: getImageLocation('ke_alien_card.png'), | ||||||
}, | ||||||
national_id: { | ||||||
new_display_name: '', | ||||||
example_format: '12345678', | ||||||
sample_image: getImageLocation('ke_national_identity_card.png'), | ||||||
}, | ||||||
passport: { | ||||||
new_display_name: '', | ||||||
example_format: 'A12345678', | ||||||
sample_image: getImageLocation('ke_passport.png'), | ||||||
}, | ||||||
}, | ||||||
za: { | ||||||
national_id: { | ||||||
new_display_name: 'National ID', | ||||||
example_format: '1234567890123', | ||||||
sample_image: getImageLocation('za_national_identity_card.png'), | ||||||
}, | ||||||
national_id_no_photo: { | ||||||
new_display_name: 'National ID (No Photo)', | ||||||
example_format: '1234567890123', | ||||||
sample_image: '', | ||||||
}, | ||||||
}, | ||||||
ng: { | ||||||
bvn: { | ||||||
new_display_name: 'Bank Verification Number', | ||||||
example_format: '12345678901', | ||||||
sample_image: '', | ||||||
}, | ||||||
cac: { | ||||||
new_display_name: 'Corporate Affairs Commission', | ||||||
example_format: '12345678', | ||||||
sample_image: '', | ||||||
}, | ||||||
drivers_license: { | ||||||
new_display_name: '', | ||||||
example_format: 'ABC123456789', | ||||||
sample_image: getImageLocation('ng_drivers_license.png'), | ||||||
}, | ||||||
nin: { | ||||||
new_display_name: 'National Identity Number', | ||||||
example_format: '12345678901', | ||||||
sample_image: '', | ||||||
}, | ||||||
nin_slip: { | ||||||
new_display_name: 'National Identity Number Slip', | ||||||
example_format: '12345678901', | ||||||
sample_image: getImageLocation('ng_nin_slip.png'), | ||||||
}, | ||||||
tin: { | ||||||
new_display_name: 'Taxpayer identification number', | ||||||
example_format: '12345678-1234', | ||||||
sample_image: '', | ||||||
}, | ||||||
voter_id: { | ||||||
new_display_name: 'Voter ID', | ||||||
example_format: '1234567890123456789', | ||||||
sample_image: getImageLocation('ng_voter_id.png'), | ||||||
}, | ||||||
}, | ||||||
gh: { | ||||||
drivers_license: { | ||||||
new_display_name: '', | ||||||
example_format: 'B1234567', | ||||||
sample_image: '', | ||||||
}, | ||||||
national_id: { | ||||||
new_display_name: 'National ID', | ||||||
example_format: 'GHA-123456789-1', | ||||||
sample_image: '', | ||||||
}, | ||||||
passport: { | ||||||
new_display_name: 'Passport', | ||||||
example_format: 'G1234567', | ||||||
sample_image: '', | ||||||
}, | ||||||
ssnit: { | ||||||
new_display_name: 'Social Security and National Insurance Trust', | ||||||
example_format: 'C123456789012', | ||||||
sample_image: '', | ||||||
}, | ||||||
voter_id: { | ||||||
new_display_name: 'Voter ID', | ||||||
example_format: '01234567890', | ||||||
sample_image: '', | ||||||
}, | ||||||
}, | ||||||
br: { | ||||||
cpf: { | ||||||
new_display_name: 'CPF', | ||||||
example_format: '123.456.789-12', | ||||||
sample_image: '', | ||||||
}, | ||||||
}, | ||||||
ug: { | ||||||
national_id: { | ||||||
new_display_name: 'National ID', | ||||||
example_format: 'CM12345678PE1D', | ||||||
sample_image: getImageLocation('ug_national_identity_card.png'), | ||||||
}, | ||||||
national_id_no_photo: { | ||||||
new_display_name: 'National ID (No Photo)', | ||||||
example_format: 'CM12345678PE1D', | ||||||
sample_image: '', | ||||||
}, | ||||||
}, | ||||||
zw: { | ||||||
national_id: { | ||||||
new_display_name: 'National ID', | ||||||
example_format: '081234567F53', | ||||||
sample_image: getImageLocation('zw_national_identity_card.png'), | ||||||
}, | ||||||
}, | ||||||
}; | ||||||
|
||||||
export const shouldShowIdentityInformation = ({ | ||||||
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. You can also make this into a hook! 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. I think here hook is not needed as the function just accepts inputs and computes a boolean. It is not maintaining a state nor makes use of any other hooks |
||||||
account_status, | ||||||
account_settings, | ||||||
residence, | ||||||
residence_list, | ||||||
real_account_signup_target, | ||||||
}) => { | ||||||
const citizen = account_settings.citizen || residence; | ||||||
const country = residence_list.find(item => item.value === citizen); | ||||||
const maltainvest = real_account_signup_target === 'maltainvest'; | ||||||
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.
Suggested change
|
||||||
const should_skip_idv = account_status?.status?.some(status => status === 'skip_idv'); //status added by BE when idv should be skipped for the user | ||||||
return !maltainvest && citizen && country?.identity?.services?.idv?.is_country_supported && !should_skip_idv; | ||||||
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.
Suggested change
|
||||||
}; | ||||||
|
||||||
export const getDocumentData = (country_code, document_type) => { | ||||||
return ( | ||||||
(Object.keys(idv_document_data).includes(country_code) && idv_document_data[country_code][document_type]) || { | ||||||
new_display_name: '', | ||||||
example_format: '', | ||||||
sample_image: '', | ||||||
} | ||||||
); | ||||||
}; | ||||||
|
||||||
export const preventEmptyClipboardPaste = e => { | ||||||
const clipboardData = (e.clipboardData || window.clipboardData).getData('text'); | ||||||
if (clipboardData.length === 0) { | ||||||
e.preventDefault(); | ||||||
} | ||||||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -277,7 +277,7 @@ const AccountWizard = props => { | |
props.onFinishSuccess(response.new_account_real.currency.toLowerCase()); | ||
} | ||
const { document_type, document_number, document_additional } = { ...form_values() }; | ||
if (document_type && document_number) { | ||
if (document_type && document_type.id !== '#NA' && document_number) { | ||
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.
|
||
const country_code = props.account_settings.citizen || props.residence; | ||
submitIDVData(document_type, document_number, document_additional, country_code); | ||
} | ||
|
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.
Containers folder is also missing from the list
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.
Will add the entry