fix support of deferred transactions
This commit is contained in:
parent
0d11694605
commit
9aa27eb225
3 changed files with 17 additions and 4 deletions
|
|
@ -60,8 +60,12 @@ class BarclaysBackend(BaseBackend, ICapBank):
|
|||
|
||||
def iter_history(self, account):
|
||||
with self.browser:
|
||||
return self.browser.get_history(account)
|
||||
for tr in self.browser.get_history(account):
|
||||
if not tr._coming:
|
||||
yield tr
|
||||
|
||||
def iter_coming(self, account):
|
||||
with self.browser:
|
||||
return self.browser.get_coming_operations(account)
|
||||
for tr in self.browser.get_card_operations(account):
|
||||
if tr._coming:
|
||||
yield tr
|
||||
|
|
|
|||
|
|
@ -103,9 +103,13 @@ class Barclays(BaseBrowser):
|
|||
|
||||
assert self.is_on_page((TransactionsPage, ValuationPage, LoanPage))
|
||||
|
||||
return self.page.get_history()
|
||||
for tr in self.page.get_history():
|
||||
yield tr
|
||||
|
||||
def get_coming_operations(self, account):
|
||||
for tr in self.get_card_operations(account):
|
||||
yield tr
|
||||
|
||||
def get_card_operations(self, account):
|
||||
for card in account._card_links:
|
||||
if not self.is_on_page(AccountsPage):
|
||||
self.location('tbord.do')
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ class TransactionsPage(BasePage):
|
|||
credit = u''.join([txt.strip() for txt in tds[-2].itertext()])
|
||||
t.parse(date, re.sub(r'[ ]+', ' ', raw))
|
||||
t.set_amount(credit, debit)
|
||||
t._coming = False
|
||||
|
||||
if t.raw.startswith('ACHAT CARTE -DEBIT DIFFERE'):
|
||||
continue
|
||||
|
|
@ -152,6 +153,7 @@ class TransactionsPage(BasePage):
|
|||
class CardPage(BasePage):
|
||||
def get_history(self):
|
||||
debit_date = None
|
||||
coming = True
|
||||
for tr in self.document.xpath('//table[@class="report"]/tbody/tr'):
|
||||
tds = tr.findall('td')
|
||||
|
||||
|
|
@ -159,6 +161,8 @@ class CardPage(BasePage):
|
|||
# headers
|
||||
m = re.match('.* (\d+)/(\d+)/(\d+)', tds[0].text.strip())
|
||||
debit_date = datetime.date(int(m.group(3)), int(m.group(2)), int(m.group(1)))
|
||||
if debit_date < datetime.date.today():
|
||||
coming = False
|
||||
|
||||
if len(tds) != 3:
|
||||
continue
|
||||
|
|
@ -172,6 +176,7 @@ class CardPage(BasePage):
|
|||
t.date = debit_date
|
||||
t.label = unicode(tds[1].find('span').text.strip())
|
||||
t.type = t.TYPE_CARD
|
||||
t._coming = coming
|
||||
t.set_amount(amount)
|
||||
yield t
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue