improvements on transaction and account types detection
This commit is contained in:
parent
2147c4b363
commit
8fdbf330dd
11 changed files with 112 additions and 27 deletions
|
|
@ -29,8 +29,8 @@ __all__ = ['AccountHistory', 'CardsList']
|
|||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile(u'^(?P<category>CHEQUE) (?P<text>.*)'), FrenchTransaction.TYPE_CHECK),
|
||||
(re.compile(r'^(?P<category>ACHAT CB) (?P<text>.*) (?P<dd>\d{2})\.(?P<mm>\d{2}).(?P<yy>\d{2})'),
|
||||
PATTERNS = [(re.compile(u'^(?P<category>CHEQUE)( N)? (?P<text>.*)'), FrenchTransaction.TYPE_CHECK),
|
||||
(re.compile(r'^(?P<category>ACHAT CB) (?P<text>.*) (?P<dd>\d{2})\.(?P<mm>\d{2}).(?P<yy>\d{2}).*'),
|
||||
FrenchTransaction.TYPE_CARD),
|
||||
(re.compile('^(?P<category>(PRELEVEMENT DE|TELEREGLEMENT|TIP)) (?P<text>.*)'),
|
||||
FrenchTransaction.TYPE_ORDER),
|
||||
|
|
@ -43,8 +43,9 @@ class Transaction(FrenchTransaction):
|
|||
FrenchTransaction.TYPE_TRANSFER),
|
||||
(re.compile('^(?P<category>REMBOURST)(?P<text>.*)'), FrenchTransaction.TYPE_PAYBACK),
|
||||
(re.compile('^(?P<category>COMMISSIONS)(?P<text>.*)'), FrenchTransaction.TYPE_BANK),
|
||||
(re.compile('^(?P<category>FRAIS POUR)(?P<text>.*)'), FrenchTransaction.TYPE_BANK),
|
||||
(re.compile('^(?P<text>(?P<category>REMUNERATION).*)'), FrenchTransaction.TYPE_BANK),
|
||||
(re.compile('^(?P<category>REMISE DE CHEQUE) (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||
(re.compile('^(?P<category>REMISE DE CHEQUES?) (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,16 +33,16 @@ __all__ = ['AccountList']
|
|||
class AccountList(BasePage):
|
||||
def on_loaded(self):
|
||||
self.accounts = OrderedDict()
|
||||
self.parse_table('comptes')
|
||||
self.parse_table('comptesEpargne')
|
||||
self.parse_table('comptesTitres')
|
||||
self.parse_table('comptesVie')
|
||||
self.parse_table('comptes', Account.TYPE_CHECKING)
|
||||
self.parse_table('comptesEpargne', Account.TYPE_SAVINGS)
|
||||
self.parse_table('comptesTitres', Account.TYPE_MARKET)
|
||||
self.parse_table('comptesVie', Account.TYPE_DEPOSIT)
|
||||
self.parse_table('comptesRetraireEuros')
|
||||
|
||||
def get_accounts_list(self):
|
||||
return self.accounts.itervalues()
|
||||
|
||||
def parse_table(self, what):
|
||||
def parse_table(self, what, actype=None):
|
||||
tables = self.document.xpath("//table[@id='%s']" % what, smart_strings=False)
|
||||
if len(tables) < 1:
|
||||
return
|
||||
|
|
@ -52,6 +52,7 @@ class AccountList(BasePage):
|
|||
account = Account()
|
||||
tmp = line.xpath("./td//a")[0]
|
||||
account.label = to_unicode(tmp.text)
|
||||
account.type = actype
|
||||
account._link_id = tmp.get("href")
|
||||
if 'BourseEnLigne' in account._link_id:
|
||||
account.type = Account.TYPE_MARKET
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue