support 'OPPOSITION' state for cards (and better detection of unknown values)
This commit is contained in:
parent
9518899b34
commit
db57ff1c36
1 changed files with 6 additions and 4 deletions
|
|
@ -22,7 +22,7 @@ import datetime
|
||||||
from urlparse import parse_qs, urlparse
|
from urlparse import parse_qs, urlparse
|
||||||
from lxml.etree import XML
|
from lxml.etree import XML
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
from decimal import Decimal
|
from decimal import Decimal, InvalidOperation
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from weboob.capabilities.base import empty, NotAvailable
|
from weboob.capabilities.base import empty, NotAvailable
|
||||||
|
|
@ -69,10 +69,12 @@ class AccountsList(BasePage):
|
||||||
div = td.xpath('./div[@class="Solde"]')
|
div = td.xpath('./div[@class="Solde"]')
|
||||||
if len(div) > 0:
|
if len(div) > 0:
|
||||||
balance = self.parser.tocleanstring(div[0])
|
balance = self.parser.tocleanstring(div[0])
|
||||||
if len(balance) > 0 and balance != 'ANNULEE':
|
if len(balance) > 0 and balance not in ('ANNULEE', 'OPPOSITION'):
|
||||||
|
try:
|
||||||
|
acccount.balance = Decimal(FrenchTransaction.clean_amount(balance))
|
||||||
|
except InvalidOperation:
|
||||||
|
raise BrokenPageError('Unable to parse balance %r' % balance)
|
||||||
account.currency = account.get_currency(balance)
|
account.currency = account.get_currency(balance)
|
||||||
balance = FrenchTransaction.clean_amount(balance)
|
|
||||||
account.balance = Decimal(balance)
|
|
||||||
else:
|
else:
|
||||||
account.balance = NotAvailable
|
account.balance = NotAvailable
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue