
November 1, 2011 10:41 by
Couldn't find a c# example so I created one. A customer wanted to pull notes from an Invoice to place in SAGE when the processing orders were being pulled down via the v2 API.
//pass in the order_id value from your salesOrderEntity object.
public salesOrderInvoiceEntity[] GetSalesOrders(string orderID)
{
if (string.IsNullOrEmpty(this.SessionId))
this.Login();
filters listFilters = null;
complexFilter cFilter = new complexFilter();
cFilter.key = "order_id";
cFilter.value = new associativeEntity
{
key = "equal",
value = orderID
};
listFilters = new filters();
listFilters.complex_filter = new complexFilter[] { cFilter };
salesOrderInvoiceListRequest req = new salesOrderInvoiceListRequest(this.SessionId, listFilters);
return magentoService.salesOrderInvoiceList(req).result;
}
//I Only need the last comment but you can return the salesOrderInvoiceCommentEntity object and parse all that the invoice has.
public string GetInvoiceComments(string id)
{
if (string.IsNullOrEmpty(this.SessionId))
this.Login();
salesOrderInvoiceInfoResponse req = magentoService.salesOrderInvoiceInfo(new salesOrderInvoiceInfoRequest(this.SessionId, id));
if (req.result.comments != null)
return req.result.comments[0].comment;
else
return string.Empty;
}
d4e59d85-694f-43f5-ad41-f0b5138b0838|0|.0