How to programmatically check whether an order is canceled?

See also: