Repository navigation
VCST-6309: Validate list, sale and min quantity on price update API - #242
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
kutasinaelena
pushed a commit
that referenced
this pull request
Oct 16, 2026
kutasinaelena
pushed a commit
that referenced
this pull request
Oct 16, 2026
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.

Description
The product price update API now validates price values on the server. Before this,
PUT /api/products/prices,PUT /api/products/{productId}/pricesandPATCH /api/products/prices/{id}stored whatever they received. Integrations, imports and scripts could save a negative or zero list price, a negative sale price, a sale price above the list price, or a min quantity of 0. Only the Admin price grid blocked these values, and only on the client.Each price in the request must now meet these rules:
list> 0sale≥ 0 andsale≤list, whensaleis setminQuantity> 0These are the rules the Admin grid already applies before it enables Save. If any price breaks a rule, nothing is saved. The endpoint returns
400 Bad Requestwith errors keyed by field. The key holds the index of the product entry and of the price inside it:{ "[1].Prices[0].List": ["List price must be greater than 0"] }PATCH /api/products/prices/{id}used to ignore the result of the update it delegates to and always answered204. It now returns that result, so an invalid patch gets the same400.No schema change, no migrations, no new settings, no new dependencies.
New GraphQL queries and mutations
None. This module has no GraphQL surface.
Changes to existing GraphQL queries and mutations
None.
New public services / interfaces / methods
VirtoCommerce.PricingModule.Data.Validators.PriceValidator(AbstractValidator<Price>) holds the per-price rules.VirtoCommerce.PricingModule.Data.Validators.ProductPriceValidator(AbstractValidator<ProductPrice>) appliesAbstractValidator<Price>to each price in aProductPrice.Both are registered in DI as
AbstractValidator<Price>andAbstractValidator<ProductPrice>. To relax or extend the rules, for example to allow a zero list price for free items, register your ownAbstractValidator<Price>in your module. The controller doesn't need to change.New protected methods (extensibility)
None.
Breaking changes
PricingModuleControllerhas a new constructor parameter,AbstractValidator<ProductPrice> productPriceValidator. Code that constructs or subclasses the controller directly must pass it. No[Obsolete]overload was added, because the controller is resolved by DI and is not meant to be constructed by hand.204now fail with400when a price breaks one of the rules above. This applies toPUT /api/products/prices,PUT /api/products/{productId}/pricesandPATCH /api/products/prices/{id}. Check that integrations which write prices through these endpoints don't send zero or negative list prices, negative sale prices, sale prices above the list price, or aminQuantityof 0.New dependencies
None.
References
QA-test:
Jira-link:
https://virtocommerce.atlassian.net/browse/VCST-6309
Artifact URL:
https://vc3prerelease.blob.core.windows.net/packages/VirtoCommerce.Pricing_3.1009.0-pr-242-db99.zip
🤖 Generated with Claude Code