本文整理汇总了Python中weboob.tools.capabilities.bank.transactions.FrenchTransaction.original_amount方法的典型用法代码示例。如果您正苦于以下问题:Python FrenchTransaction.original_amount方法的具体用法?Python FrenchTransaction.original_amount怎么用?Python FrenchTransaction.original_amount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weboob.tools.capabilities.bank.transactions.FrenchTransaction
的用法示例。
在下文中一共展示了FrenchTransaction.original_amount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_transaction
# 需要导入模块: from weboob.tools.capabilities.bank.transactions import FrenchTransaction [as 别名]
# 或者: from weboob.tools.capabilities.bank.transactions.FrenchTransaction import original_amount [as 别名]
def parse_transaction(self, transaction, account):
trans = []
if transaction['transactionStatus'] in [u'Créé', u'Annulé', u'Suspendu', u'Mis à jour', u'Actif', u'Payé', u'En attente', u'Rejeté', u'Expiré', \
u'Created']:
return []
if transaction['transactionDescription'].startswith(u'Offre de remboursement') or transaction['transactionDescription'].startswith(u'Commande à'):
return []
t = FrenchTransaction(transaction['transactionId'])
if not transaction['transactionAmount']['currencyCode'] == account.currency:
cc = self.browser.convert_amount(account, transaction, 'https://www.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=' + transaction['transactionId'])
if not cc:
return []
t.original_amount = Decimal('%.2f' % transaction['transactionAmount']['currencyDoubleValue'])
t.original_currency = u'' + transaction['transactionAmount']['currencyCode']
t.amount = abs(cc) if not transaction['debit'] else -abs(cc)
else:
t.amount = Decimal('%.2f' % transaction['net']['currencyDoubleValue'])
date = parse_french_date(transaction['transactionTime'])
raw = transaction['transactionDescription']
if raw.startswith(u'Paiement \xe0') or raw.startswith('Achat de'):
payback_id, payback_raw, payback_amount, payback_currency = self.browser.check_for_payback(transaction, 'https://www.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=' + transaction['transactionId'])
if payback_id and payback_raw and payback_amount and payback_currency:
t_payback = FrenchTransaction(payback_id)
t_payback.amount = payback_amount
t_payback.original_currency = payback_currency
t_payback.type = FrenchTransaction.TYPE_TRANSFER
t_payback.parse(date=date, raw=u'Prélèvement pour %s' % raw)
trans.append(t_payback)
t.commission = Decimal('%.2f' % transaction['fee']['currencyDoubleValue'])
t.parse(date=date, raw=raw)
trans.append(t)
return trans
示例2: parse_transaction
# 需要导入模块: from weboob.tools.capabilities.bank.transactions import FrenchTransaction [as 别名]
# 或者: from weboob.tools.capabilities.bank.transactions.FrenchTransaction import original_amount [as 别名]
def parse_transaction(self, transaction, account):
t = FrenchTransaction(transaction['id'])
if not transaction['isPrimaryCurrency']:
original_currency = unicode(transaction['amounts']['txnCurrency'])
if original_currency in self.browser.account_currencies:
return []
if 'conversionFrom' in transaction['amounts'] and account.currency == transaction['amounts']['conversionFrom']['currency']:
cc = self.format_amount(transaction['amounts']['conversionFrom']['value'], transaction['isCredit'])
else:
try:
cc = self.browser.convert_amount(account, transaction, transaction['detailsLink'])
except ServerError:
self.logger.warning('Unable to go on detail, transaction skipped.')
return []
if not cc:
return []
t.original_amount = self.format_amount(transaction['amounts']['net']['value'], transaction["isCredit"])
t.original_currency = original_currency
t.amount = self.format_amount(cc, transaction['isCredit'])
else:
t.amount = self.format_amount(transaction['amounts']['net']['value'], transaction['isCredit'])
date = parse_french_date(transaction['date']['formattedDate'] + ' ' + transaction['date']['year'])
raw = transaction.get('counterparty', transaction['displayType'])
t.parse(date=date, raw=raw)
return [t]
示例3: parse_transaction
# 需要导入模块: from weboob.tools.capabilities.bank.transactions import FrenchTransaction [as 别名]
# 或者: from weboob.tools.capabilities.bank.transactions.FrenchTransaction import original_amount [as 别名]
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
示例4: parse_transaction
# 需要导入模块: from weboob.tools.capabilities.bank.transactions import FrenchTransaction [as 别名]
# 或者: from weboob.tools.capabilities.bank.transactions.FrenchTransaction import original_amount [as 别名]
def parse_transaction(self, transaction, account):
if transaction['transactionStatus'] in [u'Créé', u'Annulé', u'Suspendu', u'Mis à jour', u'Actif']:
return
t = FrenchTransaction(transaction['transactionId'])
if not transaction['transactionAmount']['currencyCode'] == account.currency:
cc = self.browser.convert_amount(account, transaction, 'https://www.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=' + transaction['transactionId'])
if not cc:
return
t.original_amount = Decimal(transaction['transactionAmount']['currencyDoubleValue'])
t.original_currency = u'' + transaction['transactionAmount']['currencyCode']
t.set_amount(cc)
else:
t.amount = Decimal(transaction['transactionAmount']['currencyDoubleValue'])
date = parse_french_date(transaction['transactionTime'])
raw = transaction['transactionDescription']
t.commission = Decimal(transaction['fee']['currencyDoubleValue'])
t.parse(date=date, raw=raw)
return t
示例5: parse_transaction
# 需要导入模块: from weboob.tools.capabilities.bank.transactions import FrenchTransaction [as 别名]
# 或者: from weboob.tools.capabilities.bank.transactions.FrenchTransaction import original_amount [as 别名]
def parse_transaction(self, transaction, account):
page = None
if 'id' not in transaction or not transaction['date']:
return []
t = FrenchTransaction(transaction['id'])
if not transaction['isPrimaryCurrency']:
if not 'txnCurrency' in transaction['amounts']:
return []
original_currency = unicode(transaction['amounts']['txnCurrency'])
if original_currency in self.browser.account_currencies:
return []
if 'conversionFrom' in transaction['amounts'] and 'value' in transaction['amounts']['conversionFrom'] and account.currency == transaction['amounts']['conversionFrom']['currency']:
cc = self.format_amount(transaction['amounts']['conversionFrom']['value'], transaction['isCredit'])
else:
try:
page = self.return_detail_page(transaction['detailsLink'])
cc = page.get_converted_amount() if isinstance(page, HistoryDetailsPage) else None
except ServerError:
self.logger.warning('Unable to go on detail, transaction skipped.')
return []
if not cc:
return []
t.original_amount = self.format_amount(transaction['amounts']['net']['value'], transaction["isCredit"])
t.original_currency = original_currency
t.amount = self.format_amount(cc, transaction['isCredit'])
else:
t.amount = self.format_amount(transaction['amounts']['net']['value'], transaction['isCredit'])
date = parse_french_date(transaction['date']['formattedDate'] + ' ' + transaction['date']['year']).date()
raw = transaction.get('counterparty', transaction['displayType'])
t.parse(date=date, raw=raw)
if page is None and t.amount < 0:
page = self.return_detail_page(transaction['detailsLink'])
funding_src = page.get_funding_src(t) if isinstance(page, HistoryDetailsPage) else None
return [t] if funding_src is None else ([t] + [funding_src])