Changeset - c714b2f41fd2
[Not reviewed]
0 3 0
Brett Smith - 3 years ago 2021-03-18 15:47:56
brettcsmith@brettcsmith.org
patreon: Income2017Importer grabs email address.
3 files changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
import2ledger/importers/patreon.py
Show inline comments
 
import pathlib
 
import re
 

	
 
from . import _csv
 
from .. import strparse
 

	
 
class EarningsImporter(_csv.CSVImporterBase):
 
    AMOUNT_FIELDS = {
 
        'Creator Share': 'net_amount',
 
        'Creator Platform Fee': 'platform_fee',
 
        'Creator Payment Processing Fee': 'processing_fee',
 
        'Creator Currency Conversion Fee': 'currency_fee',
 
        'Creator Equivalent of Patron Tax': 'tax_amount',
 
    }
 
    DATE_KEY = 'Date'
 
    TYPE_KEY = 'Event Type'
 
    NEEDED_FIELDS = frozenset([*AMOUNT_FIELDS, DATE_KEY, TYPE_KEY])
 
    COPIED_FIELDS = {
 
        'Creator Currency': 'currency',
 
        'Event ID': 'event_id',
 
        'Patron Email': 'email',
 
        'Patron Name': 'payee',
 
        'Patron User ID': 'user_id',
 
    }
 
    DATE_FMT = '%Y-%m-%d %H:%M:%S'
 

	
 
    def _read_row(self, row):
 
        if row[self.TYPE_KEY] != 'Payment':
 
            return None
 
        retval = {
 
            ret_key: strparse.currency_decimal(row[src_key] or 0)
 
            for src_key, ret_key in self.AMOUNT_FIELDS.items()
 
        }
 
        retval['amount'] = sum(retval.values()) - retval['tax_amount']
 
        retval['date'] = strparse.date(row[self.DATE_KEY], self.DATE_FMT)
 
        return retval
 

	
 

	
 
class IncomeImporter(_csv.CSVImporterBase):
 
    AMOUNT_KEY = 'Pledge Amount'
 
    DATE_KEY = 'Last Charge Date'
 
    STATUS_KEY = 'Last Charge Status'
 
    NEEDED_FIELDS = frozenset([
 
        AMOUNT_KEY,
 
        DATE_KEY,
 
        STATUS_KEY,
 
    ])
 
    COPIED_FIELDS = {
 
        'Name': 'payee',
 
        'Email': 'email',
 
        'Tier': 'tier',
 
        'User ID': 'patreon_id',
 
    }
 
    ENTRY_SEED = {
 
        'currency': 'USD',
 
    }
 

	
 
    def __init_subclass__(cls):
 
        cls.NEEDED_FIELDS = frozenset([
 
            cls.AMOUNT_KEY,
 
            cls.DATE_KEY,
 
            cls.STATUS_KEY,
 
        ])
 

	
 
    def _read_row(self, row):
 
        if row[self.STATUS_KEY] != 'Paid':
 
            return None
 
        else:
 
            return {
 
                'amount': strparse.currency_decimal(row[self.AMOUNT_KEY]),
 
                'date': strparse.date(row[self.DATE_KEY], '%Y-%m-%d %H:%M:%S'),
 
            }
 

	
 

	
 
class PayoutImporter(_csv.CSVImporterBase):
 
    AMOUNT_KEY = 'Total funds deducted from creator balance'
 
    PLEDGE_KEY = 'Funds used for pledges to other creators'
 
    TRANSFER_KEY = 'Funds transferred to you'
 
    NEEDED_FIELDS = frozenset([
 
        'Month',
 
        TRANSFER_KEY,
 
        PLEDGE_KEY,
 
        AMOUNT_KEY,
 
    ])
 
    ENTRY_SEED = {
 
        'currency': 'USD',
 
        'payee': 'Patreon',
 
    }
 

	
 
    def _read_row(self, row):
 
        amount = strparse.currency_decimal(row[self.AMOUNT_KEY])
 
        if not amount:
 
            return None
 
        else:
 
            return {
 
                'amount': amount,
 
                'date': strparse.date(row['Month'], '%Y-%m'),
 
                'pledges_amount': strparse.currency_decimal(row[self.PLEDGE_KEY]),
 
                'transfer_amount': strparse.currency_decimal(row[self.TRANSFER_KEY]),
 
            }
 

	
 

	
 
class FeeImporterBase(_csv.CSVImporterBase):
 
    ENTRY_SEED = {
 
        'currency': 'USD',
 
        'payee': "Patreon",
 
    }
 

	
 
    def _read_row(self, row):
 
        return {
 
            'amount': row[self.AMOUNT_FIELD],
 
            'date': strparse.date(row['Month'], '%Y-%m'),
 
        }
 

	
 

	
 
class ServiceFeesImporter(FeeImporterBase):
 
    AMOUNT_FIELD = 'Patreon Fee'
 
    NEEDED_FIELDS = frozenset(['Month', AMOUNT_FIELD])
 

	
 

	
 
class CardFeesImporter(FeeImporterBase):
 
    AMOUNT_FIELD = 'Processing Fees'
 
    NEEDED_FIELDS = frozenset(['Month', AMOUNT_FIELD])
 

	
 

	
 
class VATImporter(FeeImporterBase):
 
    AMOUNT_FIELD = 'Vat Charged'
 
    NEEDED_FIELDS = frozenset(['Month', AMOUNT_FIELD])
 
    COPIED_FIELDS = {
 
        'Country Code': 'country_code',
 
        'Country Name': 'country_name',
 
    }
 

	
 

	
 

	
 
class Income2020OctoberImporter(IncomeImporter):
 
    AMOUNT_KEY = 'Pledge $'
 

	
 

	
 
class Income2020AugustImporter(Income2020OctoberImporter):
 
    DATE_KEY = 'Charged On Date'
 
    STATUS_KEY = 'Charge Status'
 

	
 

	
 
class Income2017Importer(_csv.CSVImporterBase):
 
    NEEDED_FIELDS = frozenset([
 
        'FirstName',
 
        'LastName',
 
        'Pledge',
 
        'Status',
 
    ])
 
    COPIED_FIELDS = {
 
        'Email': 'email',
 
        'Pledge': 'amount',
 
    }
 
    ENTRY_SEED = {
 
        'currency': 'USD',
 
    }
 

	
 
    def __init__(self, input_file):
 
        super().__init__(input_file)
 
        match = re.search(r'(?:\b|_)(\d{4}-\d{2}-\d{2})(?:\b|_)',
 
                          pathlib.Path(input_file.name).name)
 
        if match:
 
            self.entry_seed['date'] = strparse.date(match.group(1), '%Y-%m-%d')
 

	
 
    def _read_row(self, row):
 
        if row['Status'] != 'Processed':
 
            return None
 
        else:
 
            return {
 
                'payee': '{0[FirstName]} {0[LastName]}'.format(row),
 
            }
setup.py
Show inline comments
 
#!/usr/bin/env python3
 

	
 
import sys
 

	
 
from setuptools import setup, find_packages
 

	
 
REQUIREMENTS = {
 
    'install_requires': [
 
        'babel',
 
        'enum34;python_version<"3.4"',
 
    ],
 
    'setup_requires': ['pytest-runner'],
 
    'extras_require': {
 
        'brightfunds': ['xlrd'],
 
        'nbpy2017': ['beautifulsoup4', 'html5lib'],
 
    },
 
}
 

	
 
all_extras_require = [
 
    req for reqlist in REQUIREMENTS['extras_require'].values() for req in reqlist
 
]
 

	
 
REQUIREMENTS['extras_require']['all_importers'] = all_extras_require
 
REQUIREMENTS['tests_require'] = [
 
    'pytest',
 
    'PyYAML',
 
    *all_extras_require,
 
]
 

	
 
setup(
 
    name='import2ledger',
 
    description="Import different sources of financial data to Ledger",
 
    version='1.4.2',
 
    version='1.4.3',
 
    author='Brett Smith',
 
    author_email='brettcsmith@brettcsmith.org',
 
    license='GNU AGPLv3+',
 

	
 
    packages=find_packages(include=['import2ledger', 'import2ledger.*']),
 
    entry_points={
 
        'console_scripts': ['import2ledger = import2ledger.__main__:main'],
 
    },
 

	
 
    **REQUIREMENTS,
 
)
tests/data/imports.yml
Show inline comments
 
- source: PatreonPatronReport_2017-09-01.csv
 
  importer: patreon.Income2017Importer
 
  expect:
 
    - payee: Alex Jones
 
      date: !!python/object/apply:datetime.date [2017, 9, 1]
 
      amount: !!python/object/apply:decimal.Decimal ["1500.00"]
 
      currency: USD
 
      email: alex@example.org
 
    - payee: Dakota Doe
 
      date: !!python/object/apply:datetime.date [2017, 9, 1]
 
      amount: !!python/object/apply:decimal.Decimal ["12.00"]
 
      currency: USD
 
      email: ddoe@example.org
 

	
 
- 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.Income2020OctoberImporter
 
  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-11-01.csv
 
  importer: patreon.IncomeImporter
 
  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: PatreonEarnings.csv
 
  importer: patreon.ServiceFeesImporter
 
  expect:
 
    - payee: Patreon
 
      date: !!python/object/apply:datetime.date [2017, 9, 1]
 
      amount: !!python/object/apply:decimal.Decimal ["61.73"]
 
      currency: USD
 
    - payee: Patreon
 
      date: !!python/object/apply:datetime.date [2017, 10, 1]
 
      amount: !!python/object/apply:decimal.Decimal ["117.03"]
 
      currency: USD
 

	
 
