diff --git a/import2ledger/importers/patreon.py b/import2ledger/importers/patreon.py index 2de0313..19e4348 100644 --- a/import2ledger/importers/patreon.py +++ b/import2ledger/importers/patreon.py @@ -8,11 +8,9 @@ class IncomeImporter(_csv.CSVImporterBase): NEEDED_FIELDS = frozenset([ 'FirstName', 'LastName', + 'Pledge', 'Status', ]) - COPIED_FIELDS = { - 'Pledge': 'amount', - } ENTRY_SEED = { 'currency': 'USD', } @@ -30,6 +28,7 @@ class IncomeImporter(_csv.CSVImporterBase): return None else: return { + 'amount': row['Pledge'].replace(',', ''), 'payee': '{0[FirstName]} {0[LastName]}'.format(row), } diff --git a/tests/data/PatreonPatronReport_2017-09-01.csv b/tests/data/PatreonPatronReport_2017-09-01.csv index 4ac9ef5..0c5459c 100644 --- a/tests/data/PatreonPatronReport_2017-09-01.csv +++ b/tests/data/PatreonPatronReport_2017-09-01.csv @@ -1,6 +1,6 @@ FirstName,LastName,Email,Pledge,Lifetime,Status,Twitter,Street,City,State,Zip,Country,Start,MaxAmount,Complete 100 + Reward,Description You donate a lot of money!,,,,,,,,,,,,, -Alex,Jones,alex@example.org,150,300,Processed,,,,,,,2017-08-11 11:28:06.166065,200,0 +Alex,Jones,alex@example.org,"1,500.00","3,000.00",Processed,,,,,,,2017-08-11 11:28:06.166065,"2,000.00",0 5 + Reward,Description You’re nice!,,,,,,,,,,,,, -Brett,Smith,brett@example.org,10,30,Declined,Brett20XX,,,,,,2017-08-10 13:24:15.955782,10,0 -Dakota,Doe,ddoe@example.org,12,48,Processed,,,,,,,2017-08-10 12:58:31.919341,12,0 +Brett,Smith,brett@example.org,10.00,30.00,Declined,Brett20XX,,,,,,2017-08-10 13:24:15.955782,10.00,0 +Dakota,Doe,ddoe@example.org,12.00,48.00,Processed,,,,,,,2017-08-10 12:58:31.919341,12.00,0 diff --git a/tests/data/imports.yml b/tests/data/imports.yml index 18b950b..cea69c6 100644 --- a/tests/data/imports.yml +++ b/tests/data/imports.yml @@ -3,7 +3,7 @@ expect: - payee: Alex Jones date: !!python/object/apply:datetime.date [2017, 9, 1] - amount: !!python/object/apply:decimal.Decimal ["150.00"] + amount: !!python/object/apply:decimal.Decimal ["1500.00"] currency: USD - payee: Dakota Doe date: !!python/object/apply:datetime.date [2017, 9, 1]