diff --git a/modules/societegenerale/browser.py b/modules/societegenerale/browser.py index abbe51efb274e23a0ace81044f97d189dfc7ffa4..62cb061727b11ddb418b55d9b1ced7d003a3b60d 100644 --- a/modules/societegenerale/browser.py +++ b/modules/societegenerale/browser.py @@ -36,7 +36,7 @@ CardHistoryPage, PeaLiquidityPage, AccountsSynthesesPage, AdvisorPage, HTMLProfilePage, CreditPage, CreditHistoryPage, OldHistoryPage, MarketPage, LifeInsurance, LifeInsuranceHistory, LifeInsuranceInvest, LifeInsuranceInvest2, - UnavailableServicePage, + UnavailableServicePage, LoanDetailsPage, ) from .pages.transfer import AddRecipientPage, SignRecipientPage, TransferJson, SignTransferPage from .pages.login import MainPage, LoginPage, BadLoginPage, ReinitPasswordPage, ActionNeededPage, ErrorPage @@ -58,6 +58,7 @@ class SocieteGenerale(LoginBrowser, StatesMixin): accounts_syntheses = URL(r'/icd/cbo/data/liste-prestations-authsec.json\?n10_avecMontant=1', AccountsSynthesesPage) history = URL(r'/icd/cbo/data/liste-operations-authsec.json', HistoryPage) loans = URL(r'/abm/restit/listeRestitutionPretsNET.json\?a100_isPretConso=(?P\w+)', LoansPage) + loan_details_page = URL(r'icd/cbo/data/recapitulatif-prestation-authsec.json', LoanDetailsPage) card_history = URL(r'/restitution/cns_listeReleveCarteDd.xml', CardHistoryPage) credit = URL(r'/restitution/cns_detailAVPAT.html', CreditPage) @@ -221,6 +222,8 @@ def get_accounts_list(self): if account.type == account.TYPE_REVOLVING_CREDIT: self.loans.stay_or_go(conso=(account._loan_type == 'PR_CONSO')) account = self.page.get_revolving_account(account) + self.loan_details_page.go(params={'b64e200_prestationIdTechnique': account._internal_id}) + self.page.set_loan_details(account) yield account diff --git a/modules/societegenerale/pages/accounts_list.py b/modules/societegenerale/pages/accounts_list.py index 207d35df8c6011d7ea69df58ce78265a8b79464f..261f0aa4bcb198763e2632eee63d4d4c4f3c0b24 100644 --- a/modules/societegenerale/pages/accounts_list.py +++ b/modules/societegenerale/pages/accounts_list.py @@ -231,6 +231,15 @@ def get_account_comings(self): return account_comings +class LoanDetailsPage(JsonPage): + def set_loan_details(self, account): + # If there are no available details for the loan, the statut will be "NOK" + if Dict('commun/statut')(self.doc) == 'NOK': + return + else: + account.rate = CleanDecimal(Dict('donnees/caracteristiquesReservea/tauxHorsAssurance'))(self.doc) + + class LoansPage(JsonBasePage): def get_loan_account(self, account): assert account._prestation_id in Dict('donnees/tabIdAllPrestations')(self.doc), \