- source: PatreonEarnings2020.csv
 
  importer: patreon.EarningsImporter
 
  expect:
 
    - payee: Frances Jones
 
      email: fjones@example.com
 
      user_id: "32101234"
 
      event_id: "30123456"
 
      date: !!python/object/apply:datetime.date [2020, 12, 3]
 
      currency: USD
 
      amount: !!python/object/apply:decimal.Decimal ["5"]
 
      tax_amount: !!python/object/apply:decimal.Decimal ["1"]
 
      net_amount: !!python/object/apply:decimal.Decimal ["4.31"]
 
      platform_fee: !!python/object/apply:decimal.Decimal ["0.25"]
 
      processing_fee: !!python/object/apply:decimal.Decimal ["0.44"]
 
      currency_fee: !!python/object/apply:decimal.Decimal ["0"]
 
    - payee: Barbara Johnson
 
      email: bjohnson@example.com
 
      user_id: "2345678"
 
      event_id: "34567890"
 
      date: !!python/object/apply:datetime.date [2020, 12, 2]
 
      currency: USD
 
      amount: !!python/object/apply:decimal.Decimal ["6.06"]
 
      tax_amount: !!python/object/apply:decimal.Decimal ["1.27"]
 
      net_amount: !!python/object/apply:decimal.Decimal ["5.14"]
 
      platform_fee: !!python/object/apply:decimal.Decimal ["0.31"]
 
      processing_fee: !!python/object/apply:decimal.Decimal ["0.42"]
 
      currency_fee: !!python/object/apply:decimal.Decimal ["0.19"]
 
    - payee: Alex Jones
 
      email: ajones@example.com
 
      user_id: "7654321"
 
      event_id: "456789090"
 
      date: !!python/object/apply:datetime.date [2020, 12, 1]
 
      currency: USD
 
      amount: !!python/object/apply:decimal.Decimal ["14"]
 
      tax_amount: !!python/object/apply:decimal.Decimal ["0"]
 
      net_amount: !!python/object/apply:decimal.Decimal ["12.64"]
 
      platform_fee: !!python/object/apply:decimal.Decimal [".7"]
 
      processing_fee: !!python/object/apply:decimal.Decimal [".66"]
 
      currency_fee: !!python/object/apply:decimal.Decimal ["0"]
 

	
 
- source: PatreonEarnings.csv
 
  importer: patreon.CardFeesImporter
 
  expect:
 
    - payee: Patreon
 
      date: !!python/object/apply:datetime.date [2017, 9, 1]
 
      amount: !!python/object/apply:decimal.Decimal ["52.47"]
 
      currency: USD
 
    - payee: Patreon
 
      date: !!python/object/apply:datetime.date [2017, 10, 1]
 
      amount: !!python/object/apply:decimal.Decimal ["99.47"]
 
      currency: USD
 

	
 
- source: PatreonVat.csv
 
  importer: patreon.VATImporter
 
  expect:
 
    - payee: Patreon
 
      date: !!python/object/apply:datetime.date [2017, 9, 1]
 
      amount: !!python/object/apply:decimal.Decimal ["2.00"]
 
      currency: USD
 
      country_code: AT
 
      country_name: Austria
 
    - payee: Patreon
 
      date: !!python/object/apply:datetime.date [2017, 9, 1]
 
      amount: !!python/object/apply:decimal.Decimal ["3.30"]
 
      currency: USD
 
      country_code: BE
 
      country_name: Belgium
 
    - payee: Patreon
 
      date: !!python/object/apply:datetime.date [2017, 10, 1]
 
      amount: !!python/object/apply:decimal.Decimal ["0.40"]
 
      currency: USD
 
      country_code: BG
 
      country_name: Bulgaria
 
    - payee: Patreon
 
      date: !!python/object/apply:datetime.date [2017, 10, 1]
 
      amount: !!python/object/apply:decimal.Decimal ["6.05"]
 
      currency: USD
 
      country_code: CZ
 
      country_name: Czech Republic
 

	
 
- source: PatreonPayouts.csv
 
  importer: patreon.PayoutImporter
 
  expect:
 
    - payee: Patreon
 
      date: !!python/object/apply:datetime.date [2018, 4, 1]
 
      amount: !!python/object/apply:decimal.Decimal ["123.45"]
 
      pledges_amount: !!python/object/apply:decimal.Decimal ["0"]
 
      transfer_amount: !!python/object/apply:decimal.Decimal ["123.45"]
 
      currency: USD
 
    - payee: Patreon
 
      date: !!python/object/apply:datetime.date [2018, 5, 1]
 
      amount: !!python/object/apply:decimal.Decimal ["2345.67"]
 
      pledges_amount: !!python/object/apply:decimal.Decimal ["0"]
 
      transfer_amount: !!python/object/apply:decimal.Decimal ["2345.67"]
 
      currency: USD
 

	
 
- source: StripePayments.csv
 
  importer: stripe.PaymentImporter
 
  expect:
 
    - payee: Dakota Smith
 
      date: !!python/object/apply:datetime.date [2017, 11, 8]
 
      amount: !!python/object/apply:decimal.Decimal ["100.00"]
 
      fee: !!python/object/apply:decimal.Decimal ["3"]
 
      tax: !!python/object/apply:decimal.Decimal ["0"]
 
      currency: USD
 
      payment_id: ch_oxuish6phae2Raighooghi3U
 
      customer_id: cus_DohSheeQu8eng3
 
      customer_email: one@example.org
 
      payout_id: po_aeYees2ahtier8ohju7Eeyie
 
      description: "Payment for invoice #102"
 
    - payee: Dakota Jones
 
      date: !!python/object/apply:datetime.date [2017, 10, 28]
 
      amount: !!python/object/apply:decimal.Decimal ["50.00"]
 
      fee: !!python/object/apply:decimal.Decimal ["1.4"]
 
      tax: !!python/object/apply:decimal.Decimal ["0"]
 
      currency: USD
 
      payment_id: ch_hHee9ef1aeyee1ruo7ochee9
 
      customer_id: cus_iepae2Iecae8Ei
 
      customer_email: two@example.org
 
      payout_id: po_aeYees2ahtier8ohju7Eeyie
 
      description: "Payment for invoice #100"
 

	
 
- source: StripePayouts.csv
 
  importer: stripe.PayoutImporter
 
  expect:
 
    - payee: Stripe
 
      date: !!python/object/apply:datetime.date [2017, 11, 30]
 
      amount: !!python/object/apply:decimal.Decimal ["-50"]
 
      currency: USD
 
      payment_count: !!python/object/apply:decimal.Decimal ["0"]
 
      payment_gross: !!python/object/apply:decimal.Decimal ["0"]
 
      payment_fees: !!python/object/apply:decimal.Decimal ["0"]
 
      payment_net: !!python/object/apply:decimal.Decimal ["0"]
 
      refund_count: !!python/object/apply:decimal.Decimal ["1"]
 
      refund_gross: !!python/object/apply:decimal.Decimal ["-50"]
 
      refund_fees: !!python/object/apply:decimal.Decimal ["0"]
 
      refund_net: !!python/object/apply:decimal.Decimal ["-50"]
 
      collected_fee_count: !!python/object/apply:decimal.Decimal ["0"]
 
      collected_fee_gross: !!python/object/apply:decimal.Decimal ["0"]
 
      collected_fee_refund_count: !!python/object/apply:decimal.Decimal ["0"]
 
      collected_fee_refund_gross: !!python/object/apply:decimal.Decimal ["0"]
 
      adjustment_count: !!python/object/apply:decimal.Decimal ["0"]
 
      adjustment_gross: !!python/object/apply:decimal.Decimal ["0"]
 
      adjustment_fees: !!python/object/apply:decimal.Decimal ["0"]
 
      adjustment_net: !!python/object/apply:decimal.Decimal ["0"]
 
      validation_count: !!python/object/apply:decimal.Decimal ["0"]
 
      validation_fees: !!python/object/apply:decimal.Decimal ["0"]
 
      retried_payout_count: !!python/object/apply:decimal.Decimal ["0"]
 
      retried_payout_net: !!python/object/apply:decimal.Decimal ["0"]
 
      total_count: !!python/object/apply:decimal.Decimal ["1"]
 
      total_gross: !!python/object/apply:decimal.Decimal ["-50"]
 
      total_fees: !!python/object/apply:decimal.Decimal ["0"]
 
      total_net: !!python/object/apply:decimal.Decimal ["-50"]
 
      payout_id: po_faegh6aeghishuethuoSoT2i
 
      destination_id: ba_chu0Woop5queewi2Ea1Aibah
 
      balance_txid: txn_EiKahrazei3aeMohk7EeDigh
 
      failure_txid: ""
 
    - payee: Stripe
 
      date: !!python/object/apply:datetime.date [2017, 11, 29]
 
      amount: !!python/object/apply:decimal.Decimal ["146.50"]
 
      currency: USD
 
      payment_count: !!python/object/apply:decimal.Decimal ["2"]
 
      payment_gross: !!python/object/apply:decimal.Decimal ["150"]
 
      payment_fees: !!python/object/apply:decimal.Decimal ["3.5"]
 
      payment_net: !!python/object/apply:decimal.Decimal ["146.5"]
 
      refund_count: !!python/object/apply:decimal.Decimal ["0"]
 
      refund_gross: !!python/object/apply:decimal.Decimal ["0"]
 
      refund_fees: !!python/object/apply:decimal.Decimal ["0"]
 
      refund_net: !!python/object/apply:decimal.Decimal ["0"]
 
      collected_fee_count: !!python/object/apply:decimal.Decimal ["0"]
 
      collected_fee_gross: !!python/object/apply:decimal.Decimal ["0"]
 
      collected_fee_refund_count: !!python/object/apply:decimal.Decimal ["0"]
 
      collected_fee_refund_gross: !!python/object/apply:decimal.Decimal ["0"]
 
      adjustment_count: !!python/object/apply:decimal.Decimal ["0"]
 
      adjustment_gross: !!python/object/apply:decimal.Decimal ["0"]
 
      adjustment_fees: !!python/object/apply:decimal.Decimal ["0"]
 
      adjustment_net: !!python/object/apply:decimal.Decimal ["0"]
 
      validation_count: !!python/object/apply:decimal.Decimal ["0"]
 
      validation_fees: !!python/object/apply:decimal.Decimal ["0"]
 
      retried_payout_count: !!python/object/apply:decimal.Decimal ["0"]
 
      retried_payout_net: !!python/object/apply:decimal.Decimal ["0"]
 
      total_count: !!python/object/apply:decimal.Decimal ["2"]
 
      total_gross: !!python/object/apply:decimal.Decimal ["150"]
 
      total_fees: !!python/object/apply:decimal.Decimal ["3.5"]
 
      total_net: !!python/object/apply:decimal.Decimal ["146.5"]
 
      payout_id: po_Do9pathoo9Pu8jaePhahJa0e
 
      destination_id: ba_chu0Woop5queewi2Ea1Aibah
 
      balance_txid: txn_ahsaixiene6Thie1aiti3tuo
 
      failure_txid: ""
 

	
 
- source: nbpy2017a.html
 
  importer: nbpy2017.InvoiceImporter
 
  expect:
 
    - payee: Python Person A
 
      ledger template: nbpy2017 invoice ledger entry
 
      date: !!python/object/apply:datetime.date [2017, 10, 19]
 
      amount: !!python/object/apply:decimal.Decimal ["80.00"]
 
      tickets_sold: !!python/object/apply:decimal.Decimal ["1"]
 
      ticket_price: !!python/object/apply:decimal.Decimal ["80.00"]
 
      ticket_rate: Early Bird (Ticket - Individual Supporter)
 
      shirts_sold: !!python/object/apply:decimal.Decimal ["1"]
 
      shirt_price: !!python/object/apply:decimal.Decimal ["0"]
 
      shirt_rate: "Complimentary for ticket holder (Supporter-level and above) (T-Shirt - Men's/Straight Cut Size L)"
 
      currency: USD
 
      status: Invoice
 
      invoice_id: "83"
 
      invoice_date: !!python/object/apply:datetime.date [2017, 10, 19]
 
    - payee: Python Person A
 
      ledger template: nbpy2017 payment ledger entry
 
      date: !!python/object/apply:datetime.date [2017, 10, 19]
 
      amount: !!python/object/apply:decimal.Decimal ["80.00"]
 
      tickets_sold: !!python/object/apply:decimal.Decimal ["1"]
 
      ticket_price: !!python/object/apply:decimal.Decimal ["80.00"]
 
      ticket_rate: Early Bird (Ticket - Individual Supporter)
 
      shirts_sold: !!python/object/apply:decimal.Decimal ["1"]
 
      shirt_price: !!python/object/apply:decimal.Decimal ["0"]
 
      shirt_rate: "Complimentary for ticket holder (Supporter-level and above) (T-Shirt - Men's/Straight Cut Size L)"
 
      currency: USD
 
      status: Payment
 
      invoice_id: "83"
 
      invoice_date: !!python/object/apply:datetime.date [2017, 10, 19]
 
      payment_id: ch_ahr0ue8lai1ohqu4Gei4Biem
 
      stripe_id: ch_ahr0ue8lai1ohqu4Gei4Biem
 

	
 
- source: nbpy2017b.html
 
  importer: nbpy2017.InvoiceImporter
 
  expect:
 
    - payee: Python Person B
 
      ledger template: nbpy2017 invoice ledger entry
 
      date: !!python/object/apply:datetime.date [2017, 12, 3]
 
      amount: !!python/object/apply:decimal.Decimal ["50.00"]
 
      tickets_sold: !!python/object/apply:decimal.Decimal ["1"]
 
      ticket_price: !!python/object/apply:decimal.Decimal ["50.00"]
 
      ticket_rate: Ticket - Unaffiliated Individual
 
      shirts_sold: !!python/object/apply:decimal.Decimal ["0"]
 
      shirt_price: !!python/object/apply:decimal.Decimal ["0"]
 
      shirt_rate: ""
 
      status: Invoice
 
      currency: USD
 
      invoice_date: !!python/object/apply:datetime.date [2017, 12, 3]
 
      invoice_id: "304"
 
    - payee: Python Person B
 
      ledger template: nbpy2017 payment ledger entry
 
      date: !!python/object/apply:datetime.date [2017, 12, 3]
 
      amount: !!python/object/apply:decimal.Decimal ["50.00"]
 
      tickets_sold: !!python/object/apply:decimal.Decimal ["1"]
 
      ticket_price: !!python/object/apply:decimal.Decimal ["50.00"]
 
      ticket_rate: Ticket - Unaffiliated Individual
 
      shirts_sold: !!python/object/apply:decimal.Decimal ["0"]
 
      shirt_price: !!python/object/apply:decimal.Decimal ["0"]
 
      shirt_rate: ""
 
      status: Payment
 
      currency: USD
 
      invoice_date: !!python/object/apply:datetime.date [2017, 12, 3]
 
      payment_id: ch_eishei9aiY8aiqu4lieYiu9i
 
      stripe_id: ch_eishei9aiY8aiqu4lieYiu9i
 
      invoice_id: "304"
 

	
 
- source: nbpy2017c.html
 
  importer: nbpy2017.InvoiceImporter
 
  expect:
 
    - payee: Python Person C
 
      ledger template: nbpy2017 invoice ledger entry
 
      date: !!python/object/apply:datetime.date [2017, 9, 5]
 
      amount: !!python/object/apply:decimal.Decimal ["60.00"]
 
      tickets_sold: !!python/object/apply:decimal.Decimal ["0"]
 
      ticket_price: !!python/object/apply:decimal.Decimal ["0"]
 
      ticket_rate: Ticket - Talk Proposer
 
      shirts_sold: !!python/object/apply:decimal.Decimal ["2"]
 
      shirt_price: !!python/object/apply:decimal.Decimal ["30.00"]
 
      shirt_rate: "T-Shirt - Men's/Straight Cut Size M"
 
      status: Invoice
 
      currency: USD
 
      invoice_date: !!python/object/apply:datetime.date [2017, 9, 5]
 
      invoice_id: "11"
 
    - payee: Python Person C
 
      ledger template: nbpy2017 payment ledger entry
 
      date: !!python/object/apply:datetime.date [2017, 9, 5]
 
      amount: !!python/object/apply:decimal.Decimal ["60.00"]
 
      tickets_sold: !!python/object/apply:decimal.Decimal ["0"]
 
      ticket_price: !!python/object/apply:decimal.Decimal ["0"]
 
      ticket_rate: Ticket - Talk Proposer
 
      shirts_sold: !!python/object/apply:decimal.Decimal ["2"]
 
      shirt_price: !!python/object/apply:decimal.Decimal ["30.00"]
 
      shirt_rate: "T-Shirt - Men's/Straight Cut Size M"
 
      status: Payment
 
      currency: USD
 
      invoice_date: !!python/object/apply:datetime.date [2017, 9, 5]
 
      payment_id: ch_daer0ahwoh9oDeiqu2eimoD7
 
      stripe_id: ch_daer0ahwoh9oDeiqu2eimoD7
 
      invoice_id: "11"
 

	
 
- source: AmazonAffiliateEarnings.csv
 
  importer: amazon.EarningsImporter
 
  header_rows: 1
 
  header_cols: 12
 
  expect:
 
    - payee: Amazon
 
      date: !!python/object/apply:datetime.date [2016, 12, 20]
 
      amount: !!python/object/apply:decimal.Decimal ["4.24"]
 
      currency: USD
 
    - payee: Amazon
 
      date: !!python/object/apply:datetime.date [2017, 1, 7]
 
      amount: !!python/object/apply:decimal.Decimal ["-.08"]
 
      currency: USD
 

	
 
- source: Benevity2018.csv
 
  importer: benevity.Donations2018Importer
 
  header_rows: 11
 
  header_cols: 17
 
  expect:
 
    - date: !!python/object/apply:datetime.date [2017, 10, 28]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [20]
 
      net_amount: !!python/object/apply:decimal.Decimal [20]
 
      donation_amount: !!python/object/apply:decimal.Decimal [20]
 
      match_amount: !!python/object/apply:decimal.Decimal [0]
 
      match_amount: !!python/object/apply:decimal.Decimal [0]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: null
 
      payee: Dakota Smith
 
      corporation: Company A
 
      project: ""
 
      comment: ""
 
      frequency: One-time
 
      transaction_id: 67890QWERT
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2017, 10, 30]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [25]
 
      net_amount: !!python/object/apply:decimal.Decimal [25]
 
      donation_amount: !!python/object/apply:decimal.Decimal [25]
 
      match_amount: !!python/object/apply:decimal.Decimal [0]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: null
 
      payee: Dakota Smith
 
      corporation: Company A
 
      project: ""
 
      comment: ""
 
      frequency: One-time
 
      transaction_id: 67890WERTY
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2017, 10, 19]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [10]
 
      net_amount: !!python/object/apply:decimal.Decimal [10]
 
      donation_amount: !!python/object/apply:decimal.Decimal [0]
 
      match_amount: !!python/object/apply:decimal.Decimal [10]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: null
 
      payee: Anonymous
 
      corporation: Company B
 
      project: ""
 
      comment: ""
 
      frequency: Unknown
 
      transaction_id: 67890ERTYU
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2017, 10, 19]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [20]
 
      net_amount: !!python/object/apply:decimal.Decimal [20]
 
      donation_amount: !!python/object/apply:decimal.Decimal [0]
 
      match_amount: !!python/object/apply:decimal.Decimal [20]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: null
 
      payee: Anonymous
 
      corporation: Company B
 
      project: ""
 
      comment: ""
 
      frequency: Unknown
 
      transaction_id: 67890RTYUI
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2017, 10, 19]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [30]
 
      net_amount: !!python/object/apply:decimal.Decimal [30]
 
      donation_amount: !!python/object/apply:decimal.Decimal [30]
 
      match_amount: !!python/object/apply:decimal.Decimal [0]
 
      payee: Anonymous
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: null
 
      corporation: Company B
 
      project: ""
 
      comment: ""
 
      frequency: Recurring
 
      transaction_id: 67890TYUIO
 
      ledger template: benevity donations ledger entry
 

	
 
