AddDiscount

[POST] .../v1/orderfrompartneroperation/adddiscount

Creates discount/allowance order-from-partner document. Use this method to apply a discount or allowance to all operation rows of a DocOrderFromPartner customer order. The request body must contain document_id, action and type; Percent requires a positive percent, Amount requires a positive amount and _document_typeid is filled by the controller and should not be sent by clients. The document must be locked by the current user, remain in the initial editable status and already contain operation rows; missing body, invalid discount fields, denied access, locked document, non-editable status, missing operations or storage failures 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": 4601,
  "action": "Discount",
  "type": "Percent",
  "percent": 5
}

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": [
      9101
    ]
  }
}