feat: create specific price system and adapt product queries
This commit is contained in:
73
bruno/api_v1/specific_price/folder.yml
Normal file
73
bruno/api_v1/specific_price/folder.yml
Normal file
@@ -0,0 +1,73 @@
|
||||
info:
|
||||
name: specific_price
|
||||
type: folder
|
||||
seq: 3
|
||||
|
||||
docs:
|
||||
content: |
|
||||
# Specific Price API
|
||||
|
||||
Endpoints for managing specific price rules (price reductions).
|
||||
|
||||
## Scopes
|
||||
|
||||
Specific prices can be **global** or **scoped**:
|
||||
|
||||
- **Global**: If all scope arrays (`product_ids`, `category_ids`, `product_attribute_ids`, `country_ids`, `customer_ids`) are empty, the price reduction applies to everything.
|
||||
|
||||
- **Scoped**: If ANY scope array has values, the price reduction applies only when ANY condition matches (UNION logic).
|
||||
|
||||
### Scope Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `product_ids` | uint[] | Specific products |
|
||||
| `category_ids` | uint[] | Products in categories |
|
||||
| `product_attribute_ids` | uint[] | Product variants (e.g., size, color) |
|
||||
| `country_ids` | uint[] | Customers in countries |
|
||||
| `customer_ids` | uint[] | Specific customers |
|
||||
|
||||
### Examples
|
||||
|
||||
**Global** (applies to all products):
|
||||
```json
|
||||
{
|
||||
"name": "Global Sale",
|
||||
"reduction_type": "percentage",
|
||||
"percentage_reduction": 10,
|
||||
"from_quantity": 1
|
||||
}
|
||||
```
|
||||
|
||||
**Scoped to specific products**:
|
||||
```json
|
||||
{
|
||||
"name": "Product Sale",
|
||||
"reduction_type": "percentage",
|
||||
"percentage_reduction": 20,
|
||||
"product_ids": [1, 2, 3]
|
||||
}
|
||||
```
|
||||
|
||||
**Scoped to category + country**:
|
||||
```json
|
||||
{
|
||||
"name": "Category Country Sale",
|
||||
"reduction_type": "amount",
|
||||
"price": 9.99,
|
||||
"category_ids": [5],
|
||||
"country_ids": [1]
|
||||
}
|
||||
```
|
||||
|
||||
## Reduction Types
|
||||
|
||||
- `percentage`: Requires `percentage_reduction` (e.g., 10.5 = 10.5% off)
|
||||
- `amount`: Requires `price` (fixed price after reduction)
|
||||
|
||||
## Validation
|
||||
|
||||
- `reduction_type` is required and must be "percentage" or "amount"
|
||||
- If `reduction_type` is "percentage", then `percentage_reduction` is required
|
||||
- If `reduction_type` is "amount", then `price` is required
|
||||
type: text/markdown
|
||||
Reference in New Issue
Block a user