[management] Code generation: update services and models#497
[management] Code generation: update services and models#497AdyenAutomationBot wants to merge 1 commit into
Conversation
|
There was a problem hiding this comment.
Code Review
This pull request introduces the DonationCampaignsApi class to the management service, adding endpoints for managing donation campaigns and listing nonprofits. Feedback suggests adding corresponding unit tests to prevent regressions, and implementing defensive checks for required path parameters (such as companyId and donationCampaignId) to avoid malformed API requests.
| from ..base import AdyenServiceBase | ||
|
|
||
|
|
||
| class DonationCampaignsApi(AdyenServiceBase): |
There was a problem hiding this comment.
A new API class DonationCampaignsApi has been introduced with several new endpoints, but no corresponding unit tests have been added to test/ManagementTest.py. To ensure correctness and prevent future regressions, please add unit tests covering these new methods (e.g., verifying the correct HTTP method, endpoint URL construction, and request body handling).
| def create_donation_campaign(self, request, companyId, idempotency_key=None, **kwargs): | ||
| """ | ||
| Create a donation campaign | ||
| """ | ||
| endpoint = self.baseUrl + f"/companies/{companyId}/campaignManagement" |
There was a problem hiding this comment.
To prevent constructing malformed URLs and sending invalid requests to the server, consider adding a defensive check to ensure companyId is provided and is not empty.
def create_donation_campaign(self, request, companyId, idempotency_key=None, **kwargs):
"""
Create a donation campaign
"""
if not companyId:
raise ValueError("companyId is required and cannot be empty")
endpoint = self.baseUrl + f"/companies/{companyId}/campaignManagement"| def delete_donation_campaign( | ||
| self, companyId, donationCampaignId, idempotency_key=None, **kwargs | ||
| ): | ||
| """ | ||
| Delete a donation campaign | ||
| """ | ||
| endpoint = self.baseUrl + f"/companies/{companyId}/campaignManagement/{donationCampaignId}" |
There was a problem hiding this comment.
Both companyId and donationCampaignId are required path parameters. Consider adding defensive checks to ensure they are provided and not empty before constructing the endpoint URL.
| def delete_donation_campaign( | |
| self, companyId, donationCampaignId, idempotency_key=None, **kwargs | |
| ): | |
| """ | |
| Delete a donation campaign | |
| """ | |
| endpoint = self.baseUrl + f"/companies/{companyId}/campaignManagement/{donationCampaignId}" | |
| def delete_donation_campaign( | |
| self, companyId, donationCampaignId, idempotency_key=None, **kwargs | |
| ): | |
| """ | |
| Delete a donation campaign | |
| """ | |
| if not companyId: | |
| raise ValueError("companyId is required and cannot be empty") | |
| if not donationCampaignId: | |
| raise ValueError("donationCampaignId is required and cannot be empty") | |
| endpoint = self.baseUrl + f"/companies/{companyId}/campaignManagement/{donationCampaignId}" |



This PR contains the automated changes for the
managementservice.The commit history of this PR reflects the
adyen-openapicommits that have been applied.