benevity: Add support for latest Benevity format.

This commit is contained in:
Brett Smith 2019-12-30 15:45:14 -05:00
parent 13c316acf6
commit 01a86107d7
4 changed files with 210 additions and 2 deletions

View file

@ -137,14 +137,19 @@ Benevity
This information was not available in reports before 2019, This information was not available in reports before 2019,
so this amount will always be 0.00 in those reports. so this amount will always be 0.00 in those reports.
---------------- ----------------------------------------------------------- ---------------- -----------------------------------------------------------
fee_comment The note from the Fee Comment column in the report.
This information was not available in reports before 2020,
so this field will always be empty in those reports.
---------------- -----------------------------------------------------------
frequency The frequency of this donation as indicated in the report frequency The frequency of this donation as indicated in the report
---------------- ----------------------------------------------------------- ---------------- -----------------------------------------------------------
match_amount The amount of the donation match by the participating match_amount The amount of the donation match by the participating
corporation corporation
---------------- ----------------------------------------------------------- ---------------- -----------------------------------------------------------
match_fee The fee taken from the donation match. match_fee The fee taken from the donation match.
This information was not available in reports before 2019, This information is not available in reports from
so this amount will always be 0.00 in those reports. before 2019 or since 2020, so this amount will always be
0.00 in those reports.
---------------- ----------------------------------------------------------- ---------------- -----------------------------------------------------------
merchant_fee The merchant fee taken from the donation total. merchant_fee The merchant fee taken from the donation total.
This information was not available in reports before 2019, This information was not available in reports before 2019,

View file

@ -34,6 +34,9 @@ class _DonationsImporterBase(_csv.CSVImporterBase):
retval.update((retkey, strparse.currency_decimal(row[rowkey])) retval.update((retkey, strparse.currency_decimal(row[rowkey]))
for rowkey, retkey in self.DECIMAL_FIELDS.items()) for rowkey, retkey in self.DECIMAL_FIELDS.items())
retval['amount'] = retval['donation_amount'] + retval['match_amount'] retval['amount'] = retval['donation_amount'] + retval['match_amount']
retval.setdefault('net_amount', retval['amount'] - sum(
fee for key, fee in retval.items() if key.endswith('_fee')
))
return retval return retval
@ -43,6 +46,7 @@ class Donations2018Importer(_DonationsImporterBase):
'donation_fee': ZERO_DECIMAL, 'donation_fee': ZERO_DECIMAL,
'match_fee': ZERO_DECIMAL, 'match_fee': ZERO_DECIMAL,
'merchant_fee': ZERO_DECIMAL, 'merchant_fee': ZERO_DECIMAL,
'fee_comment': None,
} }
DATE_FIELD = 'Date of Donation' DATE_FIELD = 'Date of Donation'
DATE_FMT = '%Y-%m-%d' DATE_FMT = '%Y-%m-%d'
@ -72,6 +76,7 @@ class Donations2018Importer(_DonationsImporterBase):
class Donations2019Importer(_DonationsImporterBase): class Donations2019Importer(_DonationsImporterBase):
ENTRY_SEED = { ENTRY_SEED = {
'ledger template': 'benevity donations ledger entry', 'ledger template': 'benevity donations ledger entry',
'fee_comment': None,
} }
DATE_FIELD = 'Donation Date' DATE_FIELD = 'Donation Date'
DATE_FMT = '%Y-%m-%dT%H:%M:%SZ' DATE_FMT = '%Y-%m-%dT%H:%M:%SZ'
@ -99,3 +104,35 @@ class Donations2019Importer(_DonationsImporterBase):
'Transaction ID': 'transaction_id', 'Transaction ID': 'transaction_id',
'Donation Frequency': 'frequency', 'Donation Frequency': 'frequency',
} }
class Donations2020Importer(_DonationsImporterBase):
ENTRY_SEED = {
'ledger template': 'benevity donations ledger entry',
'match_fee': ZERO_DECIMAL,
}
DATE_FIELD = 'Donation Date'
DATE_FMT = '%Y-%m-%dT%H:%M:%SZ'
HEADER_FIELDS = {
'Disbursement ID': 'disbursement_id',
}
DECIMAL_FIELDS = {
'Total Donation to be Acknowledged': 'donation_amount',
'Cause Support Fee': 'donation_fee',
'Match Amount': 'match_amount',
'Merchant Fee': 'merchant_fee',
}
NEEDED_FIELDS = frozenset([
DATE_FIELD,
*_DonationsImporterBase.NAME_FIELDS,
*DECIMAL_FIELDS,
])
COPIED_FIELDS = {
'Company': 'corporation',
'Currency': 'currency',
'Project': 'project',
'Comment': 'comment',
'Transaction ID': 'transaction_id',
'Donation Frequency': 'frequency',
'Fee Comment': 'fee_comment',
}

View file

@ -0,0 +1,22 @@
Donations Report
"#-------------------------------------------"
Charity Name,"Software Freedom Conservancy, Inc."
Charity ID,850-607080900
Period Ending,Tue 1 Jan 2019 0:00:00
Currency,USD
Payment Method,EFT
Disbursement ID,ABCDE12345
Note,Rounding may be applied to some values in this report. Learn more at https://causes.benevity.org/feedback-support
"#-------------------------------------------"
Company,Project,Donation Date,Donor First Name,Donor Last Name,Email,Address,City,State/Province,Postal Code,Activity,Comment,Transaction ID,Donation Frequency,Currency,Project Remote ID,Source,Reason,Total Donation to be Acknowledged,Match Amount,Cause Support Fee,Merchant Fee,Fee Comment
Company A,,2019-10-28T12:00:01Z,Dakota,Smith,a@example.com,Not shared by donor,Not shared by donor,Not shared by donor,0,Volunteering,,67890QWERT,One-time,USD,,,,20,0,0,0,
Company A,,2019-10-30T12:00:03Z,Dakota,Smith,a@example.com,Not shared by donor,Not shared by donor,Not shared by donor,0,Volunteering,,67890WERTY,One-time,USD,,,,25,0,0,0,
Company B,,2019-10-19T12:00:05Z,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,12345,,,67890ERTYU,Unknown,USD,,,,0,10,0,0,
Company B,,2019-10-19T12:00:07Z,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,12345,,,67890RTYUI,Unknown,USD,,,,0,20,0,0,
Company B,,2019-10-19T12:00:09Z,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,12345,,,67890TYUIO,Recurring,USD,,,,30,0,0,0,
Company C,,2019-10-18T12:00:11Z,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,12345,,,67890YUIOP,Unknown,USD,,,,10,10,0.3,0.15,
Company C,,2019-10-21T12:00:13Z,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,Not shared by donor,12345,,,67890ASDFG,Unknown,USD,,,,10,10,0.3,0.15,
Totals,,,,,,,,,,,,,,,,,,95,50,0.6,0.3,
Check Fee,0
Total Donations (Gross),144.1
Can't render this file because it contains an unexpected character in line 3 and column 14.

View file

