Closing a paid delivered delivery order from the APII
Starting with API V8Preview1, it became possible to close delivery directly from the plugin.
Courier delivery can be closed by calling the method
SetDeliveryCloseTime
.
In this case, the delivery order must be in the “Closed” status.
(IDeliveryOrder.Status
==
OrderStatus.Closed
,
that is, paid. Payment for delivery orders was made earlier, as we wrote about in
note.
The delivery itself must be in the “Delivered” status.
(IDeliveryOrder.DeliveryStatus
==
DeliveryStatus.Delivered
).
You can mark a delivery as delivered by sequentially calling the methods
SetDeliveryDelivered
and
ChangeDeliveryActualDeliverTime
.
The method takes as a parameter the delivery closing time DateTime? closeTime
.
If you set this parameter to null
, the method will change the delivery status from “Closed” back to “Delivered”.
This method does not work for self-pickup deliveries, since to close such a delivery you simply need to pay for it, as mentioned in note, and the return of such delivery implies order reversal (i.e., refund of payments), which is not yet supported from the API.