Commit a082c0cb authored by Sylvie Ye's avatar Sylvie Ye Committed by Romain Bignon

[ing] get estimated value on transfer page

get on transfer page because estimated value on account page can be different
need estimated value to validate origin account to do transfer

Closes: 15168@sibi 15200@sibi 15553@sibi 15554@sibi 10417@sibi 13715@sibi 15566@sibi 15231@sibi 15371@sibi
parent f1bcae65
......@@ -190,8 +190,6 @@ class IngBrowser(LoginBrowser):
def get_iban(self, account):
if account.type in [Account.TYPE_CHECKING, Account.TYPE_SAVINGS]:
self.go_account_page(account)
# nedeed for transfer
account._estimated_balance = self.page.get_estimated_balance()
account.iban = self.ibanpage.go().get_iban()
if account.type in (Account.TYPE_MARKET, Account.TYPE_PEA):
......
......@@ -172,7 +172,6 @@ class AccountsList(LoggedPage, HTMLPage):
obj_type = AddType(Field('label'))
obj_coming = NotAvailable
obj__jid = Attr('//input[@name="javax.faces.ViewState"]', 'value')
obj__estimated_balance = None
def obj_balance(self):
balance = CleanDecimal('./span[@class="solde"]/label', replace_dots=True)(self)
......@@ -323,11 +322,6 @@ class AccountsList(LoggedPage, HTMLPage):
self.fillup_form(form, r"\),\{(.*)\},'", on_click)
form.submit()
def get_estimated_balance(self):
# nedeed to do transfer
if self.doc.xpath('//div[@class="previsionnel"]'):
return CleanDecimal('//div[@class="previsionnel"]//div[@class="solde_value"]//label[@class="digits positive"]', replace_dots=True)(self.doc)
class IbanPage(LoggedPage, HTMLPage):
def get_iban(self):
iban = CleanText('//tr[td[1]//text()="IBAN"]/td[2]')(self.doc).strip().replace(' ', '')
......
......@@ -80,11 +80,15 @@ class TransferPage(LoggedPage, HTMLPage):
self.env['label'] = account.label
self.env['iban'] = account.iban
def get_origin_account_id(self, origin):
return [Attr('.', 'data-acct-number')(div) for div in self.doc.xpath('//div[@id="internalAccounts"]//div[@data-acct-number]')
if Attr('.', 'data-acct-number')(div) in origin.id][0]
def update_origin_account_estimated_balance(self, origin):
for div in self.doc.xpath('//div[@id="internalAccounts"]//div[@data-acct-number]'):
if Attr('.', 'data-acct-number')(div) in origin.id:
origin._estimated_balance = CleanDecimal('.//span[@class="solde"]', replace_dots=True, default=NotAvailable)(div)
def get_transfer_form(self, txt):
form = self.get_form(xpath='//form[script[contains(text(), "%s")]]' % txt)
form['AJAXREQUEST'] = '_viewRoot'
......@@ -98,6 +102,8 @@ class TransferPage(LoggedPage, HTMLPage):
form['screenStep'] = '1'
form.submit()
# update account estimated balance
self.update_origin_account_estimated_balance(origin)
# Select debit account
form = self.get_transfer_form('SetDebitAccount')
form['selectedDebitAccountNumber'] = self.get_origin_account_id(origin)
......
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