Commit 89c46b40 authored by Romain Bignon's avatar Romain Bignon

Update of modules

parent c36cdb25
# -*- coding: utf-8 -*-
# Copyright(C) 2019 Sylvie Ye
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
from datetime import date
from weboob.browser.pages import LoggedPage, JsonPage, RawPage
from weboob.browser.elements import method, ItemElement, DictElement
from weboob.capabilities.bank import (
Account, Recipient, Transfer, TransferBankError,
)
from weboob.browser.filters.standard import (
CleanDecimal, Env, Date, CleanText,
)
from weboob.browser.filters.json import Dict
class RecipientsPage(LoggedPage, JsonPage):
def is_sender_account(self, account_id):
for acc in self.doc:
if acc.get('senderOfTransfert') and account_id == acc.get('accountNumber'):
return True
@method
class iter_debit_accounts(DictElement):
class item(ItemElement):
def condition(self):
return Dict('accountNumber', default=None)(self)
klass = Account
obj_id = obj_number = Dict('accountNumber')
obj_label = Dict('accountNatureLongLabel')
obj_iban = Dict('ibanCode')
obj_currency = Dict('currencyCode')
def obj_balance(self):
balance_value = CleanDecimal(Dict('balanceValue'))(self)
if CleanText(Dict('balanceSign'))(self) == '-':
return -balance_value
return balance_value
@method
class iter_internal_recipient(DictElement):
class item(ItemElement):
def condition(self):
return Dict('recipientOfTransfert', default=None)(self) and \
Env('account_id')(self) != Dict('accountNumber', default=None)(self)
klass = Recipient
obj_id = Dict('accountNumber')
obj_label = Dict('accountNatureLongLabel')
obj_iban = Dict('ibanCode')
obj_category = 'Interne'
obj_enabled_at = date.today()
@method
class iter_external_recipient(DictElement):
def store(self, obj):
return obj
class item(ItemElement):
def condition(self):
return Dict('recipientId', default=None)(self)
klass = Recipient
obj_id = obj_iban = Dict('ibanCode')
obj_label = Dict('recipientName')
obj_category = 'Externe'
obj_enabled_at = date.today()
class TransferTokenPage(LoggedPage, RawPage):
def get_token(self):
return self.doc
class TransferPage(LoggedPage, JsonPage):
def check_transfer(self):
error_msg = Dict('messageErreur')(self.doc)
if error_msg:
raise TransferBankError(message=error_msg)
return Dict('page')(self.doc) == '/recap'
def handle_response(self, transfer):
t = Transfer()
t._space = transfer._space
t._operation = transfer._operation
t._token = transfer._token
t._connection_id = transfer._connection_id
t.label = Dict('transferComplementaryInformations1')(self.doc)
t.exec_date = Date(Dict('dateVirement'), dayfirst=True)(self.doc)
t.amount = CleanDecimal(Dict('amount'))(self.doc)
t.currency = Dict('currencyCode')(self.doc)
t.account_id = Dict('currentDebitAccountNumber')(self.doc)
t.account_iban = Dict('currentDebitIbanCode')(self.doc)
t.account_label = Dict('typeCompte')(self.doc)
t.recipient_id = t.recipient_iban = Dict('currentCreditIbanCode')(self.doc)
t.recipient_label = Dict('currentCreditAccountName')(self.doc)
return t
def check_transfer_exec(self):
error_msg = Dict('messageErreur')(self.doc)
if error_msg:
raise TransferBankError(message=error_msg)
return Dict('page')(self.doc)
# -*- coding: utf-8 -*-
# Copyright(C) 2017 Jean Walrave
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
from .module import HumanisModule
__all__ = ['HumanisModule']
# -*- coding: utf-8 -*-
# Copyright(C) 2016 Jean Walrave
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from weboob.browser import AbstractBrowser, URL
from .pages import LoginPage
class HumanisBrowser(AbstractBrowser):
PARENT = 'cmes'
login = URL('humanis/fr/identification/login.cgi', LoginPage)
def __init__(self, login, password, baseurl, subsite, *args, **kwargs):
self.weboob = kwargs['weboob']
super(HumanisBrowser, self).__init__(login, password, baseurl, subsite, *args, **kwargs)
# -*- coding: utf-8 -*-
# Copyright(C) 2016 Jean Walrave
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.value import ValueBackendPassword
from weboob.capabilities.bank import CapBankPockets, AccountNotFound
from weboob.capabilities.base import find_object
from .browser import HumanisBrowser
__all__ = ['HumanisModule']
class HumanisModule(Module, CapBankPockets):
NAME = 'humanis'
DESCRIPTION = u'Humanis Épargne Salariale'
MAINTAINER = u'Jean Walrave'
EMAIL = 'jwalrave@budget-insight.com'
LICENSE = 'LGPLv3+'
VERSION = '1.5'
CONFIG = BackendConfig(ValueBackendPassword('login', label=u'Code d\'accès', masked=False),
ValueBackendPassword('password', label='Mot de passe'))
BROWSER = HumanisBrowser
def create_default_browser(self):
return self.create_browser(
self.config['login'].get(),
self.config['password'].get(),
'https://www.gestion-epargne-salariale.fr',
'humanis/',
weboob=self.weboob
)
def get_account(self, _id):
return find_object(self.browser.iter_accounts(), id=_id, error=AccountNotFound)
def iter_accounts(self):
return self.browser.iter_accounts()
def iter_history(self, account):
return self.browser.iter_history(account)
def iter_investment(self, account):
return self.browser.iter_investment(account)
def iter_pocket(self, account):
return self.browser.iter_pocket(account)
# -*- coding: utf-8 -*-
# Copyright(C) 2016 Jean Walrave
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from weboob.browser.pages import AbstractPage
class LoginPage(AbstractPage):
PARENT = 'cmes'
PARENT_URL = 'login'
BROWSER_ATTR = 'package.browser.CmesBrowser'
# -*- coding: utf-8 -*-
# Copyright(C) 2017 Jean Walrave
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
from weboob.tools.test import BackendTest
class HumanisTest(BackendTest):
MODULE = 'humanis'
# -*- coding: utf-8 -*-
# Copyright(C) 2015 Romain Bignon
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from .module import ThemisModule
__all__ = ['ThemisModule']
# -*- coding: utf-8 -*-
# Copyright(C) 2015 Romain Bignon
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from weboob.browser import LoginBrowser, URL, need_login
from weboob.tools.compat import urljoin
from .pages import LoginPage, LoginConfirmPage, AccountsPage, RibPage, RibPDFPage, HistoryPage
class ThemisBrowser(LoginBrowser):
BASEURL = 'https://esab.themisbanque.eu/'
home = URL('/es@b/fr/esab.jsp')
login = URL('/es@b/fr/codeident.jsp', LoginPage)
login_confirm = URL('/es@b/servlet/internet0.ressourceWeb.servlet.Login', LoginConfirmPage)
accounts = URL(r'/es@b/servlet/internet0.ressourceWeb.servlet.PremierePageServlet\?pageToTreatError=fr/Infos.jsp&dummyDate=',
r'/es@b/servlet/internet0.ressourceWeb.servlet.PremierePageServlet\?cryptpara=.*',
r'/es@b/servlet/internet0.ressourceWeb.servlet.EsabServlet.*',
AccountsPage)
history = URL('/es@b/servlet/internet0.ressourceWeb.servlet.ListeDesMouvementsServlet.*', HistoryPage)
rib = URL(r'/es@b/fr/rib.jsp\?cryptpara=.*', RibPage)
rib_pdf = URL(r'/es@b/servlet/internet0.ressourceWeb.servlet.RibPdfDownloadServlet', RibPDFPage)
def do_login(self):
self.home.go()
self.login.go()
self.page.login(self.username, self.password)
@need_login
def iter_accounts(self):
self.accounts.stay_or_go()
# sometimes when the user has messages, accounts's page will redirect
# to the message page and the user will have to click "ok" to access his accounts
# this will happen as long as the messages aren't deleted.
# In this case, accounts may be reached through a different link (in the "ok" button)
acc_link = self.page.get_acc_link()
if acc_link:
self.location(urljoin(self.BASEURL, acc_link))
return self.page.iter_accounts()
@need_login
def get_history(self, account):
self.location(account._link)
return self.page.get_operations()
@need_login
def get_profile(self):
accounts = list(self.iter_accounts())
self.location(accounts[0]._url)
return self.page.get_profile()
# -*- coding: utf-8 -*-
# Copyright(C) 2015 Romain Bignon
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.backend import Module, BackendConfig
from weboob.capabilities.bank import CapBank, AccountNotFound
from weboob.capabilities.base import find_object
from weboob.capabilities.profile import CapProfile
from weboob.tools.value import ValueBackendPassword
from .browser import ThemisBrowser
__all__ = ['ThemisModule']
class ThemisModule(Module, CapBank, CapProfile):
NAME = 'themisbanque'
DESCRIPTION = u'Themis'
MAINTAINER = u'Romain Bignon'
EMAIL = 'romain@weboob.org'
LICENSE = 'LGPLv3+'
VERSION = '1.5'
CONFIG = BackendConfig(ValueBackendPassword('login', label=u"Numéro d'abonné", masked=False),
ValueBackendPassword('password', label='Code secret'),
)
BROWSER = ThemisBrowser
def create_default_browser(self):
return self.create_browser(self.config['login'].get(),
self.config['password'].get())
def get_account(self, _id):
return find_object(self.browser.iter_accounts(), id=_id, error=AccountNotFound)
def iter_accounts(self):
return self.browser.iter_accounts()
def iter_coming(self, account):
raise NotImplementedError()
def iter_history(self, account):
return self.browser.get_history(account)
def iter_investment(self, account):
raise NotImplementedError()
def get_profile(self):
return self.browser.get_profile()
This diff is collapsed.
# -*- coding: utf-8 -*-
# Copyright(C) 2015 Romain Bignon
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.test import BackendTest
class ThemisBanqueTest(BackendTest):
MODULE = 'themisbanque'
def test_themisbanque(self):
raise NotImplementedError()
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