Add a transfer capability and implante it in bp and boobank

Make a transfer in boobank like that:

>transfer fromaccountid toaccoundid amount

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-24 18:07:06 +02:00 committed by Romain Bignon
commit 81706f23ad
4 changed files with 59 additions and 1 deletions

View file

@ -2,7 +2,7 @@
#
# backend.py
#
# Copyright 2010 nicolas <nicolas@NicolasDesktop>
# 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
@ -52,3 +52,15 @@ class BPBackend(BaseBackend, ICapBank):
for history in self.browser.get_history(account):
yield history
def transfer(self, id_from, id_to, amount):
from_account = self.get_account(id_from)
to_account = self.get_account(id_to)
#TODO: retourner le numero du virement
self.browser.make_transfer(from_account, to_account, amount)

View file

@ -183,8 +183,26 @@ class BPbrowser(object):
def make_transfer(self, from_account, to_account, amount):
self.Browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/f_virementSafran.jsp?n=11")
self.Browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/virementsafran/aiguillage/saisieComptes.ea")
self.Browser.select_form(name="AiguillageForm")
self.Browser["idxCompteEmetteur"] = [from_account.id]
self.Browser["idxCompteReceveur"] = [to_account.id]
self.Browser.submit()
self.Browser.select_form(name="VirementNationalForm")
self.Browser["montant"] = str(amount)
self.Browser.submit()
#Confirmation
# TODO: verifier que tout c'est bien passe
self.Browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/virementsafran/virementnational/4-virementNational.ea")