From a6d9db5b897b580ebef1ad4518e42b827e90867c Mon Sep 17 00:00:00 2001 From: Sylvie Ye Date: Thu, 24 Jan 2019 14:04:36 +0100 Subject: [PATCH] [societegenerale] add new TYPE_PERP account type --- modules/societegenerale/browser.py | 9 +++++---- modules/societegenerale/pages/accounts_list.py | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/societegenerale/browser.py b/modules/societegenerale/browser.py index a550292cd9..6083af09ed 100644 --- a/modules/societegenerale/browser.py +++ b/modules/societegenerale/browser.py @@ -199,7 +199,7 @@ def iter_history(self, account): if account.type == Account.TYPE_PEA and not ('Espèces' in account.label or 'ESPECE' in account.label): return - if account.type == account.TYPE_LIFE_INSURANCE: + if account.type in (account.TYPE_LIFE_INSURANCE, account.TYPE_PERP, ): # request to get json is not available yet, old request to get html response self.account_details_page.go(params={'idprest': account._prestation_id}) link = self.page.get_history_link() @@ -235,7 +235,7 @@ def iter_history(self, account): def iter_coming(self, account): if account.type in (account.TYPE_LOAN, account.TYPE_MARKET, account.TYPE_PEA, account.TYPE_LIFE_INSURANCE, account.TYPE_REVOLVING_CREDIT, - account.TYPE_CONSUMER_CREDIT, ): + account.TYPE_CONSUMER_CREDIT, Account.TYPE_PERP, ): return internal_id = account._internal_id @@ -258,7 +258,8 @@ def iter_coming(self, account): @need_login def iter_investment(self, account): - if account.type not in (Account.TYPE_MARKET, Account.TYPE_LIFE_INSURANCE, Account.TYPE_PEA): + if account.type not in (Account.TYPE_MARKET, Account.TYPE_LIFE_INSURANCE, + Account.TYPE_PEA, Account.TYPE_PERP, ): self.logger.debug('This account is not supported') return @@ -269,7 +270,7 @@ def iter_investment(self, account): for invest in self.page.iter_investments(account=account): yield invest - if account.type == Account.TYPE_LIFE_INSURANCE: + if account.type in (Account.TYPE_LIFE_INSURANCE, Account.TYPE_PERP, ): if self.page.has_link(): self.life_insurance_invest.go() diff --git a/modules/societegenerale/pages/accounts_list.py b/modules/societegenerale/pages/accounts_list.py index 8cf15daed1..45a20feb7c 100644 --- a/modules/societegenerale/pages/accounts_list.py +++ b/modules/societegenerale/pages/accounts_list.py @@ -99,6 +99,7 @@ class item(ItemElement): 'ASSURANCE_VIE_GENERALE': Account.TYPE_LIFE_INSURANCE, 'AVANCE_PATRIMOINE': Account.TYPE_REVOLVING_CREDIT, 'PRET_EXPRESSO': Account.TYPE_CONSUMER_CREDIT, + 'PERP_EPICEA': Account.TYPE_PERP, } obj_id = obj_number = CleanText(Dict('numeroCompteFormate'), replace=[(' ', '')]) @@ -447,7 +448,9 @@ class item(ItemElement): obj_code = Regexp(CleanText(TableCell('label')), r'Code ISIN : (\w+) ', default=NotAvailable) obj_quantity = MyDecimal(TableCell('quantity'), default=NotAvailable) obj_unitvalue = MyDecimal(TableCell('unitvalue'), default=NotAvailable) - obj_valuation = MyDecimal(TableCell('valuation')) + + # Some PERP invests don't have valuation + obj_valuation = MyDecimal(TableCell('valuation', default=NotAvailable), default=NotAvailable) def obj_label(self): if 'FONDS EN EUROS' in CleanText(TableCell('label'))(self): -- GitLab