/// <summary> /// This code demonstrates how to send 1 or more shipping/cancellation notifications to bol.com from a xml file. /// This code performs a simple POST on the "/services/rest/orders/v1/process/" PlazaAPI. /// See the example code below for typical usage instructions. /// </summary> /// <param name="plazaAPIClient">The plaza API client.</param> private static void ProcessOrdersFromXml(PlazaAPIClient plazaAPIClient) { // Create an instance of the XmlSerializer specifying type and namespace XmlSerializer serializer = new XmlSerializer(typeof(ProcessOrders)); // A FileStream is needed to read the XML document. FileStream fs = new FileStream(@"C:\WorkingCopy\Projects\bol.com\bol.com-plaza-api-clients-master\c#\bol.com.PlazaAPI\bol.com.PlazaAPI.Test\ProcessOrderTest.xml", FileMode.Open); XmlReader reader = XmlReader.Create(fs); // Declare an object variable of the type to be deserialized. ProcessOrders processOrders; // Use the Deserialize method to restore the object's state. processOrders = (ProcessOrders)serializer.Deserialize(reader); fs.Close(); // Done! Let's push this batch to the server. ProcessOrdersResult processOrdersResult = plazaAPIClient.ProcessOrders(processOrders); }
/// <summary> /// This code demonstrates how to send 1 or more shipping/cancellation notifications to bol.com /// This code performs a simple POST on the "/services/rest/orders/v1/process/" PlazaAPI. /// See the example code below for typical usage instructions. /// </summary> /// <param name="plazaAPIClient">The plaza API client.</param> private static void ProcessOrders(PlazaAPIClient plazaAPIClient) { // Create a new batch. // This is required before calling the method "PlazaAPIClient.ProcessOrders()" /* * ProcessOrders processOrders = new ProcessOrders() * { * // Add a shipment * Shipments = new ProcessOrdersShipment[1] { GenerateShipment() }, * * // Add a cancellation * Cancellations = new ProcessOrdersCancellation[1] { GenerateCancellation() } * }; */ ProcessOrders processOrders = new ProcessOrders(); // Create 5 random shipments processOrders.Shipments = new ProcessOrdersShipment[5]; for (int i = 0; i < processOrders.Shipments.Length; i++) { processOrders.Shipments[i] = GenerateShipment(); } // Create 5 random cancellations processOrders.Cancellations = new ProcessOrdersCancellation[5]; for (int i = 0; i < processOrders.Cancellations.Length; i++) { processOrders.Cancellations[i] = GenerateCancellation(); } // Done! Let's push this batch to the server. ProcessOrdersResult processOrdersResult = plazaAPIClient.ProcessOrders(processOrders); }
/// <summary> /// This code demonstrates how to send 1 or more shipping/cancellation notifications to bol.com /// This code performs a simple POST on the "/services/rest/orders/v1/process/" PlazaAPI. /// See the example code below for typical usage instructions. /// </summary> /// <param name="plazaAPIClient">The plaza API client.</param> private static void ProcessOrders(PlazaAPIClient plazaAPIClient) { // Create a new batch. // This is required before calling the method "PlazaAPIClient.ProcessOrders()" /* ProcessOrders processOrders = new ProcessOrders() { // Add a shipment Shipments = new ProcessOrdersShipment[1] { GenerateShipment() }, // Add a cancellation Cancellations = new ProcessOrdersCancellation[1] { GenerateCancellation() } }; */ ProcessOrders processOrders = new ProcessOrders(); // Create 5 random shipments processOrders.Shipments = new ProcessOrdersShipment[5]; for (int i = 0; i < processOrders.Shipments.Length; i++) { processOrders.Shipments[i] = GenerateShipment(); } // Create 5 random cancellations processOrders.Cancellations = new ProcessOrdersCancellation[5]; for (int i = 0; i < processOrders.Cancellations.Length; i++) { processOrders.Cancellations[i] = GenerateCancellation(); } // Done! Let's push this batch to the server. ProcessOrdersResult processOrdersResult = plazaAPIClient.ProcessOrders(processOrders); }