diff bnpparibas.py @ 16:af2e222f2dad

Adapt to server side changes
author Daniele Nicolodi <daniele@grinta.net>
date Thu, 05 May 2016 07:04:38 +0000
parents 0a3509a12762
children 80648a7a119c
line wrap: on
line diff
--- a/bnpparibas.py	Tue Jan 12 02:26:14 2016 +0100
+++ b/bnpparibas.py	Thu May 05 07:04:38 2016 +0000
@@ -324,7 +324,7 @@
         v = self.validate(r)
         return v['data']
 
-    def records(self):
+    def records0(self):
         # required to set some cookies required by the next call
         url = urljoin(URL, 'fr/connexion/virements-services/releves-en-ligne')
         r = self.session.get(url)
@@ -368,16 +368,32 @@
 
         return documents
 
+    def records(self):
+        url = urljoin(URL, 'fr/connexion/mes-outils/dematerialisation')
+        r = self.session.get(url)
+        self.validate(r)
+
+        url = urljoin(URL, 'demat-wspl/rest/listerDocuments')
+        r = self.session.get(url)
+        v = self.validate(r)
+
+        data = r.json()['data']
+        documents = data['listerDocumentDemat']['mapReleves']['Comptes chèques']['listeDocument']
+        return documents
+
+
     def document(self, x):
         url = urljoin(URL, 'demat-wspl/rest/consultationDocumentDemat')
         params = {'consulted': x['consulted'],
                   'familleDoc': x['famDoc'],
-                  'ibanCrypte': self.iban,
+                  'ibanCrypte': x['ibanCrypte'],
                   'idDocument': x['idDoc'],
-                  'idLocalisation': 'undefined',
+                  'dateDocument': x['dateDoc'],
                   'typeCpt': x['typeCompte'],
                   'typeDoc': x['typeDoc'],
                   'viDocDocument': x['viDocDocument'],
+                  'idLocalisation': x['idLocalisation'],
+                  'ikpiPersonne': '',
                   'typeFamille': 'R001'}
         r = self.session.get(url, params=params)
         self.validate(r)