Commit ff8d7021 authored by Damien Cassou's avatar Damien Cassou

[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.timedelta(weeks=1)).strftime("%Y-%m-%d")
......@@ -57,3 +57,14 @@ class NefBrowser(LoginBrowser):
def iter_transactions_list(self, account):
# CapBankTransfer
def iter_recipients_list(self):
response ={
'templateName': 'beneficiary/beneficiaryList.cfm',
page = RecipientsPage(self, response)
return page.get_items()
......@@ -22,7 +22,7 @@ from __future__ import unicode_literals
from import Module, BackendConfig
from import ValueBackendPassword
from import CapBank, Account
from 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'
MAINTAINER = 'Damien Cassou'
......@@ -95,3 +95,35 @@ class NefModule(Module, CapBank):
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 import Account
from import Account, Recipient
from import parse_french_date
......@@ -69,6 +70,22 @@ class AccountsPage(LoggedPage, PartialHTMLPage):
return Account.TYPE_UNKNOWN
class RecipientsPage(LoggedPage, PartialHTMLPage):
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