Skip to content

Feature: Donation details overview backend #7976

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

Conversation

alaca
Copy link
Member

@alaca alaca commented Jun 12, 2025

Description

This PR adds donation details overview backend.

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • Reviewed by the designer (if follows a design)
  • Self Review of code and UX completed

Sorry, something went wrong.

alaca added 4 commits June 12, 2025 16:11
@alaca alaca requested a review from glaubersilva June 12, 2025 16:32
alaca added 2 commits June 12, 2025 18:50
Copy link
Contributor

@glaubersilva glaubersilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alaca Nice work! I left a few comments with some suggestions.

Also, should we implement the update_item endpoint on this PR as well? I'm asking because I'm not sure if we need it for now.

'methods' => WP_REST_Server::READABLE,
'callback' => [$this, 'get_items'],
'permission_callback' => [$this, 'permissionsCheck'],
'args' => $this->get_collection_params(),
Copy link
Contributor

@glaubersilva glaubersilva Jun 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super imortant, but since the includeSensitiveData and anonymousDonations params are the same for get_item and get_items, we can create a getSharedParams to not repeat our selves so we can merge it and both args entries.

Sample: https://github.com/impress-org/givewp/blob/develop/src/API/REST/V3/Routes/Donors/DonorController.php#L46

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, nice idea. I would do that if we had more parameters, but since there are only 2, I think it is much cleaner this way.

alaca added 10 commits June 17, 2025 12:42
…re/donation-details-overview-backend-GIVE-2602
@alaca alaca requested a review from glaubersilva June 17, 2025 16:29
Copy link
Contributor

@glaubersilva glaubersilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alaca Nice work! I just left a comment about a minor thing.

About the failing unit tests, maybe it can help:

// Remove additional property add by the prepare_response_for_collection() method
unset($data[0]['_links']);

Another thing to keep in mind is this limitation related to the $response->get_data() method:

//The $response->get_data() method do not include _embedded data
$data = $this->responseToData($response, true);

@alaca
Copy link
Member Author

alaca commented Jun 18, 2025

@glaubersilva, your help and insight on the WP REST API helped me greatly. Thanks, man. Appreciate that.

@alaca alaca merged commit 2e96334 into epic/donation-details-admin-page Jun 18, 2025
24 checks passed
@alaca alaca deleted the feature/donation-details-overview-backend-GIVE-2602 branch June 18, 2025 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants