Commit 659f32e6 authored by mgasselin's avatar mgasselin Committed by Vincent A

[fortuneo] Get TPP id on transfer page

Seems to be for "Comptes tiers" accounts.
parent 55ab039b
......@@ -290,6 +290,9 @@ def iter_accounts(self):
time.sleep(1)
# TPP can match checking accounts with this id
self.page.fill_tpp_account_id(obj=account)
if not account._tpp_id:
self.register_transfer.go(ca=account._ca)
self.page.fill_tpp_account_id(obj=account)
yield account
......
......@@ -733,7 +733,7 @@ def obj__tpp_id(self):
return Attr(
'//input[@name="numeroCompte" and contains(@value, "%s")]/preceding-sibling::input[1]' % self.obj.id,
'value',
default=self.obj.id,
default=NotAvailable
)(self)
def is_loading(self):
......
......@@ -38,6 +38,7 @@
)
from woob.capabilities.base import NotAvailable
from woob.tools.compat import parse_qs, urlparse
from weboob.tools.json import json
from .accounts_list import ActionNeededPage
......@@ -180,6 +181,19 @@ def get_error(self):
class RegisterTransferPage(LoggedPage, HTMLPage):
@method
class fill_tpp_account_id(ItemElement):
def obj__tpp_id(self):
accounts_list = Regexp(
CleanText('//script[contains(text(), "listeComptesADebiter")]'),
r'listeComptesADebiter = (.*}]); var listeComptesACrediter'
)(self)
accounts_list = json.loads(accounts_list)
for account in accounts_list:
if account['numero'] == self.obj.id:
return account.get('numeroContratTopaze', NotAvailable)
return NotAvailable
@method
class iter_internal_recipients(ListElement):
item_xpath = '//select[@name="compteACrediter"]/option[not(@selected)]'
......
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