OnTime API: Calculating the Total Cost of an Order

The OnTime API automatically calculates the pricing (i.e. the TotalCost field) for any order submitted through the following endpoint:
REST API:    POST  /api/order/post
However, the following endpoint can also be used to determine the pricing on an order:
REST API:    POST  /api/order/getTotalCost
This endpoint accepts an order object that uses multiple factors to determine the TotalCost field value for the given order. These factors include the following fields:
  • PriceSet
  • Customer
  • CollectionLocation
  • CollectionLocation.Zone
  • DeliveryLocation
  • DeliveryLocation.Zone
  • Distance
  • BasePrice
  • BasePriceType (see below)
The following BasePriceType values should be used to determine the method of price calculation:
1 = ZoneToZone
2 = Distance
3 = FlatRate
An example of a simplified ZoneToZone pricing method request is shown below:
{
    "BasePriceType": 1,
    "PriceSet": "5c9a9f70-5bc4-4593-b516-cbd9344bf536",
    "Customer": "bf49c3d8-b3dc-48a0-8f58-60562e50d692",
    "CollectionLocation": {
        "Zone": {
            "ID": "b723a724-d753-43b4-b8f0-4fffd0ed1c56",
     ...
        },
        "ID": "720bb7bf-35fa-458c-92a6-28b34c1a3c99",
 ...
    },
    "DeliveryLocation": {
        "Zone": {
            "ID": "54208101-e29d-4567-9f86-b53b13fe0bdf",
            "Name": "Grants Pass",
            "PostalCodes": "97504,97502,97524"
        },
        "ID": "91d6c0fd-b129-4c14-a685-b710390b69f5",
     ...    }
}