Пример #1
0
    def get_recipients(self):
        # First, internals recipients
        table = self.document.xpath('//table[@id="transfer_form:receiptAccount"]')
        for tr in table[0].xpath('tbody/tr'):
            tds = tr.xpath('td')
            id = tds[0].xpath('input')[0].attrib['value']
            name = tds[0].xpath('label')[0].text
            name += u" " + tds[1].xpath('label')[0].text.replace('\n', '')
            name += u" " + tds[2].xpath('label')[0].text.replace('\n', '')
            recipient = Recipient()
            recipient.id = id
            recipient.label = name
            recipient._type = "int"
            yield recipient

        # Second, externals recipients
        select = self.document.xpath('//select[@id="transfer_form:externalAccounts"]')
        if len(select) > 0:
            recipients = select[0].xpath('option')
            recipients.pop(0)
            for option in recipients:
                recipient = Recipient()
                recipient.id = option.attrib['value']
                recipient.label = option.text
                recipient._type = "ext"
                yield recipient
Пример #2
0
    def iter_transfer_recipients(self, ignored):
        if self.config['website'].get() != 'ppold':
            raise NotImplementedError()

        for account in self.browser.get_transfer_accounts().itervalues():
            recipient = Recipient()
            recipient.id = account.id
            recipient.label = account.label
            yield recipient
Пример #3
0
    def iter_transfer_recipients(self, ignored):
        if self.config['website'].get() != 'pp':
            raise NotImplementedError()

        for account in self.browser.get_transfer_accounts().itervalues():
            recipient = Recipient()
            recipient.id = account.id
            recipient.label = account.label
            yield recipient
Пример #4
0
    def do_add_recipient(self, line):
        """
        add_recipient iban label

        Add a recipient to a backend.
        """
        iban, label = self.parse_command_args(line, 2, 2)
        recipient = Recipient()
        recipient.iban = iban
        recipient.label = label
        next(iter(self.do('add_recipient', recipient)))
Пример #5
0
    def find_recipient(self, iban):
        iban = iban.upper()
        iban_col = self.get_iban_col()

        for tr in self.doc.xpath('//table[starts-with(@summary,"Nom et IBAN")]/tbody/tr'):
            iban_text = re.sub(r'\s', '', CleanText('./td[%s]' % iban_col)(tr))
            if iban_text.upper() == 'IBAN:%s' % iban:
                res = Recipient()
                res.iban = iban
                res.id = iban
                res.label = CleanText('./td[%s]' % (iban_col-1))(tr)
                return res
Пример #6
0
 def get_recipient(self, recipient):
     # handle polling response
     r = Recipient()
     r.iban = recipient.iban
     r.id = self.get('data.gestionBeneficiaire.identifiantBeneficiaire')
     r.label = recipient.label
     r.category = u'Externe'
     r.enabled_at = datetime.now().replace(microsecond=0) + timedelta(days=5)
     r.currency = u'EUR'
     r.bank_name = NotAvailable
     r._id_transaction = self.get('data.gestionBeneficiaire.idTransactionAF') or NotAvailable
     r._transfer_id = self.get('data.gestionBeneficiaire.identifiantBeneficiaire') or NotAvailable
     return r
Пример #7
0
 def get_recipient_object(self, iban, label):
     r = Recipient()
     r.iban = iban
     r.id = iban
     r.label = label
     r.category = u'Externe'
     r.enabled_at = datetime.now().replace(microsecond=0) + timedelta(days=5)
     r.currency = u'EUR'
     r.bank_name = NotAvailable
     return r
Пример #8
0
 def build_recipient(self, recipient):
     r = Recipient()
     r.iban = recipient.iban
     r.id = recipient.iban
     r.label = recipient.label
     r.category = recipient.category
     r.enabled_at = datetime.now().replace(microsecond=0)
     r.currency = u'EUR'
     r.bank_name = recipient.bank_name
     return r
Пример #9
0
 def build_recipient(self, recipient):
     r = Recipient()
     r.iban = recipient.iban
     r.id = recipient.iban
     r.label = recipient.label
     r.category = recipient.category
     r.enabled_at = date.today()
     r.currency = u'EUR'
     r.bank_name = recipient.bank_name
     return r
Пример #10
0
 def get_recipient_obj(self, recipient):
     r = Recipient()
     r.iban = recipient.iban
     r.id = recipient.iban
     r.label = recipient.label
     r.category = u'Externe'
     r.enabled_at = datetime.datetime.now().replace(microsecond=0)
     r.currency = u'EUR'
     r.bank_name = NotAvailable
     return r
