public List<ShopifyOrder> GetListAllOrders(ShopifyStoreAuth storeAuth)
{
List<ShopifyOrder> returnList = null;
XmlDocument responseDoc = ShopifyGet((_protocol + storeAuth.StoreSubDomain + _domain + "/admin/orders.xml"),
HashString(_appAuth.Secret + storeAuth.StoreAuthToken));
if (responseDoc != null)
{
XmlNodeList errors = responseDoc.SelectNodes("//errors/error");
if (errors != null)
if (errors.Count != 0)
{
var sw = new StringWriter();
var xw = new XmlTextWriter(sw);
responseDoc.WriteTo(xw);
Logger.ErrorFormat("ShopifyCommunicator::GetAllOrders(): Shopify returned errors: {0}",
sw);
//for now we fall through and take whatever orders we can.
}
XmlNodeList orders = responseDoc.SelectNodes("//orders/order");
if (orders != null)
{
returnList = new List<ShopifyOrder>(orders.Count);
foreach (XmlNode order in orders)
{
var orderDoc = new XmlDocument();
orderDoc.AppendChild(orderDoc.ImportNode(order, true));
var serializedResponse = new ShopifyResponse<ShopifyOrder>(orderDoc);
if (serializedResponse.State == ResponseState.OK)
{
returnList.Add(serializedResponse.ResponseObject);
}
else
{
XmlNodeList orderId = responseDoc.SelectNodes("//order/id");
if (orderId != null)
{
string id = orderId.Count > 0 ? orderId[0].InnerText : "unknown";
Logger.ErrorFormat(
"ShopifyCommunicator()::GetListAllOrders(): Error deserializing order id={0}.", id);
}
}
}
}
}
return returnList;
}