AddDiscount

[POST] .../v1/purchaseoperation/adddiscount

Creates discount/allowance partner receipt document. Use this method to add a discount or allowance operation to a receipt-from-partner document before totals are finalized. The request requires document_id, action and type; Percent type requires a positive percent and zeroes amount, while Amount type requires a positive amount and zeroes percent. The response returns row_affected and ids for created discount operations and the caller must have purchase-operation discount write permission; missing body, invalid fields, denied access, document state conflicts or persistent 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_type_id_": 1,
  "action": "Discount",
  "amount": 1.0,
  "document_id": 1,
  "percent": 1.0,
  "type": "Percent"
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Update Update operation result.

Response Example

{
  "ok": true,
  "result": {
    "ids": [
      null
    ],
    "row_affected": 1
  }
}