- source: Benevity2019.csv
 
  importer: benevity.Donations2019Importer
 
  header_rows: 11
 
  header_cols: 21
 
  expect:
 
    - date: !!python/object/apply:datetime.date [2017, 10, 28]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [20]
 
      net_amount: !!python/object/apply:decimal.Decimal [20]
 
      donation_amount: !!python/object/apply:decimal.Decimal [20]
 
      match_amount: !!python/object/apply:decimal.Decimal [0]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: null
 
      payee: Dakota Smith
 
      corporation: Company A
 
      project: ""
 
      comment: ""
 
      frequency: One-time
 
      transaction_id: 67890QWERT
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2017, 10, 30]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [25]
 
      net_amount: !!python/object/apply:decimal.Decimal [25]
 
      donation_amount: !!python/object/apply:decimal.Decimal [25]
 
      match_amount: !!python/object/apply:decimal.Decimal [0]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: null
 
      payee: Dakota Smith
 
      corporation: Company A
 
      project: ""
 
      comment: ""
 
      frequency: One-time
 
      transaction_id: 67890WERTY
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2017, 10, 19]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [10]
 
      net_amount: !!python/object/apply:decimal.Decimal [10]
 
      donation_amount: !!python/object/apply:decimal.Decimal [0]
 
      match_amount: !!python/object/apply:decimal.Decimal [10]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: null
 
      payee: Anonymous
 
      corporation: Company B
 
      project: ""
 
      comment: ""
 
      frequency: Unknown
 
      transaction_id: 67890ERTYU
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2017, 10, 19]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [20]
 
      net_amount: !!python/object/apply:decimal.Decimal [20]
 
      donation_amount: !!python/object/apply:decimal.Decimal [0]
 
      match_amount: !!python/object/apply:decimal.Decimal [20]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: null
 
      payee: Anonymous
 
      corporation: Company B
 
      project: ""
 
      comment: ""
 
      frequency: Unknown
 
      transaction_id: 67890RTYUI
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2017, 10, 19]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [30]
 
      net_amount: !!python/object/apply:decimal.Decimal [30]
 
      donation_amount: !!python/object/apply:decimal.Decimal [30]
 
      match_amount: !!python/object/apply:decimal.Decimal [0]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: null
 
      payee: Anonymous
 
      corporation: Company B
 
      project: ""
 
      comment: ""
 
      frequency: Recurring
 
      transaction_id: 67890TYUIO
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2017, 10, 18]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [20]
 
      net_amount: !!python/object/apply:decimal.Decimal ["19.55"]
 
      donation_amount: !!python/object/apply:decimal.Decimal [10]
 
      match_amount: !!python/object/apply:decimal.Decimal [10]
 
      donation_fee: !!python/object/apply:decimal.Decimal [".1"]
 
      match_fee: !!python/object/apply:decimal.Decimal [".2"]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [".15"]
 
      fee_comment: null
 
      payee: Anonymous
 
      corporation: Company C
 
      project: ""
 
      comment: ""
 
      frequency: Unknown
 
      transaction_id: 67890YUIOP
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2017, 10, 21]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [20]
 
      net_amount: !!python/object/apply:decimal.Decimal ["19.55"]
 
      donation_amount: !!python/object/apply:decimal.Decimal [10]
 
      match_amount: !!python/object/apply:decimal.Decimal [10]
 
      donation_fee: !!python/object/apply:decimal.Decimal [".1"]
 
      match_fee: !!python/object/apply:decimal.Decimal [".2"]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [".15"]
 
      fee_comment: null
 
      payee: Anonymous
 
      corporation: Company C
 
      project: ""
 
      comment: ""
 
      frequency: Unknown
 
      transaction_id: 67890ASDFG
 
      ledger template: benevity donations ledger entry
 

	
 
