feat: create specific price system and adapt product queries
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
info:
|
||||
name: Change Locales
|
||||
type: http
|
||||
seq: 3
|
||||
seq: 5
|
||||
|
||||
http:
|
||||
method: POST
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
info:
|
||||
name: Delete Index - MeiliSearch
|
||||
type: http
|
||||
seq: 5
|
||||
seq: 7
|
||||
|
||||
http:
|
||||
method: DELETE
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
info:
|
||||
name: Search Index Settings
|
||||
type: http
|
||||
seq: 4
|
||||
seq: 6
|
||||
|
||||
http:
|
||||
method: POST
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
info:
|
||||
name: Search Items
|
||||
type: http
|
||||
seq: 2
|
||||
seq: 4
|
||||
|
||||
http:
|
||||
method: POST
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
info:
|
||||
name: auth
|
||||
type: folder
|
||||
seq: 6
|
||||
seq: 2
|
||||
|
||||
request:
|
||||
auth: inherit
|
||||
|
||||
@@ -11,7 +11,7 @@ http:
|
||||
data: |-
|
||||
{
|
||||
"b2b_id_currency" : 1,
|
||||
"conversion_rate": 4.2
|
||||
"conversion_rate": 3
|
||||
}
|
||||
auth: inherit
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ http:
|
||||
runtime:
|
||||
variables:
|
||||
- name: id
|
||||
value: "1"
|
||||
value: "2"
|
||||
|
||||
settings:
|
||||
encodeUrl: true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
info:
|
||||
name: currency
|
||||
type: folder
|
||||
seq: 8
|
||||
seq: 9
|
||||
|
||||
request:
|
||||
auth: inherit
|
||||
|
||||
@@ -5,10 +5,10 @@ info:
|
||||
|
||||
http:
|
||||
method: GET
|
||||
url: "{{bas_url}}/restricted/customer?id=1"
|
||||
url: "{{bas_url}}/restricted/customer?id=2"
|
||||
params:
|
||||
- name: id
|
||||
value: "1"
|
||||
value: "2"
|
||||
type: query
|
||||
auth: inherit
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ info:
|
||||
|
||||
http:
|
||||
method: GET
|
||||
url: "{{bas_url}}/restricted/customer/list?search="
|
||||
url: "{{bas_url}}/restricted/customer/list?search=marek"
|
||||
params:
|
||||
- name: search
|
||||
value: ""
|
||||
value: marek
|
||||
type: query
|
||||
auth: inherit
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
info:
|
||||
name: customer
|
||||
type: folder
|
||||
seq: 9
|
||||
seq: 10
|
||||
|
||||
request:
|
||||
auth: inherit
|
||||
|
||||
@@ -5,7 +5,7 @@ info:
|
||||
|
||||
http:
|
||||
method: GET
|
||||
url: "{{bas_url}}/restricted/product/200/1/5"
|
||||
url: "{{bas_url}}/restricted/product/51/1/7"
|
||||
auth: inherit
|
||||
|
||||
settings:
|
||||
|
||||
@@ -13,7 +13,7 @@ http:
|
||||
runtime:
|
||||
variables:
|
||||
- name: product_id
|
||||
value: "2361"
|
||||
value: "51"
|
||||
|
||||
settings:
|
||||
encodeUrl: true
|
||||
|
||||
@@ -5,7 +5,7 @@ info:
|
||||
|
||||
http:
|
||||
method: GET
|
||||
url: "{{bas_url}}/restricted/product/list?p=1&elems=30&sort=product_id,asc&category_id_in=243&reference=~62"
|
||||
url: "{{bas_url}}/restricted/product/list?p=1&elems=30&sort=product_id,asc&reference=~NC100"
|
||||
params:
|
||||
- name: p
|
||||
value: "1"
|
||||
@@ -19,8 +19,9 @@ http:
|
||||
- name: category_id_in
|
||||
value: "243"
|
||||
type: query
|
||||
disabled: true
|
||||
- name: reference
|
||||
value: ~62
|
||||
value: ~NC100
|
||||
type: query
|
||||
body:
|
||||
type: json
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
info:
|
||||
name: product
|
||||
type: folder
|
||||
seq: 7
|
||||
seq: 8
|
||||
|
||||
request:
|
||||
auth: inherit
|
||||
|
||||
20
bruno/api_v1/specific_price/Activate.yml
Normal file
20
bruno/api_v1/specific_price/Activate.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
info:
|
||||
name: Activate
|
||||
type: http
|
||||
seq: 5
|
||||
|
||||
http:
|
||||
method: PATCH
|
||||
url: "{{bas_url}}/restricted/specific-price/{{id}}/activate"
|
||||
auth: inherit
|
||||
|
||||
runtime:
|
||||
variables:
|
||||
- name: id
|
||||
value: "1"
|
||||
|
||||
settings:
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
followRedirects: true
|
||||
maxRedirects: 5
|
||||
27
bruno/api_v1/specific_price/Create.yml
Normal file
27
bruno/api_v1/specific_price/Create.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
info:
|
||||
name: Create
|
||||
type: http
|
||||
seq: 3
|
||||
|
||||
http:
|
||||
method: POST
|
||||
url: "{{bas_url}}/restricted/specific-price"
|
||||
body:
|
||||
type: json
|
||||
data: |-
|
||||
{
|
||||
"name": "Summer Sale 3",
|
||||
"scope": "shop",
|
||||
"reduction_type": "amount",
|
||||
"price": 69,
|
||||
"from_quantity": 1,
|
||||
"is_active": true,
|
||||
"currency_id": 2
|
||||
}
|
||||
auth: inherit
|
||||
|
||||
settings:
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
followRedirects: true
|
||||
maxRedirects: 5
|
||||
20
bruno/api_v1/specific_price/Deactivate.yml
Normal file
20
bruno/api_v1/specific_price/Deactivate.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
info:
|
||||
name: Deactivate
|
||||
type: http
|
||||
seq: 6
|
||||
|
||||
http:
|
||||
method: PATCH
|
||||
url: "{{bas_url}}/restricted/specific-price/{{id}}/deactivate"
|
||||
auth: inherit
|
||||
|
||||
runtime:
|
||||
variables:
|
||||
- name: id
|
||||
value: "1"
|
||||
|
||||
settings:
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
followRedirects: true
|
||||
maxRedirects: 5
|
||||
20
bruno/api_v1/specific_price/Delete.yml
Normal file
20
bruno/api_v1/specific_price/Delete.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
info:
|
||||
name: Delete
|
||||
type: http
|
||||
seq: 7
|
||||
|
||||
http:
|
||||
method: DELETE
|
||||
url: "{{bas_url}}/restricted/price-reductions/{{id}}"
|
||||
auth: inherit
|
||||
|
||||
runtime:
|
||||
variables:
|
||||
- name: id
|
||||
value: "1"
|
||||
|
||||
settings:
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
followRedirects: true
|
||||
maxRedirects: 5
|
||||
20
bruno/api_v1/specific_price/Get.yml
Normal file
20
bruno/api_v1/specific_price/Get.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
info:
|
||||
name: Get
|
||||
type: http
|
||||
seq: 2
|
||||
|
||||
http:
|
||||
method: GET
|
||||
url: "{{bas_url}}/restricted/specific-price/{{id}}"
|
||||
auth: inherit
|
||||
|
||||
runtime:
|
||||
variables:
|
||||
- name: id
|
||||
value: "1"
|
||||
|
||||
settings:
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
followRedirects: true
|
||||
maxRedirects: 5
|
||||
15
bruno/api_v1/specific_price/List.yml
Normal file
15
bruno/api_v1/specific_price/List.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
info:
|
||||
name: List
|
||||
type: http
|
||||
seq: 1
|
||||
|
||||
http:
|
||||
method: GET
|
||||
url: "{{bas_url}}/restricted/specific-price"
|
||||
auth: inherit
|
||||
|
||||
settings:
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
followRedirects: true
|
||||
maxRedirects: 5
|
||||
38
bruno/api_v1/specific_price/Update.yml
Normal file
38
bruno/api_v1/specific_price/Update.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
info:
|
||||
name: Update
|
||||
type: http
|
||||
seq: 4
|
||||
|
||||
http:
|
||||
method: PUT
|
||||
url: "{{bas_url}}/restricted/specific-price/{{id}}"
|
||||
body:
|
||||
type: json
|
||||
data: |-
|
||||
{
|
||||
"name": "Summer Sale Updated",
|
||||
"reduction_type": "amount",
|
||||
"percentage_reduction": 50.0,
|
||||
"price": 69,
|
||||
"currency_id": 1,
|
||||
"scope": "shop",
|
||||
"is_active": true,
|
||||
"from_quantity":1
|
||||
// "product_ids": [51,53],
|
||||
// "category_ids": [1],
|
||||
// "product_attribute_ids": [1114],
|
||||
// "country_ids": [1],
|
||||
// "customer_ids": [2,1]
|
||||
}
|
||||
auth: inherit
|
||||
|
||||
runtime:
|
||||
variables:
|
||||
- name: id
|
||||
value: "3"
|
||||
|
||||
settings:
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
followRedirects: true
|
||||
maxRedirects: 5
|
||||
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