-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: add new routes for donations and donors #7699
base: epic/campaigns
Are you sure you want to change the base?
Feature: add new routes for donations and donors #7699
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool seeing headers and links for pagination! This is often overlooked, but good that we are starting to leverage this feature.
I added some feedback on the queries. In particular, we have the CampaignDonationQuery
which we should consider using - or at least update what is here to account for subscriptions and test payments.
Out of curiosity, is the |
@JasonTheAdams Yes, it's a pre-existing thing. |
I'm seriously considering recommending a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some thoughts, @glaubersilva! Great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passed manual QA tests.
@glaubersilva Why did this go to QA with requested changes pending? 😅 |
@JasonTheAdams It didn't go to QA. I think @rickalday got confused because this PR is related to other tasks that were to QA |
Hahah! Got it. 😆 |
My bad. I posted on the wrong PR. |
|
@JasonTheAdams I liked the idea of renaming I believe it would be appropriate to apply this replacement everywhere, including the routes implemented in this PR as well as those for Campaigns. So, I think we can move forward with this change unless the other devs have concerns or objections about it, let's check with them just to make sure we are not missing something here. |
Sounds great, @glaubersilva! I like the idea of retroactively applying this so long as the endpoints we're applying them to are:
|
'includeAnonymousDonations' => [ | ||
'type' => 'boolean', | ||
'default' => false, | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glaubersilva Do we have any restrictions around this parameter? If our goal is to protect anonymous donations, then we may want to include some permission parameters around this. Presently, this is a fully public API, and these parameters are discoverable, so it's not hard for someone to flip the switch on this. There are a few contexts, here:
- Donor wall
- Admin list tables (donations list and campaign donations)
- Campaign donations
- 3rd Party usage
I'm guessing this will result in 3 forms of output:
- Anonymous donations are included and donor info revealed (admin-side)
- Anonymous donations are included but donor information is redacted (donor wall)
- Anonymous donations are prohibited
Now, we may actually be fine with anyone in the world being able to query anonymous donations so long as the donor information is redacted (dropping option 3). But we'll still need a way to grab all information for the admin side with proper authorization.
Note: this is true of both the collection endpoint and single donation resource endpoint.
cc: @jonwaldstein
Related to GIVE-1392 and GIVE-1393
Description
This PR implements 4 new REST API endpoints to retrieve
Donations
andDonors
. In the endpoints that return multiple entries, is possible to filter the returned data using custom parameters in the request and also is possible use pagination and sort the results using thepage
,per_page
,sort
anddirection
parameters.Another thing to consider is that sensitive data will be returned only if the user making the request is the site administrator.
Sensitive data for donations:
Sensitive data for donors:
The new endpoints to retrieve a single entry:
The new endpoints to retrieve multiple entries:
Important: These endpoints that return multiple entries allow filtering the returned data through the
campaignId
parameter. It's also possible to use thehideAnonymousDonations
orhideAnonymousDonors
parameter to exclude from the results the donations/donors that made anonymous donations. Beyond that, on the/give-api/v2/donors
endpoint, it is possible to use theonlyWithDonations
parameter to retrieve all donors or just the ones that have valid donations completed.Sample request including anonymous donations in the results:
Sample request including anonymous donors in the results:
Sample request to retrieve the 5 most recent donations:
Sample request to retrieve the top 5 donors:
Affects
GiveWP Rest API endpoints available for public use.
Testing Instructions
In your terminal, run the following commands:
Pre-review Checklist
@unreleased
tags included in DocBlocks