api-entreprise: grab data deeper for mandataires sociaux (#76720)
gitea/passerelle/pipeline/head There was a failure building this commit Details

This commit is contained in:
Emmanuel Cazenave 2023-04-17 17:14:44 +02:00
parent ea3d48b7da
commit 0ec3714996
2 changed files with 21 additions and 15 deletions

View File

@ -375,6 +375,7 @@ class APIEntreprise(BaseResource):
'v3/infogreffe/rcs/unites_legales/%s/mandataires_sociaux' % siren, raw=True, **kwargs
).get('data')
for mandataire in mandataires_data:
mandataire = mandataire.get('data', {})
for key in ('nom', 'prenom', 'fonction'):
if key not in mandataire:
mandataire[key] = ''
@ -465,6 +466,7 @@ class APIEntreprise(BaseResource):
if method not in methods:
return {'err': 1, 'err_desc': 'method %s not implemented' % method}
for mandataire in mandataires:
mandataire = mandataire.get('data', {})
if methods[method](mandataire, first_name, last_name, birthdate):
return {'err': 0, 'data': mandataire}
return {'err': 0, 'data': {}}

View File

@ -120,23 +120,27 @@ UNITES_LEGALES_SIEGE_RESPONSE = {
RCS_UNITES_LEGALES_MANDATAIRES_SOCIAUX_RESPONSE = {
"data": [
{
"nom": "HISQUIN",
"prenom": "FRANCOIS",
"fonction": "PRESIDENT DU DIRECTOIRE",
"dirigeant": True,
"date_naissance": "1965-01-27",
"raison_sociale": "",
"identifiant": "",
"type": "PP",
"data": {
"nom": "HISQUIN",
"prenom": "FRANCOIS",
"fonction": "PRESIDENT DU DIRECTOIRE",
"dirigeant": True,
"date_naissance": "1965-01-27",
"raison_sociale": "",
"identifiant": "",
"type": "PP",
},
},
{
"fonction": "COMMISSAIRE AUX COMPTES SUPPLEANT",
"dirigeant": True,
"date_naissance": "",
"date_naissance_timestamp": 0,
"raison_sociale": "BCRH & ASSOCIES - SOCIETE A RESPONSABILITE LIMITEE A ASSOCIE UNIQUE",
"identifiant": "490092574",
"type": "PM",
"data": {
"fonction": "COMMISSAIRE AUX COMPTES SUPPLEANT",
"dirigeant": True,
"date_naissance": "",
"date_naissance_timestamp": 0,
"raison_sociale": "BCRH & ASSOCIES - SOCIETE A RESPONSABILITE LIMITEE A ASSOCIE UNIQUE",
"identifiant": "490092574",
"type": "PM",
},
},
]
}