Skip to content

Commit

Permalink
Finish feature/ONI-7
Browse files Browse the repository at this point in the history
ONI-7: Added option to force FSP for insuree.
  • Loading branch information
dragos-dobre authored Aug 21, 2023
2 parents cf20637 + 1ba369c commit 32b3d2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions insuree/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
3 changes: 3 additions & 0 deletions insuree/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 32b3d2f

Please sign in to comment.