Skip to content

Commit

Permalink
Merge pull request #35643 from dimagi/ay/kyc-integration-models
Browse files Browse the repository at this point in the history
Model for KYC Integration Config
  • Loading branch information
ajeety4 authored Jan 22, 2025
2 parents c684f89 + 15bf3f7 commit 5de4581
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions corehq/apps/domain/deletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ def _delete_demo_user_restores(domain_name):
ModelDeletion('integration', 'GaenOtpServerSettings', 'domain'),
ModelDeletion('integration', 'HmacCalloutSettings', 'domain'),
ModelDeletion('integration', 'SimprintsIntegration', 'domain'),
ModelDeletion('integration', 'KycConfig', 'domain'),
ModelDeletion('linked_domain', 'DomainLink', 'linked_domain', ['DomainLinkHistory']),
CustomDeletion('scheduling', _delete_sms_content_events_schedules, [
'SMSContent', 'EmailContent', 'SMSSurveyContent',
Expand Down
1 change: 1 addition & 0 deletions corehq/apps/dump_reload/sql/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
FilteredModelIteratorBuilder('integration.GaenOtpServerSettings', SimpleFilter('domain')),
FilteredModelIteratorBuilder('integration.HmacCalloutSettings', SimpleFilter('domain')),
FilteredModelIteratorBuilder('integration.SimprintsIntegration', SimpleFilter('domain')),
FilteredModelIteratorBuilder('integration.KycConfig', SimpleFilter('domain')),
FilteredModelIteratorBuilder('phonelog.DeviceReportEntry', SimpleFilter('domain')),
FilteredModelIteratorBuilder('phonelog.ForceCloseEntry', SimpleFilter('domain')),
FilteredModelIteratorBuilder('phonelog.UserErrorEntry', SimpleFilter('domain')),
Expand Down
Empty file.
24 changes: 24 additions & 0 deletions corehq/apps/integration/kyc/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import jsonfield
from django.db import models
from django.utils.translation import gettext as _

from corehq.motech.models import ConnectionSettings


class UserDataStore(object):
CUSTOM_USER_DATA = 'custom_user_data'
USER_CASE = 'user_case'
OTHER_CASE_TYPE = 'other_case_type'
CHOICES = [
(CUSTOM_USER_DATA, _('Custom User Data')),
(USER_CASE, _('User Case')),
(OTHER_CASE_TYPE, _('Other Case Type')),
]


class KycConfig(models.Model):
domain = models.CharField(max_length=126, db_index=True)
user_data_store = models.CharField(max_length=25, choices=UserDataStore.CHOICES)
other_case_type = models.CharField(max_length=126, null=True)
api_field_to_user_data_map = jsonfield.JSONField(default=dict)
connection_settings = models.ForeignKey(ConnectionSettings, on_delete=models.PROTECT)
27 changes: 27 additions & 0 deletions corehq/apps/integration/migrations/0006_kycconfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 4.2.17 on 2025-01-21 08:22

from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields


class Migration(migrations.Migration):

dependencies = [
('motech', '0016_connectionsettings_include_client_id_and_more'),
('integration', '0005_gaenotpserversettings_server_type'),
]

operations = [
migrations.CreateModel(
name='KycConfig',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('domain', models.CharField(db_index=True, max_length=126)),
('user_data_store', models.CharField(choices=[('custom_user_data', 'Custom User Data'), ('user_case', 'User Case'), ('other_case_type', 'Other Case Type')], max_length=25)),
('other_case_type', models.CharField(max_length=126, null=True)),
('api_field_to_user_data_map', jsonfield.fields.JSONField(default=dict)),
('connection_settings', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='motech.connectionsettings')),
],
),
]
1 change: 1 addition & 0 deletions corehq/apps/integration/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from memoized import memoized

from corehq import toggles
from corehq.apps.integration.kyc.models import KycConfig # noqa


class DialerSettings(models.Model):
Expand Down
1 change: 1 addition & 0 deletions migrations.lock
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ integration
0003_hmaccalloutsettings
0004_gaenotpserversettings
0005_gaenotpserversettings_server_type
0006_kycconfig
ivr
0001_initial
0002_call_app_id
Expand Down

0 comments on commit 5de4581

Please sign in to comment.