• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python transactions.AmericanTransaction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中weboob.tools.capabilities.bank.transactions.AmericanTransaction的典型用法代码示例。如果您正苦于以下问题:Python AmericanTransaction类的具体用法?Python AmericanTransaction怎么用?Python AmericanTransaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了AmericanTransaction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: unsorted_trans

    def unsorted_trans(self):
        for jnl in self.doc['accountDetailsAndActivity']['accountActivity'] \
                           ['postedTransactionJournals']:
            tdate = jnl['columns'][0]['activityColumn'][0]
            label = jnl['columns'][1]['activityColumn'][0]
            amount = jnl['columns'][3]['activityColumn'][0]
            xdescs = dict((x['label'], x['value'][0])
                          for x in jnl['extendedDescriptions'])
            pdate = xdescs['Posted Date :']
            ref = xdescs.get('Reference Number:') or ''

            if amount.startswith('(') and amount.endswith(')'):
                amount = AmTr.decimal_amount(amount[1:-1])
            else:
                amount = -AmTr.decimal_amount(amount)
            label = clean_label(label)

            trans = Transaction(ref)
            trans.date = datetime.strptime(tdate, '%m-%d-%Y')
            trans.rdate = datetime.strptime(pdate, '%m-%d-%Y')
            trans.type = Transaction.TYPE_UNKNOWN
            trans.raw = label
            trans.label = label
            trans.amount = amount
            yield trans
开发者ID:laurentb,项目名称:weboob,代码行数:25,代码来源:browser.py


示例2: iter_transactions

    def iter_transactions(self):
        for row in self.doc.xpath('//tr/th[@headers='
                                  '"postedHeader dateHeader"]/..'):
            date = row.xpath('th[@headers="postedHeader '
                             'dateHeader"]/text()')[0]
            desc = row.xpath('td[@headers="postedHeader '
                             'descriptionHeader"]/span/text()')[0]
            deposit = row.xpath('td[@headers="postedHeader '
                                'depositsConsumerHeader"]/span/text()')[0]
            withdraw = row.xpath('td[@headers="postedHeader '
                                 'withdrawalsConsumerHeader"]/span/text()')[0]

            date = datetime.datetime.strptime(date, '%m/%d/%y')

            desc = clean_label(desc)

            deposit = deposit.strip()
            deposit = AmTr.decimal_amount(deposit or '0')
            withdraw = withdraw.strip()
            withdraw = AmTr.decimal_amount(withdraw or '0')

            amount = deposit - withdraw

            trans = Transaction(u'')
            trans.date = date
            trans.rdate = date
            trans.type = Transaction.TYPE_UNKNOWN
            trans.raw = desc
            trans.label = desc
            trans.amount = amount
            yield trans
开发者ID:frankrousseau,项目名称:weboob-modules,代码行数:31,代码来源:pages.py


示例3: account

 def account(self):
     label = u' '.join(self.doc.xpath(
         '//div[contains(@class,"myCreditCardDetails")]')[0]\
         .text_content().split())
     balance = self.amount(u'Balance')
     cardlimit = self.doc.xpath(
         u'//li[text()="Available to Spend"]')[0].text_content()\
         .replace(u'Available to Spend', u'').replace(u'Limit', u'').strip()
     paymin = self.amount(u'Payment Due')
     if self.doc.xpath(u'//li[@class="noPaymentDue"]'):
         # If payment date is not scheduled yet, set it somewhere in a
         # distant future, so that we always have a valid date.
         paydate = datetime.now() + timedelta(days=999)
     else:
         rawtext = self.doc.xpath(
             u'//li[contains(text(),"Due Date")]')[0].text_content()
         datetext = re.match('.*(\d\d/\d\d/\d\d\d\d).*', rawtext).group(1)
         paydate = datetime.strptime(datetext, '%m/%d/%Y')
     a = Account()
     a.id = label[-4:]
     a.label = label
     a.currency = Account.get_currency(balance)
     a.balance = -AmTr.decimal_amount(balance)
     a.type = Account.TYPE_CARD
     a.cardlimit = AmTr.decimal_amount(cardlimit)
     a.paymin = AmTr.decimal_amount(paymin)
     if paydate is not None:
         a.paydate = paydate
     return a
