Commit graph

126 commits

Author SHA1 Message Date
Bradley M. Kuhn
aece96946d Allow search by Supporter only. 2022-06-21 10:08:25 -07:00
Bradley M. Kuhn
36c1d11d1f Include Carp 2022-06-21 10:08:00 -07:00
Bradley M. Kuhn
ed4a2c1aea Correct function call; this is not a variable! 2022-06-21 10:07:45 -07:00
Bradley M. Kuhn
3d83a8e546 Add id as part of return for postalAddress addition. 2022-06-21 09:58:57 -07:00
Bradley M. Kuhn
6d143082de Add method: getBestPostalAddress 2022-06-21 09:55:37 -07:00
Bradley M. Kuhn
391fb0d3f2 support is_supporter setting, add findSupporter method. 2021-04-18 15:29:48 -07:00
Bradley M. Kuhn
fdf58bb729 fulfillFailure: fix reason message to include more data; add who
'who' is now a possible parameter, but default it the old way so it's
not mandatory, and improve the reason message on failures.
2021-02-20 13:02:49 -08:00
Bradley M. Kuhn
16ce9f4bf1 addPostalAddress: additional argument to set date_encountered 2021-02-11 11:58:55 -08:00
Bradley M. Kuhn
36592c9747 Correct typo in error message. 2020-12-22 16:31:52 -08:00
Bradley M. Kuhn
0c477cf4da Convert to work with Beancount; constructor takes a filehandle now
The output format for donations changed slightly when we switched to
Beancount at Conservancy from Ledger CLI.  This change now assumes a
specific format of the output for the donations, and takes a
filehandle in the constructor to receive the data.

As such, this effectively makes it slightly less dependent on any
specific donation database, since as long as you can get it into the
format the regex herein expects onto a filehandle, it doesn't matter
what system you use underneath.
2020-12-22 16:31:37 -08:00
Bradley M. Kuhn
f50c4d6053 paperMailOk: correct contact-setting typo. 2019-12-10 09:35:16 -08:00
Bradley M. Kuhn
2816c8ab2e emailOk: attempts to make more versatile.
Most of this commented out because I was attempting to make it more versatile
and it failed.
2018-01-24 11:45:03 -08:00
Bradley M. Kuhn
a82ebfb0a9 _lookupDeliveryError: begun
Verify beginnings of implementation
2017-12-26 12:32:15 -08:00
Bradley M. Kuhn
99650b23ee releaseRequestHold(): Implement & update tests.
Some of these tests were written a while ago, and the function never
implemented.  It is now implemented and test are updated.
2017-11-26 14:32:17 -08:00
Bradley M. Kuhn
faf1a239a4 holdRequest(): requestId is not a parameter. 2017-11-22 13:32:44 -08:00
Bradley M. Kuhn
ebcabc5231 holdRequest(): Document function API. 2017-11-22 13:32:30 -08:00
Bradley M. Kuhn
722105b1ff contact-setting is not plural!
This was working incorrectly because contact-setting is not plural.
It's one setting.
2017-01-18 14:33:40 +11:00
Bradley M. Kuhn
258d9fad0f Never fulfill requests that are on hold.
Requests on hold can never be fulfilled.

If you want to fulfill a request that is currently on hold, the right
semantic is that you should remove the hold, then fulfill the request.

Note that this test now passes and it didn't before:
  fulfillRequest: .... but undef is returned when attempting to fulfill a held request.
2017-01-14 20:37:56 -08:00
Bradley M. Kuhn
33e2a42179 Should be possible to release and act in same day. 2017-01-10 11:22:24 -08:00
Bradley M. Kuhn
1a6cb14254 Support email settings for donors.
This change, which is not properly documented nor tests present, adds
support for making sure those who don't want emails from us do not
receive them.

I believe I've caught most of the places we want this change supported.
2017-01-02 11:54:25 -08:00
Bradley M. Kuhn
5458c0fbc4 holdRequest: 2 minor bug fixes on parameter names.
I should be more standardized on these parameters and also write tests
to find this stuff.
2016-12-09 13:47:18 -08:00
Bradley M. Kuhn
26c7e938ff fulfillFailure: turn fulfill into hold.
if we are unable to fulfill a request, this method turns it into an
indefinite hold on the request.

This design model for handling failure in fulfillment may not be the
best one, but it seemed to roughly fit the behavior and data model we're
looking for.

A little information is lost, but is at least saved in the 'why' field
of the request_hold table.
2016-12-09 13:46:51 -08:00
Bradley M. Kuhn
89bd74a50a Implement ability to put requests on hold.
Requests can now be placed "on hold", and getRequest() can ignore held
requests.

This required addition of a table, and another API call holdRequest().

Tests were not written here, which was a mistake.  Unit tests and docs
are needed.  A FIXME was added, at least.

Also, minor imporvements to reporting on fulfilled requests.
2016-12-08 15:10:16 -08:00
Bradley M. Kuhn
4737e02745 A quick hack to fix a problem.
I had this in my checkout and was using it, noted with a FIXME.
2016-12-07 17:08:59 -08:00
Bradley M. Kuhn
bf00eeca74 Don't die on this. 2016-12-07 17:07:50 -08:00
Bradley M. Kuhn
9733aff0f3 A few changes that I had yet to commit. 2016-12-07 17:07:43 -08:00
Bradley M. Kuhn
ae7b876647 Implement {set,get}PreferredPostalAddress 2016-03-11 12:29:20 -08:00
Bradley M. Kuhn
1577a5613c getRequestType with no arguments returns full list
I debated whether to create a getRequestTypes() instead, but this seemed
reasonable.  I am too far out of Perl5 programming culture to know if
this sort of interface is recommended practice.
2016-03-11 10:58:05 -08:00
Bradley M. Kuhn
ef21af7afd holdRequest: revise tests to shake out the API.
First of all, I originally thought about releaseDate all wrong.  We want
to store the date that the hold was released, which is the indicator
that the request is no longer on hold and can be fulfilled.

We also need tests that assure a request is not fulfilled while on
hold.  Those are added here.

I shook out a few other changes to the test ordering that are necessary
for the change to testing holdRequest().
2016-01-19 17:49:20 -08:00
Bradley M. Kuhn
18e08833d5 Typo fix. 2016-01-19 17:44:34 -08:00
Bradley M. Kuhn
02dd863c53 getPostalAddresses: implementation
It's straightforward but has no unit tests, and should have some.
2016-01-18 21:20:43 -08:00
Bradley M. Kuhn
ded2028069 Allow missing entityId in Ledger output.
The ledger data can, in fact, sometimes have a missing entityId for
various reasons.  For now, these donations should just be ignored.
Perhaps in future a warning of some sort should be generated.
2016-01-18 21:10:47 -08:00
Bradley M. Kuhn
e43b6e34ae donorTotalGaveInPeriod: First implementation.
This passes all tests:

ok 224 - donorTotalGaveInPeriod(): dies with undefined donorId
ok 225 - donorTotalGaveInPeriod(): dies with non-numeric donorId
ok 226 - donorTotalGaveInPeriod(): dies with non-existent id
ok 227 - donorTotalGaveInPeriod():  dies with non ISO-8601 string in startDate
ok 228 - donorTotalGaveInPeriod():  dies with non ISO-8601 string in endDate
ok 229 - donorTotalGaveInPeriod(): dies if given an argument that is not recognized
ok 230 - donorTotalGaveInPeriod(): total for a donor with no period named succeeds...
ok 231 - donorTotalGaveInPeriod(): ...and returned value is correct.
ok 232 - donorTotalGaveInPeriod(): check for total with both start and end date succeeds...
ok 233 - donorTotalGaveInPeriod(): ...and returned value is correct.
ok 234 - donorTotalGaveInPeriod(): check for total with just a start date succeeds...
ok 235 - donorTotalGaveInPeriod(): ...and returned value is correct.
ok 236 - donorTotalGaveInPeriod(): check for total with just a end date succeeds...
ok 237 - donorTotalGaveInPeriod(): ...and returned value is correct.
2016-01-07 13:36:21 -08:00
Bradley M. Kuhn
f3b7ebc6e3 getEmailAddresses: tests and implementation. 2015-12-31 01:59:50 -08:00
Bradley M. Kuhn
39faafcab6 supporterExpirationDate: fix reverse sort bug.
These two new tests:
  ok 222 - supporterExpirationDate(): same donation amount in year...
  ok 223 - supporterExpirationDate(): ...returns the latter date.

