-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
KYC Config Page #35716
KYC Config Page #35716
Conversation
corehq/apps/integration/kyc/forms.py
Outdated
x_init='provider = $el.value', | ||
x_show='showProvider', | ||
), | ||
crispy.Field( |
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.
An open question I have is how to make the JSON field more user-friendly. Currently, it is simply a text box with JSON validation which can be difficult to correclty format JSON in. What makes this challenging is that the crispy form is loaded in as a partial HTML template, and so importing something like the base_ace
JSON editor in the parent template is not possible.
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 took a quick look at QuillJS, which is currently being evaluated.
Would it be possible to load it in corehq/apps/integration/templates/kyc/kyc_config_base.html
?
It looks like it has syntax highlighting for code blocks.
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.
Okay it looks like I managed to successfully load the base_ace
JSON editor (8bc0145). The tricky part was with saving the form. When this happens the partial gets loaded again, causing the JSON editor to be removed. I managed to work around this by initializing the editor again after the form gets saved.
api_field_to_user_data_map = JsonField( | ||
label=_('API Field to User Data Map'), | ||
required=True, | ||
expected_type=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.
The model field is api_field_to_user_data_map = jsonfield.JSONField(default=dict)
. Should this be dict
? i.e.
expected_type=list, | |
expected_type=dict, |
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.
The model field has been updated to take list
as a default type here. The expected format for the API mapping will be something like this:
[
...
{
"fieldName": "foo",
"mapsTo": "bar",
"source": "standard"
}
...
]
corehq/apps/integration/kyc/forms.py
Outdated
x_init='provider = $el.value', | ||
x_show='showProvider', | ||
), | ||
crispy.Field( |
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 took a quick look at QuillJS, which is currently being evaluated.
Would it be possible to load it in corehq/apps/integration/templates/kyc/kyc_config_base.html
?
It looks like it has syntax highlighting for code blocks.
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 is great. I just have the one question about list
vs dict
.
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.
Looks clean and clear.
form = self.config_form | ||
show_success = False | ||
if form.is_valid(): | ||
form.save(commit=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 presume the fact that the form is a ModelForm
will persist the model to the database with commit=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.
That is correct. The save()
function's help text reads "Save this form's self.instance object if commit=True...". I also verified this in my local testing by checking that the instance is actually getting saved with this function call.
Few nits, but otherwise good! |
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.
Thank you for updating!
Product Description
A new "KYC Configuration" page is added to the "Data" sidebar:
![Screenshot from 2025-01-30 23-35-53](https://private-user-images.githubusercontent.com/122617251/408308419-cd6bd597-9653-479c-8a10-5a4e598ab069.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyODIzNTYsIm5iZiI6MTczOTI4MjA1NiwicGF0aCI6Ii8xMjI2MTcyNTEvNDA4MzA4NDE5LWNkNmJkNTk3LTk2NTMtNDc5Yy04YTEwLTVhNGU1OThhYjA2OS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQxMzU0MTZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yYTkzYTFmMzkwYTliODkyNGY2NTliYmQ1MGM2NzdiM2VhMjkyNDc2MTcyMWE0NzNiYjU4OGIwYzdhYjgyMjA1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.3DTR7XsR5QUIOtfWQYkl-zuDBDw5KduNYeflEsz_r0s)
This new page shows the configuration settings for setting up KYC for a domain:
![Screenshot from 2025-02-04 08-44-59](https://private-user-images.githubusercontent.com/122617251/409426705-40b62f62-86f6-48e0-a501-36050b517b78.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyODIzNTYsIm5iZiI6MTczOTI4MjA1NiwicGF0aCI6Ii8xMjI2MTcyNTEvNDA5NDI2NzA1LTQwYjYyZjYyLTg2ZjYtNDhlMC1hNTAxLTM2MDUwYjUxN2I3OC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQxMzU0MTZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yMThiMzY0MmY5MjUyMTk3NzM0OGUyZjNkOTJmYmMzMDdjZWQ1OTAwZWFkNTMzYWE1NDA1OTFkMTk0NjgyMDI1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.f-g7QNeIFDCnTricNaCnzT85x__sTZgU530kolevGUU)
Please note that there is an extra "Provider" input on this page, however this is hidden due to there only currently being one available provider.
Upon clicking "Save", a new alert banner will be shown to the user if the form was successfully saved:
![Screenshot from 2025-02-04 08-45-08](https://private-user-images.githubusercontent.com/122617251/409426676-dd71af21-e447-489f-bea7-38ffe31d0113.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyODIzNTYsIm5iZiI6MTczOTI4MjA1NiwicGF0aCI6Ii8xMjI2MTcyNTEvNDA5NDI2Njc2LWRkNzFhZjIxLWU0NDctNDg5Zi1iZWE3LTM4ZmZlMzFkMDExMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQxMzU0MTZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iZDQxYjBlYzE3YTlkZTRlYjA2OGEzZmNlYjM0ZTIxNzZlZDYwYzI1YmEzYTA5MThmM2E4MWYwN2ZkNzc1MDU0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.n-kW66ym-kqtl3BtGYgrMXtLbHNKrs3tygPFkIyHsZc)
Technical Summary
Link to ticket here.
Link to design doc here.
Link to tech spec here.
This PR adds a new configuration page for the KYC feature. Specifically, this page will be used to set up the following:
Feature Flag
KYC_VERIFICATION
Safety Assurance
Safety story
Automated test coverage
New unit tests have been created to verify that a user cannot access the configuration page if they are not logged in or if the domain does not have access to the feature flag.
QA Plan
No QA planned.
Migrations
Rollback instructions
Labels & Review