Skip to content

Conversation

@mattgoud
Copy link
Contributor

Questions Answers
Description? add bulk operations for discounts (status and delation)
Type? new feature
BC breaks? no
Deprecations? no
Fixed ticket? Fixes #40282
Sponsor company @PrestaShopCorp
How to test? see #40282

@mattgoud mattgoud requested a review from jolelievre December 19, 2025 15:17
@mattgoud mattgoud marked this pull request as ready for review December 19, 2025 15:17
@ps-jarvis
Copy link

Hello @mattgoud!

This is your first pull request on ps_apiresources repository of the PrestaShop project.

Thank you, and welcome to this Open Source community!

@github-project-automation github-project-automation bot moved this to Ready for review in PR Dashboard Dec 19, 2025
Comment on lines 518 to 522
$bearerToken = $this->getBearerToken(['discount_read']);
static::createClient()->request('GET', '/discounts/' . $discountId, [
'auth_bearer' => $bearerToken,
]);
self::assertResponseStatusCodeSame(404);
Copy link
Contributor

Choose a reason for hiding this comment

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

You can replace this with the getItem method, the third parameter allows you to specify the expected HTTP code (here 404)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok @jolelievre done

$validId = $discount['discountId'];

// Try to bulk enable with mixed valid and invalid IDs
$bearerToken = $this->getBearerToken(['discount_write']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarily here (and following tests) you can also use the partialUpdateItem method and provide the expected HTTP error code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok @jolelievre done

@mattgoud
Copy link
Contributor Author

mattgoud commented Dec 23, 2025

NB: @jolelievre we can't use bulkDeleteItems method for testBulkDeleteWithMissingParameter caused we need to pass an empty json for this edge case without generating a 400 error (see DiscountEndpointTest - lines 568-577 )

@mattgoud mattgoud requested a review from jolelievre December 23, 2025 10:15
@ps-jarvis ps-jarvis added the Waiting for QA Status: Waiting for QA feedback label Dec 29, 2025
@ps-jarvis ps-jarvis moved this from Ready for review to To be tested in PR Dashboard Dec 29, 2025
@jolelievre jolelievre closed this Dec 30, 2025
@github-project-automation github-project-automation bot moved this from To be tested to Closed in PR Dashboard Dec 30, 2025
@jolelievre jolelievre reopened this Dec 30, 2025
@github-project-automation github-project-automation bot moved this from Closed to Reopened in PR Dashboard Dec 30, 2025
@jolelievre jolelievre added this to the 0.3.0 milestone Dec 30, 2025
@jolelievre jolelievre merged commit 928a7de into PrestaShop:dev Dec 30, 2025
42 checks passed
@github-project-automation github-project-automation bot moved this from Reopened to Merged in PR Dashboard Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Waiting for QA Status: Waiting for QA feedback

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Bulk enable disable delete on discount

4 participants