Changeset - 347203b5f420
[Not reviewed]
0 3 1
Brett Smith - 4 years ago 2020-10-05 17:49:39
brettcsmith@brettcsmith.org
patreon: Update importer for recent patron changes. RT#12747

All they did was change a couple of column names.
4 files changed with 34 insertions and 3 deletions:
0 comments (0 inline, 0 general)
import2ledger/importers/patreon.py
Show inline comments
...
 
@@ -6,8 +6,8 @@ from .. import strparse
 

	
 
class IncomeImporter(_csv.CSVImporterBase):
 
    AMOUNT_KEY = 'Pledge $'
 
    DATE_KEY = 'Charged On Date'
 
    STATUS_KEY = 'Charge Status'
 
    DATE_KEY = 'Last Charge Date'
 
    STATUS_KEY = 'Last Charge Status'
 
    NEEDED_FIELDS = frozenset([
 
        AMOUNT_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):
 
    NEEDED_FIELDS = frozenset([
 
        'FirstName',
setup.py
Show inline comments
...
 
@@ -30,7 +30,7 @@ REQUIREMENTS['tests_require'] = [
 
setup(
 
    name='import2ledger',
 
    description="Import different sources of financial data to Ledger",
 
    version='1.1.0',
 
    version='1.2.0',
 
    author='Brett Smith',
 
    author_email='brettcsmith@brettcsmith.org',
 
    license='GNU AGPLv3+',
tests/data/PatreonPatronReport_2020-10-01.csv
Show inline comments
 
new file 100644
 
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
tests/data/imports.yml
Show inline comments
...
 
@@ -11,6 +11,24 @@
 
      currency: USD
 

	
 
- 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
 
  expect:
 
    - payee: Alex Jones
0 comments (0 inline, 0 general)