@ -304,6 +304,7 @@
donation_fee: !!python/object/apply:decimal.Decimal [0] donation_fee: !!python/object/apply:decimal.Decimal [0]
match_fee: !!python/object/apply:decimal.Decimal [0] match_fee: !!python/object/apply:decimal.Decimal [0]
merchant_fee: !!python/object/apply:decimal.Decimal [0] merchant_fee: !!python/object/apply:decimal.Decimal [0]
fee_comment: null
payee: Dakota Smith payee: Dakota Smith
corporation: Company A corporation: Company A
project: "" project: ""
@ -321,6 +322,7 @@
donation_fee: !!python/object/apply:decimal.Decimal [0] donation_fee: !!python/object/apply:decimal.Decimal [0]
match_fee: !!python/object/apply:decimal.Decimal [0] match_fee: !!python/object/apply:decimal.Decimal [0]
merchant_fee: !!python/object/apply:decimal.Decimal [0] merchant_fee: !!python/object/apply:decimal.Decimal [0]
fee_comment: null
payee: Dakota Smith payee: Dakota Smith
corporation: Company A corporation: Company A
project: "" project: ""
@ -338,6 +340,7 @@
donation_fee: !!python/object/apply:decimal.Decimal [0] donation_fee: !!python/object/apply:decimal.Decimal [0]
match_fee: !!python/object/apply:decimal.Decimal [0] match_fee: !!python/object/apply:decimal.Decimal [0]
merchant_fee: !!python/object/apply:decimal.Decimal [0] merchant_fee: !!python/object/apply:decimal.Decimal [0]
fee_comment: null
payee: Anonymous payee: Anonymous
corporation: Company B corporation: Company B
project: "" project: ""
@ -355,6 +358,7 @@
donation_fee: !!python/object/apply:decimal.Decimal [0] donation_fee: !!python/object/apply:decimal.Decimal [0]
match_fee: !!python/object/apply:decimal.Decimal [0] match_fee: !!python/object/apply:decimal.Decimal [0]
merchant_fee: !!python/object/apply:decimal.Decimal [0] merchant_fee: !!python/object/apply:decimal.Decimal [0]
fee_comment: null
payee: Anonymous payee: Anonymous
corporation: Company B corporation: Company B
project: "" project: ""
@ -373,6 +377,7 @@
donation_fee: !!python/object/apply:decimal.Decimal [0] donation_fee: !!python/object/apply:decimal.Decimal [0]
match_fee: !!python/object/apply:decimal.Decimal [0] match_fee: !!python/object/apply:decimal.Decimal [0]
merchant_fee: !!python/object/apply:decimal.Decimal [0] merchant_fee: !!python/object/apply:decimal.Decimal [0]
fee_comment: null
corporation: Company B corporation: Company B
project: "" project: ""
comment: "" comment: ""
@ -395,6 +400,7 @@
donation_fee: !!python/object/apply:decimal.Decimal [0] donation_fee: !!python/object/apply:decimal.Decimal [0]
match_fee: !!python/object/apply:decimal.Decimal [0] match_fee: !!python/object/apply:decimal.Decimal [0]
merchant_fee: !!python/object/apply:decimal.Decimal [0] merchant_fee: !!python/object/apply:decimal.Decimal [0]
fee_comment: null
payee: Dakota Smith payee: Dakota Smith
corporation: Company A corporation: Company A
project: "" project: ""
@ -412,6 +418,7 @@
donation_fee: !!python/object/apply:decimal.Decimal [0] donation_fee: !!python/object/apply:decimal.Decimal [0]
match_fee: !!python/object/apply:decimal.Decimal [0] match_fee: !!python/object/apply:decimal.Decimal [0]
merchant_fee: !!python/object/apply:decimal.Decimal [0] merchant_fee: !!python/object/apply:decimal.Decimal [0]
fee_comment: null
payee: Dakota Smith payee: Dakota Smith
corporation: Company A corporation: Company A
project: "" project: ""
@ -429,6 +436,7 @@
donation_fee: !!python/object/apply:decimal.Decimal [0] donation_fee: !!python/object/apply:decimal.Decimal [0]
match_fee: !!python/object/apply:decimal.Decimal [0] match_fee: !!python/object/apply:decimal.Decimal [0]
merchant_fee: !!python/object/apply:decimal.Decimal [0] merchant_fee: !!python/object/apply:decimal.Decimal [0]
fee_comment: null
payee: Anonymous payee: Anonymous
corporation: Company B corporation: Company B
project: "" project: ""
@ -446,6 +454,7 @@
donation_fee: !!python/object/apply:decimal.Decimal [0] donation_fee: !!python/object/apply:decimal.Decimal [0]
match_fee: !!python/object/apply:decimal.Decimal [0] match_fee: !!python/object/apply:decimal.Decimal [0]
merchant_fee: !!python/object/apply:decimal.Decimal [0] merchant_fee: !!python/object/apply:decimal.Decimal [0]
fee_comment: null
payee: Anonymous payee: Anonymous
corporation: Company B corporation: Company B
project: "" project: ""
@ -463,6 +472,7 @@
donation_fee: !!python/object/apply:decimal.Decimal [0] donation_fee: !!python/object/apply:decimal.Decimal [0]
match_fee: !!python/object/apply:decimal.Decimal [0] match_fee: !!python/object/apply:decimal.Decimal [0]
merchant_fee: !!python/object/apply:decimal.Decimal [0] merchant_fee: !!python/object/apply:decimal.Decimal [0]
fee_comment: null
payee: Anonymous payee: Anonymous
corporation: Company B corporation: Company B
project: "" project: ""
@ -480,6 +490,7 @@
donation_fee: !!python/object/apply:decimal.Decimal [".1"] donation_fee: !!python/object/apply:decimal.Decimal [".1"]
match_fee: !!python/object/apply:decimal.Decimal [".2"] match_fee: !!python/object/apply:decimal.Decimal [".2"]
merchant_fee: !!python/object/apply:decimal.Decimal [".15"] merchant_fee: !!python/object/apply:decimal.Decimal [".15"]
fee_comment: null
payee: Anonymous payee: Anonymous
corporation: Company C corporation: Company C
project: "" project: ""
@ -497,6 +508,139 @@
donation_fee: !!python/object/apply:decimal.Decimal [".1"] donation_fee: !!python/object/apply:decimal.Decimal [".1"]
match_fee: !!python/object/apply:decimal.Decimal [".2"] match_fee: !!python/object/apply:decimal.Decimal [".2"]
merchant_fee: !!python/object/apply:decimal.Decimal [".15"] 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 payee: Anonymous
corporation: Company C corporation: Company C
project: "" project: ""