[POST] .../v1/returnstopartneroperation/adddiscount
Creates discount/allowance partner return document. Use this method to add one discount or allowance row to a DocReturnsToPartner document before posting. The request body must contain document_id, action, and type; when type is Percent, percent must be greater than zero and amount is reset to 0, and when type is Amount, amount must be greater than zero and percent is reset to 0. The parent document is locked through the document lock mechanism, and the controller fills the service document type for return-to-partner discounts; missing fields, invalid action/type/value combinations, denied access, lock conflicts, document state conflicts, or persistence errors are returned as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| _document_typeid | Int64 | Optional | Service document type ID filled by the controller. |
| action | String | Required | Type: Discount - discount, Allowance - allowance. Allowed values: Default, Discount, Allowance. |
| amount | Decimal | Optional | Discount amount. |
| document_id | Int64 | Required | Document ID that owns the discount/allowance operation. |
| percent | Decimal | Optional | Discount percent. |
| type | String | Required | Discount type: Percent - percentage, Amount - fixed amount. Allowed values: Default, Percent, Amount. |
Request Example
{
"document_id": 4501,
"action": "Discount",
"type": "Percent",
"percent": 5,
"amount": 0
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Update | Update operation result. |
Response Example
{
"ok": true,
"result": {
"row_affected": 1,
"ids": [
8501
]
}
}