120 |
120 |
'data': data,
|
121 |
121 |
}
|
122 |
122 |
|
123 |
|
|
124 |
123 |
@endpoint(perm='can_access',
|
125 |
|
pattern='(?P<association_id>\w+)/$',
|
|
124 |
pattern=r'(?P<association_id>\w+)/$',
|
126 |
125 |
example_pattern='{association_id}/',
|
127 |
126 |
description=_('Get association\'s documents'),
|
128 |
127 |
parameters={
|
... | ... | |
142 |
141 |
'description': _('request recipient: usually customer number'),
|
143 |
142 |
'example_value': '44317013900036'
|
144 |
143 |
}
|
145 |
|
}
|
146 |
|
)
|
|
144 |
})
|
147 |
145 |
def documents_associations(self, request, association_id, **kwargs):
|
148 |
146 |
data = []
|
149 |
147 |
resp = self.get('documents_associations/%s/' % association_id, **kwargs)
|
... | ... | |
156 |
154 |
'object': kwargs['object'],
|
157 |
155 |
'recipient': kwargs['recipient']}
|
158 |
156 |
signature = signing.dumps(signature_elements)
|
159 |
|
document_url = request.build_absolute_uri(reverse('generic-endpoint', kwargs={'connector': self.get_connector_slug(),
|
160 |
|
'slug': self.slug,
|
161 |
|
'endpoint': 'document',
|
162 |
|
'rest': '%s/%s/' % (association_id, signature)}))
|
|
157 |
document_url = request.build_absolute_uri(
|
|
158 |
reverse('generic-endpoint',
|
|
159 |
kwargs={
|
|
160 |
'connector': self.get_connector_slug(),
|
|
161 |
'slug': self.slug,
|
|
162 |
'endpoint': 'document',
|
|
163 |
'rest': '%s/%s/' % (association_id, signature),
|
|
164 |
}))
|
163 |
165 |
item['id'] = item['timestamp']
|
164 |
166 |
item['text'] = item['type']
|
165 |
167 |
item['url'] = document_url
|
... | ... | |
168 |
170 |
data.sort(key=lambda i: i['id'])
|
169 |
171 |
return {'err': 0, 'data': data}
|
170 |
172 |
|
171 |
|
|
172 |
|
@endpoint(pattern='(?P<association_id>\w+)/(?P<document_id>[\:\w-]+)/$',
|
|
173 |
@endpoint(pattern=r'(?P<association_id>\w+)/(?P<document_id>[\:\w-]+)/$',
|
173 |
174 |
example_pattern='{association_id}/{document_id}/',
|
174 |
175 |
description=_('Get association\'s document'),
|
175 |
176 |
parameters={
|
... | ... | |
193 |
194 |
'description': _('request recipient: usually customer number'),
|
194 |
195 |
'example_value': '44317013900036'
|
195 |
196 |
}
|
196 |
|
}
|
197 |
|
)
|
|
197 |
})
|
198 |
198 |
def document(self, request, association_id, document_id, **kwargs):
|
199 |
199 |
try:
|
200 |
200 |
params = signing.loads(document_id, max_age=DOCUMENT_SIGNATURE_MAX_AGE)
|
... | ... | |
205 |
205 |
return HttpResponse(response, content_type='application/pdf')
|
206 |
206 |
raise Http404('document not found')
|
207 |
207 |
|
208 |
|
|
209 |
208 |
@endpoint(perm='can_access',
|
210 |
|
pattern='(?P<siren>\w+)/$',
|
|
209 |
pattern=r'(?P<siren>\w+)/$',
|
211 |
210 |
example_pattern='{siren}/',
|
212 |
211 |
description=_('Get firm\'s data from Infogreffe'),
|
213 |
212 |
parameters={
|
... | ... | |
227 |
226 |
'description': _('request recipient: usually customer number'),
|
228 |
227 |
'example_value': '44317013900036'
|
229 |
228 |
}
|
230 |
|
}
|
231 |
|
)
|
|
229 |
})
|
232 |
230 |
def extraits_rcs(self, request, siren, **kwargs):
|
233 |
231 |
return self.get('extraits_rcs_infogreffe/%s/' % siren, **kwargs)
|
234 |
232 |
|
235 |
|
|
236 |
233 |
@endpoint(perm='can_access',
|
237 |
|
pattern='(?P<association_id>\w+)/$',
|
|
234 |
pattern=r'(?P<association_id>\w+)/$',
|
238 |
235 |
example_pattern='{association_id}/',
|
239 |
236 |
description=_('Get association\'s related informations'),
|
240 |
237 |
parameters={
|
... | ... | |
254 |
251 |
'description': _('request recipient: usually customer number'),
|
255 |
252 |
'example_value': '44317013900036'
|
256 |
253 |
}
|
257 |
|
}
|
258 |
|
)
|
|
254 |
})
|
259 |
255 |
def associations(self, request, association_id, **kwargs):
|
260 |
256 |
return self.get('associations/%s/' % association_id, **kwargs)
|
261 |
257 |
|
262 |
|
|
263 |
258 |
@endpoint(perm='can_access',
|
264 |
|
pattern='(?P<siren>\w+)/$',
|
|
259 |
pattern=r'(?P<siren>\w+)/$',
|
265 |
260 |
example_pattern='{siren}/',
|
266 |
261 |
description=_('Get firm\'s related informations'),
|
267 |
262 |
parameters={
|
... | ... | |
281 |
276 |
'description': _('request recipient: usually customer number'),
|
282 |
277 |
'example_value': '44317013900036'
|
283 |
278 |
}
|
284 |
|
}
|
285 |
|
)
|
|
279 |
})
|
286 |
280 |
def entreprises(self, request, siren, **kwargs):
|
287 |
281 |
return self.get('entreprises/%s/' % siren, **kwargs)
|
288 |
282 |
|
289 |
|
|
290 |
283 |
@endpoint(perm='can_access',
|
291 |
284 |
methods=['get'],
|
292 |
|
pattern='(?P<siret>\w+)/$',
|
|
285 |
pattern=r'(?P<siret>\w+)/$',
|
293 |
286 |
example_pattern='{siret}/',
|
294 |
287 |
description_get=_('Get firms\'s related informations'),
|
295 |
288 |
parameters={
|
... | ... | |
309 |
302 |
'description': _('request recipient: usually customer number'),
|
310 |
303 |
'example_value': '44317013900036'
|
311 |
304 |
}
|
312 |
|
}
|
313 |
|
)
|
|
305 |
})
|
314 |
306 |
def etablissements(self, request, siret, **kwargs):
|
315 |
307 |
return self.get('etablissements/%s/' % siret, **kwargs)
|
316 |
|
-
|