did not pass without this change.  The list for annuals in
supporterExpirationDate() was sorted in the wrong order, producing
erroneous results.
2015-12-30 21:26:48 -08:00
Bradley M. Kuhn
dbeb98d0f2 findDonor: empty criteria finds everyone.
Rather than die() when the criteria list is empty, instead return the
entire list.
2015-12-30 20:53:28 -08:00
Bradley M. Kuhn
97f08a7bd8 supporterExpirationDate: tests & implementation 2015-12-30 20:11:57 -08:00
Bradley M. Kuhn
7e424200c7 donorFirstGave: tests and initial implementation. 2015-12-30 19:32:31 -08:00
Bradley M. Kuhn
a57415ff6d donorLastGave: initial implementation. 2015-12-30 19:01:03 -08:00
Bradley M. Kuhn
f57ac7d3f0 Remove dead code. 2015-12-30 18:13:30 -08:00
Bradley M. Kuhn
1c6441e135 setPublicAck: Implementation
ok 48 - setPublicAck: fails supporterId invalid
ok 49 - setPublicAck: fails supporterId is string
ok 50 - setPublicAck: fails supporterId is undef
ok 51 - setPublicAck: 1 failed calls changed nothing.
ok 52 - setPublicAck: 1 failed calls changed nothing.
ok 53 - setPublicAck: 1 failed calls changed nothing.
ok 54 - setPublicAck: lives when valid id is given for undefining...
ok 55 - setPublicAck: ...and suceeds in changing value.
ok 56 - setPublicAck: lives when valid id is given for off...
ok 57 - setPublicAck: ...and suceeds in changing value.
ok 58 - setPublicAck: lives when valid id is given for on...
ok 59 - setPublicAck: ...and suceeds in changing value.
2015-12-30 17:54:37 -08:00
Bradley M. Kuhn
59d824e6b8 isSupporter: tests, implementation & docs. 2015-12-30 17:19:10 -08:00
Bradley M. Kuhn
21080cc4d5 getDisplayName: tests, implementation, and docs. 2015-12-30 17:12:58 -08:00
Bradley M. Kuhn
c9c85bb540 Correct auto-0 public_ack.
Actually, public_ack can be NULL and that's ok.  It indicates that the
donor has not answered the question yet.
2015-12-30 17:04:00 -08:00
Bradley M. Kuhn
990fa89f1d _getDonorField: generalize code for donor fields
This method can be used for a one-liner for any field in the donor
table.

Used it to implement getLedgerEntityId and getPublicAck.
2015-12-30 17:03:07 -08:00
Bradley M. Kuhn
ec7e50e8e0 getPublicAck: initial tests spec out API. 2015-12-30 16:51:04 -08:00
Bradley M. Kuhn
195732b6b0 confess is better here than die.
Maybe I should use it throughout?
2015-12-30 16:09:59 -08:00
Bradley M. Kuhn
724cb77605 new: additional arguments related to ledger.
I'll need a full command line here, as it turns out, and also regular
expressions to use for searching for monthly vs. annual donations.
2015-12-30 12:08:33 -08:00
Bradley M. Kuhn
2e14c340ec getLedgerEntityId: Initial implementation.
All tests now pass:

ok 15 - getLedgerEntityId: fails when rows are not returned but _verifyId() somehow passed
ok 16 - getLedgerEntityId: fails when rows are not returned but _verifyId() somehow passed
ok 17 - getLedgerEntityId: lives when valid id is given...
ok 18 - getLedgerEntityId: ...and return value is correct.
2015-12-30 11:31:36 -08:00
Bradley M. Kuhn
0ca9d394e2 getLedgerEntityId: tests showing basic API & docs
These tests show the basic API for the getLedgerEntityId() method.

Documentation for the method also included.
2015-12-30 11:31:09 -08:00