From 8b4db641ba2a7fe1eb6d310dacb5ca1fe805e1fa Mon Sep 17 00:00:00 2001
From: Nicolas ROCHE <nroche@entrouvert.com>
Date: Fri, 18 Nov 2022 14:09:09 +0100
Subject: [PATCH 6/6] toulouse-maelis: manage birth bean on RL (#71641)

---
 passerelle/contrib/toulouse_maelis/models.py  |  2 +-
 passerelle/contrib/toulouse_maelis/schemas.py | 79 +++++++++------
 .../data/toulouse_maelis/Q_create_family.xml  | 13 ++-
 tests/data/toulouse_maelis/Q_create_rl1.xml   |  4 +-
 tests/data/toulouse_maelis/Q_create_rl2.xml   |  4 +-
 .../data/toulouse_maelis/Q_update_family.xml  |  7 +-
 tests/data/toulouse_maelis/Q_update_rl1.xml   |  4 +-
 tests/data/toulouse_maelis/Q_update_rl2.xml   |  4 +-
 tests/data/toulouse_maelis/R_read_family.xml  | 15 ++-
 .../toulouse_maelis/R_read_family_relax.xml   | 15 ++-
 .../R_read_family_reordered.xml               | 15 ++-
 .../R_read_family_with_only_rl1.xml           |  6 +-
 .../data/toulouse_maelis/R_update_family.xml  | 12 ++-
 tests/test_toulouse_maelis.py                 | 99 ++++++++++++-------
 14 files changed, 198 insertions(+), 81 deletions(-)

diff --git a/passerelle/contrib/toulouse_maelis/models.py b/passerelle/contrib/toulouse_maelis/models.py
index 42206cec..0f417c96 100644
--- a/passerelle/contrib/toulouse_maelis/models.py
+++ b/passerelle/contrib/toulouse_maelis/models.py
@@ -471,17 +471,17 @@ class ToulouseMaelis(BaseResource, HTTPResource):
         post={'request_body': {'schema': {'application/json': schemas.LINK_SCHEMA}}},
     )
     def link(self, request, NameID, post_data):
         family_id = post_data['family_id']
         response = self.call('Family', 'readFamily', dossierNumber=family_id)
         if not (
             response['RL1']['firstname'] == post_data['firstname'].upper()
             and response['RL1']['lastname'] == post_data['lastname'].upper()
-            and response['RL1']['dateBirth'].strftime('%Y-%m-%d') == post_data['dateBirth']
+            and response['RL1']['birth']['dateBirth'].strftime('%Y-%m-%d') == post_data['dateBirth']
         ):
             raise APIError("RL1 does not match '%s' family" % family_id, err_code='not-found')
         Link.objects.update_or_create(resource=self, name_id=NameID, defaults={'family_id': family_id})
         return {'data': 'ok'}
 
     @endpoint(
         display_category='Famille',
         description='Supprimer une liaison entre un compte usager et une famille',
diff --git a/passerelle/contrib/toulouse_maelis/schemas.py b/passerelle/contrib/toulouse_maelis/schemas.py
index 51eec7e8..98e25be8 100644
--- a/passerelle/contrib/toulouse_maelis/schemas.py
+++ b/passerelle/contrib/toulouse_maelis/schemas.py
@@ -19,17 +19,17 @@ BOOLEAN_TYPES = [
     {'type': 'boolean'},
     {
         'type': 'string',
         'pattern': '^([Oo][Uu][Ii]|[Nn][Oo][Nn]|[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]|1|0)$',
         'pattern_description': 'Les valeurs "0", "1", "true", "false", "oui" ou "non" sont autorisées (insensibles à la casse).',
     },
 ]
 
-ID_PROPERTIES = {
+BASIC_ID_PROPERTIES = {
     'firstname': {
         'description': 'Prénom',
         'type': 'string',
     },
     'lastname': {
         'description': 'Nom',
         'type': 'string',
     },
@@ -49,28 +49,67 @@ LINK_SCHEMA = {
     'properties': {
         'family_id': {
             'description': 'Numéro DUI',
             'type': 'string',
         },
     },
     'additionalProperties': False,
 }
-LINK_SCHEMA['properties'].update(ID_PROPERTIES)
+LINK_SCHEMA['properties'].update(BASIC_ID_PROPERTIES)
 
 ISEXISTS_SCHEMA = {
     '$schema': 'http://json-schema.org/draft-04/schema#',
     'title': 'Exist',
     'description': "Recherche d'un responsable légal ou d'un enfant dans Maelis",
     'type': 'object',
     'required': ['firstname', 'lastname', 'dateBirth'],
-    'properties': ID_PROPERTIES,
+    'properties': BASIC_ID_PROPERTIES,
     'additionalProperties': False,
 }
 
+BIRTH_SCHEMA = {
+    '$schema': 'http://json-schema.org/draft-04/schema#',
+    'title': 'Birth info',
+    'description': "Informations relatives à la naissance",
+    'type': 'object',
+    'required': ['dateBirth'],
+    'properties': {
+        'dateBirth': {
+            'description': 'Date de naissance',
+            'type': 'string',
+            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
+        },
+        'place': {
+            'description': 'Lieu de naissance',
+            'oneOf': [{'type': 'string'}, {'type': 'null'}],
+        },
+        'communeCode': {
+            'description': 'Commune de naissance (depuis référentiel)',
+            'oneOf': [{'type': 'string'}, {'type': 'null'}],
+        },
+        'countryCode': {
+            'description': 'Pays de naissance (depuis référentiel)',
+            'oneOf': [{'type': 'string'}, {'type': 'null'}],
+        },
+    },
+}
+
+ID_PROPERTIES = {
+    'firstname': {
+        'description': 'Prénom',
+        'type': 'string',
+    },
+    'lastname': {
+        'description': 'Nom',
+        'type': 'string',
+    },
+    'birth': BIRTH_SCHEMA,
+}
+
 ADDRESS_SCHEMA = {
     '$schema': 'http://json-schema.org/draft-04/schema#',
     'title': 'Address',
     'description': 'Informations sur une adresse',
     'type': 'object',
     'required': ['street1', 'town', 'zipcode'],
     'properties': {
         'num': {
@@ -201,56 +240,38 @@ CAFINFO_SCHEMA = {
     },
 }
 
 RLINFO_SCHEMA = {
     '$schema': 'http://json-schema.org/draft-04/schema#',
     'title': 'RL',
     'description': "Informations sur le responsable légal",
     'type': 'object',
-    'required': ['firstname', 'lastname', 'civility', 'quality', 'dateBirth', 'adresse'],
+    'required': ['firstname', 'lastname', 'civility', 'quality', 'birth', 'adresse'],
     'properties': {
         'civility': {
             'description': 'civilité (depuis référentiel)',
             'type': 'string',
             'pattern': '.+',
         },
         'quality': {
             'description': 'Qualité (depuis référentiel)',
             'type': 'string',
             'pattern': '.+',
         },
         'adresse': ADDRESS_SCHEMA,
         'contact': {'oneOf': [CONTACT_SCHEMA, {'type': 'null'}]},
         'profession': {'oneOf': [PROFESSION_SCHEMA, {'type': 'null'}]},
         'CAFInfo': {'oneOf': [CAFINFO_SCHEMA, {'type': 'null'}]},
     },
+    'unflatten': True,
     'additionalProperties': False,
 }
 RLINFO_SCHEMA['properties'].update(ID_PROPERTIES)
 
-CHILDBIRTH_SCHEMA = {
-    '$schema': 'http://json-schema.org/draft-04/schema#',
-    'title': 'Child birth',
-    'description': "Informations sur la naissance d'un enfant",
-    'type': 'object',
-    'required': ['dateBirth'],
-    'properties': {
-        'dateBirth': {
-            'description': 'Date de naissance',
-            'type': 'string',
-            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
-        },
-        'place': {
-            'description': 'Lieu de naissance',
-            'oneOf': [{'type': 'string'}, {'type': 'null'}],
-        },
-    },
-}
-
 DOCTORADDRESS_SCHEMA = {
     '$schema': 'http://json-schema.org/draft-04/schema#',
     'title': 'Doctor address',
     'description': "Informations sur l'adresse du docteur",
     'type': 'object',
     'properties': {
         'street1': {
             'description': 'Libellé de la voie',
@@ -364,28 +385,24 @@ PAIINFO_SCHEMA = {
     'additionalProperties': False,
 }
 
 CHILD_SCHEMA = {
     '$schema': 'http://json-schema.org/draft-04/schema#',
     'title': 'Child',
     'description': "Informations sur la création d'un enfant",
     'type': 'object',
-    'required': ['sexe', 'firstname', 'lastname'],
-    'oneOf': [
-        {'required': ['dateBirth']},  # createFamily
-        {'required': ['birth']},  # updateFamily
-    ],
+    'required': ['sexe', 'firstname', 'lastname', 'birth'],
     'properties': {
         'sexe': {
             'description': 'Sexe (depuis référentiel)',
             'type': 'string',
             'pattern': '.+',
         },
-        'birth': CHILDBIRTH_SCHEMA,
+        'birth': BIRTH_SCHEMA,
         'dietcode': {
             'description': 'Code de régime alimentaire (depuis référentiel)',
             'oneOf': [{'type': 'string'}, {'type': 'null'}],
         },
         'bPhoto': {
             'description': 'Autorisation photo',
             'oneOf': BOOLEAN_TYPES,
         },
@@ -441,17 +458,17 @@ FAMILYPERSON_SCHEMA = {
             'description': 'Sexe (depuis référentiel)',
             'oneOf': [{'type': 'string'}, {'type': 'null'}],
         },
         'contact': {'oneOf': [CONTACTLIGHT_SCHEMA, {'type': 'null'}]},
     },
     'unflatten': True,
     'additionalProperties': False,
 }
-FAMILYPERSON_SCHEMA['properties'].update(ID_PROPERTIES)
+FAMILYPERSON_SCHEMA['properties'].update(BASIC_ID_PROPERTIES)
 
 AUTHORIZEDPERSON_SCHEMA = {
     '$schema': 'http://json-schema.org/draft-04/schema#',
     'title': 'Family persons',
     'description': "Informations sur les personnes autorisées à venir chercher les enfants ou à prévenir en cas d'urgence",
     'type': 'object',
     'properties': {
         'personList': {
@@ -535,17 +552,17 @@ CREATE_RL1_SCHEMA = copy.deepcopy(CREATE_FAMILY_SCHEMA)
 del CREATE_RL1_SCHEMA['properties']['rl2']
 del CREATE_RL1_SCHEMA['properties']['emergencyPersonList']
 del CREATE_RL1_SCHEMA['properties']['childList']
 del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['contact']
 del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['profession']
 del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['CAFInfo']
 
 UPDATE_RL1_SCHEMA = copy.deepcopy(RLINFO_SCHEMA)
-UPDATE_RL1_SCHEMA['required'] = ['firstname', 'lastname', 'civility', 'quality', 'dateBirth']
+UPDATE_RL1_SCHEMA['required'] = ['firstname', 'lastname', 'civility', 'quality', 'birth']
 del UPDATE_RL1_SCHEMA['properties']['adresse']
 del UPDATE_RL1_SCHEMA['properties']['contact']
 del UPDATE_RL1_SCHEMA['properties']['profession']
 del UPDATE_RL1_SCHEMA['properties']['CAFInfo']
 
 CREATE_RL2_SCHEMA = copy.deepcopy(RLINFO_SCHEMA)
 CREATE_RL2_SCHEMA['unflatten'] = True
 del CREATE_RL2_SCHEMA['properties']['contact']
diff --git a/tests/data/toulouse_maelis/Q_create_family.xml b/tests/data/toulouse_maelis/Q_create_family.xml
index f9f02ccc..e856fdb9 100644
--- a/tests/data/toulouse_maelis/Q_create_family.xml
+++ b/tests/data/toulouse_maelis/Q_create_family.xml
@@ -12,17 +12,21 @@
     <ns0:createFamily xmlns:ns0="family.ws.maelis.sigec.com">
       <category>ACCEUI</category>
       <situation>C</situation>
       <rl1>
         <firstname>Jhon</firstname>
         <lastname>Doe</lastname>
         <quality>AU</quality>
         <civility>M.</civility>
-        <dateBirth>1938-07-26</dateBirth>
+        <birth>
+          <dateBirth>1938-07-26</dateBirth>
+          <place>Rabbat</place>
+          <countryCode>99350</countryCode>
+        </birth>
         <adresse>
           <numComp>B</numComp>
           <street1>Chateau</street1>
           <town>Paris</town>
           <zipcode>75014</zipcode>
         </adresse>
         <profession>
           <codeCSP>ART</codeCSP>
@@ -30,17 +34,22 @@
         <CAFInfo>
           <organ>A10007752822</organ>
         </CAFInfo>
       </rl1>
       <childList>
         <firstname>Robert</firstname>
         <lastname>Zimmerman</lastname>
         <sexe>M</sexe>
-        <dateBirth>1941-05-24</dateBirth>
+        <birth>
+          <dateBirth>1941-05-24</dateBirth>
+          <place>Saint-louis</place>
+          <communeCode>91122</communeCode>
+          <countryCode>99100</countryCode>
+        </birth>
         <dietcode>RSV</dietcode>
         <medicalRecord>
           <vaccinList>
             <code>DTC</code>
             <vaccinationDate>1940-07-26</vaccinationDate>
           </vaccinList>
         </medicalRecord>
       </childList>
diff --git a/tests/data/toulouse_maelis/Q_create_rl1.xml b/tests/data/toulouse_maelis/Q_create_rl1.xml
index 03e9e05f..fcc47161 100644
--- a/tests/data/toulouse_maelis/Q_create_rl1.xml
+++ b/tests/data/toulouse_maelis/Q_create_rl1.xml
@@ -12,17 +12,19 @@
     <ns0:createFamily xmlns:ns0="family.ws.maelis.sigec.com">
       <category>ACCEUI</category>
       <situation>C</situation>
       <rl1>
         <firstname>Jhon</firstname>
         <lastname>Doe</lastname>
         <quality>AU</quality>
         <civility>M.</civility>
-        <dateBirth>1938-07-26</dateBirth>
+        <birth>
+          <dateBirth>1938-07-26</dateBirth>
+        </birth>
         <adresse>
           <street1>Chateau</street1>
           <town>Paris</town>
           <zipcode>75014</zipcode>
         </adresse>
       </rl1>
     </ns0:createFamily>
   </soap-env:Body>
diff --git a/tests/data/toulouse_maelis/Q_create_rl2.xml b/tests/data/toulouse_maelis/Q_create_rl2.xml
index 05913e9c..63a71405 100644
--- a/tests/data/toulouse_maelis/Q_create_rl2.xml
+++ b/tests/data/toulouse_maelis/Q_create_rl2.xml
@@ -14,17 +14,19 @@
       <situation>M</situation>
       <flagCom>true</flagCom>
       <nbChild>2</nbChild>
       <rl2>
         <firstname>JANE</firstname>
         <lastname>DOE</lastname>
         <quality>MERE</quality>
         <civility>MME</civility>
-        <dateBirth>1940-06-22</dateBirth>
+        <birth>
+          <dateBirth>1940-06-22</dateBirth>
+        </birth>
         <adresse>
           <num>170</num>
           <street1>Chateau d'eau</street1>
           <town>Paris</town>
           <zipcode>75014</zipcode>
         </adresse>
       </rl2>
     </ns0:updateFamily>
diff --git a/tests/data/toulouse_maelis/Q_update_family.xml b/tests/data/toulouse_maelis/Q_update_family.xml
index a9245f3e..2239a3c4 100644
--- a/tests/data/toulouse_maelis/Q_update_family.xml
+++ b/tests/data/toulouse_maelis/Q_update_family.xml
@@ -13,17 +13,22 @@
       <dossierNumber>1312</dossierNumber>
       <category>BI</category>
       <situation>C</situation>
       <rl1>
         <firstname>Jhon</firstname>
         <lastname>Doe</lastname>
         <quality>AU</quality>
         <civility>M.</civility>
-        <dateBirth>1938-07-26</dateBirth>
+        <birth>
+          <dateBirth>1938-07-26</dateBirth>
+          <place>Rabbat</place>
+          <communeCode/>
+          <countryCode>99350</countryCode>
+        </birth>
         <adresse>
           <numComp>B</numComp>
           <street1>Chateau</street1>
           <town>Paris</town>
           <zipcode>75014</zipcode>
         </adresse>
         <profession>
           <codeCSP>ART</codeCSP>
diff --git a/tests/data/toulouse_maelis/Q_update_rl1.xml b/tests/data/toulouse_maelis/Q_update_rl1.xml
index 4e356430..77b2f6f9 100644
--- a/tests/data/toulouse_maelis/Q_update_rl1.xml
+++ b/tests/data/toulouse_maelis/Q_update_rl1.xml
@@ -16,17 +16,19 @@
       <flagCom>true</flagCom>
       <nbChild>2</nbChild>
       <rl1>
         <num>613878</num>
         <firstname>Jhonny</firstname>
         <lastname>Doe</lastname>
         <quality>PERE</quality>
         <civility>M.</civility>
-        <dateBirth>1943-06-15</dateBirth>
+        <birth>
+          <dateBirth>1943-06-15</dateBirth>
+        </birth>
         <adresse>
           <num>170</num>
           <street1>Chateau d'eau</street1>
           <town>Paris</town>
           <zipcode>75014</zipcode>
         </adresse>
       </rl1>
     </ns0:updateFamily>
diff --git a/tests/data/toulouse_maelis/Q_update_rl2.xml b/tests/data/toulouse_maelis/Q_update_rl2.xml
index 5846fc21..02ad1d47 100644
--- a/tests/data/toulouse_maelis/Q_update_rl2.xml
+++ b/tests/data/toulouse_maelis/Q_update_rl2.xml
@@ -15,17 +15,19 @@
       <flagCom>true</flagCom>
       <nbChild>2</nbChild>
       <rl2>
         <num>613879</num>
         <firstname>JANE</firstname>
         <lastname>DOE</lastname>
         <quality>MERE</quality>
         <civility>MME</civility>
-        <dateBirth>1940-06-22</dateBirth>
+        <birth>
+          <dateBirth>1940-06-22</dateBirth>
+        </birth>
         <adresse>
           <num>170</num>
           <street1>Chateau d'eau</street1>
           <town>Paris</town>
           <zipcode>75014</zipcode>
         </adresse>
       </rl2>
     </ns0:updateFamily>
diff --git a/tests/data/toulouse_maelis/R_read_family.xml b/tests/data/toulouse_maelis/R_read_family.xml
index 669d20c9..73887dd0 100644
--- a/tests/data/toulouse_maelis/R_read_family.xml
+++ b/tests/data/toulouse_maelis/R_read_family.xml
@@ -8,17 +8,21 @@
         <flagCom>true</flagCom>
         <nbChild>2</nbChild>
         <RL1>
           <num>613878</num>
           <lastname>DOE</lastname>
           <firstname>JHON</firstname>
           <quality>PERE</quality>
           <civility>M.</civility>
-          <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
+          <birth>
+            <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
+            <place>Rabbat</place>
+            <countryCode>99350</countryCode>
+          </birth>
           <adresse>
             <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
             <num>170</num>
             <street1>Chateau d'eau</street1>
             <town>Paris</town>
             <zipcode>75014</zipcode>
           </adresse>
           <contact>
@@ -34,17 +38,21 @@
           </profession>
         </RL1>
         <RL2>
           <num>613879</num>
           <lastname>DOE</lastname>
           <firstname>JANE</firstname>
           <quality>MERE</quality>
           <civility>MME</civility>
-          <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
+          <birth>
+            <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
+            <place>Bardot</place>
+            <countryCode>99351</countryCode>
+          </birth>
           <adresse>
             <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
             <num>170</num>
             <street1>Chateau d'eau</street1>
             <town>Paris</town>
             <zipcode>75014</zipcode>
           </adresse>
           <contact>
@@ -80,16 +88,19 @@
         </emergencyPersonList>
         <childList>
           <num>613880</num>
           <lastname>DOE</lastname>
           <firstname>JANNIS</firstname>
           <sexe>F</sexe>
           <birth>
             <dateBirth>1943-01-19T00:00:00+01:00</dateBirth>
+            <place>Saint-louis</place>
+            <communeCode>91122</communeCode>
+            <countryCode>99100</countryCode>
           </birth>
           <dietcode>RSV</dietcode>
           <bPhoto>true</bPhoto>
           <bLeaveAlone>false</bLeaveAlone>
           <authorizedPersonList>
             <personInfo>
               <num>614719</num>
               <lastname>BENT</lastname>
diff --git a/tests/data/toulouse_maelis/R_read_family_relax.xml b/tests/data/toulouse_maelis/R_read_family_relax.xml
index 91102dfa..dda74651 100644
--- a/tests/data/toulouse_maelis/R_read_family_relax.xml
+++ b/tests/data/toulouse_maelis/R_read_family_relax.xml
@@ -8,17 +8,21 @@
         <flagCom>true</flagCom>
         <nbChild>2</nbChild>
         <RL1>
           <num>613878</num>
           <lastname>DOE</lastname>
           <firstname>JHON</firstname>
           <quality>PERE</quality>
           <civility>M.</civility>
-          <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
+          <birth>
+            <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
+            <place>Rabbat</place>
+            <countryCode>99350</countryCode>
+          </birth>
           <adresse>
             <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
             <num>170</num>
             <street1>Chateau d'eau</street1>
             <town>Paris</town>
             <zipcode>75014</zipcode>
           </adresse>
           <contact>
@@ -33,17 +37,21 @@
             <addressPro/>
           </profession>
         </RL1>
         <RL2>
           <num>613879</num>
           <lastname>DOE</lastname>
           <firstname>JANE</firstname>
           <civility>MME</civility>
-          <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
+          <birth>
+            <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
+            <place>Bardot</place>
+            <countryCode>99351</countryCode>
+          </birth>
           <adresse>
             <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
             <num>170</num>
             <street1>Chateau d'eau</street1>
             <town>Paris</town>
             <zipcode>75014</zipcode>
           </adresse>
           <contact>
@@ -79,16 +87,19 @@
         </emergencyPersonList>
         <childList>
           <num>613880</num>
           <lastname>DOE</lastname>
           <firstname>JANNIS</firstname>
           <sexe>F</sexe>
           <birth>
             <dateBirth>1943-01-19T00:00:00+01:00</dateBirth>
+            <place>Saint-louis</place>
+            <communeCode>91122</communeCode>
+            <countryCode>99100</countryCode>
           </birth>
           <dietcode>RSV</dietcode>
           <bPhoto>true</bPhoto>
           <bLeaveAlone>false</bLeaveAlone>
           <authorizedPersonList>
             <personInfo>
               <num>614719</num>
               <lastname>BENT</lastname>
diff --git a/tests/data/toulouse_maelis/R_read_family_reordered.xml b/tests/data/toulouse_maelis/R_read_family_reordered.xml
index ddcd4211..4c8b514f 100644
--- a/tests/data/toulouse_maelis/R_read_family_reordered.xml
+++ b/tests/data/toulouse_maelis/R_read_family_reordered.xml
@@ -8,17 +8,21 @@
         <flagCom>true</flagCom>
         <nbChild>2</nbChild>
         <RL1>
           <num>613878</num>
           <lastname>DOE</lastname>
           <firstname>JHON</firstname>
           <quality>PERE</quality>
           <civility>M.</civility>
-          <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
+          <birth>
+            <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
+            <place>Rabbat</place>
+            <countryCode>99350</countryCode>
+          </birth>
           <adresse>
             <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
             <num>170</num>
             <street1>Chateau d'eau</street1>
             <town>Paris</town>
             <zipcode>75014</zipcode>
           </adresse>
           <contact>
@@ -34,17 +38,21 @@
           </profession>
         </RL1>
         <RL2>
           <num>613879</num>
           <lastname>DOE</lastname>
           <firstname>JANE</firstname>
           <quality>MERE</quality>
           <civility>MME</civility>
-          <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
+          <birth>
+            <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
+            <place>Bardot</place>
+            <countryCode>99351</countryCode>
+          </birth>
           <adresse>
             <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
             <num>170</num>
             <street1>Chateau d'eau</street1>
             <town>Paris</town>
             <zipcode>75014</zipcode>
           </adresse>
           <contact>
@@ -80,16 +88,19 @@
         </emergencyPersonList>
         <childList>
           <num>613880</num>
           <lastname>DOE</lastname>
           <firstname>JANNIS</firstname>
           <sexe>F</sexe>
           <birth>
             <dateBirth>1943-01-19T00:00:00+01:00</dateBirth>
+            <place>Saint-louis</place>
+            <communeCode>91122</communeCode>
+            <countryCode>99100</countryCode>
           </birth>
           <dietcode>RSV</dietcode>
           <bPhoto>true</bPhoto>
           <bLeaveAlone>false</bLeaveAlone>
           <authorizedPersonList>
             <personInfo>
               <num>614719</num>
               <lastname>BENT</lastname>
diff --git a/tests/data/toulouse_maelis/R_read_family_with_only_rl1.xml b/tests/data/toulouse_maelis/R_read_family_with_only_rl1.xml
index 1d0d1db3..a9308816 100644
--- a/tests/data/toulouse_maelis/R_read_family_with_only_rl1.xml
+++ b/tests/data/toulouse_maelis/R_read_family_with_only_rl1.xml
@@ -8,17 +8,21 @@
         <flagCom>true</flagCom>
         <nbChild>2</nbChild>
         <RL1>
           <num>613878</num>
           <lastname>DOE</lastname>
           <firstname>JHON</firstname>
           <quality>PERE</quality>
           <civility>M.</civility>
-          <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
+          <birth>
+            <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
+            <place>Rabbat</place>
+            <countryCode>99350</countryCode>
+          </birth>
           <adresse>
             <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
             <num>170</num>
             <street1>Chateau d'eau</street1>
             <town>Paris</town>
             <zipcode>75014</zipcode>
           </adresse>
           <contact>
diff --git a/tests/data/toulouse_maelis/R_update_family.xml b/tests/data/toulouse_maelis/R_update_family.xml
index 7402b6c5..0d95677c 100644
--- a/tests/data/toulouse_maelis/R_update_family.xml
+++ b/tests/data/toulouse_maelis/R_update_family.xml
@@ -7,17 +7,21 @@
         <category>BI</category>
         <situation>C</situation>
         <RL1>
           <num>613955</num>
           <lastname>DOE</lastname>
           <firstname>JHON</firstname>
           <quality>AU</quality>
           <civility>MR</civility>
-          <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
+          <birth>
+            <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
+            <place>Rabbat</place>
+            <countryCode>99350</countryCode>
+          </birth>
           <adresse>
             <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
             <num>0</num>
             <street1>Chateau</street1>
             <town>Paris</town>
             <zipcode>75014</zipcode>
           </adresse>
           <contact>
@@ -27,17 +31,21 @@
           </contact>
         </RL1>
         <RL2>
           <num>614062</num>
           <lastname>DOE</lastname>
           <firstname>JANNETTE</firstname>
           <quality>MERE</quality>
           <civility>MR</civility>
-          <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
+          <birth>
+            <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
+            <place>Bardot</place>
+            <countryCode>99351</countryCode>
+          </birth>
           <adresse>
             <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
             <num>0</num>
             <street1>Chateau</street1>
             <town>Paris</town>
             <zipcode>75014</zipcode>
           </adresse>
           <contact>
diff --git a/tests/test_toulouse_maelis.py b/tests/test_toulouse_maelis.py
index cd8f8d42..ba49bae6 100644
--- a/tests/test_toulouse_maelis.py
+++ b/tests/test_toulouse_maelis.py
@@ -582,17 +582,22 @@ def test_read_family(mocked_post, mocked_get, read_family, con, app):
     del data['profession']
     assert data == {
         'num': '613878',
         'lastname': 'DOE',
         'firstname': 'JHON',
         'maidenName': None,
         'quality': 'PERE',
         'civility': 'M.',
-        'dateBirth': '1938-07-26T00:00:00+01:00',
+        'birth': {
+            'communeCode': None,
+            'countryCode': '99350',
+            'dateBirth': '1938-07-26T00:00:00+01:00',
+            'place': 'Rabbat',
+        },
         'adresse': {
             'idStreet': None,
             'num': 170,
             'numComp': None,
             'street1': "Chateau d'eau",
             'street2': None,
             'town': 'Paris',
             'zipcode': '75014',
@@ -617,17 +622,22 @@ def test_read_family(mocked_post, mocked_get, read_family, con, app):
     del data['authorizedPersonList']
     del data['paiInfoBean']
     assert data == {
         'num': '613880',
         'lastname': 'DOE',
         'firstname': 'JANNIS',
         'sexe': 'F',
         'sexe_text': 'Féminin',
-        'birth': {'dateBirth': '1943-01-19T00:00:00+01:00', 'place': None},
+        'birth': {
+            'dateBirth': '1943-01-19T00:00:00+01:00',
+            'place': 'Saint-louis',
+            'communeCode': '91122',
+            'countryCode': '99100',
+        },
         'dietcode': 'RSV',
         'dietcode_text': '3- RÉGIME SANS VIANDE',
         'bPhoto': True,
         'bLeaveAlone': False,
         'insurance': None,
         'indicatorList': [],
         'subscribeSchoolList': [],
         'mother': {'num': 613963, 'civility': 'MME', 'firstname': 'JANE', 'lastname': 'DOE'},
@@ -758,17 +768,22 @@ def test_read_rl2(mocked_post, mocked_get, con, app):
     assert resp.json['err'] == 0
     assert resp.json['data'] == {
         'num': '613879',
         'lastname': 'DOE',
         'firstname': 'JANE',
         'maidenName': None,
         'quality': 'MERE',
         'civility': 'MME',
-        'dateBirth': '1940-06-22T00:00:00+02:00',
+        'birth': {
+            'communeCode': None,
+            'countryCode': '99351',
+            'dateBirth': '1940-06-22T00:00:00+02:00',
+            'place': 'Bardot',
+        },
         'adresse': {
             'idStreet': None,
             'num': 170,
             'numComp': None,
             'street1': "Chateau d'eau",
             'street2': None,
             'town': 'Paris',
             'zipcode': '75014',
@@ -1041,27 +1056,33 @@ def test_create_family(mocked_post, mocked_get, con, app):
     url = get_endpoint('create-family')
     params = {
         'category': 'ACCEUI',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/communeCode': None,
+        'rl1/birth/countryCode': '99350',
+        'rl1/birth/dateBirth': '1938-07-26',
+        'rl1/birth/place': 'Rabbat',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
         'rl1/adresse/numComp': 'B',
         'rl1/profession/codeCSP': 'ART',
         'rl1/CAFInfo/organ': 'A10007752822',
         'childList/0/lastname': 'Zimmerman',
         'childList/0/firstname': 'Robert',
         'childList/0/sexe': 'M',
-        'childList/0/dateBirth': '1941-05-24',
+        'childList/0/birth/dateBirth': '1941-05-24',
+        'childList/0/birth/place': 'Saint-louis',
+        'childList/0/birth/communeCode': '91122',
+        'childList/0/birth/countryCode': '99100',
         'childList/0/dietcode': 'RSV',
         'childList/0/medicalRecord/vaccinList/0/code': 'DTC',
         'childList/0/medicalRecord/vaccinList/0/vaccinationDate': '1940-07-26',
     }
 
     resp = app.post_json(url + '?NameID=local', params=params)
     assert_sent_payload(mocked_post, 'Q_create_family.xml')
     assert resp.json['err'] == 0
@@ -1078,17 +1099,17 @@ def test_create_family_empty_referential_key_error(con, app):
     url = get_endpoint('create-family')
     params = {
         'category': '',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/dateBirth': '1938-07-26',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
     }
 
     resp = app.post_json(url + '?NameID=local', params=params, status=400)
     assert resp.json['err'] == 1
     assert resp.json['err_desc'] == "category: '' does not match '.+'"
@@ -1098,17 +1119,17 @@ def test_create_family_already_linked_error(con, app):
     url = get_endpoint('create-family')
     params = {
         'category': 'ACCEUI',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/dateBirth': '1938-07-26',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'already-linked'
@@ -1129,17 +1150,17 @@ def test_create_family_maelis_error(mocked_post, mocked_get, con, app):
     url = get_endpoint('create-family')
     params = {
         'category': 'ACCEUI',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/dateBirth': '1938-07-26',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
     }
 
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'E54a, E54a'
     assert 'Il existe déjà' in resp.json['err_desc']
@@ -1162,27 +1183,33 @@ def test_create_family_wrong_referential_key_error(mocked_post, mocked_get, con,
     url = get_endpoint('create-family')
     params = {
         'category': 'ACCEUI',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/communeCode': None,
+        'rl1/birth/countryCode': '99350',
+        'rl1/birth/dateBirth': '1938-07-26',
+        'rl1/birth/place': 'Rabbat',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
         'rl1/adresse/numComp': 'B',
         'rl1/profession/codeCSP': 'ART',
         'rl1/CAFInfo/organ': 'A10007752822',
         'childList/0/lastname': 'Zimmerman',
         'childList/0/firstname': 'Robert',
         'childList/0/sexe': 'M',
-        'childList/0/dateBirth': '1941-05-24',
+        'childList/0/birth/dateBirth': '1941-05-24',
+        'childList/0/birth/place': 'Saint-louis',
+        'childList/0/birth/communeCode': '91122',
+        'childList/0/birth/countryCode': '99100',
         'childList/0/dietcode': 'RSV',
         'childList/0/medicalRecord/vaccinList/0/code': 'plop',
         'childList/0/medicalRecord/vaccinList/0/vaccinationDate': '1940-07-26',
     }
 
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'wrong-key'
     assert (
@@ -1210,17 +1237,20 @@ def test_update_family(mocked_post, mocked_get, con, app):
     url = get_endpoint('update-family')
     params = {
         'category': 'BI',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/communeCode': None,
+        'rl1/birth/countryCode': '99350',
+        'rl1/birth/dateBirth': '1938-07-26',
+        'rl1/birth/place': 'Rabbat',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
         'rl1/adresse/numComp': 'B',
         'rl1/profession/codeCSP': 'ART',
         'rl1/CAFInfo/organ': 'A10007752822',
         'emergencyPersonList/0/personList/0/civility': 'MME',
         'emergencyPersonList/0/personList/0/firstname': 'Keny',
@@ -1251,17 +1281,17 @@ def test_update_family_not_linked_error(con, app):
     url = get_endpoint('update-family')
     params = {
         'category': 'BI',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/dateBirth': '1938-07-26',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
     }
 
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'not-linked'
     assert resp.json['err_desc'] == 'User not linked to family'
@@ -1302,17 +1332,17 @@ def test_update_family_soap_error(mocked_post, mocked_get, con, app):
     params = {
         'nbChild': '100',
         'category': 'BI',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/dateBirth': '1938-07-26',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'Family-readCategoryList-soap:Server'
@@ -1337,17 +1367,20 @@ def test_update_family_wrong_referential_key_error(mocked_post, mocked_get, con,
     url = get_endpoint('update-family')
     params = {
         'category': 'BI',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/communeCode': None,
+        'rl1/birth/countryCode': '99350',
+        'rl1/birth/dateBirth': '1938-07-26',
+        'rl1/birth/place': 'Rabbat',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
         'rl1/adresse/numComp': 'B',
         'rl1/profession/codeCSP': 'ART',
         'rl1/CAFInfo/organ': 'A10007752822',
         'emergencyPersonList/0/personList/0/civility': 'MME',
         'emergencyPersonList/0/personList/0/firstname': 'Keny',
@@ -1389,17 +1422,17 @@ def test_create_rl1(mocked_post, mocked_get, con, app):
     url = get_endpoint('create-rl1')
     params = {
         'category': 'ACCEUI',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/dateBirth': '1938-07-26',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
     }
 
     resp = app.post_json(url + '?NameID=local', params=params)
     assert_sent_payload(mocked_post, 'Q_create_rl1.xml')
     assert resp.json['err'] == 0
@@ -1411,17 +1444,17 @@ def test_create_rl1_empty_referential_key_error(con, app):
     url = get_endpoint('create-rl1')
     params = {
         'category': 'ACCEUI',
         'situation': 'C',
         'rl1/civility': '',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': '',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/dateBirth': '1938-07-26',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
     }
 
     resp = app.post_json(url + '?NameID=local', params=params, status=400)
     assert resp.json['err'] == 1
     assert resp.json['err_desc'] == "rl1/civility: '' does not match '.+'"
@@ -1431,17 +1464,17 @@ def test_create_rl1_already_linked_error(con, app):
     url = get_endpoint('create-rl1')
     params = {
         'category': 'ACCEUI',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/dateBirth': '1938-07-26',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'already-linked'
@@ -1456,17 +1489,17 @@ def test_create_rl1_wrong_referential_key_error(mocked_post, mocked_get, con, ap
     url = get_endpoint('create-rl1')
     params = {
         'category': 'ACCEUI',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/dateBirth': '1938-07-26',
         'rl1/adresse/numComp': 'plop',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
     }
 
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'wrong-key'
@@ -1490,17 +1523,17 @@ def test_create_rl1_maelis_error(mocked_post, mocked_get, con, app):
     url = get_endpoint('create-rl1')
     params = {
         'category': 'ACCEUI',
         'situation': 'C',
         'rl1/civility': 'M.',
         'rl1/firstname': 'Jhon',
         'rl1/lastname': 'Doe',
         'rl1/quality': 'AU',
-        'rl1/dateBirth': '1938-07-26',
+        'rl1/birth/dateBirth': '1938-07-26',
         'rl1/adresse/street1': 'Chateau',
         'rl1/adresse/town': 'Paris',
         'rl1/adresse/zipcode': '75014',
     }
 
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'already-rl1'
     assert 'Il existe déjà' in resp.json['err_desc']
@@ -1512,33 +1545,33 @@ def test_update_rl1(mocked_post, mocked_get, con, app):
     mocked_get.return_value = FAMILY_SERVICE_WSDL
     mocked_post.side_effect = [READ_RL1_FAMILY, READ_CIVILITIES, READ_QUALITIES, UPDATE_FAMILY]
     url = get_endpoint('update-rl1')
     params = {
         'civility': 'M.',
         'firstname': 'Jhonny',
         'lastname': 'Doe',
         'quality': 'PERE',
-        'dateBirth': '1943-06-15',
+        'birth/dateBirth': '1943-06-15',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params)
     assert_sent_payload(mocked_post, 'Q_update_rl1.xml')
     assert resp.json['err'] == 0
 
 
 def test_update_rl1_not_linked_error(con, app):
     url = get_endpoint('update-rl1')
     params = {
         'civility': 'M.',
         'firstname': 'Jhonny',
         'lastname': 'Doe',
         'quality': 'PERE',
-        'dateBirth': '1943-06-15',
+        'birth/dateBirth': '1943-06-15',
     }
 
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'not-linked'
     assert resp.json['err_desc'] == 'User not linked to family'
 
 
 @mock.patch('passerelle.utils.Request.get')
@@ -1547,17 +1580,17 @@ def test_update_rl1_connection_error(mocked_post, mocked_get, con, app):
     mocked_get.return_value = FAMILY_SERVICE_WSDL
     mocked_post.side_effect = CONNECTION_ERROR
     url = get_endpoint('update-rl1')
     params = {
         'civility': 'M.',
         'firstname': 'Jhonny',
         'lastname': 'Doe',
         'quality': 'PERE',
-        'dateBirth': '1943-06-15',
+        'birth/dateBirth': '1943-06-15',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params, status=500)
     assert resp.json['err']
     assert resp.json['err_desc'] == 'No address associated with hostname'
 
 
@@ -1567,17 +1600,17 @@ def test_update_rl1_wrong_referential_key_error(mocked_post, mocked_get, con, ap
     mocked_get.return_value = FAMILY_SERVICE_WSDL
     mocked_post.side_effect = [READ_FAMILY, READ_CIVILITIES, READ_QUALITIES]
     url = get_endpoint('update-rl1')
     params = {
         'civility': 'M.',
         'firstname': 'Jhonny',
         'lastname': 'Doe',
         'quality': 'plop',
-        'dateBirth': '1943-06-15',
+        'birth/dateBirth': '1943-06-15',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'wrong-key'
     assert resp.json['err_desc'] == "quality key value 'plop' do not belong to 'Quality' required referential"
 
 
@@ -1587,17 +1620,17 @@ def test_create_rl2(mocked_post, mocked_get, con, app):
     mocked_get.return_value = FAMILY_SERVICE_WSDL
     mocked_post.side_effect = [READ_RL1_FAMILY, READ_CIVILITIES, READ_QUALITIES, UPDATE_FAMILY]
     url = get_endpoint('create-rl2')
     params = {
         'civility': 'MME',
         'firstname': 'JANE',
         'lastname': 'DOE',
         'quality': 'MERE',
-        'dateBirth': '1940-06-22',
+        'birth/dateBirth': '1940-06-22',
         'adresse/num': '170',
         'adresse/street1': "Chateau d'eau",
         'adresse/town': 'Paris',
         'adresse/zipcode': '75014',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params)
@@ -1608,17 +1641,17 @@ def test_create_rl2(mocked_post, mocked_get, con, app):
 
 def test_create_rl2_not_linked_error(con, app):
     url = get_endpoint('create-rl2')
     params = {
         'civility': 'MME',
         'firstname': 'JANE',
         'lastname': 'DOE',
         'quality': 'MERE',
-        'dateBirth': '1940-06-22',
+        'birth/dateBirth': '1940-06-22',
         'adresse/num': '170',
         'adresse/street1': "Chateau d'eau",
         'adresse/town': 'Paris',
         'adresse/zipcode': '75014',
     }
 
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'not-linked'
@@ -1631,17 +1664,17 @@ def test_create_rl2_connection_error(mocked_post, mocked_get, con, app):
     mocked_get.return_value = FAMILY_SERVICE_WSDL
     mocked_post.side_effect = CONNECTION_ERROR
     url = get_endpoint('create-rl2')
     params = {
         'civility': 'MME',
         'firstname': 'JANE',
         'lastname': 'DOE',
         'quality': 'MERE',
-        'dateBirth': '1940-06-22',
+        'birth/dateBirth': '1940-06-22',
         'adresse/num': '170',
         'adresse/street1': "Chateau d'eau",
         'adresse/town': 'Paris',
         'adresse/zipcode': '75014',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params, status=500)
@@ -1655,17 +1688,17 @@ def test_create_rl2_already_exists_error(mocked_post, mocked_get, con, app):
     mocked_get.return_value = FAMILY_SERVICE_WSDL
     mocked_post.return_value = READ_FAMILY
     url = get_endpoint('create-rl2')
     params = {
         'civility': 'MME',
         'firstname': 'JANE',
         'lastname': 'DOE',
         'quality': 'MERE',
-        'dateBirth': '1940-06-22',
+        'birth/dateBirth': '1940-06-22',
         'adresse/num': '170',
         'adresse/street1': "Chateau d'eau",
         'adresse/town': 'Paris',
         'adresse/zipcode': '75014',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params)
@@ -1679,17 +1712,17 @@ def test_create_rl2_wrong_referential_key_error(mocked_post, mocked_get, con, ap
     mocked_get.return_value = FAMILY_SERVICE_WSDL
     mocked_post.side_effect = [READ_RL1_FAMILY, READ_CIVILITIES, READ_QUALITIES]
     url = get_endpoint('create-rl2')
     params = {
         'civility': 'MME',
         'firstname': 'JANE',
         'lastname': 'DOE',
         'quality': 'plop',
-        'dateBirth': '1940-06-22',
+        'birth/dateBirth': '1940-06-22',
         'adresse/num': '170',
         'adresse/street1': "Chateau d'eau",
         'adresse/town': 'Paris',
         'adresse/zipcode': '75014',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params)
@@ -1703,33 +1736,33 @@ def test_update_rl2(mocked_post, mocked_get, con, app):
     mocked_get.return_value = FAMILY_SERVICE_WSDL
     mocked_post.side_effect = [READ_FAMILY, READ_CIVILITIES, READ_QUALITIES, UPDATE_FAMILY]
     url = get_endpoint('update-rl2')
     params = {
         'civility': 'MME',
         'firstname': 'JANE',
         'lastname': 'DOE',
         'quality': 'MERE',
-        'dateBirth': '1940-06-22',
+        'birth/dateBirth': '1940-06-22',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params)
     assert_sent_payload(mocked_post, 'Q_update_rl2.xml')
     assert resp.json['err'] == 0
 
 
 def test_update_rl2_not_linked_error(con, app):
     url = get_endpoint('update-rl2')
     params = {
         'civility': 'MME',
         'firstname': 'JANE',
         'lastname': 'DOE',
         'quality': 'MERE',
-        'dateBirth': '1940-06-22',
+        'birth/dateBirth': '1940-06-22',
     }
 
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'not-linked'
     assert resp.json['err_desc'] == 'User not linked to family'
 
 
 @mock.patch('passerelle.utils.Request.get')
@@ -1738,17 +1771,17 @@ def test_update_rl2_connection_error(mocked_post, mocked_get, con, app):
     mocked_get.return_value = FAMILY_SERVICE_WSDL
     mocked_post.side_effect = CONNECTION_ERROR
     url = get_endpoint('update-rl2')
     params = {
         'civility': 'MME',
         'firstname': 'JANE',
         'lastname': 'DOE',
         'quality': 'MERE',
-        'dateBirth': '1940-06-22',
+        'birth/dateBirth': '1940-06-22',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params, status=500)
     assert resp.json['err']
     assert resp.json['err_desc'] == 'No address associated with hostname'
 
 
@@ -1758,17 +1791,17 @@ def test_update_rl2_not_exists_error(mocked_post, mocked_get, con, app):
     mocked_get.return_value = FAMILY_SERVICE_WSDL
     mocked_post.return_value = READ_RL1_FAMILY
     url = get_endpoint('update-rl2')
     params = {
         'civility': 'MME',
         'firstname': 'JANE',
         'lastname': 'DOE',
         'quality': 'MERE',
-        'dateBirth': '1940-06-22',
+        'birth/dateBirth': '1940-06-22',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'no-rl2'
     assert resp.json['err_desc'] == 'No RL2 to update on family'
 
 
@@ -1778,17 +1811,17 @@ def test_update_rl2_wrong_referential_key_error(mocked_post, mocked_get, con, ap
     mocked_get.return_value = FAMILY_SERVICE_WSDL
     mocked_post.side_effect = [READ_FAMILY, READ_CIVILITIES, READ_QUALITIES]
     url = get_endpoint('update-rl2')
     params = {
         'civility': 'MME',
         'firstname': 'JANE',
         'lastname': 'DOE',
         'quality': 'plop',
-        'dateBirth': '1940-06-22',
+        'birth/dateBirth': '1940-06-22',
     }
 
     Link.objects.create(resource=con, family_id='1312', name_id='local')
     resp = app.post_json(url + '?NameID=local', params=params)
     assert resp.json['err'] == 'wrong-key'
     assert resp.json['err_desc'] == "quality key value 'plop' do not belong to 'Quality' required referential"
 
 
-- 
2.30.2

