GetPurchaseInfo

[POST] .../v1/retailcustomer/getpurchaseinfo

Returns customer purchase information. Use this method to retrieve an aggregated purchase profile for a retail customer when a client needs one response with preferred items, average cheque, cheque counts and last purchase date. The request filters by customer_id and optional stock_id, while server settings define the preferred-purchase period, top mode, item count, minimum amount and availability rule; the response result is a RetailCustomerPurchaseInfo object. The method checks the current request user and requires retail customer select permission; missing body, missing customer_id, denied permission and storage errors from any aggregate query are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
filters Array of Filter Required Filters by fields available for this API method. Required filter fields: customer_id.

Filterable Fields

Field Type Required Description
customer_id int Required Customer ID.
stock_id int Optional Stock ID.

Request Example

{
  "filters": [
    {
      "Field": "customer_id",
      "Operator": "Equal",
      "Value": "string"
    }
  ]
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result RetailCustomerPurchaseInfo Result object.

Response Example

{
  "ok": true,
  "result": {
    "AvgChequeAmount": 1.0,
    "ChequeQuantity": 1,
    "FavoritePurchases": [
      {
        "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",
              "field_id": 1,
              "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,
          "max_quantity": 1.0,
          "min_quantity": 1.0,
          "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
      }
    ],
    "LastPurchaseDate": 1,
    "ReturnChequeQuantity": 1,
    "SaleChequeQuantity": 1
  }
}