Пример #11
0
    def get_recipients(self):
        # First, internals recipients
        table = self.document.xpath('//table[@id="transfer_form:receiptAccount"]')
        for tr in table[0].xpath('tbody/tr'):
            tds = tr.xpath('td')
            id = tds[0].xpath('input')[0].attrib['value']
            name = tds[0].xpath('label')[0].text
            name += u" " + tds[1].xpath('label')[0].text.replace('\n', '')
            name += u" " + tds[2].xpath('label')[0].text.replace('\n', '')
            recipient = Recipient()
            recipient.id = id
            recipient.label = name
            recipient._type = "int"
            yield recipient

        # Second, externals recipients
        select = self.document.xpath('//select[@id="transfer_form:externalAccounts"]')
        if len(select) > 0:
            recipients = select[0].xpath('option')
            recipients.pop(0)
            for option in recipients:
                recipient = Recipient()
                recipient.id = option.attrib['value']
                recipient.label = option.text
                recipient._type = "ext"
                yield recipient
Пример #12
0
 def get_recipient_object(self, recipient):
     r = Recipient()
     r.iban = recipient.iban
     r.id = recipient.iban
     r.label = recipient.label
     r.category = recipient.category
     # On credit mutuel recipients are immediatly available.
     r.enabled_at = datetime.now().replace(microsecond=0)
     r.currency = u'EUR'
     r.bank_name = NotAvailable
     return r
Пример #13
0
 def get_recipient(self, recipient):
     r = Recipient()
     r.iban = recipient.iban
     r.id = self.get('data.gestionBeneficiaire.identifiantBeneficiaire')
     r.label = recipient.label
     r.category = u'Externe'
     r.enabled_at = datetime.now().replace(microsecond=0) + timedelta(
         days=5)
     r.currency = u'EUR'
     r.bank_name = NotAvailable
     return r
Пример #14
0
 def get_recipient(self, recipient):
     r = Recipient()
     r.iban = recipient.iban
     r.id = recipient.webid if hasattr(recipient, 'webid') else recipient.id
     r.label = recipient.label
     r.category = u'Externe'
     r.enabled_at = datetime.now().replace(microsecond=0) + timedelta(
         days=5)
     r.currency = u'EUR'
     r.bank_name = self.get('data.activationBeneficiaire.nomBanque')
     return r
Пример #15
0
    def do_add_recipient(self, line):
        """
        add_recipient iban label

        Add a recipient to a backend.
        """
        if len(self.enabled_backends) > 1:
            print('Error: select a single backend to add a recipient (Hint: try the command "backends only")', file=self.stderr)
            return 1
        iban, label, origin_account_id = self.parse_command_args(line, 3, 2)
        recipient = Recipient()
        recipient.iban = iban
        recipient.label = label
        recipient.origin_account_id = origin_account_id
        next(iter(self.do('add_recipient', recipient)))
Пример #16
0
    def do_add_recipient(self, line):
        """
        add_recipient iban label

        Add a recipient to a backend.
        """
        if len(self.enabled_backends) > 1:
            print(
                'Error: select a single backend to add a recipient (Hint: try the command "backends only")',
                file=self.stderr)
            return 1
        iban, label = self.parse_command_args(line, 2, 2)
        recipient = Recipient()
        recipient.iban = iban
        recipient.label = label
        next(iter(self.do('add_recipient', recipient)))
Пример #17
0
 def copy_recipient_obj(self, recipient):
     rcpt = Recipient()
     rcpt.id = recipient.iban
     rcpt.iban = recipient.iban
     rcpt.label = recipient.label
     rcpt.category = 'Externe'
     rcpt.enabled_at = date.today()
     rcpt.currency = 'EUR'
     return rcpt
Пример #18
0
 def copy_recipient(self, recipient):
     rcpt = Recipient()
     rcpt.iban = recipient.iban
     rcpt.id = recipient.iban
     rcpt.label = recipient.label
     rcpt.category = recipient.category
     rcpt.enabled_at = datetime.now().replace(microsecond=0) + timedelta(
         days=1)
     rcpt.currency = u'EUR'
     return rcpt
Пример #19
0
 def build_recipient(self, recipient):
     r = Recipient()
     r.iban = recipient.iban
     r.id = recipient.iban
     r.label = recipient.label
     r.category = recipient.category
     r.enabled_at = datetime.now().replace(microsecond=0) + timedelta(days=5)
     r.currency = u'EUR'
     r.bank_name = recipient.bank_name
     return r
Пример #20
0
 def get_recipient_object(self, iban, label):
     r = Recipient()
     r.iban = iban
     r.id = iban
     r.label = label
     r.category = u'Externe'
     r.enabled_at = datetime.now().replace(microsecond=0) + timedelta(days=5)
     r.currency = u'EUR'
     r.bank_name = NotAvailable
     return r
