update GitHub Sponsors importer
This commit is contained in:
parent
ac2359101b
commit
8b0fd52602
2 changed files with 7 additions and 8 deletions
|
@ -6,15 +6,14 @@ from .. import strparse
|
||||||
class SponsorsImporter(_csv.CSVImporterBase):
|
class SponsorsImporter(_csv.CSVImporterBase):
|
||||||
DATE_FMT = '%Y-%m-%d %H:%M:%S %z'
|
DATE_FMT = '%Y-%m-%d %H:%M:%S %z'
|
||||||
NEEDED_FIELDS = frozenset([
|
NEEDED_FIELDS = frozenset([
|
||||||
'processed amount',
|
'transferred amount',
|
||||||
'status',
|
'transaction timestamp',
|
||||||
'transaction date',
|
|
||||||
])
|
])
|
||||||
COPIED_FIELDS = {
|
COPIED_FIELDS = {
|
||||||
'sponsor handle': 'handle',
|
'sponsor handle': 'handle',
|
||||||
# 'sponsor profile name': 'name',
|
# 'sponsor profile name': 'name',
|
||||||
'sponsor email': 'email',
|
'sponsor email': 'email',
|
||||||
'transaction id': 'transaction_id',
|
'stripe transfer id': 'transaction_id',
|
||||||
}
|
}
|
||||||
ENTRY_SEED = {'currency': 'USD'}
|
ENTRY_SEED = {'currency': 'USD'}
|
||||||
PAYEE_MAP = {
|
PAYEE_MAP = {
|
||||||
|
@ -22,12 +21,12 @@ class SponsorsImporter(_csv.CSVImporterBase):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _read_row(self, row):
|
def _read_row(self, row):
|
||||||
amount = strparse.currency_decimal(row['processed amount'])
|
amount = strparse.currency_decimal(row['transferred amount'])
|
||||||
if (not amount) or row['status'] != 'settled':
|
if (not amount):
|
||||||
return None
|
return None
|
||||||
payee = row.get('sponsor profile name') or row['sponsor handle']
|
payee = row.get('sponsor profile name') or row['sponsor handle']
|
||||||
return {
|
return {
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
'date': strparse.date(row['transaction date'], self.DATE_FMT),
|
'date': strparse.date(row['transaction timestamp'], self.DATE_FMT),
|
||||||
'payee': self.PAYEE_MAP.get(payee, payee),
|
'payee': self.PAYEE_MAP.get(payee, payee),
|
||||||
}
|
}
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -30,7 +30,7 @@ REQUIREMENTS['tests_require'] = [
|
||||||
setup(
|
setup(
|
||||||
name='import2ledger',
|
name='import2ledger',
|
||||||
description="Import different sources of financial data to Ledger",
|
description="Import different sources of financial data to Ledger",
|
||||||
version='1.4.4',
|
version='1.4.5',
|
||||||
author='Brett Smith',
|
author='Brett Smith',
|
||||||
author_email='brettcsmith@brettcsmith.org',
|
author_email='brettcsmith@brettcsmith.org',
|
||||||
license='GNU AGPLv3+',
|
license='GNU AGPLv3+',
|
||||||
|
|
Loading…
Reference in a new issue