support payment in several times

This commit is contained in:
Romain Bignon 2012-11-10 12:37:12 +01:00
commit 33bbe6d451
2 changed files with 6 additions and 6 deletions

View file

@ -79,7 +79,7 @@ class BredBrowser(BaseBrowser):
return None
def iter_transactions(self, id):
def iter_transactions(self, id, is_coming=None):
numero_compte, numero_poste = id.split('.')
data = {'typeDemande': 'recherche',
'motRecherche': '',
@ -94,7 +94,7 @@ class BredBrowser(BaseBrowser):
self.location('https://www.bred.fr/Andromede/Ecriture', urllib.urlencode(data))
assert self.is_on_page(TransactionsPage)
return self.page.get_history()
return self.page.get_history(is_coming)
def get_history(self, account):
for tr in self.iter_transactions(account.id):
@ -105,5 +105,5 @@ class BredBrowser(BaseBrowser):
def get_card_operations(self, account):
for id in account._card_links:
for tr in self.iter_transactions(id):
for tr in self.iter_transactions(id, True):
yield tr

View file

@ -124,15 +124,15 @@ class Transaction(FrenchTransaction):
(re.compile('^REMISE (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
(re.compile('^(?P<text>.*)( \d+)? QUITTANCE .*'),
FrenchTransaction.TYPE_ORDER),
(re.compile('^CB PAIEM. EN \d+ FOIS \d+ (?P<text>.*?) LE .* LE (?P<dd>\d{2})/(?P<mm>\d{2})/(?P<yy>\d{2})$'),
FrenchTransaction.TYPE_CARD),
(re.compile('^.* LE (?P<dd>\d{2})/(?P<mm>\d{2})/(?P<yy>\d{2})$'),
FrenchTransaction.TYPE_UNKNOWN),
]
class TransactionsPage(BasePage):
def get_history(self):
is_coming = None
def get_history(self, is_coming=None):
for tr in self.document.xpath('//div[@class="scrollTbody"]/table//tr'):
cols = tr.findall('td')