- source: Benevity2020.csv
 
  importer: benevity.Donations2020Importer
 
  header_rows: 11
 
  header_cols: 23
 
  expect:
 
    - date: !!python/object/apply:datetime.date [2019, 10, 28]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [20]
 
      net_amount: !!python/object/apply:decimal.Decimal [20]
 
      donation_amount: !!python/object/apply:decimal.Decimal [20]
 
      match_amount: !!python/object/apply:decimal.Decimal [0]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: ""
 
      payee: Dakota Smith
 
      corporation: Company A
 
      project: ""
 
      comment: ""
 
      frequency: One-time
 
      transaction_id: 67890QWERT
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2019, 10, 30]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [25]
 
      net_amount: !!python/object/apply:decimal.Decimal [25]
 
      donation_amount: !!python/object/apply:decimal.Decimal [25]
 
      match_amount: !!python/object/apply:decimal.Decimal [0]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: ""
 
      payee: Dakota Smith
 
      corporation: Company A
 
      project: ""
 
      comment: ""
 
      frequency: One-time
 
      transaction_id: 67890WERTY
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2019, 10, 19]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [10]
 
      net_amount: !!python/object/apply:decimal.Decimal [10]
 
      donation_amount: !!python/object/apply:decimal.Decimal [0]
 
      match_amount: !!python/object/apply:decimal.Decimal [10]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: ""
 
      payee: Anonymous
 
      corporation: Company B
 
      project: ""
 
      comment: ""
 
      frequency: Unknown
 
      transaction_id: 67890ERTYU
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2019, 10, 19]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [20]
 
      net_amount: !!python/object/apply:decimal.Decimal [20]
 
      donation_amount: !!python/object/apply:decimal.Decimal [0]
 
      match_amount: !!python/object/apply:decimal.Decimal [20]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: ""
 
      payee: Anonymous
 
      corporation: Company B
 
      project: ""
 
      comment: ""
 
      frequency: Unknown
 
      transaction_id: 67890RTYUI
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2019, 10, 19]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [30]
 
      net_amount: !!python/object/apply:decimal.Decimal [30]
 
      donation_amount: !!python/object/apply:decimal.Decimal [30]
 
      match_amount: !!python/object/apply:decimal.Decimal [0]
 
      donation_fee: !!python/object/apply:decimal.Decimal [0]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [0]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: ""
 
      payee: Anonymous
 
      corporation: Company B
 
      project: ""
 
      comment: ""
 
      frequency: Recurring
 
      transaction_id: 67890TYUIO
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2019, 10, 18]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [20]
 
      net_amount: !!python/object/apply:decimal.Decimal ["19.55"]
 
      donation_amount: !!python/object/apply:decimal.Decimal [10]
 
      match_amount: !!python/object/apply:decimal.Decimal [10]
 
      donation_fee: !!python/object/apply:decimal.Decimal [".3"]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [".15"]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: ""
 
      payee: Anonymous
 
      corporation: Company C
 
      project: ""
 
      comment: ""
 
      frequency: Unknown
 
      transaction_id: 67890YUIOP
 
      ledger template: benevity donations ledger entry
 
    - date: !!python/object/apply:datetime.date [2019, 10, 21]
 
      currency: USD
 
      disbursement_id: ABCDE12345
 
      amount: !!python/object/apply:decimal.Decimal [20]
 
      net_amount: !!python/object/apply:decimal.Decimal ["19.55"]
 
      donation_amount: !!python/object/apply:decimal.Decimal [10]
 
      match_amount: !!python/object/apply:decimal.Decimal [10]
 
      donation_fee: !!python/object/apply:decimal.Decimal [".3"]
 
      merchant_fee: !!python/object/apply:decimal.Decimal [".15"]
 
      match_fee: !!python/object/apply:decimal.Decimal [0]
 
      fee_comment: ""
 
      payee: Anonymous
 
      corporation: Company C
 
      project: ""
 
      comment: ""
 
      frequency: Unknown
 
      transaction_id: 67890ASDFG
 
      ledger template: benevity donations ledger entry
 

	
 
- source: BrightFunds.xls
 
  importer: brightfunds.DonorReportXLSImporter
 
  expect:
 
    - date: !!python/object/apply:datetime.date [2017, 10, 20]
 
      currency: USD
 
      amount: !!python/object/apply:decimal.Decimal [120]
 
      payee: Dakota Smith
 
      corporation: Company
 
      company_name: ""
 
      designation: ""
 
      donor_name: Company
 
      donor_email: ""
 
      fund: ""
 
      on_behalf_of: Dakota Smith
 
      type: Matched Donation
 

	
 
- source: BrightFunds.csv
 
  importer: brightfunds.DonorReportImporter
 
  expect:
 
    - date: !!python/object/apply:datetime.date [2020, 10, 01]
 
      currency: USD
 
      amount: !!python/object/apply:decimal.Decimal [15]
 
      payee: Company
 
      corporation: Company
 
      company_name: Company
 
      designation: ""
 
      donor_name: Company
 
      donor_email: ""
 
      fund: ""
 
      on_behalf_of: Employed Person
 
      type: MatchingTransaction
 
    - date: !!python/object/apply:datetime.date [2020, 9, 24]
 
      currency: USD
 
      amount: !!python/object/apply:decimal.Decimal [15]
0 comments (0 inline, 0 general)