Esempio n. 1
0
 def parse_transaction(self, transaction):
     t = FrenchTransaction(transaction['activityId'])
     date = parse_french_date(transaction['date'])
     raw = transaction['counterparty']
     t.parse(date=date, raw=raw)
     amount = transaction['displayAmount']
     t.set_amount(amount)
     t._currency = transaction['currencyCode']
     return t
Esempio n. 2
0
 def parse(self):
     for i, tr in enumerate(self.document.xpath('//tr')):
         t = FrenchTransaction(tr.xpath('./td[@class="transactionId"]/span')[0].text.strip())
         date = parse_french_date(tr.xpath('./td[@class="date"]')[0].text.strip())
         status = tr.xpath('./td[@class="desc"]/ul/li[@class="first"]')[0].text.strip()
         #We pass this because it's not transaction
         if status == u'Créé' or status == u'Annulé':
             continue
         raw = tr.xpath('./td[@class="desc"]/strong')[0].text.strip()
         t.parse(date=date, raw=raw)
         amount = tr.xpath('./td[@class="price"]/span')[0].text.strip()
         t.set_amount(amount)
         t._currency = Account.get_currency(amount)
         yield t
Esempio n. 3
0
 def parse(self):
     for i, tr in enumerate(self.document.xpath('//tr')):
         t = FrenchTransaction(
             tr.xpath('./td[@class="transactionId"]/span')[0].text.strip())
         date = parse_french_date(
             tr.xpath('./td[@class="date"]')[0].text.strip())
         status = tr.xpath(
             './td[@class="desc"]/ul/li[@class="first"]')[0].text.strip()
         #We pass this because it's not transaction
         if status == u'Créé' or status == u'Annulé':
             continue
         raw = tr.xpath('./td[@class="desc"]/strong')[0].text.strip()
         t.parse(date=date, raw=raw)
         amount = tr.xpath('./td[@class="price"]/span')[0].text.strip()
         t.set_amount(amount)
         t._currency = Account.get_currency(amount)
         yield t
Esempio n. 4
0
    def parse_transaction(self, transaction, account):
        t = FrenchTransaction(transaction['activityId'])
        date = parse_french_date(transaction['date'])
        raw = transaction.get('counterparty', transaction['displayType'])
        t.parse(date=date, raw=raw)

        try:
            if transaction['currencyCode'] != account.currency:
                transaction = self.browser.convert_amount(account, transaction)
                t.original_amount = self.format_amount(transaction['originalAmount'], transaction["isCredit"])
                t.original_currency = u'' + transaction["currencyCode"]
            t.amount = self.format_amount(transaction['netAmount'], transaction["isCredit"])
        except KeyError:
            return

        t._currency = transaction['currencyCode']

        return t
Esempio n. 5
0
    def parse_transaction(self, transaction):
        t = FrenchTransaction(transaction['activityId'])
        date = parse_french_date(transaction['date'])
        try:
            raw = transaction['counterparty']
        except KeyError:
            raw = transaction['displayType']
        t.parse(date=date, raw=raw)
        try:
            amount = transaction['netAmount']
        except KeyError:
            return
        if transaction['isCredit']:
            t.set_amount(credit=amount)
        else:
            t.set_amount(debit=amount)
        t._currency = transaction['currencyCode']

        return t
Esempio n. 6
0
    def parse_transaction(self, transaction):
        t = FrenchTransaction(transaction['activityId'])
        date = parse_french_date(transaction['date'])
        try:
            raw = transaction['counterparty']
        except KeyError:
            raw = transaction['displayType']
        t.parse(date=date, raw=raw)
        try:
            amount = transaction['netAmount']
        except KeyError:
            return
        if transaction['isCredit']:
            t.set_amount(credit=amount)
        else:
            t.set_amount(debit=amount)
        t._currency = transaction['currencyCode']

        return t
Esempio n. 7
0
    def parse(self):
        for tr in self.document.xpath('//tbody/tr'):
            tlink = tr.xpath('./td[@class="desc"]/a[@class="rowClick"]')[0].attrib['href'].strip()
            t = FrenchTransaction(tlink[tlink.find('&id=')+4:])
            date = parse_french_date(tr.xpath('./td[@class="date"]')[0].text.strip())
            raw = tr.xpath('./td[@class="desc"]/a[@class="rowClick"]')[0].tail.strip()
            # Filter lines that do not actually modify the balance
            if raw.startswith('Autorisation ') or raw.endswith(' en attente  par PayPal'):
                continue
            t.parse(date=date, raw=raw)

            amount = tr.xpath('./td[@class="price-value net"]')[0].text.strip()
            t.set_amount(amount)
            commission = tr.xpath('./td[@class="price-value fee"]')[0].text.strip()
            t.commission = Decimal(t.clean_amount(commission))
            t.label = t.raw
            if t.commission:
                t.label += " (%s)" % tr.xpath('./td[@class="price-value gross"]')[0].text.strip()

            t._currency = Account.get_currency(amount)
            yield t