diff --git a/modules/societegenerale/module.py b/modules/societegenerale/module.py index 13397eef2878d8cf37a71a6ca46e30ef8dcd3183..e5b26165b04845c510b290f38065a190f7be4b6e 100644 --- a/modules/societegenerale/module.py +++ b/modules/societegenerale/module.py @@ -28,7 +28,7 @@ ) from weboob.capabilities.bill import ( CapDocument, Subscription, SubscriptionNotFound, - Document, DocumentNotFound, + Document, DocumentNotFound, DocumentTypes, ) from weboob.capabilities.contact import CapContact from weboob.capabilities.profile import CapProfile @@ -57,6 +57,8 @@ class SocieteGeneraleModule(Module, CapBankWealth, CapBankTransferAddRecipient, Value('website', label='Type de compte', default='par', choices={'par': 'Particuliers', 'pro': 'Professionnels', 'ent': 'Entreprises'})) + accepted_document_types = (DocumentTypes.STATEMENT,) + def create_default_browser(self): b = {'par': SocieteGenerale, 'pro': SGProfessionalBrowser, 'ent': SGEnterpriseBrowser} self.BROWSER = b[self.config['website'].get()] diff --git a/modules/societegenerale/pages/subscription.py b/modules/societegenerale/pages/subscription.py index c8844dd3f76d453b937fc3d4706a0057609350f1..292eb75d6a424c5af149729bb56701dbdf336b01 100644 --- a/modules/societegenerale/pages/subscription.py +++ b/modules/societegenerale/pages/subscription.py @@ -22,7 +22,7 @@ import re from dateutil.relativedelta import relativedelta -from weboob.capabilities.bill import Document, Subscription +from weboob.capabilities.bill import Document, Subscription, DocumentTypes from weboob.browser.elements import TableElement, ItemElement, method from weboob.browser.filters.standard import CleanText, Regexp, Env, Date, Format, Field from weboob.browser.filters.html import Link, TableCell, Attr @@ -111,7 +111,7 @@ def iter_documents(self, subscription): d.url = Regexp(Link('.'), r"= '(.*)';")(a) d.id = '%s_%s' % (subscription.id, date_filter(a).replace('/', '')) - d.type = 'document' + d.type = DocumentTypes.STATEMENT yield d diff --git a/modules/societegenerale/sgpe/json_pages.py b/modules/societegenerale/sgpe/json_pages.py index ce9d67f7dfefe14fe653d1d7299b3d59c59721c2..78795c171edc4f1526cdbe69fdbcd0f130f89c68 100644 --- a/modules/societegenerale/sgpe/json_pages.py +++ b/modules/societegenerale/sgpe/json_pages.py @@ -30,7 +30,7 @@ from weboob.capabilities.base import Currency from weboob.capabilities import NotAvailable from weboob.capabilities.bank import Account -from weboob.capabilities.bill import Document, Subscription +from weboob.capabilities.bill import Document, Subscription, DocumentTypes from weboob.exceptions import ( BrowserUnavailable, NoAccountsException, BrowserIncorrectPassword, BrowserPasswordExpired, AuthMethodNotImplemented, @@ -237,7 +237,7 @@ def iter_documents(self): d = Document() d.date = datetime.strptime(document['dateEdition'], '%d/%m/%Y') d.label = '%s %s' % (account['libelle'], document['dateEdition']) - d.type = 'document' + d.type = DocumentTypes.STATEMENT d.format = 'pdf' d.id = '%s_%s' % (account['id'], document['dateEdition'].replace('/', '')) d.url = '/icd/syd-front/data/syd-rce-telechargerReleve.html?b64e4000_sceau=%s' % quote_plus(document['sceau']) diff --git a/modules/societegenerale/sgpe/pages.py b/modules/societegenerale/sgpe/pages.py index ab075ee4b12bca7c5e0a0fb7fb02f2ca97c51ea0..3f05ec40ed9cd4f6a7e11c2be2594d061b7e1ca8 100644 --- a/modules/societegenerale/sgpe/pages.py +++ b/modules/societegenerale/sgpe/pages.py @@ -33,7 +33,7 @@ from weboob.tools.capabilities.bank.investments import is_isin_valid from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.capabilities.profile import Profile, Person -from weboob.capabilities.bill import Document, Subscription +from weboob.capabilities.bill import Document, Subscription, DocumentTypes from weboob.capabilities.bank import Account, Investment from weboob.exceptions import ActionNeeded, BrowserIncorrectPassword, BrowserUnavailable from weboob.tools.json import json @@ -243,7 +243,7 @@ class item(ItemElement): obj_date = Date(Regexp(Field('label'), r'au (\d{4}\-\d{2}\-\d{2})')) obj_id = Format('%s_%s', Env('sub_id'), CleanText(Regexp(Field('label'), r'au (\d{4}\-\d{2}\-\d{2})'), replace=[('-', '')])) obj_format = 'pdf' - obj_type = 'document' + obj_type = DocumentTypes.STATEMENT obj_url = Format( '/Pgn/PrintServlet?PageID=ReleveRIE&MenuID=BANRELRIE&urlTypeTransfert=ipdf&REPORTNAME=ReleveInteretElectronique.sgi&numeroRie=%s', Regexp(Attr('./td[2]/a', 'onclick'), r"impression\('(.*)'\);")