_Shipping::PreviewShipments
Use this method to create shipment preview information.
Definition
HRESULT _Shipping::PreviewShipments(VARIANT*orderform,VARIANT*context,VARIANT*ShipmentDistinguishers,VARIANT*ShippingPreview);
Parameters
orderform
[in] A pointer to a VARIANT containing the OrderForm dictionary for which to calculate shipping cost previews.
context
[in] A pointer to a VARIANT containing the Context dictionary to use to run the shipping components.
ShipmentDistinguishers
[in] A pointer to a VARIANT containing a SIMPLEARRAY of strings containing the line item attributes (keys) to use to split the order into shipments.
ShippingPreview
[out, retval] A pointer to a VARIANT used to return a Simplelist of dictionaries, one for each shipment, which in turn contain a Simplelist of dictionaries containing the shipping cost previews, one for each shipping method.
Return Values
This method returns an HRESULT indicating whether or not it completed successfully. See the Error Values section for more details.
Error Values
This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.
Remarks
The ShippingPreview parameter points to valid data only if the method completes successfully.
The PreviewShipments method creates the shipping cost previews by splitting the order into individual shipments. The mechanism used is the same as the Splitter pipeline component. For more information about how shipment distinguishers are used to split shipments, see Splitter.
The PreviewShipments method returns a SimpleList of dictionaries, one for each shipment. Each shipment dictionary in turn contains a SimpleList of dictionaries each of which contains the shipping cost for using a particular shipping method.
For example code showing how to loop through the preview shipments, see Previewing Shipping Costs.
For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.