Expose GetTaxRuleList as GET /tax-rules-groups/{id}/tax-rules - #411
Draft
PrestaEdit wants to merge 4 commits into
Draft
PrestaEdit wants to merge 4 commits into
PrestaEdit wants to merge 4 commits into
Conversation
Adds a paginated sub-resource returning the tax rules attached to a
tax rules group. The endpoint delegates to the existing core CQRS query
GetTaxRuleList (taxRulesGroupId + languageId + optional limit/offset).
Fields exposed match the TaxRuleForList DTO returned by the core handler:
taxRuleId, countryName, stateName, zipcode, behavior, taxName, taxRate,
description — plus the parent taxRulesGroupId injected from the URI.
Scope: tax_rules_group_read (mirrors /products/{id}/images convention).
Tracks PrestaShop/PrestaShop#39630.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The GetTaxRuleList CQRS query only exists on PrestaShop develop. Mark the operation experimental, guard the tests with class_exists(), and add PHPStan version ignores for 9.0.3 and 9.1.4 — same treatment as the TaxRule Command/Exception classes already handled. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ApiPlatform interprets #[ApiProperty(identifier: true)] on a collection
sub-resource as the URL variable target, which shadowed the natural
{taxRulesGroupId} URI variable and produced 'Invalid identifier value
or configuration' 404s. ProductImageList / CombinationList follow the
same convention with no identifier annotation, so align on that.
Also pin requirements: ['taxRulesGroupId' => '\d+'] for consistency
with the main TaxRulesGroup resource operations.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
testProtectedEndpoints expected a 401 but got 404 on 9.0/9.1 because the experimental route is not registered when the CQRS class is absent. Guard the yield with class_exists() to mirror the runtime gating. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Questions
Description
Adds a paginated sub-resource that returns the tax rules attached to a tax rules group, delegating to the existing core CQRS query
GetTaxRuleList.GET /tax-rules-groups/{taxRulesGroupId}/tax-rules?limit=&offset=PrestaShop\PrestaShop\Core\Domain\TaxRulesGroup\TaxRule\Query\GetTaxRuleListTaxRuleList { taxRules[], totalCount }→itemsField/countFieldlanguageIdsourced from request context ([_context][langId]), same pattern asCombinationListtax_rules_group_read(mirrorsproduct_readon/products/{id}/images)develop, so the operation is markedexperimentalOperation: true, the tests are guarded withclass_exists(), and PHPStan version ignores cover9.0.3/9.1.4— same treatment as the existing TaxRule Command/Exception classesFields exposed match
TaxRuleForList:taxRuleId,countryName,stateName,zipcode,behavior,taxName,taxRate,description, plustaxRulesGroupIdfrom the URI.Test plan
composer setup-local-tests && composer run-module-tests -- --filter TaxRulesGroupEndpointTest/tax-rules-groups/1/tax-rulesvia Swagger UI, verify response shape and pagination🤖 Generated with Claude Code