summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2019-09-19 11:29:46 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2019-09-19 11:29:46 (GMT)
commitc7c2b3882911136f8695c655d136342ea008b65f (patch)
tree1ad97397048969f8d50a604d7c5e5261756a537b
parenta0ad1af920a37c9cd491dcb52f72a94b11b55314 (diff)
downloadpasserelle-grandlyon-cartads-cs-master.zip
passerelle-grandlyon-cartads-cs-master.tar.gz
passerelle-grandlyon-cartads-cs-master.tar.bz2
use "GetDossiersSelonDerniereEtape" API to get detailsHEADmaster
(as notifications are not sent/received)
-rw-r--r--grandlyon_cartads_cs/models.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/grandlyon_cartads_cs/models.py b/grandlyon_cartads_cs/models.py
index a6280a1..a25971f 100644
--- a/grandlyon_cartads_cs/models.py
+++ b/grandlyon_cartads_cs/models.py
@@ -17,13 +17,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import base64
+import datetime
import os
from django.core.cache import cache
from django.db import models
from django.utils.translation import ugettext_lazy as _
-from passerelle.apps.cartads_cs.models import AbstractCartaDSCS
+from passerelle.apps.cartads_cs.models import AbstractCartaDSCS, CartaDSDossier
from passerelle.utils import SOAPTransport
class Transport(SOAPTransport):
@@ -96,3 +97,35 @@ class GLCartaDSCS(AbstractCartaDSCS):
if resp.content:
# error messages are put in content, valid responses are empty.
raise Exception(resp.content)
+
+ def hourly(self):
+ client = self.soap_client(wsdl_url=self.get_wsdl_url('ServiceRechercheDossier'))
+ client2 = self.soap_client(wsdl_url=self.get_wsdl_url('ServiceDossier'))
+
+ resp = client.service.GetDossiersSelonDerniereEtape(
+ self.client_name,
+ datetime.datetime.now() - datetime.timedelta(days=1),
+ datetime.datetime.now()),
+ for cartads_dossier in resp[0]:
+ resp = client2.service.GetInfosDossier(self.get_token(), cartads_dossier['IdDossier'])
+ id_dossier_externe = resp['IdDossierExterne']
+ if not id_dossier_externe:
+ continue
+ if not id_dossier_externe.startswith('publik-'):
+ continue
+ publik, dossier_id, tracking_code = id_dossier_externe.split('-', 2)
+ try:
+ dossier = CartaDSDossier.objects.get(
+ zip_ready=True,
+ zip_sent=True,
+ zip_ack_response='True',
+ cartads_id_dossier__isnull=True,
+ tracking_code=tracking_code,
+ id=dossier_id)
+ except CartaDSDossier.DoesNotExist:
+ continue
+ dossier.cartads_id_dossier = resp['IdDossier']
+ dossier.cartads_numero_dossier = resp['NomDossier']
+ dossier.save()
+
+ super(GLCartaDSCS, self).hourly()