[POST] .../v1/retailcustomer/getfavoritepurchases
Returns preferred customer purchases. Use this method to retrieve a customer's preferred purchased items for POS recommendations and loyalty-personalization screens. The request filters by customer_id and operating_cash_id, may use price_type_id and server settings choose the period, top-by-quantity or top-by-amount mode, minimum amount, item count and whether only available items are returned; the response result is an array of purchased item statistics. The method checks the current request user and requires retail customer select permission; missing body, missing customer_id, missing or unresolved operating_cash_id, denied permission and storage errors are returned as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| filters | Array of Filter | Optional | Optional filters by fields available for this API method. |
Filterable Fields
| Field | Type | Description |
|---|---|---|
| customer_id | int | Customer ID. |
| operating_cash_id | int | Operating cash ID. |
| price_type_id | int | Price type ID used to calculate purchases. |
Request Example
{
"filters": [
{
"Field": "customer_id",
"Operator": "Equal",
"Value": "string"
}
]
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Array of RetailCustomerItemPurchases | Result object. |
Response Example
{
"ok": true,
"result": [
{
"amount": 1.0,
"amount2": 1.0,
"item": {
"articul": "string",
"assemblable": true,
"barcode_list": "string",
"base_barcode": "string",
"brand": {
"id": 1,
"last_update": 1,
"name": "string"
},
"code": 1,
"color": {
"id": 1,
"last_update": 1,
"name": "string"
},
"comission_tin": "string",
"compound": true,
"country": {
"alfa2": "string",
"alfa3": "string",
"code": "string",
"fullname": "string",
"id": 1,
"last_update": 1,
"name": "string"
},
"deleted_mark": true,
"department": {
"id": 1,
"last_update": 1,
"name": "string"
},
"description": "string",
"disassemblable": true,
"fields": [
{
"data_type": "string",
"is_custom": true,
"key": "string",
"metadata": "string",
"name": "string",
"required": true,
"value": "string"
}
],
"fullname": "string",
"group": {
"child_count": 1,
"id": 1,
"last_update": 1,
"name": "string",
"parent_id": 1,
"path": "string"
},
"has_child": true,
"icps": "string",
"id": 1,
"image_url": "string",
"is_labeled": true,
"last_update": 1,
"min_quantity": 1,
"name": "string",
"origin": "BuyingAndSelling",
"package_code": "string",
"parent_id": 1,
"partner_id": 1,
"producer": {
"id": 1,
"last_update": 1,
"name": "string"
},
"size": {
"id": 1,
"last_update": 1,
"name": "string"
},
"type": "Item",
"unit": {
"description": "string",
"id": 1,
"last_update": 1,
"name": "string",
"type": "non_pcs"
},
"vat": {
"enabled": true,
"id": 1,
"last_update": 1,
"name": "string",
"value": 1.0
}
},
"price": 1.0,
"quantity": 1.0
}
]
}