-
Notifications
You must be signed in to change notification settings - Fork 25
Bulk enable disable delete discount #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bulk enable disable delete discount #130
Conversation
mattgoud
commented
Dec 19, 2025
| 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 |
…mprove doc for bulk delete
…te import for bulk-update-status
…meter (422 instead of 400)
|
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! |
| $bearerToken = $this->getBearerToken(['discount_read']); | ||
| static::createClient()->request('GET', '/discounts/' . $discountId, [ | ||
| 'auth_bearer' => $bearerToken, | ||
| ]); | ||
| self::assertResponseStatusCodeSame(404); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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']); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok @jolelievre done
…y needs to send an empty JSON object to test
|
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 ) |