patreon: Update importer for recent patron changes. RT#12747
All they did was change a couple of column names.
This commit is contained in:
parent
fcd14f3c44
commit
347203b5f4
4 changed files with 34 additions and 3 deletions
|
@ -6,8 +6,8 @@ from .. import strparse
|
||||||
|
|
||||||
class IncomeImporter(_csv.CSVImporterBase):
|
class IncomeImporter(_csv.CSVImporterBase):
|
||||||
AMOUNT_KEY = 'Pledge $'
|
AMOUNT_KEY = 'Pledge $'
|
||||||
DATE_KEY = 'Charged On Date'
|
DATE_KEY = 'Last Charge Date'
|
||||||
STATUS_KEY = 'Charge Status'
|
STATUS_KEY = 'Last Charge Status'
|
||||||
NEEDED_FIELDS = frozenset([
|
NEEDED_FIELDS = frozenset([
|
||||||
AMOUNT_KEY,
|
AMOUNT_KEY,
|
||||||
DATE_KEY,
|
DATE_KEY,
|
||||||
|
@ -93,6 +93,16 @@ class VATImporter(FeeImporterBase):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Income2020AugustImporter(IncomeImporter):
|
||||||
|
DATE_KEY = 'Charged On Date'
|
||||||
|
STATUS_KEY = 'Charge Status'
|
||||||
|
NEEDED_FIELDS = frozenset([
|
||||||
|
IncomeImporter.AMOUNT_KEY,
|
||||||
|
DATE_KEY,
|
||||||
|
STATUS_KEY,
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
class Income2017Importer(_csv.CSVImporterBase):
|
class Income2017Importer(_csv.CSVImporterBase):
|
||||||
NEEDED_FIELDS = frozenset([
|
NEEDED_FIELDS = frozenset([
|
||||||
'FirstName',
|
'FirstName',
|
||||||
|
|
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.1.0',
|
version='1.2.0',
|
||||||
author='Brett Smith',
|
author='Brett Smith',
|
||||||
author_email='brettcsmith@brettcsmith.org',
|
author_email='brettcsmith@brettcsmith.org',
|
||||||
license='GNU AGPLv3+',
|
license='GNU AGPLv3+',
|
||||||
|
|
3
tests/data/PatreonPatronReport_2020-10-01.csv
Normal file
3
tests/data/PatreonPatronReport_2020-10-01.csv
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Name,Email,Twitter,Patron Status,Follows You,Lifetime $,Pledge $,Charge Frequency,Tier,Addressee,Street,City,State,Zip,Country,Phone,Patronage Since Date,Max Amount,Last Charge Date,Last Charge Status,Additional Details,User ID,Last Updated
|
||||||
|
Alex Jones,ajones@example.com,,Active patron,No,$28,$2,monthly,Even tier,,,,,,,,2019-10-30 18:25:15.457830,$2,2020-08-01 18:21:04,Paid,,1234567,2020-08-12 12:34:31.348413
|
||||||
|
Breonna,breonna@example.org,patreonb,Active patron,No,$5,$5,monthly,Odd tier,,,,,,,,2020-08-02 11:59:15.365305,$5,2020-08-02 12:00:02,Paid,,234567,2020-08-12 12:43:08.745681
|
|
|
@ -11,6 +11,24 @@
|
||||||
currency: USD
|
currency: USD
|
||||||
|
|
||||||
- source: PatreonPatronReport_2020-08-01.csv
|
- source: PatreonPatronReport_2020-08-01.csv
|
||||||
|
importer: patreon.Income2020AugustImporter
|
||||||
|
expect:
|
||||||
|
- payee: Alex Jones
|
||||||
|
email: ajones@example.com
|
||||||
|
tier: Even tier
|
||||||
|
patreon_id: "1234567"
|
||||||
|
date: !!python/object/apply:datetime.date [2020, 8, 1]
|
||||||
|
amount: !!python/object/apply:decimal.Decimal ["2"]
|
||||||
|
currency: USD
|
||||||
|
- payee: Breonna
|
||||||
|
email: breonna@example.org
|
||||||
|
tier: Odd tier
|
||||||
|
patreon_id: "234567"
|
||||||
|
date: !!python/object/apply:datetime.date [2020, 8, 2]
|
||||||
|
amount: !!python/object/apply:decimal.Decimal ["5.00"]
|
||||||
|
currency: USD
|
||||||
|
|
||||||
|
- source: PatreonPatronReport_2020-10-01.csv
|
||||||
importer: patreon.IncomeImporter
|
importer: patreon.IncomeImporter
|
||||||
expect:
|
expect:
|
||||||
- payee: Alex Jones
|
- payee: Alex Jones
|
||||||
|
|
Loading…
Reference in a new issue