Return transfer id Prevent when the two accounts aren't on the same backend

Signed-off-by: Nicolas Duhamel <nicolas@jombi.fr>
Signed-off-by: Romain Bignon <romain@peerfuse.org>
This commit is contained in:
Nicolas Duhamel 2010-09-28 21:58:54 +02:00 committed by Romain Bignon
commit 935531c5ae
4 changed files with 28 additions and 13 deletions

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
#
# backend.py
# backend.py
#
# Copyright 2010 nicolas <nicolas@jombi.fr>
# Copyright 2010 nicolas <nicolas@jombi.fr>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -29,7 +29,7 @@ class BPBackend(BaseBackend, ICapBank):
VERSION = '0.2'
LICENSE = 'GPLv3'
DESCRIPTION = u'La banque postale, French bank'
CONFIG = {'login': BaseBackend.ConfigField(description='Account ID'),
CONFIG = {'login': BaseBackend.ConfigField(description='Account ID'),
'password': BaseBackend.ConfigField(description='Password of account', is_masked=True)
}
BROWSER = BPbrowser
@ -57,4 +57,4 @@ class BPBackend(BaseBackend, ICapBank):
to_account = self.get_account(id_to)
#TODO: retourner le numero du virement
self.browser.make_transfer(from_account, to_account, amount)
return self.browser.make_transfer(from_account, to_account, amount)

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
#
# browser.py
# browser.py
#
# Copyright 2010 nicolas <nicolas@NicolasDesktop>
# Copyright 2010 nicolas <nicolas@NicolasDesktop>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# MA 02110-1301, USA.
# MA 02110-1301, USA.
import mechanize
import hashlib
@ -197,4 +197,12 @@ class BPbrowser(object):
#Confirmation
# TODO: verifier que tout c'est bien passe
self.Browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/virementsafran/virementnational/4-virementNational.ea")
rep = self.Browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/virementsafran/virementnational/4-virementNational.ea")
html = rep.get_data()
pattern = "Votre virement N.+ ([0-9]+) "
regex = re.compile(pattern)
match = regex.search(html)
id_transfer = match.groups()[0]
return id_transfer