Commit 387a3e3c authored by Damien Mat's avatar Damien Mat Committed by ntome

[cices] Account typing (cmes)

Typing 'compte courant bloqué' account as TYPE_LIFE_DEPOSIT
Build to associate a transaction to the proper account in case of several transactions on the OperationPage

Closes: 11364@zendesk
parent 6b63fe43
......@@ -78,9 +78,10 @@ class CmesBrowser(LoginBrowser):
def iter_history(self, account):
self.operations_list.stay_or_go(subsite=self.subsite, client_space=self.client_space)
for idx in self.page.get_operations_idx():
tr = self.operation.go(subsite=self.subsite, client_space=self.client_space, idx=idx).get_transaction()
if account.label == tr._account_label:
yield tr
self.operation.go(subsite=self.subsite, client_space=self.client_space, idx=idx)
for tr in self.page.get_transactions():
if account.label == tr._account_label:
yield tr
@need_login
def iter_pocket(self, account):
......
......@@ -77,14 +77,15 @@ class ActionNeededPage(HTMLPage, LoggedPage):
ACCOUNTS_TYPES = {
"pargne entreprise": Account.TYPE_PEE,
"pargne groupe": Account.TYPE_PEE,
"pargne retraite": Account.TYPE_PERCO
"pargne retraite": Account.TYPE_PERCO,
"courant bloqué": Account.TYPE_DEPOSIT,
}
class NewAccountsPage(LoggedPage, HTMLPage):
@method
class iter_accounts(ListElement):
item_xpath = '//th[text()= "Nom du support" or text()="Nom du profil"]/ancestor::table/ancestor::table'
item_xpath = '//th[text()= "Nom du support" or text()="Nom du profil" or text()="Nom du compte"]/ancestor::table/ancestor::table'
class item(ItemElement):
klass = Account
......@@ -166,15 +167,27 @@ class NewAccountsPage(LoggedPage, HTMLPage):
class OperationPage(LoggedPage, HTMLPage):
# Most '_account_label' correspond 'account.label', but there are exceptions
ACCOUNTS_SPE_LABELS = {
'CCB': 'Compte courant bloqué',
}
@method
class get_transaction(ItemElement):
klass = Transaction
obj_amount = MyDecimal('//td[contains(text(), "Montant total")]/following-sibling::td')
obj_label = CleanText('(//p[contains(@id, "smltitle")])[2]')
obj_raw = Transaction.Raw(Field('label'))
obj_date = Date(Regexp(CleanText('(//p[contains(@id, "smltitle")])[1]'), r'(\d{1,2}/\d{1,2}/\d+)'), dayfirst=True)
obj__account_label = CleanText('//td[contains(text(), "Montant total")]/../following-sibling::tr/th[1]')
class get_transactions(ListElement):
item_xpath = '//tr[@id]'
class item(ItemElement):
klass = Transaction
obj_amount = MyDecimal('./th[@scope="rowgroup"][2]')
obj_label = CleanText('(//p[contains(@id, "smltitle")])[2]')
obj_raw = Transaction.Raw(Field('label'))
obj_date = Date(Regexp(CleanText('(//p[contains(@id, "smltitle")])[1]'), r'(\d{1,2}/\d{1,2}/\d+)'), dayfirst=True)
def obj__account_label(self):
account_label = CleanText('./th[@scope="rowgroup"][1]')(self)
return self.page.ACCOUNTS_SPE_LABELS.get(account_label, account_label)
class OperationsListPage(LoggedPage, HTMLPage):
......
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