Commit graph

53 commits

Author SHA1 Message Date
Brett Smith
25b45abaeb benevity: Support new 2019 report format. 2019-02-15 15:26:37 -05:00
Brett Smith
8326bd68d9 benevity: Version the current importer.
The report format has changed slightly in 2019.
2019-02-15 11:47:27 -05:00
Brett Smith
7bb5815b08 nbpy2017: Handle complimentary t-shirts. 2018-09-28 08:47:02 -04:00
Brett Smith
ba3b9ef93c nbpy2017: Actually count the quantity listed on invoices. 2018-09-28 08:47:02 -04:00
Brett Smith
a135e71a4a nbpy2017: Handle complimentary tickets.
The conference is offering these to people who proposed talks this year.
2018-09-28 08:31:24 -04:00
Brett Smith
4df5748a4f nbpy2017: Handle one-off "Sept." abbreviation in invoices. 2018-09-27 22:55:46 -04:00
Brett Smith
0eb014aeeb patreon: New importer for payouts. 2018-07-10 11:36:07 -04:00
Brett Smith
309ea4ac6a oreilly: New importer. 2018-07-03 10:24:21 -04:00
Brett Smith
2de14e4573 stripe: Add payouts importer. 2018-01-25 17:59:19 -05:00
Brett Smith
f3e8f774c7 stripe: Extract more columns from payment data. 2018-01-25 12:11:58 -05:00
Brett Smith
5681545267 nbpy2017: Bugfix entry data key name for custom Ledger template. 2018-01-24 18:01:16 -05:00
Brett Smith
37563ffae0 brightfunds: New importer.
This commit adds infrastructure to treat XLS files like CSV files, and
import them using the base classes that already exist for that.
2018-01-21 17:04:37 -05:00
Brett Smith
db59d2fc8c hooks.ledger_entry: Look up templates dynamically.
If there's a 'ledger entry' key in the entry data, use that value as the
name of the template to load.  Thanks to this, nbpy2017 could collapse
multiple importers into one.

Otherwise, build a default template name based on the importer source, and
try to use that.

All the configuration names now end with "ledger entry" instead of starting
with "template".  This makes it clearer what they're for, in case we
support other kinds of output templates in the future.

I ended up changing the names of some of the importers so the default
template name was nice, rather than specifying template names for all of
them, to reduce the amount of name discrepancies across the codebase.
2017-12-31 18:52:30 -05:00
Brett Smith
cdec3d9aab hooks.ledger_entry: Bring in all Ledger-specific code.
This includes the old "template" module, plus the associated
template-loading code from config.
2017-12-31 17:29:14 -05:00
Brett Smith
6d1a7cb57d config: Make get_section a public method.
As hooks and importers both require more configuration, they're gonna need
to have lower-level access to configuration settings.
2017-12-31 16:50:07 -05:00
Brett Smith
76f2707aac hooks.ledger_entry: New hook to output Ledger entries.
This is roughly the smallest diff necessary to move output to a hook.
There's a lot of code reorganization that should still happen to bring it
better in line with this new structure.
2017-12-31 12:35:20 -05:00
Brett Smith
d2f8772e08 config: Add open_output_file method.
Make this functionality accessible to hooks.
2017-12-31 11:10:49 -05:00
Brett Smith
efe5768941 main: Set up a decimal context that safely handles currency. 2017-12-31 10:06:57 -05:00
Brett Smith
85b665200c hooks: Hooks declare what order they run in. 2017-12-30 18:11:41 -05:00
Brett Smith
e8bcbd5f99 hooks.add_entity: Remove common company suffixes from entity tags. 2017-12-30 17:29:54 -05:00
Brett Smith
c7de107267 tests: Test Benevity disbursement importer from 1b1e2d0. 2017-12-30 16:39:38 -05:00
Brett Smith
e497561a7e tests: Test Amazon Affiliate Earnings importer from 25c6454. 2017-12-30 16:14:15 -05:00
Brett Smith
d9f68e9817 tests: Add template test for 40552d6. 2017-12-30 15:55:47 -05:00
Brett Smith
f6599a3deb tests: Add template test for 9f72052. 2017-12-30 15:55:25 -05:00
Brett Smith
52f2bdcd0e tests: Add render_lines shortcut to template tests. 2017-12-30 15:54:53 -05:00
Brett Smith
fdcc214f9f tests: AddEntityHook test for f2c869d. 2017-12-30 09:54:17 -05:00
Brett Smith
7bdd98075f tests: AddEntityHook tests for e758db3, 56cba14, 82e4bf5. 2017-12-30 09:49:33 -05:00
Brett Smith
18eebbc0ed hooks: run() return value controls processing of entry data.
Instead of using in-band signaling with the entry_data dict.
I don't know why I didn't think of this in the first place.
2017-12-19 10:19:56 -05:00
Brett Smith
cc8c03ab62 main: Provide template variables about the file being imported. 2017-12-19 09:13:44 -05:00
Brett Smith
b41a7a99af hooks: Filter entries by setting entry_data['_hook_cancel'] to True.
The current method only works for plain dicts and other simple mappings.
Mapping that may still contain items after .clear(), like ChainMap, can't
rely on the old method.
2017-12-19 09:13:44 -05:00
Brett Smith
34b71baaf7 template: render() takes a single mapping argument.
This lets it receive other mapping types like ChainMap.
2017-12-19 09:13:00 -05:00
Brett Smith
1b98ab2015 util: Rename to strparse.
Better describes what the functions in the module do.
2017-12-19 06:42:05 -05:00
Brett Smith
6ea28c2c89 util: Add parse_currency_dec.
The current importers trim lots of extraneous symbols and whitespace from
currency strings before passing them to Decimal().  This function takes care
of all that in a single place.
2017-12-18 23:04:05 -05:00
Brett Smith
4796932cb7 importers.patreon: Handle commas in large amounts. 2017-12-18 14:09:54 -05:00
Brett Smith
a2120805ab tests: Remove noop cruft file. 2017-12-18 14:06:53 -05:00
Brett Smith
0b665d388e template: Add is_empty method.
This makes it easy to detect when a user has specifically cleared a
template; i.e., from a specific configuration section.
2017-12-18 12:35:18 -05:00
Brett Smith
474a0390e3 template: Support custom payee lines. 2017-12-18 12:23:18 -05:00
Brett Smith
668906b944 importers.nbpy2017: Yield entries for the original invoice.
This lets us write up a cleaner separation between the original act of
invoicing and the Stripe payment.
2017-12-18 10:47:04 -05:00
Brett Smith
fb0e4f2235 tests: Specify types in importers.yml, rather than munging them manually. 2017-12-18 10:28:05 -05:00
Brett Smith
f56571219b importers.nbpy2017: Don't deal with refunds.
Only one refund was actually issued, so we can deal with that manually.  But
the code did its job of revealing those cases and checking we were handling
them well.
2017-12-18 09:21:31 -05:00
Brett Smith
93fffe6666 importers: New importer for North Bay Python invoices.
This probably has no use outside Conservancy.
2017-12-17 20:46:00 -05:00
Brett Smith
a924d9fb1f tests: Support more Decimal values from importers without specifying them all. 2017-12-17 13:42:51 -05:00
Brett Smith
e3ec03cf19 template: Don't output accounts that end up having no amount. 2017-12-16 13:10:49 -05:00
Brett Smith
a1f815c60b template: Improve error detection and reporting in amount expressions. 2017-11-09 17:39:24 -05:00
Brett Smith
093834dd15 template: Support variables in account names. 2017-11-09 16:18:03 -05:00
Brett Smith
e5a0089eb9 importers: Add an importer for Stripe payments. 2017-11-09 16:18:03 -05:00
Brett Smith
3b821cbbee template: Template amounts are now written with fuller expressions.
This makes it possible to support transactions that divide funds in
ways other than a simple percentage split.  For example, there
might be tax withheld, or a flat fee expense on each transaction.
2017-11-09 16:17:58 -05:00
Brett Smith
cebd1481ec patreon: Import VAT withholdings. 2017-10-26 12:56:29 -04:00
Brett Smith
ab9c65d20d import2ledger: Support only importing entries in a date range. 2017-10-22 16:10:17 -04:00
Brett Smith
b37575eabc tests: Remove stray debug prints. 2017-10-22 16:08:37 -04:00