开发者ID:P4ncake,项目名称:weboob,代码行数:29,代码来源:pages.py


示例4: amount

 def amount(self, shmt, name):
     for root in shmt.xpath(u'../../../../../../../..'
                            u'//td[text()="Item(s) Subtotal: "]/../..'):
         for node in root.xpath(u'tr/td[text()="%s"]' % name):
             return AmTr.decimal_amount(
                 node.xpath('../td')[-1].text.strip())
         for node in root.xpath(u'tr/td/b[text()="%s"]' % name):
             return AmTr.decimal_amount(
                 node.xpath('../../td/b')[-1].text.strip())
     return Decimal(0)
开发者ID:sputnick-dev,项目名称:weboob,代码行数:10,代码来源:pages.py


示例5: read_indent_amount

    def read_indent_amount(self, pos, range_skip=(0,0), range_plus=(0,0),
                           range_minus=(0,0)):
        startPos = pos

        # Read layout-amount pairs.
        amounts = []
        while True:
            prevPos = pos
            pos, layout = self.read_layout_tm(pos)
            pos, amount = self.read_amount(pos)
            if layout is None or amount is None:
                pos = prevPos
                break
            else:
                amounts.append((layout, amount))

        if not amounts:
            return startPos, None
        else:
            # Infer amount type by its indentation in the layout.
            amount_total = AmTr.decimal_amount('0')
            for (_, _, _, _, indent, _), amount in amounts:
                within = lambda xmin_xmax: xmin_xmax[0] <= indent <= xmin_xmax[1]
                if within(range_skip):
                    continue
                elif within(range_plus):
                    amount_total += amount
                elif within(range_minus):
                    amount_total -= amount
            return pos, amount_total
开发者ID:P4ncake,项目名称:weboob,代码行数:30,代码来源:parsers.py


示例6: items

    def items(self):
        for shmt in self.shipments():
            root = shmt.xpath(u'../../../../../../../..'
                              u'//b[text()="Items Ordered"]')[0]
            for item in root.xpath('../../../tr')[1:]:
                count = url = label = None
                for div in item.xpath('*//div'):
                    m = re.match(u'^\s*(\d+)\s*of:(.*)$', div.text,
                                 re.MULTILINE + re.DOTALL)
                    if not m:
                        continue
                    count = Decimal(m.group(1).strip())
                    label = unicode(m.group(2).strip())
                    if label:
                        url = u''
                    else:
                        a = div.xpath('*//a[contains(@href,"/gp/product")]')[0]
                        url = unicode(a.attrib['href'])
                        label = unicode(a.text.strip())
                price1 = item.xpath('*//div')[-1].text.strip()
                price = count * AmTr.decimal_amount(price1)

                itm = Item()
                itm.label = label
                itm.url = url
                itm.price = price
                yield itm
开发者ID:sputnick-dev,项目名称:weboob,代码行数:27,代码来源:pages.py


示例7: shipping

 def shipping(self):
     if self.doc.xpath('//tr[@id="shipping_fee_row"]'
                       '//span[@class="free_shipping"]'):
         amount = '0'
     else:
         amount = self.doc.xpath('//span[@id="shipping_fee"]/text()')[0]
     return AmTr.decimal_amount(amount)
开发者ID:laurentb,项目名称:weboob,代码行数:7,代码来源:browser.py


示例8: payment_part

 def payment_part(self, which):
     # The numbers notation on VS is super wierd.
     # Sometimes negative amounts are represented by <em> element.
     for node in self.doc.xpath('//tbody[@class="payment-summary"]'
                           '//td[contains(text(),"%s")]/../td[2]' % which):
         strv = node.text_content().strip()
         v = Decimal(0) if strv == u'FREE' else AmTr.decimal_amount(strv)
         return -v if node.xpath('em') and v > 0 else v
     return Decimal(0)
