Skip to content
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

ONI-7: Added option to force FSP for insuree. #69

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions insuree/apps.py
Original file line number Diff line number Diff line change
@@ -59,6 +59,7 @@ class InsureeConfig(AppConfig):
insuree_number_validator = None
insuree_number_length = None
insuree_number_modulo_root = None
insuree_fsp_mandatory = False

def _configure_permissions(self, cfg):
InsureeConfig.gql_query_insurees_perms = cfg["gql_query_insurees_perms"]
3 changes: 3 additions & 0 deletions insuree/services.py
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
from core.signals import register_service_signal
from insuree.apps import InsureeConfig
from insuree.models import InsureePhoto, PolicyRenewalDetail, Insuree, Family, InsureePolicy
from django.core.exceptions import ValidationError


logger = logging.getLogger(__name__)
@@ -232,6 +233,8 @@ def create_or_update(self, data):
now = datetime.datetime.now()
data['audit_user_id'] = self.user.id_for_audit
data['validity_from'] = now
if InsureeConfig.insuree_fsp_mandatory and 'health_facility_id' not in data:
raise ValidationError("mutation.insuree.fsp_required")
insuree_uuid = data.pop('uuid', None)
errors = validate_insuree_number(data["chf_id"], insuree_uuid)
if errors: