toulouse-maelis: add child school pre-registration (#72751)
gitea-wip/passerelle/pipeline/pr-main This commit looks good Details

This commit is contained in:
Serghei Mihai 2023-01-06 11:13:36 +01:00
parent 0d2d076cba
commit 2f6bbff57a
4 changed files with 81 additions and 0 deletions

View File

@ -809,3 +809,31 @@ SUPPLIED_DOCUMENTS_SCHEMA = {
'unflatten': True,
'additionalProperties': False,
}
SCHOOL_PRE_REGISTRATION_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'School pre-registration',
'description': 'Crée une pré-inscription scolaire pour un enfant',
'type': 'object',
'required': ['numPerson', 'schoolYear', 'dateSubscribe', 'levelCode'],
'properties': {
'numPerson': {
'description': "Numéro de l'enfant",
'type': 'string',
},
'schoolYear': {
'description': "Année scolaire",
'type': 'string',
},
'dateSubscribe': {
'description': "Date d'inscription",
'type': 'string',
},
'levelCode': {
'description': "Le code du niveau scolaire",
'type': 'string',
},
},
'unflatten': True,
'additionalProperties': False,
}

View File

@ -1998,6 +1998,19 @@ class ToulouseMaelis(BaseResource, HTTPResource):
)
return {'data': serialize_object(response)}
@endpoint(
display_category='Inscriptions',
description="Création d'une pré-inscription scolaire pour un enfant",
name='create-child-school-pre-registration',
perm='can_access',
post={
'request_body': {'schema': {'application/json': family_schemas.SCHOOL_PRE_REGISTRATION_SCHEMA}}
},
)
def create_child_school_pre_registration(self, request, post_data):
response = self.call('Family', 'preSubscribeSchoolPerim', **post_data)
return {'data': serialize_object(response)}
class Link(models.Model):
resource = models.ForeignKey(ToulouseMaelis, on_delete=models.CASCADE)

View File

@ -0,0 +1,20 @@
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:preSubscribeSchoolPerimResponse xmlns:ns2="family.ws.maelis.sigec.com">
<resultSubscribeBean><subscribeSchoolBean>
<year>2023</year>
<idSchool>2435</idSchool>
<schoolName>DUPONT PIERRE ELEMENTAIRE</schoolName>
<levelBean/>
<adresse> GRANDE-RUE SAINT MICHEL</adresse>
<headmaster>FOURCADE MARIE-SYLVIE</headmaster>
<dateIns>2023-09-01T00:00:00+02:00</dateIns>
<isWaitList>true</isWaitList>
<codeWait>MO_PERIM</codeWait>
<libWait>GRU</libWait>
</subscribeSchoolBean>
</resultSubscribeBean>
</ns2:preSubscribeSchoolPerimResponse>
</soap:Body>
</soap:Envelope>

View File

@ -4336,3 +4336,23 @@ def test_read_child_school_subscription_information(family_service, con, app):
assert 'rl1Info' in resp.json['data']
assert 'childSubscribeSchoolInformation' in resp.json['data']
assert 'personSubscribeSchoolList' in resp.json['data']
def test_create_child_school_pre_registration(family_service, con, app):
family_service.add_soap_response(
'preSubscribeSchoolPerim', get_xml_file('R_create_child_school_pre_registration.xml')
)
url = get_endpoint('create-child-school-pre-registration')
resp = app.post_json(
url,
params={
'numPerson': '248460',
'schoolYear': '2023',
'levelCode': 'CM1',
'dateSubscribe': '2023-09-01T00:00:00+02:00',
},
)
assert resp.json['err'] == 0
assert resp.json['data']['subscribeSchoolBean']['idSchool'] == '2435'
assert resp.json['data']['subscribeSchoolBean']['schoolName'] == 'DUPONT PIERRE ELEMENTAIRE'
assert resp.json['data']['subscribeSchoolBean']['isWaitList']