Skip to content

Expose GetTaxRuleList as GET /tax-rules-groups/{id}/tax-rules - #411

Draft
PrestaEdit wants to merge 4 commits into
PrestaShop:devfrom
PrestaEdit:feat/tax-rule-list
Draft

PrestaEdit wants to merge 4 commits into
PrestaShop:devfrom
PrestaEdit:feat/tax-rule-list

Conversation

@PrestaEdit

Copy link
Copy Markdown
Contributor

Questions

Question Answer
Branch? dev
Bug fix? no
New feature? yes
Category? FO
BC breaks? no
Deprecations? no
How to test? See test plan below
Fixed ticket? Tracked in PrestaShop/PrestaShop#39630

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.

  • Route: GET /tax-rules-groups/{taxRulesGroupId}/tax-rules?limit=&offset=
  • CQRS: PrestaShop\PrestaShop\Core\Domain\TaxRulesGroup\TaxRule\Query\GetTaxRuleList
  • Wrapper mapping: TaxRuleList { taxRules[], totalCount } → itemsField / countField
  • Language: languageId sourced from request context ([_context][langId]), same pattern as CombinationList
  • Scope: tax_rules_group_read (mirrors product_read on /products/{id}/images)
  • Version gating: the CQRS query only exists on develop, so the operation is marked experimentalOperation: true, the tests are guarded with class_exists(), and PHPStan version ignores cover 9.0.3 / 9.1.4 — same treatment as the existing TaxRule Command/Exception classes

Fields exposed match TaxRuleForList: taxRuleId, countryName, stateName, zipcode, behavior, taxName, taxRate, description, plus taxRulesGroupId from the URI.

Test plan

  • CI green on the PrestaEdit fork: PHPStan (9.0.3 / 9.1.4 / 9.2.x / develop), PHP-CS-Fixer, Rector, PHPUnit, license headers, integration tests on the full PHP × PS matrix (8.1/8.4/8.5 × 9.0.3/9.1.4/9.2.x/develop) — see PrestaEdit#1
  • Local: composer setup-local-tests && composer run-module-tests -- --filter TaxRulesGroupEndpointTest
  • Manual: hit /tax-rules-groups/1/tax-rules via Swagger UI, verify response shape and pagination

🤖 Generated with Claude Code

PrestaEdit and others added 4 commits August 11, 2026 15:54
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

2 participants