[POST] .../v1/purchaseoperation/getdiscount
Returns discounts/allowances. Use this method to retrieve discount and allowance operations that belong to receipt-from-partner documents when the client needs to display or recalculate purchase totals. The response returns an array of DiscountOperation records, supports id and document_id filter plus sort_orders and the controller fills the purchase document type internally before querying. The caller must have purchase-operation discount read permission; missing body, denied access, invalid filters or sort_orders and persistent storage failures 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. |
| sort_orders | Array of DiscountOperationSortOrder | Optional | Output parameter sorting. |
Filterable Fields
| Field | Type | Description |
|---|---|---|
| document_id | int | |
| id | int |
Sortable Fields
| Field |
|---|
| action |
| amount |
| document_id |
| id |
| last_update |
| percent |
| type |
Request Example
{
"document_ids": [
5001
],
"sort_orders": [
{
"column": "amount",
"direction": "DESC"
}
]
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Array of DiscountOperation | Result array. |
Response Example
{
"ok": true,
"result": [
{
"id": 9101,
"document_id": 5001,
"action": "Discount",
"type": "Amount",
"percent": 0,
"amount": 15000,
"last_update": 1767225600
}
]
}