toulouse-maelis: add endpoint for school pre-registration with exemption (#73138)
gitea-wip/passerelle/pipeline/pr-main This commit looks good
Details
gitea-wip/passerelle/pipeline/pr-main This commit looks good
Details
This commit is contained in:
parent
fe17cbc907
commit
2d3c604f10
|
@ -837,3 +837,59 @@ SCHOOL_PRE_REGISTRATION_SCHEMA = {
|
|||
'unflatten': True,
|
||||
'additionalProperties': False,
|
||||
}
|
||||
|
||||
SCHOOL_PRE_REGISTRATION_WITH_EXEMPTION_SCHEMA = {
|
||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
||||
'title': 'School pre-registration',
|
||||
'description': 'Crée une pré-inscription scolaire pour un enfant avec demande de dérogation',
|
||||
'type': 'object',
|
||||
'required': [
|
||||
'numPerson',
|
||||
'schoolYear',
|
||||
'datePresubscribe',
|
||||
'levelCode',
|
||||
'idRequestSchool1',
|
||||
'derogReasonCode',
|
||||
'derogComment',
|
||||
],
|
||||
'properties': {
|
||||
'numPerson': {
|
||||
'description': "Numéro de l'enfant",
|
||||
'type': 'string',
|
||||
},
|
||||
'schoolYear': {
|
||||
'description': "Année scolaire",
|
||||
'type': 'string',
|
||||
},
|
||||
'datePresubscribe': {
|
||||
'description': "Date d'inscription",
|
||||
'type': 'string',
|
||||
},
|
||||
'levelCode': {
|
||||
'description': "Le code du niveau scolaire",
|
||||
'type': 'string',
|
||||
},
|
||||
'idRequestSchool1': {
|
||||
'description': "Identifiant de l'établissement demandé 1",
|
||||
'type': 'string',
|
||||
},
|
||||
'idRequestSchool2': {
|
||||
'description': "Identifiant de l'établissement demandé 2",
|
||||
'type': 'string',
|
||||
},
|
||||
'idRequestSchool3': {
|
||||
'description': "Identifiant de l'établissement demandé 3",
|
||||
'type': 'string',
|
||||
},
|
||||
'derogReasonCode': {
|
||||
'description': "Code du motif de dérogation",
|
||||
'type': 'string',
|
||||
},
|
||||
'derogComment': {
|
||||
'description': "Commentaire relatif à la dérogation",
|
||||
'type': 'string',
|
||||
},
|
||||
},
|
||||
'unflatten': True,
|
||||
'additionalProperties': False,
|
||||
}
|
||||
|
|
|
@ -2011,6 +2011,21 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
response = self.call('Family', 'preSubscribeSchoolPerim', **post_data)
|
||||
return {'data': serialize_object(response)}
|
||||
|
||||
@endpoint(
|
||||
display_category='Inscriptions',
|
||||
description="Création d'une pré-inscription scolaire avec demande de dérogation",
|
||||
name='create-child-school-pre-registration-with-exemption',
|
||||
perm='can_access',
|
||||
post={
|
||||
'request_body': {
|
||||
'schema': {'application/json': family_schemas.SCHOOL_PRE_REGISTRATION_WITH_EXEMPTION_SCHEMA}
|
||||
}
|
||||
},
|
||||
)
|
||||
def create_child_school_pre_registration_with_exemption(self, request, post_data):
|
||||
response = self.call('Family', 'presubscribeSchoolDerog', **post_data)
|
||||
return {'data': serialize_object(response)}
|
||||
|
||||
|
||||
class Link(models.Model):
|
||||
resource = models.ForeignKey(ToulouseMaelis, on_delete=models.CASCADE)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns2:presubscribeSchoolDerogResponse xmlns:ns2="family.ws.maelis.sigec.com">
|
||||
<subscribeSchool3Bean>
|
||||
<idInssco>S10053187805</idInssco>
|
||||
<year>2023</year>
|
||||
<idSchool>2435</idSchool>
|
||||
<schoolName>DUPONT PIERRE ELEMENTAIRE</schoolName>
|
||||
<levelBean><code>CM1</code>
|
||||
<libelle>Cours moyen 1</libelle>
|
||||
</levelBean>
|
||||
<adresse> GRANDE-RUE SAINT MICHEL</adresse>
|
||||
<headmaster>FOURCADE MARIE-SYLVIE</headmaster>
|
||||
<dateIns>2023-09-01T00:00:00+02:00</dateIns>
|
||||
<preSubscribeDate>2023-09-01T00:00:00+02:00</preSubscribeDate>
|
||||
<isWaitList>true</isWaitList>
|
||||
<codeWait>MO_DEROG</codeWait>
|
||||
<libWait>GRU</libWait>
|
||||
<isDerog>true</isDerog>
|
||||
<derogReason>11DERO-1</derogReason>
|
||||
<derogState>E</derogState>
|
||||
<derogComment>exemption comment</derogComment>
|
||||
</subscribeSchool3Bean>
|
||||
</ns2:presubscribeSchoolDerogResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -4356,3 +4356,30 @@ def test_create_child_school_pre_registration(family_service, con, app):
|
|||
assert resp.json['data']['subscribeSchoolBean']['idSchool'] == '2435'
|
||||
assert resp.json['data']['subscribeSchoolBean']['schoolName'] == 'DUPONT PIERRE ELEMENTAIRE'
|
||||
assert resp.json['data']['subscribeSchoolBean']['isWaitList']
|
||||
|
||||
|
||||
def test_create_child_school_pre_registration_with_exemption(family_service, con, app):
|
||||
family_service.add_soap_response(
|
||||
'presubscribeSchoolDerog', get_xml_file('R_create_child_school_pre_registration_with_exemption.xml')
|
||||
)
|
||||
url = get_endpoint('create-child-school-pre-registration-with-exemption')
|
||||
resp = app.post_json(
|
||||
url,
|
||||
params={
|
||||
'numPerson': '248460',
|
||||
'schoolYear': '2023',
|
||||
'levelCode': 'CM1',
|
||||
'datePresubscribe': '2023-09-01T00:00:00+02:00',
|
||||
'idRequestSchool1': '2435',
|
||||
'derogReasonCode': '11DERO-1',
|
||||
'derogComment': 'exemption comment',
|
||||
},
|
||||
)
|
||||
assert resp.json['err'] == 0
|
||||
print(resp.json['data'])
|
||||
assert resp.json['data']['idSchool'] == '2435'
|
||||
assert resp.json['data']['schoolName'] == 'DUPONT PIERRE ELEMENTAIRE'
|
||||
assert resp.json['data']['isWaitList']
|
||||
assert resp.json['data']['isDerog']
|
||||
assert resp.json['data']['derogReason'] == '11DERO-1'
|
||||
assert resp.json['data']['derogComment'] == 'exemption comment'
|
||||
|
|
Loading…
Reference in New Issue