Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Bezleputh
#
# This file is part of weboob.
#
# weboob 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.
#
# weboob 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 weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser2.page import HTMLPage, method, TableElement, ItemElement, LoggedPage
from weboob.tools.browser2.filters import CleanText, CleanDecimal, TableCell, Date
from weboob.capabilities.bank import Account, Transaction
from weboob.tools.date import LinearDateGuesser
__all__ = ['LoginPage', 'LoginErrorPage', 'AvoirPage', 'OperationsFuturesPage', 'OperationsTraiteesPage']
class LoginPage(HTMLPage):
def login(self, login, passwd):
form = self.get_form(nr=0)
form['_cm_user'] = login
form['_cm_pwd'] = passwd
form.submit()
class LoginErrorPage(HTMLPage):
pass
class AvoirPage(LoggedPage, HTMLPage):
@method
class iter_accounts(TableElement):
item_xpath = u'//table[@summary="Liste des échéances"]/tbody/tr'
head_xpath = u'//table[@summary="Liste des échéances"]/thead/tr/th/text()'
col_name = u'Plan'
col_value = u'Evaluation en'
class item(ItemElement):
klass = Account
obj_id = CleanText(TableCell('name'))
obj_label = CleanText(TableCell('name'))
#obj_coming = CleanDecimal(TableCell('value'))
obj_balance = CleanDecimal(TableCell('value'))
obj_currency = CleanText(u'//table[@summary="Liste des échéances"]/thead/tr/th/small/text()')
obj_type = Account.TYPE_UNKNOWN
class OperationsFuturesPage(LoggedPage, HTMLPage):
@method
class get_list(TableElement):
head_xpath = u'//table[@summary="Liste des opérations en attente"]/thead/tr/th/text()'
item_xpath = u'//table[@summary="Liste des opérations en attente"]/tbody/tr'
col_date = u'Date'
col_operation = u'Opération'
col_etat = u'Etat'
col_montant = u'Montant net en'
col_action = u'Action'
class item(ItemElement):
klass = Transaction
def condition(self):
return not u'Aucune opération en attente' in CleanText(TableCell('date'))(self)
obj_date = Date(CleanText(TableCell('date')), LinearDateGuesser())
obj_type = Transaction.TYPE_UNKNOWN
obj_label = CleanText(TableCell('operation'))
obj_amount = CleanDecimal(TableCell('montant'))
class OperationsTraiteesPage(LoggedPage, HTMLPage):
@method
class get_history(TableElement):
head_xpath = u'//table[@summary="Liste des opérations en attente"]/thead/tr/th/text()'
item_xpath = u'//table[@summary="Liste des opérations en attente"]/tbody/tr'
col_date = u'Date'
col_operation = u'Opération'
col_montant = u'Montant net en'
class item(ItemElement):
klass = Transaction
def condition(self):
return not u'Aucune opération' in CleanText(TableCell('date'))(self)
obj_date = Date(CleanText(TableCell('date')), LinearDateGuesser())
obj_type = Transaction.TYPE_UNKNOWN
obj_label = CleanText(TableCell('operation'))
obj_amount = CleanDecimal(TableCell('montant'))