[nef] Add recipients

parent 28419651
Pipeline #1983 passed with stages
in 16 minutes and 51 seconds
......@@ -24,7 +24,7 @@ import datetime
from weboob.browser import LoginBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword
from .pages import LoginPage, HomePage, AccountsPage, TransactionsPage
from .pages import LoginPage, HomePage, AccountsPage, RecipientsPage, TransactionsPage
def next_week_string():
return (datetime.date.today() + datetime.timedelta(weeks=1)).strftime("%Y-%m-%d")
......@@ -57,3 +57,14 @@ class NefBrowser(LoginBrowser):
@need_login
def iter_transactions_list(self, account):
return self.download.go(account_id=account.id).iter_history()
# CapBankTransfer
@need_login
def iter_recipients_list(self):
response = self.main.open(data={
'templateName': 'beneficiary/beneficiaryList.cfm',
'LISTTYPE': 'HISTORY'
})
page = RecipientsPage(self, response)
return page.get_items()
......@@ -22,7 +22,7 @@ from __future__ import unicode_literals
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.value import ValueBackendPassword
from weboob.capabilities.bank import CapBank, Account
from weboob.capabilities.bank import CapBankTransfer, Account
from .browser import NefBrowser
......@@ -30,7 +30,7 @@ from .browser import NefBrowser
__all__ = ['NefModule']
class NefModule(Module, CapBank):
class NefModule(Module, CapBankTransfer):
NAME = 'nef'
DESCRIPTION = 'La Nef'
MAINTAINER = 'Damien Cassou'
......@@ -95,3 +95,35 @@ class NefModule(Module, CapBank):
self._restrict_level(split_path)
return self.iter_accounts()
# CapBankTransfer
def iter_transfer_recipients(self, account):
"""
Iter recipients availables for a transfer from a specific account.
:param account: account which initiate the transfer
:type account: :class:`Account`
:rtype: iter[:class:`Recipient`]
:raises: :class:`AccountNotFound`
"""
return self.browser.iter_recipients_list()
def init_transfer(self, transfer, **params):
"""
Initiate a transfer.
:param :class:`Transfer`
:rtype: :class:`Transfer`
:raises: :class:`TransferError`
"""
raise NotImplementedError()
def execute_transfer(self, transfer, **params):
"""
Execute a transfer.
:param :class:`Transfer`
:rtype: :class:`Transfer`
:raises: :class:`TransferError`
"""
raise NotImplementedError()
......@@ -21,12 +21,13 @@ from __future__ import unicode_literals
import re
from weboob.browser.elements import ListElement, DictElement, ItemElement, method
from weboob.browser.elements import ListElement, DictElement, ItemElement, method, TableElement
from weboob.browser.filters.standard import CleanText, CleanDecimal, Regexp, Field, Date
from weboob.browser.pages import HTMLPage, PartialHTMLPage, CsvPage, LoggedPage
from weboob.browser.filters.json import Dict
from weboob.browser.filters.html import Attr, TableCell
from weboob.capabilities.bank import Account
from weboob.capabilities.bank import Account, Recipient
from weboob.tools.date import parse_french_date
......@@ -69,6 +70,22 @@ class AccountsPage(LoggedPage, PartialHTMLPage):
return Account.TYPE_UNKNOWN
class RecipientsPage(LoggedPage, PartialHTMLPage):
@method
class get_items(TableElement):
head_xpath = '//table[@id="tblBeneficiaryList"]/thead//td'
item_xpath = '//table[@id="tblBeneficiaryList"]//tr[has-class("beneficiary-data-rows")]'
col_label = re.compile('Nom.*')
col_iban = re.compile('IBAN.*')
class item(ItemElement):
klass = Recipient
obj_id = Attr('.', 'beneficiaryid')
obj_label = CleanText(TableCell('label'))
obj_iban = CleanText(TableCell('iban'))
class TransactionsPage(LoggedPage, CsvPage):
ENCODING = 'latin-1'
DIALECT = 'excel'
......
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