AddDiscount

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

Adds a discount or allowance to a customer order document. 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 and Amount requires a positive amount. 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.

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
    ]
  }
}