Exemple #1
0
    def get_list(self, accounts_ids):
        l = []
        # Read the json data
        json_data = self.browser.readurl('/banque/PA_Autonomy-war/ProxyIAService?cleOutil=IA_SMC_UDC&service=getlstcpt&dashboard=true&refreshSession=true&cre=udc&poka=true')
        json_infos = json.loads(json_data)
        for famille in json_infos['smc']['data']['familleCompte']:
            id_famille = famille['idFamilleCompte']
            for compte in famille['compte']:
                account = Account()
                account.label = unicode(compte['libellePersoProduit'] or compte['libelleProduit'])
                account.currency = account.get_currency(compte['devise'])
                account.balance = Decimal(str(compte['soldeDispo']))
                account.coming = Decimal(str(compte['soldeAVenir']))
                account.type = self.ACCOUNT_TYPES.get(id_famille, Account.TYPE_UNKNOWN)
                account.id = 0
                account._link_id = 'KEY'+compte['key']

                # IBAN aren't in JSON
                # Fast method, get it from transfer page.
                for i,a in accounts_ids.items():
                    if a.label == account.label:
                        account.id = i
                # But it's doesn't work with LOAN and MARKET, so use slow method : Get it from transaction page.
                if account.id == 0:
                    account.id = self.browser.get_IBAN_from_account(account)
                l.append(account)

        if not l:
            self.logger.warning('no accounts')
            # oops, no accounts? check if we have not exhausted the allowed use
            # of this password
            for img in self.document.getroot().cssselect('img[align="middle"]'):
                if img.attrib.get('alt', '') == 'Changez votre code secret':
                    raise BrowserPasswordExpired('Your password has expired')
        return l
Exemple #2
0
    def get_list(self):
        accounts = []
        for table in self.document.xpath('//table[@class="tableCompte"]'):
            for account in self._parse_account_group(table):
                accounts.append(account)

        if len(accounts) == 0:
            # oops, no accounts? check if we have not exhausted the allowed use
            # of this password
            for img in self.document.getroot().cssselect(
                    'img[align="middle"]'):
                if img.attrib.get('alt', '') == 'Changez votre code secret':
                    raise BrowserPasswordExpired('Your password has expired')
        return accounts
Exemple #3
0
    def get_accounts_list(self):
        # We have to parse transfer page to get the IBAN numbers
        if not self.is_on_page(TransferPage):
            now = datetime.now()
            self.location('/NS_VIRDF?Origine=DSP_VIR&stp=%s' %
                          now.strftime("%Y%m%d%H%M%S"))

        accounts = self.page.get_accounts()
        if len(accounts) == 0:
            self.logger.warning('no accounts')
            # oops, no accounts? check if we have not exhausted the allowed use
            # of this password
            for img in self.document.getroot().cssselect(
                    'img[align="middle"]'):
                if img.attrib.get('alt', '') == 'Changez votre code secret':
                    raise BrowserPasswordExpired('Your password has expired')
        self.location('/NSFR?Action=DSP_VGLOBALE')
        return self.page.get_list(accounts)
Exemple #4
0
 def on_loaded(self):
     for td in self.document.xpath('//td[@class="hdvon1"]'):
         if td.text and 'Vous avez atteint le seuil de' in td.text:
             raise BrowserPasswordExpired(td.text.strip())