Commit 2cd005ba authored by Maxime Pommier's avatar Maxime Pommier Committed by ntome

[bnporc] Add revolving credit details

parent d55ee1b5
......@@ -168,6 +168,15 @@ class BNPParibasBrowser(JsonBrowserMixin, LoginBrowser):
return profile
raise ProfileMissing(self.page.get_error_message())
def is_loan(self, account):
return account.type in (
Account.TYPE_LOAN,
Account.TYPE_MORTGAGE,
Account.TYPE_CONSUMER_CREDIT,
Account.TYPE_REVOLVING_CREDIT
)
@need_login
def iter_accounts(self):
if self.accounts_list is None:
......@@ -186,10 +195,19 @@ class BNPParibasBrowser(JsonBrowserMixin, LoginBrowser):
market_accounts = self.page.get_list() # get the list of 'Comptes Titres'
checked_accounts = set()
for account in accounts:
if account.type == Account.TYPE_MORTGAGE:
if self.is_loan(account):
account = Loan.from_dict(account.to_dict())
self.loan_details.go(data={'iban': account.id}, loan_type='creditPret')
self.page.fill_loan_details(obj=account)
if account.type in (Account.TYPE_MORTGAGE, Account.TYPE_CONSUMER_CREDIT):
self.loan_details.go(data={'iban': account.id}, loan_type='creditPret')
self.page.fill_loan_details(obj=account)
elif account.type == Account.TYPE_REVOLVING_CREDIT:
self.loan_details.go(data={'iban': account.id}, loan_type='creditConsoProvisio')
self.page.fill_revolving_details(obj=account)
elif account.type == Account.TYPE_LOAN:
self.loan_details.go(data={'iban': account.id}, loan_type='creditPretPersoPro')
self.page.fill_loan_details(obj=account)
for market_acc in market_accounts:
if all((
......
......@@ -332,6 +332,8 @@ class AccountsPage(BNPPage):
'PEL': Account.TYPE_SAVINGS,
'Plan Epargne Retraite Particulier': Account.TYPE_PERP,
'Crédit immobilier': Account.TYPE_MORTGAGE,
'Réserve Provisio': Account.TYPE_REVOLVING_CREDIT,
'Prêt personnel': Account.TYPE_CONSUMER_CREDIT,
}
klass = Account
......@@ -379,6 +381,11 @@ class LoanDetailsPage(BNPPage):
obj_nb_payments_left = Dict('data/nbRemboursementRestant')
obj_next_payment_date = Date(Dict('data/dateProchainAmortissement'), dayfirst=True)
@method
class fill_revolving_details(ItemElement):
obj_total_amount = Dict('data/montantDisponible')
obj_rate = Dict('data/tauxInterets')
class AccountsIBANPage(BNPPage):
def get_ibans_dict(self):
......
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