Commit 7dcd259d authored by Maxime Pommier's avatar Maxime Pommier Committed by Romain Bignon

[societegenerale] Handle a new page to get more details on the loan (the rate)

parent 99bef950
...@@ -36,7 +36,7 @@ from .pages.accounts_list import ( ...@@ -36,7 +36,7 @@ from .pages.accounts_list import (
CardHistoryPage, PeaLiquidityPage, AccountsSynthesesPage, CardHistoryPage, PeaLiquidityPage, AccountsSynthesesPage,
AdvisorPage, HTMLProfilePage, CreditPage, CreditHistoryPage, OldHistoryPage, AdvisorPage, HTMLProfilePage, CreditPage, CreditHistoryPage, OldHistoryPage,
MarketPage, LifeInsurance, LifeInsuranceHistory, LifeInsuranceInvest, LifeInsuranceInvest2, MarketPage, LifeInsurance, LifeInsuranceHistory, LifeInsuranceInvest, LifeInsuranceInvest2,
UnavailableServicePage, UnavailableServicePage, LoanDetailsPage,
) )
from .pages.transfer import AddRecipientPage, SignRecipientPage, TransferJson, SignTransferPage from .pages.transfer import AddRecipientPage, SignRecipientPage, TransferJson, SignTransferPage
from .pages.login import MainPage, LoginPage, BadLoginPage, ReinitPasswordPage, ActionNeededPage, ErrorPage from .pages.login import MainPage, LoginPage, BadLoginPage, ReinitPasswordPage, ActionNeededPage, ErrorPage
...@@ -58,6 +58,7 @@ class SocieteGenerale(LoginBrowser, StatesMixin): ...@@ -58,6 +58,7 @@ class SocieteGenerale(LoginBrowser, StatesMixin):
accounts_syntheses = URL(r'/icd/cbo/data/liste-prestations-authsec.json\?n10_avecMontant=1', AccountsSynthesesPage) 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) history = URL(r'/icd/cbo/data/liste-operations-authsec.json', HistoryPage)
loans = URL(r'/abm/restit/listeRestitutionPretsNET.json\?a100_isPretConso=(?P<conso>\w+)', LoansPage) loans = URL(r'/abm/restit/listeRestitutionPretsNET.json\?a100_isPretConso=(?P<conso>\w+)', LoansPage)
loan_details_page = URL(r'icd/cbo/data/recapitulatif-prestation-authsec.json', LoanDetailsPage)
card_history = URL(r'/restitution/cns_listeReleveCarteDd.xml', CardHistoryPage) card_history = URL(r'/restitution/cns_listeReleveCarteDd.xml', CardHistoryPage)
credit = URL(r'/restitution/cns_detailAVPAT.html', CreditPage) credit = URL(r'/restitution/cns_detailAVPAT.html', CreditPage)
...@@ -221,6 +222,8 @@ class SocieteGenerale(LoginBrowser, StatesMixin): ...@@ -221,6 +222,8 @@ class SocieteGenerale(LoginBrowser, StatesMixin):
if account.type == account.TYPE_REVOLVING_CREDIT: if account.type == account.TYPE_REVOLVING_CREDIT:
self.loans.stay_or_go(conso=(account._loan_type == 'PR_CONSO')) self.loans.stay_or_go(conso=(account._loan_type == 'PR_CONSO'))
account = self.page.get_revolving_account(account) 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 yield account
......
...@@ -231,6 +231,15 @@ class AccountsSynthesesPage(JsonBasePage): ...@@ -231,6 +231,15 @@ class AccountsSynthesesPage(JsonBasePage):
return account_comings 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): class LoansPage(JsonBasePage):
def get_loan_account(self, account): def get_loan_account(self, account):
assert account._prestation_id in Dict('donnees/tabIdAllPrestations')(self.doc), \ assert account._prestation_id in Dict('donnees/tabIdAllPrestations')(self.doc), \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment