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
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
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'//section[@id=" account_summary"]' '//span[text()="Current Balance"]/../span[2]/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
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
def get_account(self): json = self._auth() account = Account(id=Dict('id')(json)) account.number = account.id # weboob.capabilities.bank.BaseAccount account.bank_name = 'Lunchr' account.type = Account.TYPE_CHECKING # Check if account have a card balance = Dict('meal_voucher_info/balance/value', default=None)(json) if empty(balance): return account.balance = CleanDecimal.SI(balance)(json) account.label = Format('%s %s', CleanText(Dict('first_name')), CleanText(Dict('last_name')))(json) account.currency = Currency(Dict('meal_voucher_info/balance/currency/iso_3'))(json) account.cardlimit = CleanDecimal.SI(Dict('meal_voucher_info/daily_balance/value'))(json) yield 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
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
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
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