128 |
128 |
'data': data,
|
129 |
129 |
}
|
130 |
130 |
|
|
131 |
# description of common endpoint parameters
|
|
132 |
ASSOCIATION_PARAM = {
|
|
133 |
'description': _('association SIREN or RNA/WALDEC number'),
|
|
134 |
'example_value': '44317013900036'
|
|
135 |
}
|
|
136 |
|
|
137 |
CONTEXT_PARAM = {
|
|
138 |
'description': _('request context: MPS, APS...'),
|
|
139 |
'example_value': 'APS'
|
|
140 |
}
|
|
141 |
|
|
142 |
OBJECT_PARAM = {
|
|
143 |
'description': _('request object: form number, file identifier...'),
|
|
144 |
'example_value': '42'
|
|
145 |
}
|
|
146 |
|
|
147 |
RECIPIENT_PARAM = {
|
|
148 |
'description': _('request recipient: usually customer number'),
|
|
149 |
'example_value': '44317013900036'
|
|
150 |
}
|
|
151 |
|
|
152 |
SIREN_PARAM = {
|
|
153 |
'description': _('firm SIREN number'),
|
|
154 |
'example_value': '44317013900036',
|
|
155 |
}
|
|
156 |
|
|
157 |
SIRET_PARAM = {
|
|
158 |
'description': _('firms SIRET number'),
|
|
159 |
'example_value': '44317013900036'
|
|
160 |
}
|
|
161 |
|
131 |
162 |
@endpoint(perm='can_access',
|
132 |
163 |
pattern=r'(?P<association_id>\w+)/$',
|
133 |
164 |
example_pattern='{association_id}/',
|
134 |
165 |
description=_('Get association\'s documents'),
|
135 |
166 |
parameters={
|
136 |
|
'association_id': {
|
137 |
|
'description': _('association SIREN or RNA/WALDEC number'),
|
138 |
|
'example_value': '44317013900036',
|
139 |
|
},
|
140 |
|
'object': {
|
141 |
|
'description': _('request object: form number, file identifier...'),
|
142 |
|
'example_value': '42'
|
143 |
|
},
|
144 |
|
'context': {
|
145 |
|
'description': _('request context: MPS, APS...'),
|
146 |
|
'example_value': 'APS'
|
147 |
|
},
|
148 |
|
'recipient': {
|
149 |
|
'description': _('request recipient: usually customer number'),
|
150 |
|
'example_value': '44317013900036'
|
151 |
|
}
|
|
167 |
'association_id': ASSOCIATION_PARAM,
|
|
168 |
'object': OBJECT_PARAM,
|
|
169 |
'context': CONTEXT_PARAM,
|
|
170 |
'recipient': RECIPIENT_PARAM
|
152 |
171 |
})
|
153 |
172 |
def documents_associations(self, request, association_id, **kwargs):
|
154 |
173 |
data = []
|
... | ... | |
182 |
201 |
example_pattern='{association_id}/{document_id}/',
|
183 |
202 |
description=_('Get association\'s document'),
|
184 |
203 |
parameters={
|
185 |
|
'association_id': {
|
186 |
|
'description': _('association SIREN or RNA/WALDEC number'),
|
187 |
|
'example_value': '44317013900036',
|
188 |
|
},
|
|
204 |
'association_id': ASSOCIATION_PARAM,
|
189 |
205 |
'document_id': {
|
190 |
206 |
'description': _('document id'),
|
191 |
207 |
'example_value': 'A1500660325',
|
192 |
208 |
},
|
193 |
|
'object': {
|
194 |
|
'description': _('request object: form number, file identifier...'),
|
195 |
|
'example_value': '42'
|
196 |
|
},
|
197 |
|
'context': {
|
198 |
|
'description': _('request context: MPS, APS...'),
|
199 |
|
'example_value': 'APS'
|
200 |
|
},
|
201 |
|
'recipient': {
|
202 |
|
'description': _('request recipient: usually customer number'),
|
203 |
|
'example_value': '44317013900036'
|
204 |
|
}
|
|
209 |
'object': OBJECT_PARAM,
|
|
210 |
'context': CONTEXT_PARAM,
|
|
211 |
'recipient': RECIPIENT_PARAM,
|
205 |
212 |
})
|
206 |
213 |
def document(self, request, association_id, document_id, **kwargs):
|
207 |
214 |
try:
|
... | ... | |
218 |
225 |
example_pattern='{association_id}/get-last/',
|
219 |
226 |
description=_('Get association\'s last document of type'),
|
220 |
227 |
parameters={
|
221 |
|
'association_id': {
|
222 |
|
'description': _('association SIREN or RNA/WALDEC number'),
|
223 |
|
'example_value': '44317013900036',
|
224 |
|
},
|
|
228 |
'association_id': ASSOCIATION_PARAM,
|
225 |
229 |
'document_type': {
|
226 |
230 |
'description': _('document type'),
|
227 |
231 |
'example_value': 'Statuts',
|
228 |
232 |
},
|
229 |
|
'object': {
|
230 |
|
'Description': _('request object: form number, file identifier...'),
|
231 |
|
'example_value': '42'
|
232 |
|
},
|
233 |
|
'context': {
|
234 |
|
'description': _('request context: MPS, APS...'),
|
235 |
|
'example_value': 'APS'
|
236 |
|
},
|
237 |
|
'recipient': {
|
238 |
|
'description': _('request recipient: usually customer number'),
|
239 |
|
'example_value': '44317013900036'
|
240 |
|
}
|
|
233 |
'object': OBJECT_PARAM,
|
|
234 |
'context': CONTEXT_PARAM,
|
|
235 |
'recipient': RECIPIENT_PARAM,
|
241 |
236 |
})
|
242 |
237 |
def get_last_document_of_type(self, request, association_id, document_type, **kwargs):
|
243 |
238 |
document = None
|
... | ... | |
253 |
248 |
example_pattern='{siren}/',
|
254 |
249 |
description=_('Get firm\'s data from Infogreffe'),
|
255 |
250 |
parameters={
|
256 |
|
'siren': {
|
257 |
|
'description': _('firm SIREN number'),
|
258 |
|
'example_value': '44317013900036',
|
259 |
|
},
|
260 |
|
'object': {
|
261 |
|
'description': _('request object: form number, file identifier...'),
|
262 |
|
'example_value': '42'
|
263 |
|
},
|
264 |
|
'context': {
|
265 |
|
'description': _('request context: MPS, APS...'),
|
266 |
|
'example_value': 'APS'
|
267 |
|
},
|
268 |
|
'recipient': {
|
269 |
|
'description': _('request recipient: usually customer number'),
|
270 |
|
'example_value': '44317013900036'
|
271 |
|
}
|
|
251 |
'siren': SIREN_PARAM,
|
|
252 |
'object': OBJECT_PARAM,
|
|
253 |
'context': CONTEXT_PARAM,
|
|
254 |
'recipient': RECIPIENT_PARAM,
|
272 |
255 |
})
|
273 |
256 |
def extraits_rcs(self, request, siren, **kwargs):
|
274 |
257 |
return self.get('extraits_rcs_infogreffe/%s/' % siren, **kwargs)
|
... | ... | |
278 |
261 |
example_pattern='{association_id}/',
|
279 |
262 |
description=_('Get association\'s related informations'),
|
280 |
263 |
parameters={
|
281 |
|
'association_id': {
|
282 |
|
'description': _('association SIRET or RNA/WALDEC number'),
|
283 |
|
'example_value': '44317013900036',
|
284 |
|
},
|
285 |
|
'object': {
|
286 |
|
'description': _('request object: form number, file identifier...'),
|
287 |
|
'example_value': '42'
|
288 |
|
},
|
289 |
|
'context': {
|
290 |
|
'description': _('request context: MPS, APS...'),
|
291 |
|
'example_value': 'APS'
|
292 |
|
},
|
293 |
|
'recipient': {
|
294 |
|
'description': _('request recipient: usually customer number'),
|
295 |
|
'example_value': '44317013900036'
|
296 |
|
}
|
|
264 |
'association_id': ASSOCIATION_PARAM,
|
|
265 |
'object': OBJECT_PARAM,
|
|
266 |
'context': CONTEXT_PARAM,
|
|
267 |
'recipient': RECIPIENT_PARAM,
|
297 |
268 |
})
|
298 |
269 |
def associations(self, request, association_id, **kwargs):
|
299 |
270 |
return self.get('associations/%s/' % association_id, **kwargs)
|
... | ... | |
303 |
274 |
example_pattern='{siren}/',
|
304 |
275 |
description=_('Get firm\'s related informations'),
|
305 |
276 |
parameters={
|
306 |
|
'siren': {
|
307 |
|
'description': _('firm SIREN number'),
|
308 |
|
'example_value': '44317013900036',
|
309 |
|
},
|
310 |
|
'object': {
|
311 |
|
'description': _('request object: form number, file identifier...'),
|
312 |
|
'example_value': '42'
|
313 |
|
},
|
314 |
|
'context': {
|
315 |
|
'description': _('request context: MPS, APS...'),
|
316 |
|
'example_value': 'APS'
|
317 |
|
},
|
318 |
|
'recipient': {
|
319 |
|
'description': _('request recipient: usually customer number'),
|
320 |
|
'example_value': '44317013900036'
|
321 |
|
}
|
|
277 |
'siren': SIREN_PARAM,
|
|
278 |
'object': OBJECT_PARAM,
|
|
279 |
'context': CONTEXT_PARAM,
|
|
280 |
'recipient': RECIPIENT_PARAM,
|
322 |
281 |
})
|
323 |
282 |
def entreprises(self, request, siren, **kwargs):
|
324 |
283 |
return self.get('entreprises/%s/' % siren, **kwargs)
|
... | ... | |
329 |
288 |
example_pattern='{siret}/',
|
330 |
289 |
description_get=_('Get firms\'s related informations'),
|
331 |
290 |
parameters={
|
332 |
|
'siret': {
|
333 |
|
'description': _('firms SIRET number'),
|
334 |
|
'example_value': '44317013900036',
|
335 |
|
},
|
336 |
|
'object': {
|
337 |
|
'description': _('request object: form number, file identifier...'),
|
338 |
|
'example_value': '42'
|
339 |
|
},
|
340 |
|
'context': {
|
341 |
|
'description': _('request context: MPS, APS...'),
|
342 |
|
'example_value': 'APS'
|
343 |
|
},
|
344 |
|
'recipient': {
|
345 |
|
'description': _('request recipient: usually customer number'),
|
346 |
|
'example_value': '44317013900036'
|
347 |
|
}
|
|
291 |
'siret': SIRET_PARAM,
|
|
292 |
'object': OBJECT_PARAM,
|
|
293 |
'context': CONTEXT_PARAM,
|
|
294 |
'recipient': RECIPIENT_PARAM,
|
348 |
295 |
})
|
349 |
296 |
def etablissements(self, request, siret, **kwargs):
|
350 |
297 |
return self.get('etablissements/%s/' % siret, **kwargs)
|
351 |
|
-
|