Пример #21
0
 def get_recipient(self, recipient):
     r = Recipient()
     r.iban = recipient.iban
     r.id = recipient.id
     r.label = recipient.label
     r.category = u'Externe'
     r.enabled_at = datetime.now().replace(microsecond=0) + timedelta(days=5)
     r.currency = u'EUR'
     r.bank_name = self.get('data.activationBeneficiaire.nomBanque')
     return r
Пример #22
0
 def build_recipient(self, recipient):
     r = Recipient()
     r.iban = recipient.iban
     r.id = recipient.iban
     r.label = recipient.label
     r.category = recipient.category
     r.enabled_at = date.today()
     r.currency = u'EUR'
     r.bank_name = recipient.bank_name
     return r
Пример #23
0
 def get_recipient_obj(self, recipient):
     r = Recipient()
     r.iban = recipient.iban
     r.id = recipient.iban
     r.label = recipient.label
     r.category = u'Externe'
     r.enabled_at = datetime.datetime.now().replace(microsecond=0)
     r.currency = u'EUR'
     r.bank_name = NotAvailable
     return r
Пример #24
0
 def get_recipient(self, recipient):
     r = Recipient()
     r.iban = recipient.iban
     r.id = self.get('data.gestionBeneficiaire.identifiantBeneficiaire')
     r.label = recipient.label
     r.category = u'Externe'
     r.enabled_at = datetime.now().replace(microsecond=0) + timedelta(days=5)
     r.currency = u'EUR'
     r.bank_name = NotAvailable
     return r
Пример #25
0
 def get_recipient_object(self, recipient):
     r = Recipient()
     r.iban = recipient.iban
     r.id = recipient.iban
     r.label = recipient.label
     r.category = recipient.category
     # On credit mutuel recipients are immediatly available.
     r.enabled_at = datetime.now().replace(microsecond=0)
     r.currency = 'EUR'
     r.bank_name = NotAvailable
     return r
Пример #26
0
 def copy_recipient_obj(self, recipient):
     rcpt = Recipient()
     rcpt.id = recipient.iban
     rcpt.iban = recipient.iban
     rcpt.label = recipient.label
     rcpt.category = 'Externe'
     rcpt.enabled_at = date.today()
     rcpt.currency = 'EUR'
     return rcpt
Пример #27
0
    def iter_internal_recipients(self):
        if self.doc.xpath('//ul[@id="idCmptToInterne"]'):
            for account in self.doc.xpath('//ul[@id="idCmptToInterne"]/li'):
                data = Attr('.', 'data-comptecomplet')(account)
                json_data = json.loads(data.replace('"', '"'))

                rcpt = Recipient()
                rcpt.category = 'Interne'
                rcpt.id = rcpt.iban = json_data['ibanCompte']
                rcpt.label = json_data['libelleCompte']
                rcpt.enabled_at = date.today()

                rcpt._formatted_iban = json_data['ibanFormateCompte']
                rcpt._account_title = json_data['intituleCompte']
                rcpt._bic = json_data['bicCompte']
                rcpt._ref = ''
                rcpt._code_origin = ''
                rcpt._created_date = ''

                yield rcpt
Пример #28
0
 def get_recipient_object(self, recipient, get_info=False):
     r = Recipient()
     if get_info:
         recap_iban = CleanText('//div[div[contains(text(), "IBAN")]]/div[has-class("recapTextField")]', replace=[(' ', '')])(self.doc)
         assert recap_iban == recipient.iban
         recipient.bank_name = CleanText('//div[div[contains(text(), "Banque du")]]/div[has-class("recapTextField")]', default=NotAvailable)(self.doc)
     r.iban = recipient.iban
     r.id = recipient.iban
     r.label = recipient.label
     r.category = recipient.category
     # On societe generale recipients are immediatly available.
     r.enabled_at = datetime.now().replace(microsecond=0)
     r.currency = u'EUR'
     r.bank_name = recipient.bank_name
     return r
Пример #29
0
 def get_recipient_object(self, recipient, get_info=False):
     r = Recipient()
     if get_info:
         recap_iban = CleanText(
             '//div[div[contains(text(), "IBAN")]]/div[has-class("recapTextField")]',
             replace=[(' ', '')])(self.doc)
         assert recap_iban == recipient.iban
         recipient.bank_name = CleanText(
             '//div[div[contains(text(), "Banque du")]]/div[has-class("recapTextField")]',
             default=NotAvailable)(self.doc)
     r.iban = recipient.iban
     r.id = recipient.iban
     r.label = recipient.label
     r.category = recipient.category
     # On societe generale recipients are immediatly available.
     r.enabled_at = datetime.now().replace(microsecond=0)
     r.currency = u'EUR'
     r.bank_name = recipient.bank_name
     return r