开发者ID:P4ncake,项目名称:weboob,代码行数:9,代码来源:browser.py


示例9: iter_history_recent

    def iter_history_recent(self, account):
        self.start()
        if account.id != self._account_id():
            raise AccountNotFound()
        self._account_link().click()
        self.wait_ajax()
        for span in self.find('span.cM-maximizeButton'):
            span.click()
        for tr in self.find('tr.payments,tr.purchase'):
            trdata = lambda n: tr.find_element_by_css_selector(
                        'td.cT-bodyTableColumn%i span.cT-line1' % n).text
            treid = tr.get_attribute('id').replace('rowID', 'rowIDExt')
            tredata = {}
            for tre in self.find('tr#%s' % treid):
                labels = [x.text for x in tre.find_elements_by_css_selector(
                                                    'div.cT-labelItem')]
                values = [x.text for x in tre.find_elements_by_css_selector(
                                                    'div.cT-valueItem')]
                tredata = dict(zip(labels, values))

            ref = tredata.get(u'Reference Number:', u'')
            tdate = trdata(1)
            pdate = tredata.get(u'Posted Date :', tdate)
            desc = clean_label(trdata(2))
            amount = trdata(4)

            tdate = datetime.datetime.strptime(tdate, '%m-%d-%Y')
            pdate = datetime.datetime.strptime(pdate, '%m-%d-%Y')

            if amount.startswith(u'(') and amount.endswith(u')'):
                amount = AmTr.decimal_amount(amount[1:-1])
            else:
                amount = -AmTr.decimal_amount(amount)

            trans = Transaction(ref)
            trans.date = tdate
            trans.rdate = pdate
            trans.type = Transaction.TYPE_UNKNOWN
            trans.raw = desc
            trans.label = desc
            trans.amount = amount
            yield trans

        self.finish()
开发者ID:frankrousseau,项目名称:weboob-modules,代码行数:44,代码来源:browser.py


示例10: account

 def account(self):
     detact = self.doc["accountDetailsAndActivity"]
     details = detact["accountDetails"]
     account = Account()
     account.type = Account.TYPE_CARD
     account.label = re.sub(r"<[^>]+>", "", detact["accountName"])
     account.id = account.label[-4:]
     for bal in details["accountBalances"]:
         label, value = bal["label"], (bal["value"] or ["0"])[0]
         if label == u"Current Balance:":
             account.currency = Account.get_currency(value)
             account.balance = -AmTr.decimal_amount(value)
         elif label == u"Total Revolving Credit Line:":
             account.cardlimit = AmTr.decimal_amount(value)
         elif label.startswith(u"Minimum Payment Due"):
             d = re.match(r".*(..-..-....):$", label).group(1)
             account.paydate = datetime.strptime(d, "%m-%d-%Y")
             account.paymin = AmTr.decimal_amount(value)
     return account
开发者ID:ngrislain,项目名称:weboob,代码行数:19,代码来源:browser.py


示例11: account

 def account(self):
     detact = self.doc['accountDetailsAndActivity']
     details = detact['accountDetails']
     account = Account()
     account.type = Account.TYPE_CARD
     account.label = re.sub(r'<[^>]+>', '', detact['accountName'])
     account.id = account.label[-4:]
     for bal in details['accountBalances']:
         label, value = bal['label'], (bal['value'] or ['0'])[0]
         if label == u'Current Balance:':
             account.currency = Account.get_currency(value)
             account.balance = -AmTr.decimal_amount(value)
         elif label == u'Total Revolving Credit Line:':
             account.cardlimit = AmTr.decimal_amount(value)
         elif label.startswith(u'Minimum Payment Due'):
             d = re.match(r'.*(..-..-....):$', label).group(1)
             account.paydate = datetime.strptime(d, '%m-%d-%Y')
             account.paymin = AmTr.decimal_amount(value)
     return account
开发者ID:ffourcot,项目名称:weboob,代码行数:19,代码来源:browser.py


示例12: iter_accounts

 def iter_accounts(self):
     self.start()
     bal = self.wait('div.cT-valueItem span.cT-balanceIndicator1')[0].text
     account = Account()
     account.id = self._account_id()
     account.label = self._account_link().text
     account.currency = Account.get_currency(bal)
     account.balance = -AmTr.decimal_amount(bal)
     account.type = Account.TYPE_CARD
     self.finish()
     yield account
开发者ID:frankrousseau,项目名称:weboob-modules,代码行数:11,代码来源:browser.py


示例13: account

 def account(self):
     id_ = self.doc.xpath(u'//strong[contains(text(),'
         '"credit card account ending in")]/text()')[0].strip()[-4:]
     balance = self.doc.xpath(u'//span[@class="description" and text()="Current Balance"]/../span[@class="total"]/text()')[0].strip()
     cardlimit = self.doc.xpath(u'//span[contains(text(),"Credit limit")]'
                                 '/text()')[0].split()[-1]
     paymin = self.doc.xpath(u'//section[@id=" account_summary"]'
         '//strong[text()="Minimum Payment Due"]/../../span[2]/text()'
         )[0].strip()
     a = Account()
     a.id = id_
     a.label = u'ACCOUNT ENDING IN %s' % id_
     a.currency = Account.get_currency(balance)
     a.balance = -AmTr.decimal_amount(balance)
     a.type = Account.TYPE_CARD
     a.cardlimit = AmTr.decimal_amount(cardlimit)
     a.paymin = AmTr.decimal_amount(paymin)
     #TODO: Add paydate.
     #Oleg: I don't have an account with scheduled payment.
     #      Need to wait for a while...
     return a
开发者ID:dasimon,项目名称:weboob,代码行数:21,代码来源:browser.py


示例14: account

 def account(self):
     label = u' '.join(u''.join(self.doc.xpath(
         u'//text()[contains(.,"Account ending in")]')).split())
     balance = self.doc.xpath(
         '//span[@id="currentBalance"]/..')[0].text_content()
     cardlimit = self.doc.xpath(u'//td[contains(text(),'
         '"Total Credit Limit")]/../td[2]')[0].text_content()
     paydate = self.doc.xpath(u'//td[contains(text(),'
         '"Payment Due Date")]/../td[2]')[0].text_content()
     paymin = self.doc.xpath(
         '//span[@id="nextMinPayment"]/..')[0].text_content()
     a = Account()
     a.id = label[-4:]
     a.label = label
     a.currency = Account.get_currency(balance)
     a.balance = -AmTr.decimal_amount(balance)
     a.type = Account.TYPE_CARD
     a.cardlimit = AmTr.decimal_amount(cardlimit)
     a.paydate = datetime.strptime(paydate, '%m/%d/%Y')
     a.paymin = AmTr.decimal_amount(paymin)
     return a
开发者ID:nojhan,项目名称:weboob-devel,代码行数:21,代码来源:pages.py


示例15: items

 def items(self):
     for tr in self.doc.xpath('//tbody[@class="order-items"]/tr'):
         label = tr.xpath('*//h1')[0].text_content().strip()
         price = AmTr.decimal_amount(re.match(r'^\s*([^\s]+)(\s+.*)?',
             tr.xpath('*//div[@class="price"]')[0].text_content(),
             re.DOTALL).group(1))
         url = 'http:' + tr.xpath('*//img/@src')[0]
         item = Item()
         item.label = unicode(label)
         item.url = unicode(url)
         item.price = price
         yield item
开发者ID:P4ncake,项目名称:weboob,代码行数:12,代码来源:browser.py


示例16: account

 def account(self):
     label = u' '.join(u''.join(self.doc.xpath(
         u'//text()[contains(.,"Account ending in")]')).split())
     balance = self.doc.xpath(
         '//span[@id="currentBalance"]/..')[0].text_content()
     a = Account()
     a.id = label[-4:]
     a.label = label
     a.currency = Account.get_currency(balance)
     a.balance = -AmTr.decimal_amount(balance)
     a.type = Account.TYPE_CARD
     return a
开发者ID:frankrousseau,项目名称:weboob-modules,代码行数:12,代码来源:pages.py


示例17: iter_transactions

 def iter_transactions(self):
     for li in self.doc.xpath('//section[@class="transactions"]//div/li'):
         date = li.xpath('p[@data-type="date"]//text()')[0].strip()
         label = li.xpath('p[@data-type="description"]//text()')[0].strip()
         amount = li.xpath('p[@data-type="amount"]//text()')[0].strip()
         t = Transaction()
         t.date = datetime.strptime(date, '%m/%d/%Y')
         t.rdate = datetime.strptime(date, '%m/%d/%Y')
         t.type = Transaction.TYPE_UNKNOWN
         t.raw = unicode(label)
         t.label = unicode(label)
         t.amount = -AmTr.decimal_amount(amount)
         yield t
开发者ID:dasimon,项目名称:weboob,代码行数:13,代码来源:browser.py


示例18: payments

 def payments(self):
     for tr in self.doc.xpath('//tbody[@class="payment-summary"]'
                     '//th[text()="Payment Summary"]/../../../tbody/tr'):
         method = tr.xpath('td[1]/text()')[0]
         amnode = tr.xpath('td[2]')[0]
         amsign = -1 if amnode.xpath('em') else 1
         amount = amnode.text_content().strip()
         pmt = Payment()
         pmt.date = self.order_date()
         pmt.method = unicode(method)
         pmt.amount = amsign * AmTr.decimal_amount(amount)
         if pmt.method not in [u'Funds to be applied on backorder']:
             yield pmt
开发者ID:P4ncake,项目名称:weboob,代码行数:13,代码来源:browser.py


示例19: unsorted_trans

    def unsorted_trans(self):
        for jnl in self.doc["accountDetailsAndActivity"]["accountActivity"]["postedTransactionJournals"]:
            tdate = jnl["columns"][0]["activityColumn"][0]
            label = jnl["columns"][1]["activityColumn"][0]
            amount = jnl["columns"][3]["activityColumn"][0]
            xdescs = dict((x["label"], x["value"][0]) for x in jnl["extendedDescriptions"])
            pdate = xdescs[u"Posted Date :"]
            ref = xdescs.get(u"Reference Number:") or u""

            if amount.startswith(u"(") and amount.endswith(u")"):
                amount = AmTr.decimal_amount(amount[1:-1])
            else:
                amount = -AmTr.decimal_amount(amount)
            label = clean_label(label)

            trans = Transaction(ref)
            trans.date = datetime.strptime(tdate, "%m-%d-%Y")
            trans.rdate = datetime.strptime(pdate, "%m-%d-%Y")
            trans.type = Transaction.TYPE_UNKNOWN
            trans.raw = label
            trans.label = label
            trans.amount = amount
            yield trans
开发者ID:ngrislain,项目名称:weboob,代码行数:23,代码来源:browser.py


示例20: get_account

    def get_account(self):
        name = self.account_name()
        balance = self.account_balance()
        currency = Account.get_currency(balance)
        id_ = self.account_id()
        type_ = self.account_type()
        paydate, paymin = self.account_paydatemin()
        cardlimit = self.account_cardlimit()

        account = Account()
        account.id = id_
        account.label = name
        account.currency = currency
        account.balance = AmTr.decimal_amount(balance)
        account.type = type_
        if paydate is not None:
            account.paydate = paydate
        if paymin is not None:
            account.paymin = paymin
        if cardlimit is not None:
            account.cardlimit = AmTr.decimal_amount(cardlimit)

        return account
开发者ID:laurentb,项目名称:weboob,代码行数:23,代码来源:pages.py



注:本文中的weboob.tools.capabilities.bank.transactions.AmericanTransaction类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python transactions.FrenchTransaction类代码示例发布时间:2022-05-26
下一篇:
Python browser.BaseBrowser类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap