Skip to content

Conversation

@Progi1984
Copy link
Member

@Progi1984 Progi1984 commented Oct 1, 2025

Questions Answers
Branch? dev
Description? Added endpoints for domain "Tax"
Type? improvement
Category? CO
BC breaks? no
Deprecations? no
How to test? ⬇️
Fixed issue or discussion? N/A
Related PRs N/A
Sponsor company lefevre.dev

✔️ PrestaShop/PrestaShop#39669
Can't use prestashop.core.grid.data_factory.tax
because @prestashop.core.grid.query_builder.tax return empty data
because @=service('prestashop.adapter.legacy.context').getContext().employee.id_lang is NULL

How to test 🚧

  • Create an API Client with these scopes : tax_read & tax_write
  • Request an access token
  • Query 1 :
    • Method : POST
    • URI : /taxes
    • Body :
{
    "names": {
        "en-US": "My Tax EN",
        "fr-FR": "My Tax FR"
    },
    "enabled": false,
    "rate": 1.23
}
  • Response :
    • HTTP Code : 201
    • HTTP Body : Contains the ID of the tax (keep it to use it after : I will call it {theCreatedID}
    • Check in BO if the tax is correctly created
  • Query 2 : Repeat with new tax name 2 times (we have created three new taxes, keep their ID too) : I will call it {theCreatedID2} & {theCreatedID3}
  • Query 3 :
    • Method : GET
    • URI : /taxes/{theCreatedID}
    • Response :
      • HTTP Code : 200
      • HTTP Body : Contains a JSON for the Tax
  • Query 4 :
    • Method : PATCH
    • URI : /taxes/{theCreatedID}
    • Body :
{
    "names": {
        "en-US": "My Tax Updated EN",
        "fr-FR": "My Tax Updated FR"
    }
}
  • Response :
    • HTTP Code : 200
    • HTTP Body : Contains a JSON for the tax with updated data
    • Check in BO if tax is updated
  • Query 5 :
    • Method : PATCH
    • URI : /taxes/{theCreatedID}
    • Body :
{
    "enabled": true
}
  • Response :
    • HTTP Code : 200
    • HTTP Body : Contains a JSON for the tax with updated data
    • Check in BO if tax is updated
  • Query 6 :
    • Method : PATCH
    • URI : /taxes/{theCreatedID}
    • Body :
{
    "rate": 9.87
}
  • Response :
    • HTTP Code : 200
    • HTTP Body : Contains a JSON for the tax with updated data
    • Check in BO if tax is updated
  • Query 7 :
    • Method : GET
    • URI : /taxes/{theCreatedID}
    • Response :
      • HTTP Code : 200
      • HTTP Body : Contains a JSON for the tax with updated data
  • Query 8 :
    • Method : GET
    • URI : /taxes
    • Response :
      • HTTP Code : 200
      • HTTP Body : Contains a JSON for all taxes with our created tax
  • Query 9 :
    • Method : DELETE
    • URI : /taxes/{theCreatedID}
    • Response :
      • HTTP Code : 204
      • Check in BO that the tax is deleted
  • Query 10 :
    • Method : GET
    • URI : /taxes/{theCreatedID}
    • Response :
      • HTTP Code : 404
  • Query 11 :
    • Method : PUT
    • URI : /taxes/bulk-set-status
    • Body :
    {"taxIds": [{theCreatedID2}, {theCreatedID3}], "enabled": false}
    • Response :
      • HTTP Code : 204
      • Check in BO that taxes are disabled
  • Query 12 :
    • Method : GET
    • URI : /taxes/{theCreatedID2}
    • Response :
      • HTTP Code : 200
      • The tax is disabled
  • Query 13 :
    • Method : GET
    • URI : /taxes/{theCreatedID3}
    • Response :
      • HTTP Code : 200
      • The tax is disabled
  • Query 14 :
    • Method : PUT
    • URI : /taxes/bulk-delete
    • Body :
    {"taxIds": [{theCreatedID2}, {theCreatedID3}]}
    • Response :
      • HTTP Code : 204
      • Check in BO that taxes are deleted
  • Query 15 :
    • Method : GET
    • URI : /taxes/{theCreatedID2}
    • Response :
      • HTTP Code : 404
  • Query 16 :
    • Method : GET
    • URI : /taxes/{theCreatedID3}
    • Response :
      • HTTP Code : 404

@Codencode
Copy link
Contributor

Codencode commented Oct 1, 2025

@Progi1984, I think the issue is located here:

https://github.com/PrestaShop/PrestaShop/blob/6e9cba9ad21e7e05b0715d348a6c1317c2e217de/src/PrestaShopBundle/Resources/config/services/core/grid/doctrine_query_builder.yml#L182

we should use @=service('prestashop.adapter.legacy.context').getContext().language.id

I'll create a PR now so you can verify it.

@Codencode
Copy link
Contributor

@Progi1984
I've created the PR: PrestaShop/PrestaShop#39669
Can you check if this fixes your issue?
Thanks!

@jolelievre
Copy link
Contributor

@Progi1984 yep I was about to suggest the same thing as @Codencode did in their PR

The service can be fixed on the 9.0.x branch to be based on LanguageContext which adapts better to both BO and API contexts

@Codencode
Copy link
Contributor

@Progi1984 PR PrestaShop/PrestaShop#39669 has been merged, could you please check if the issue is now resolved?
Thanks!

@Progi1984 Progi1984 force-pushed the tax branch 4 times, most recently from 8aeaad1 to f283733 Compare November 20, 2025 07:55
@Progi1984
Copy link
Member Author

@Codencode I wait for the develop merge.

@Progi1984 Progi1984 force-pushed the tax branch 2 times, most recently from a50f99d to 9b111b5 Compare November 25, 2025 08:00
@Progi1984 Progi1984 marked this pull request as ready for review November 26, 2025 08:13
@Progi1984
Copy link
Member Author

Ping for review :

@ps-jarvis ps-jarvis added the Waiting for QA Status: Waiting for QA feedback label Nov 26, 2025
@ps-jarvis ps-jarvis moved this from Ready for review to To be tested in PR Dashboard Nov 26, 2025
@Progi1984 Progi1984 added this to the 0.2.0 milestone Nov 28, 2025
@SiraDIOP SiraDIOP self-assigned this Nov 28, 2025
@jolelievre jolelievre modified the milestones: 0.2.0, 0.3.0 Dec 3, 2025
Copy link

@SiraDIOP SiraDIOP left a comment

Choose a reason for hiding this comment

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

Hello @Progi1984 ,

Thanks for your PR, i tested it i have an 500 error for the query 8

Query 1
Capture d’écran 2025-12-09 à 11 25 36

Query 2
Capture d’écran 2025-12-09 à 11 26 19

Query 3
Capture d’écran 2025-12-09 à 11 27 40

Query 4
Capture d’écran 2025-12-09 à 11 30 30

Query 5

Capture d’écran 2025-12-09 à 11 31 14

Query 6:
Capture d’écran 2025-12-09 à 11 31 57

Query 7
Capture d’écran 2025-12-09 à 11 32 32

Query 8:
Capture d’écran 2025-12-09 à 11 33 54

Thanks

@SiraDIOP SiraDIOP added Waiting for author and removed Waiting for QA Status: Waiting for QA feedback labels Dec 9, 2025
@ps-jarvis ps-jarvis moved this from To be tested to Waiting for author in PR Dashboard Dec 9, 2025
@jolelievre jolelievre removed this from the 0.3.0 milestone Jan 22, 2026
@kpodemski
Copy link
Contributor

Hello @Progi1984

Will you have time to take a look at query number 8 to see what's wrong?

@Progi1984 Progi1984 marked this pull request as draft January 23, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Waiting for author

Development

Successfully merging this pull request may close these issues.

6 participants