Commit 583a5310 authored by Damien Mat's avatar Damien Mat Committed by Vincent A

[creditmutuel/cic] Fixed checking accounts balance

When there is comings for a checking account the balance that is
presently parsed is the present balance minus the sum of comings. We
have to go to the details page of the account to fetch the real balance
(without the comings).

Closes: 12737@zendesk
parent 972ea834
......@@ -262,6 +262,16 @@ class item_account_generic(ItemElement):
for td in el.xpath('./td[2] | ./td[3]'):
balance = CleanDecimal('.', replace_dots=True)(td)
has_child_def_card = CleanText('.//following-sibling::tr[1]//span[contains(text(), "Dépenses cartes prélevées")]')(el)
if Field('type')(self) == Account.TYPE_CHECKING and not has_child_def_card:
# the present day, real balance (without comings) is displayed in the operations page of the account
# need to limit requests to checking accounts with no def cards
details_page_link = Link('.//a', default=None)(self)
if details_page_link:
coming_page =
balance_without_comings = coming_page.get_balance()
if not empty(balance_without_comings):
balance = balance_without_comings
except InvalidOperation:
......@@ -731,6 +741,9 @@ class OperationsPage(LoggedPage, HTMLPage):
def has_more_operations(self):
return bool(self.doc.xpath('//a/span[contains(text(), "Plus d\'opérations")]'))
def get_balance(self):
return CleanDecimal.French('//span[contains(text(), "Dont opérations enregistrées")]', default=NotAvailable)(self.doc)
class CardsOpePage(OperationsPage):
def select_card(self, card_number):
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