Пример #30
0
    def get_recipient(self):
        div = self.doc.xpath('//div[@class="confirmation__text"]')[0]

        ret = Recipient()
        ret.label = CleanText('//p[b[contains(text(),"Libellé du compte :")]]/text()')(div)
        ret.iban = ret.id = CleanText('//p[b[contains(text(),"Iban :")]]/text()')(div)
        ret.bank_name = CleanText(u'//p[b[contains(text(),"Établissement bancaire :")]]/text()')(div)
        ret.currency = u'EUR'
        ret.category = u'Externe'
        ret.enabled_at = datetime.date.today()
        assert ret.label
        return ret
Пример #31
0
    def get_new_recipient(self, recipient):
        recipient_xpath = '//form[@id="CompteExterneActionForm"]//ul'

        rcpt = Recipient()
        rcpt.label = Regexp(
            CleanText(
                recipient_xpath + '/li[contains(text(), "Nom du titulaire")]',
                replace=[(' ', '')]), r'(?<=Nomdutitulaire:)(\w+)')(self.doc)
        rcpt.iban = Regexp(
            CleanText(recipient_xpath + '/li[contains(text(), "IBAN")]'),
            r'IBAN : ([A-Za-z]{2}[\dA-Za-z]+)')(self.doc)
        rcpt.id = rcpt.iban
        rcpt.category = 'Externe'
        rcpt.enabled_at = date.today() + timedelta(1)
        rcpt.currency = 'EUR'
        return rcpt
Пример #32
0
    def rcpt_after_sms(self, recipient):
        rcpt_data = self.doc['donnees']

        assert recipient.label == Dict('nomRaisonSociale')(rcpt_data)
        assert recipient.iban == Dict('coordonnee/0/numeroCompte')(rcpt_data)

        rcpt = Recipient()
        rcpt.id = Dict('coordonnee/0/refSICoordonnee')(rcpt_data)
        rcpt.iban = Dict('coordonnee/0/numeroCompte')(rcpt_data)
        rcpt.label = Dict('nomRaisonSociale')(rcpt_data)
        rcpt.category = u'Externe'
        rcpt.enabled_at = date.today()
        return rcpt
Пример #33
0
    def get_recipients(self):
        recipients_xpath = '//select[@id="compteDestinataireSelectionne"]/option[not(contains(@selected, "selected"))]'

        for recipient in self.doc.xpath(recipients_xpath):
            rcpt = Recipient()

            rcpt.label = re.sub(r' - \w{2,}\d{6,}', '',
                                CleanText('.')(recipient))
            rcpt.iban = CleanText('./@value')(recipient)
            rcpt.id = rcpt.iban
            rcpt.enabled_at = date.today()
            rcpt.category = 'Interne'

            yield rcpt
Пример #34
0
    def get_new_recipient(self, recipient):
        recipient_xpath = '//form[@id="CompteExterneActionForm"]//ul'

        rcpt = Recipient()
        rcpt.label = Regexp(CleanText(
            recipient_xpath + '/li[contains(text(), "Nom du titulaire")]', replace=[(' ', '')]
        ), r'(?<=Nomdutitulaire:)(\w+)')(self.doc)
        rcpt.iban = Regexp(CleanText(
            recipient_xpath + '/li[contains(text(), "IBAN")]'
        ), r'IBAN : ([A-Za-z]{2}[\dA-Za-z]+)')(self.doc)
        rcpt.id = rcpt.iban
        rcpt.category = 'Externe'
        rcpt.enabled_at = date.today() + timedelta(1)
        rcpt.currency = 'EUR'
        return rcpt
Пример #35
0
    def get_recipient(self):
        div = self.doc.xpath('//div[@class="confirmation__text"]')[0]

        ret = Recipient()
        ret.label = CleanText('//p[b[contains(text(),"Libellé du compte :")]]/text()')(div)
        ret.iban = ret.id = CleanText('//p[b[contains(text(),"Iban :")]]/text()')(div)
        ret.bank_name = CleanText(u'//p[b[contains(text(),"Établissement bancaire :")]]/text()')(div)
        ret.currency = u'EUR'
        ret.category = u'Externe'
        ret.enabled_at = datetime.date.today()
        assert ret.label
        return ret
Пример #36
0
    def rcpt_after_sms(self, recipient):
        rcpt_data = self.doc['donnees']

        assert recipient.label == Dict('nomRaisonSociale')(rcpt_data)
        assert recipient.iban == Dict('coordonnee/0/numeroCompte')(rcpt_data)

        rcpt = Recipient()
        rcpt.id = Dict('coordonnee/0/refSICoordonnee')(rcpt_data)
        rcpt.iban = Dict('coordonnee/0/numeroCompte')(rcpt_data)
        rcpt.label = Dict('nomRaisonSociale')(rcpt_data)
        rcpt.category = u'Externe'
        rcpt.enabled_at = date.today()
        return rcpt
Пример #37
0
    def get_recipients(self):
        recipients_xpath = '//select[@id="compteDestinataireSelectionne"]/option[not(contains(@selected, "selected"))]'

        for recipient in self.doc.xpath(recipients_xpath):
            rcpt = Recipient()

            rcpt.label = re.sub(r' - \w{2,}\d{6,}', '', CleanText('.')(recipient))
            rcpt.iban = CleanText('./@value')(recipient)
            rcpt.id = rcpt.iban
            rcpt.enabled_at = date.today()
            rcpt.category = 'INTERNE'

            yield rcpt
Пример #38
0
 def iter_transfer_recipients(self, ignored):
     for account in self.browser.get_transfer_accounts().itervalues():
         recipient = Recipient()
         recipient.id = account.id
         recipient.label = account.label
         yield recipient
Пример #39
0
 def iter_transfer_recipients(self, ignored):
     for account in self.browser.get_accounts_list():
         recipient = Recipient()
         recipient.id = account.id
         recipient.label = account.label
         yield recipient
Пример #40
0
    def parse_recipients(self, items, assume_internal=False):
        for opt in items:
            lines = get_text_lines(opt)

            if opt.attrib['value'].startswith('I') or assume_internal:
                for n, line in enumerate(lines):
                    if line.strip().startswith('n°'):
                        rcpt = Recipient()
                        rcpt._index = opt.attrib['value']
                        rcpt._raw_label = ' '.join(lines)
                        rcpt.category = 'Interne'
                        rcpt.id = CleanText().filter(line[2:].strip())
                        # we don't have iban here, use account number
                        rcpt.label = ' '.join(lines[:n])
                        rcpt.currency = Currency.get_currency(lines[-1])
                        rcpt.enabled_at = datetime.now().replace(microsecond=0)
                        yield rcpt
                        break
            elif opt.attrib['value'].startswith('E'):
                if len(lines) > 1:
                    # In some cases we observed beneficiaries without label, we skip them
                    rcpt = Recipient()
                    rcpt._index = opt.attrib['value']
                    rcpt._raw_label = ' '.join(lines)
                    rcpt.category = 'Externe'
                    rcpt.label = lines[0]
                    rcpt.iban = lines[1].upper()
                    rcpt.id = rcpt.iban
                    rcpt.enabled_at = datetime.now().replace(microsecond=0)
                    yield rcpt
                else:
                    self.logger.warning('The recipient associated with the iban %s has got no label' % lines[0])
Пример #41
0
    def iter_internal_recipients(self):
        if self.doc.xpath('//ul[@id="idCmptToInterne"]'):
            for account in self.doc.xpath('//ul[@id="idCmptToInterne"]/li'):
                data = Attr('.', 'data-comptecomplet')(account)
                json_data = json.loads(data.replace('&quot;', '"'))

                rcpt = Recipient()
                rcpt.category = 'Interne'
                rcpt.id = rcpt.iban = json_data['ibanCompte']
                rcpt.label = json_data['libelleCompte']
                rcpt.enabled_at = date.today()

                rcpt._formatted_iban = json_data['ibanFormateCompte']
                rcpt._account_title = json_data['intituleCompte']
                rcpt._bic = json_data['bicCompte']
                rcpt._ref = ''
                rcpt._code_origin = ''
                rcpt._created_date = ''

                yield rcpt
Пример #42
0
 def get_recipient(self, recipient):
     # handle polling response
     r = Recipient()
     r.iban = recipient.iban
     r.id = self.get('data.gestionBeneficiaire.identifiantBeneficiaire')
     r.label = recipient.label
     r.category = u'Externe'
     r.enabled_at = datetime.now().replace(microsecond=0) + timedelta(
         days=5)
     r.currency = u'EUR'
     r.bank_name = NotAvailable
     r._id_transaction = self.get(
         'data.gestionBeneficiaire.idTransactionAF') or NotAvailable
     r._transfer_id = self.get(
         'data.gestionBeneficiaire.identifiantBeneficiaire') or NotAvailable
     return r