/// <summary> /// Fetches the OrderItems for the specified orderId. /// </summary> public void FetchOrderItems(string orderId, ProcessOrderItemHandler handler) { if (handler == null) { throw new ArgumentNullException("handler"); } ListOrderItemsRequest request = new ListOrderItemsRequest(); request.SellerId = mwsSellerId; request.AmazonOrderId = orderId; ListOrderItemsResponse response = null; OrderFetcher.InvokeRetriable(LIST_ORDER_ITEMS_DEFAULT_THROTTLE_LIMIT, delegate() { response = mwsService.ListOrderItems(request); foreach (OrderItem orderItem in response.ListOrderItemsResult.OrderItems.OrderItem) { handler(orderItem); } }); String nextTokenString = response.ListOrderItemsResult.NextToken; while (!string.IsNullOrEmpty(nextTokenString)) { // If NextToken is set, continue looping through the orders. ListOrderItemsByNextTokenRequest nextRequest = new ListOrderItemsByNextTokenRequest(); nextRequest.NextToken = nextTokenString; nextRequest.SellerId = mwsSellerId; ListOrderItemsByNextTokenResponse nextResponse = null; OrderFetcher.InvokeRetriable(LIST_ORDER_ITEMS_DEFAULT_THROTTLE_LIMIT, delegate() { nextResponse = mwsService.ListOrderItemsByNextToken(nextRequest); foreach (OrderItem orderItem in nextResponse.ListOrderItemsByNextTokenResult.OrderItems.OrderItem) { handler(orderItem); } }); nextTokenString = nextResponse.ListOrderItemsByNextTokenResult.NextToken; } }
/// <summary> /// Gets the orders details by order id. /// </summary> /// <param name="command">The command.</param> /// <returns></returns> private async Task <IDictionary <string, IList <AmazonOrderItemDetail> > > GetOrdersDetailsByOrderId(AmazonGetOrdersDetails3PartyCommand command) { Dictionary <string, IList <AmazonOrderItemDetail> > ordersDetails = new Dictionary <string, IList <AmazonOrderItemDetail> >(); foreach (var request in CreateRequests(command)) { //first request var response = await AmazonService.Orders.ListOrderItems(request); List <AmazonOrderItemDetail> currentOrderDetails = new List <AmazonOrderItemDetail>(); if (response.IsSetListOrderItemsResult()) { //store parsed response data var orderDetails = ParseOrderDetailsResponse(response.ListOrderItemsResult.OrderItems); currentOrderDetails.AddRange(orderDetails); } //tries to get next details requests (for the same order) string nextToken = response.ListOrderItemsResult.NextToken; while (!string.IsNullOrEmpty(nextToken)) { var nextRequest = CreateNextRequest(command, nextToken); //get next response ListOrderItemsByNextTokenResponse nextResponse = await AmazonService.Orders.ListOrderItemsByNextToken(nextRequest); if (nextResponse.IsSetListOrderItemsByNextTokenResult()) { //store parsed response data currentOrderDetails.AddRange(ParseOrderDetailsResponse(nextResponse.ListOrderItemsByNextTokenResult.OrderItems)); nextToken = nextResponse.ListOrderItemsByNextTokenResult.NextToken; } else { nextToken = null; } } //store all order details by AmazonOrderId ordersDetails.Add(request.AmazonOrderId, currentOrderDetails); } return(ordersDetails); }
private List <OrderItem> getOrderItems(String amazonOrderId) { ListOrderItemsResponse listOrderItemsResponse = getListOrderItems(amazonOrderId); if (listOrderItemsResponse == null) { return(null); } List <OrderItem> orderItems = new List <OrderItem>(); foreach (OrderItem orderItem in listOrderItemsResponse.ListOrderItemsResult.OrderItems) { orderItems.Add(orderItem); } if (String.IsNullOrEmpty(listOrderItemsResponse.ListOrderItemsResult.NextToken)) { return(orderItems); } ListOrderItemsByNextTokenResponse listOrderItemsByNextTokenResponse = getListOrderItemsByNextToken(listOrderItemsResponse.ListOrderItemsResult.NextToken); if (listOrderItemsByNextTokenResponse == null) { return(null); } while (true) { foreach (OrderItem orderItem in listOrderItemsByNextTokenResponse.ListOrderItemsByNextTokenResult.OrderItems) { orderItems.Add(orderItem); } if (String.IsNullOrEmpty(listOrderItemsByNextTokenResponse.ListOrderItemsByNextTokenResult.NextToken)) { return(orderItems); } listOrderItemsByNextTokenResponse = getListOrderItemsByNextToken(listOrderItemsByNextTokenResponse.ListOrderItemsByNextTokenResult.NextToken); if (listOrderItemsByNextTokenResponse == null) { return(null); } } }
/// <summary> /// Converts the response object into MarketplaceOrder object. /// Also makes the call to get the items for the order. /// </summary> /// <param name="order">The given Amazon order objecdt.</param> /// <returns>A MarketplaceOrder object</returns> private MarketplaceOrder convertOrderResponseToMarketplaceOrder(MarketplaceWebServiceOrders.Model.Order order) { var orderStatus = (Inventory.Shared.Models.OrderStatus)Enum.Parse(typeof(Inventory.Shared.Models.OrderStatus), order.OrderStatus, true); var marketplaceOrder = new MarketplaceOrder() { BuyerEmail = order.BuyerEmail, BuyerName = order.BuyerName, OrderTotal = order.IsSetOrderTotal() ? decimal.Parse(order.OrderTotal.Amount) : 0, OrderId = order.AmazonOrderId, Marketplace = ChannelName, ShipServiceLevel = order.ShipServiceLevel, ShipmentServiceCategory = order.ShipmentServiceLevelCategory, NumOfItemsShipped = order.NumberOfItemsShipped, NumOfItemsUnshipped = order.NumberOfItemsUnshipped, PurchaseDate = order.PurchaseDate, LastUpdateDate = order.LastUpdateDate, PaymentMethod = order.PaymentMethod, OrderStatus = orderStatus, OrderType = order.OrderType, EarliestShipDate = order.EarliestShipDate, LatestShipDate = order.LatestShipDate, EarliestDeliveryDate = order.EarliestDeliveryDate, LatestDeliveryDate = order.LatestDeliveryDate, MarketplaceId = order.MarketplaceId, PurchaseOrderNumber = order.PurchaseOrderNumber, SalesChannel = order.SalesChannel, SellerOrderId = order.SellerOrderId, }; if (order.IsSetShippingAddress()) { marketplaceOrder.ShippingAddressLine1 = order.ShippingAddress.AddressLine1; marketplaceOrder.ShippingAddressLine2 = order.ShippingAddress.AddressLine2; marketplaceOrder.ShippingAddressLine3 = order.ShippingAddress.AddressLine3; marketplaceOrder.ShippingCity = order.ShippingAddress.City; marketplaceOrder.ShippingStateOrRegion = order.ShippingAddress.StateOrRegion; marketplaceOrder.ShippingPostalCode = order.ShippingAddress.PostalCode; marketplaceOrder.ShippingAddressName = order.ShippingAddress.Name; marketplaceOrder.ShippingAddressPhone = order.ShippingAddress.Phone; } // do the request for the list of items for this order var listOrderRequest = new ListOrderItemsRequest { SellerId = _credential.MerchantId, AmazonOrderId = order.AmazonOrderId }; var listItemsResponse = _ordersClient.ListOrderItems(listOrderRequest); var nextToken = listItemsResponse.ListOrderItemsResult.NextToken; var items = new List <MarketplaceOrderItem>(); ListOrderItemsByNextTokenResponse nextTokenResponse = null; // convert the item responses to marketplace order item objects. var orderItems = listItemsResponse.ListOrderItemsResult.OrderItems; do { if (nextTokenResponse != null) { orderItems = nextTokenResponse.ListOrderItemsByNextTokenResult.OrderItems; nextToken = nextTokenResponse.ListOrderItemsByNextTokenResult.NextToken; } // iterate and convert the marketplace order item into local object for (var i = 0; i < orderItems.Count; i++) { var orderItem = orderItems[i]; var item = new MarketplaceOrderItem { OrderId = order.AmazonOrderId, MarketplaceItemId = orderItem.ASIN, OrderItemId = orderItem.OrderItemId, SKU = orderItem.SellerSKU, Title = orderItem.Title, QtyOrdered = Convert.ToInt32(orderItem.QuantityOrdered), QtyShipped = Convert.ToInt32(orderItem.QuantityShipped), ConditionNote = orderItem.ConditionNote }; item.Price = orderItem.IsSetItemPrice() ? decimal.Parse(orderItem.ItemPrice.Amount) : 0; item.ShippingPrice = orderItem.IsSetShippingPrice() ? decimal.Parse(orderItem.ShippingPrice.Amount) : 0; item.GiftWrapPrice = orderItem.IsSetGiftWrapPrice() ? decimal.Parse(orderItem.GiftWrapPrice.Amount) : 0; item.Tax = orderItem.IsSetItemTax() ? decimal.Parse(orderItem.ItemTax.Amount) : 0; item.ShippingTax = orderItem.IsSetShippingTax() ? decimal.Parse(orderItem.ShippingTax.Amount) : 0; item.GiftWrapTax = orderItem.IsSetGiftWrapTax() ? decimal.Parse(orderItem.GiftWrapTax.Amount) : 0; item.ShippingDiscount = orderItem.IsSetShippingDiscount() ? decimal.Parse(orderItem.ShippingDiscount.Amount) : 0; item.PromotionDiscount = orderItem.IsSetPromotionDiscount() ? decimal.Parse(orderItem.PromotionDiscount.Amount) : 0; items.Add(item); } // get the page order items if the next token not null if (!string.IsNullOrWhiteSpace(nextToken)) { // pause for 2 seconds, this is the restore reate for the ListOrderItemsByNextToken for every 30 quota Thread.Sleep(2000); var nextRequest = new ListOrderItemsByNextTokenRequest { SellerId = _credential.MerchantId, NextToken = nextToken }; nextTokenResponse = _ordersClient.ListOrderItemsByNextToken(nextRequest); } } while (!string.IsNullOrWhiteSpace(nextToken)); // set the order items to the local object marketplaceOrder.OrderItems = items; return(marketplaceOrder); }
public static void GetOrderList() { dt = new DataTable(); dt.Columns.Add("OrderId"); MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig(); string SellerId = "A3U1G59YKB47LS"; string MarketplaceId = "A1VC38T7YXB528"; string AccessKeyId = "AKIAJFRPIMOTC4CJGHLQ"; string SecretKeyId = "4KI9yuXr7Ni64iFpdjnW1dw3LNdNXIn4rgOnNrZQ"; string ApplicationVersion = "1.0"; string ApplicationName = "ラスタスポーツ"; string MWSAuthToken = "amzn.mws.fea748c0-bfe0-4039-0cc0-88b6ce5c0058"; string serviceURL = "https://mws.amazonservices.jp"; string strbuff = string.Empty; config.ServiceURL = serviceURL; MarketplaceWebServiceOrders.MarketplaceWebServiceOrders client = new MarketplaceWebServiceOrdersClient( AccessKeyId, SecretKeyId, ApplicationName, ApplicationVersion, config); //ListOrder try { ListOrdersRequest request = new ListOrdersRequest(); request.SellerId = SellerId; request.CreatedAfter = DateTime.Now.AddDays(-1); List <string> lstMarketplace = new List <string>(); lstMarketplace.Add(MarketplaceId); request.MarketplaceId = lstMarketplace; request.MWSAuthToken = MWSAuthToken; ListOrdersResponse response = client.ListOrders(request); if (response.IsSetListOrdersResult()) { ListOrdersResult listOrdersResult = response.ListOrdersResult; if (listOrdersResult.IsSetOrders()) { List <Order> orders = listOrdersResult.Orders; foreach (Order order in orders) { dt.Rows.Add(order.AmazonOrderId); } } } } catch (Exception ex) { var msge = ex.Message; } //// ListOrderByNextToken try { ListOrdersRequest request = new ListOrdersRequest(); request.SellerId = SellerId; request.CreatedAfter = DateTime.Now.AddDays(-1); List <string> lstMarketplace = new List <string>(); lstMarketplace.Add(MarketplaceId); request.MarketplaceId = lstMarketplace; request.MaxResultsPerPage = 14; request.MWSAuthToken = MWSAuthToken; ListOrdersResponse response = client.ListOrders(request); if (response.IsSetListOrdersResult()) { ListOrdersResult listOrdersResult = response.ListOrdersResult; if (listOrdersResult.IsSetOrders()) { if (listOrdersResult.NextToken != null) { ListOrdersByNextTokenRequest request1 = new ListOrdersByNextTokenRequest(); request1.SellerId = SellerId; request1.MWSAuthToken = MWSAuthToken; request1.NextToken = listOrdersResult.NextToken; ListOrdersByNextTokenResponse response1 = client.ListOrdersByNextToken(request1); if (response1.IsSetListOrdersByNextTokenResult()) { ListOrdersByNextTokenResult listOrdersByNextResult = response1.ListOrdersByNextTokenResult; if (listOrdersByNextResult.IsSetOrders()) { List <Order> orders = listOrdersByNextResult.Orders; foreach (Order order in orders) { dt.Rows.Add(order.AmazonOrderId); // strbuff += order.AmazonOrderId + System.Environment.NewLine; } } } } } var val = strbuff; } Environment.Exit(0); } catch (Exception ex) { } // //List Order Item //try //{ // foreach (DataRow dr in dt.Rows) // { // ListOrderItemsRequest request = new ListOrderItemsRequest(); // request.SellerId = SellerId; // request.AmazonOrderId = dr["OrderId"].ToString(); // request.MWSAuthToken = MWSAuthToken; // ListOrderItemsResponse response = client.ListOrderItems(request); // if (response.IsSetListOrderItemsResult()) // { // ListOrderItemsResult listOrderItemsResult = response.ListOrderItemsResult; // if (listOrderItemsResult.IsSetOrderItems()) // { // List<OrderItem> orderItems = listOrderItemsResult.OrderItems; // foreach (OrderItem orderItem in orderItems) // { // strbuff += "商品名:" + orderItem.Title + System.Environment.NewLine; // } // } // } // } //} //catch (Exception ex) //{ //} //// ListOrderItem_byNextToken try { foreach (DataRow dr in dt.Rows) { ListOrderItemsRequest request = new ListOrderItemsRequest(); request.SellerId = SellerId; request.AmazonOrderId = dr["OrderId"].ToString(); request.MWSAuthToken = MWSAuthToken; ListOrderItemsResponse response = client.ListOrderItems(request); if (response.IsSetListOrderItemsResult()) { ListOrderItemsResult listOrderItemsResult = response.ListOrderItemsResult; if (listOrderItemsResult.NextToken != null) { ListOrderItemsByNextTokenRequest request1 = new ListOrderItemsByNextTokenRequest(); request1.SellerId = SellerId; request1.MWSAuthToken = MWSAuthToken; request1.NextToken = listOrderItemsResult.NextToken; ListOrderItemsByNextTokenResponse response1 = client.ListOrderItemsByNextToken(request1); if (response1.IsSetListOrderItemsByNextTokenResult()) { ListOrderItemsByNextTokenResult listOrderByNextItemsResult = response1.ListOrderItemsByNextTokenResult; if (listOrderByNextItemsResult.IsSetOrderItems()) { List <OrderItem> orderItems = listOrderItemsResult.OrderItems; foreach (OrderItem orderItem in orderItems) { if (orderItem.IsSetOrderItemId()) { strbuff += "商品名:" + orderItem.Title + System.Environment.NewLine; } } } } } } } } catch (Exception ex) { } //// GetOrder //try //{ // foreach (DataRow dr in dt.Rows) // { // GetOrderRequest request = new GetOrderRequest(); // request.SellerId = SellerId; // request.MWSAuthToken = MWSAuthToken; // List<string> amazonorderId = new List<string>(); // amazonorderId.Add(dr["OrderId"].ToString()); // request.AmazonOrderId = amazonorderId; // GetOrderResponse response = client.GetOrder(request); // if (response.IsSetGetOrderResult()) // { // List<Order> orders = response.GetOrderResult.Orders; // foreach (Order order in orders) // { // strbuff += "購入者:" + order.AmazonOrderId + ","+ order.OrderStatus + System.Environment.NewLine; // } // } // } //} //catch (Exception ex) //{ //} //// GetService Status //try //{ // MarketplaceWebServiceOrdersConfig config1 = new MarketplaceWebServiceOrdersConfig(); // config1.ServiceURL = serviceURL; // MarketplaceWebServiceOrders.MarketplaceWebServiceOrders client1 = new MarketplaceWebServiceOrdersClient( // AccessKeyId, // SecretKeyId, // ApplicationName, // ApplicationVersion, // config1); // MarketplaceWebServiceOrders.Model.GetServiceStatusRequest request = new MarketplaceWebServiceOrders.Model.GetServiceStatusRequest(); // request.SellerId = SellerId; // request.MWSAuthToken = MWSAuthToken; // // MarketplaceWebServiceOrders.Model.GetServiceStatusRequest // var response = client1.GetServiceStatus(request); // if (response.IsSetGetServiceStatusResult()) // { // strbuff = "処理状況:" + response.GetServiceStatusResult.Status; // } //} //catch (Exception ex) //{ //} }
/// <summary> /// If ListOrderItems cannot return all the order items in one go, it will /// provide a nextToken. That nextToken can be used with this operation to /// retrive the next batch of items for that order. /// /// </summary> /// <param name="service">Instance of MarketplaceWebServiceOrders service</param> /// <param name="request">ListOrderItemsByNextTokenRequest request</param> public static void InvokeListOrderItemsByNextToken(MarketplaceWebServiceOrders service, ListOrderItemsByNextTokenRequest request) { try { ListOrderItemsByNextTokenResponse response = service.ListOrderItemsByNextToken(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" ListOrderItemsByNextTokenResponse"); if (response.IsSetListOrderItemsByNextTokenResult()) { Console.WriteLine(" ListOrderItemsByNextTokenResult"); ListOrderItemsByNextTokenResult listOrderItemsByNextTokenResult = response.ListOrderItemsByNextTokenResult; if (listOrderItemsByNextTokenResult.IsSetNextToken()) { Console.WriteLine(" NextToken"); Console.WriteLine(" {0}", listOrderItemsByNextTokenResult.NextToken); } if (listOrderItemsByNextTokenResult.IsSetAmazonOrderId()) { Console.WriteLine(" AmazonOrderId"); Console.WriteLine(" {0}", listOrderItemsByNextTokenResult.AmazonOrderId); } if (listOrderItemsByNextTokenResult.IsSetOrderItems()) { Console.WriteLine(" OrderItems"); OrderItemList orderItems = listOrderItemsByNextTokenResult.OrderItems; List <OrderItem> orderItemList = orderItems.OrderItem; foreach (OrderItem orderItem in orderItemList) { Console.WriteLine(" OrderItem"); if (orderItem.IsSetASIN()) { Console.WriteLine(" ASIN"); Console.WriteLine(" {0}", orderItem.ASIN); } if (orderItem.IsSetSellerSKU()) { Console.WriteLine(" SellerSKU"); Console.WriteLine(" {0}", orderItem.SellerSKU); } if (orderItem.IsSetOrderItemId()) { Console.WriteLine(" OrderItemId"); Console.WriteLine(" {0}", orderItem.OrderItemId); } if (orderItem.IsSetTitle()) { Console.WriteLine(" Title"); Console.WriteLine(" {0}", orderItem.Title); } if (orderItem.IsSetQuantityOrdered()) { Console.WriteLine(" QuantityOrdered"); Console.WriteLine(" {0}", orderItem.QuantityOrdered); } if (orderItem.IsSetQuantityShipped()) { Console.WriteLine(" QuantityShipped"); Console.WriteLine(" {0}", orderItem.QuantityShipped); } if (orderItem.IsSetItemPrice()) { Console.WriteLine(" ItemPrice"); Money itemPrice = orderItem.ItemPrice; if (itemPrice.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", itemPrice.CurrencyCode); } if (itemPrice.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", itemPrice.Amount); } } if (orderItem.IsSetShippingPrice()) { Console.WriteLine(" ShippingPrice"); Money shippingPrice = orderItem.ShippingPrice; if (shippingPrice.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", shippingPrice.CurrencyCode); } if (shippingPrice.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", shippingPrice.Amount); } } if (orderItem.IsSetGiftWrapPrice()) { Console.WriteLine(" GiftWrapPrice"); Money giftWrapPrice = orderItem.GiftWrapPrice; if (giftWrapPrice.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", giftWrapPrice.CurrencyCode); } if (giftWrapPrice.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", giftWrapPrice.Amount); } } if (orderItem.IsSetItemTax()) { Console.WriteLine(" ItemTax"); Money itemTax = orderItem.ItemTax; if (itemTax.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", itemTax.CurrencyCode); } if (itemTax.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", itemTax.Amount); } } if (orderItem.IsSetShippingTax()) { Console.WriteLine(" ShippingTax"); Money shippingTax = orderItem.ShippingTax; if (shippingTax.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", shippingTax.CurrencyCode); } if (shippingTax.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", shippingTax.Amount); } } if (orderItem.IsSetGiftWrapTax()) { Console.WriteLine(" GiftWrapTax"); Money giftWrapTax = orderItem.GiftWrapTax; if (giftWrapTax.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", giftWrapTax.CurrencyCode); } if (giftWrapTax.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", giftWrapTax.Amount); } } if (orderItem.IsSetShippingDiscount()) { Console.WriteLine(" ShippingDiscount"); Money shippingDiscount = orderItem.ShippingDiscount; if (shippingDiscount.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", shippingDiscount.CurrencyCode); } if (shippingDiscount.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", shippingDiscount.Amount); } } if (orderItem.IsSetPromotionDiscount()) { Console.WriteLine(" PromotionDiscount"); Money promotionDiscount = orderItem.PromotionDiscount; if (promotionDiscount.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", promotionDiscount.CurrencyCode); } if (promotionDiscount.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", promotionDiscount.Amount); } } if (orderItem.IsSetPromotionIds()) { Console.WriteLine(" PromotionIds"); PromotionIdList promotionIds = orderItem.PromotionIds; List <String> promotionIdList = promotionIds.PromotionId; foreach (String promotionId in promotionIdList) { Console.WriteLine(" PromotionId"); Console.WriteLine(" {0}", promotionId); } } if (orderItem.IsSetCODFee()) { Console.WriteLine(" CODFee"); Money CODFee = orderItem.CODFee; if (CODFee.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", CODFee.CurrencyCode); } if (CODFee.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", CODFee.Amount); } } if (orderItem.IsSetCODFeeDiscount()) { Console.WriteLine(" CODFeeDiscount"); Money CODFeeDiscount = orderItem.CODFeeDiscount; if (CODFeeDiscount.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", CODFeeDiscount.CurrencyCode); } if (CODFeeDiscount.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", CODFeeDiscount.Amount); } } if (orderItem.IsSetGiftMessageText()) { Console.WriteLine(" GiftMessageText"); Console.WriteLine(" {0}", orderItem.GiftMessageText); } if (orderItem.IsSetGiftWrapLevel()) { Console.WriteLine(" GiftWrapLevel"); Console.WriteLine(" {0}", orderItem.GiftWrapLevel); } if (orderItem.IsSetInvoiceData()) { Console.WriteLine(" InvoiceData"); InvoiceData invoiceData = orderItem.InvoiceData; if (invoiceData.IsSetInvoiceRequirement()) { Console.WriteLine(" InvoiceRequirement"); Console.WriteLine(" {0}", invoiceData.InvoiceRequirement); } if (invoiceData.IsSetBuyerSelectedInvoiceCategory()) { Console.WriteLine(" BuyerSelectedInvoiceCategory"); Console.WriteLine(" {0}", invoiceData.BuyerSelectedInvoiceCategory); } if (invoiceData.IsSetInvoiceTitle()) { Console.WriteLine(" InvoiceTitle"); Console.WriteLine(" {0}", invoiceData.InvoiceTitle); } if (invoiceData.IsSetInvoiceInformation()) { Console.WriteLine(" InvoiceInformation"); Console.WriteLine(" {0}", invoiceData.InvoiceInformation); } } } } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } Console.WriteLine(" ResponseHeaderMetadata"); Console.WriteLine(" RequestId"); Console.WriteLine(" " + response.ResponseHeaderMetadata.RequestId); Console.WriteLine(" ResponseContext"); Console.WriteLine(" " + response.ResponseHeaderMetadata.ResponseContext); Console.WriteLine(" Timestamp"); Console.WriteLine(" " + response.ResponseHeaderMetadata.Timestamp); Console.WriteLine(); } catch (MarketplaceWebServiceOrdersException ex) { Console.WriteLine("Caught Exception: " + ex.Message); Console.WriteLine("Response Status Code: " + ex.StatusCode); Console.WriteLine("Error Code: " + ex.ErrorCode); Console.WriteLine("Error Type: " + ex.ErrorType); Console.WriteLine("Request ID: " + ex.RequestId); Console.WriteLine("XML: " + ex.XML); Console.WriteLine("ResponseHeaderMetadata: " + ex.ResponseHeaderMetadata); } }