Commit e1074147 authored by Maxime Pommier's avatar Maxime Pommier Committed by Romain Bignon

[creditmutuel] Added the PSU statut

parent c1b5b6fe
......@@ -33,7 +33,7 @@ from weboob.browser.url import URL
from weboob.browser.pages import FormNotFound
from weboob.browser.exceptions import ClientError, ServerError
from weboob.exceptions import BrowserIncorrectPassword, AuthMethodNotImplemented, BrowserUnavailable, NoAccountsException
from import Account, AddRecipientStep, Recipient
from import Account, AddRecipientStep, Recipient, AccountOwnership
from import create_french_liquidity
from weboob.capabilities import NotAvailable
from import urlparse
......@@ -180,6 +180,26 @@ class CreditMutuelBrowser(LoginBrowser, StatesMixin):
def ownership_guesser(self):
profile = self.get_profile()
psu_names =
for account in self.accounts_list:
label = account.label.lower()
# We try to find "M ou Mme" or "Mlle XXX ou M XXXX" for example (non-exhaustive exemple list)
if'.* ((m) ([\w].*|ou )?(m[ml]e)|(m[ml]e) ([\w].*|ou )(m) ).*', label):
account.ownership = AccountOwnership.CO_OWNER
# We check if the PSU firstname and lastname is in the account label
elif all(name in label.split() for name in psu_names):
account.ownership = AccountOwnership.OWNER
# Card Accounts should be set with the same ownership of their parents
for account in self.accounts_list:
if account.type == Account.TYPE_CARD:
account.ownership = account.parent.ownership
def get_accounts_list(self):
if not self.accounts_list:
......@@ -267,6 +287,8 @@ class CreditMutuelBrowser(LoginBrowser, StatesMixin):
if has_no_account and not self.accounts_list:
raise NoAccountsException(has_no_account)
return self.accounts_list
def get_account(self, _id):
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