private void GetOrderItemsByNextToken(AmazonOrderItemDetailsList list, AmazonOrdersItemsRequestInfo requestInfo, string nextToken, ActionAccessType access, RequestsCounterData requestCounter) { var sellerId = requestInfo.MerchantId; var req = new ListOrderItemsByNextTokenRequest { NextToken = nextToken, SellerId = sellerId, MWSAuthToken = requestInfo.MWSAuthToken }; var response = AmazonWaitBeforeRetryHelper.DoServiceAction( requestInfo.ErrorRetryingInfo, ListOrderItemsTrapForThrottling, "ListOrderItemsByNextToken", access, requestCounter, () => _Service.ListOrderItemsByNextToken(req)); if (response == null) { return; } var result = response.ListOrderItemsByNextTokenResult; if (result.IsSetOrderItems()) { ParseOrderItems(list, result.OrderItems); } if (result.IsSetNextToken()) { GetOrderItemsByNextToken(list, requestInfo, result.NextToken, access, requestCounter); } }
private AmazonOrderItemDetailsList GetOrderItems( AmazonSecurityInfo securityInfo, ActionAccessType access, AmazonOrderItem orderItem2, ElapsedTimeInfo elapsedTimeInfo, AmazonOrdersList orders, int mpId ) { var itemsRequestInfo = new AmazonOrdersItemsRequestInfo { MarketplaceId = securityInfo.MarketplaceId, MerchantId = securityInfo.MerchantId, OrderId = orderItem2.OrderId, ErrorRetryingInfo = this.amazonSettings, MWSAuthToken = securityInfo.MWSAuthToken }; AmazonOrderItemDetailsList orderItems = ElapsedTimeHelper.CalculateAndStoreElapsedTimeForCallInSeconds( elapsedTimeInfo, mpId, ElapsedDataMemberType .RetrieveDataFromExternalService, () => AmazonServiceHelper.GetListItemsOrdered(this.connectionInfo, itemsRequestInfo, access, orders.RequestsCounter) ); return(orderItems); }
private AmazonOrderItemDetailsList GetListItemsOrdered(AmazonOrdersItemsRequestInfo requestInfo, ActionAccessType access, RequestsCounterData requestCounter) { var orderId = requestInfo.OrderId; var sellerId = requestInfo.MerchantId; try { var req = new ListOrderItemsRequest { AmazonOrderId = orderId, SellerId = sellerId, MWSAuthToken = requestInfo.MWSAuthToken }; var response = AmazonWaitBeforeRetryHelper.DoServiceAction( requestInfo.ErrorRetryingInfo, ListOrderItemsTrapForThrottling, "ListOrderItems", access, requestCounter, () => _Service.ListOrderItems(req)); var list = new AmazonOrderItemDetailsList(DateTime.UtcNow) { RequestsCounter = requestCounter }; if (response == null) { return(list); } var result = response.ListOrderItemsResult; if (result.IsSetOrderItems()) { ParseOrderItems(list, result.OrderItems); } if (result.IsSetNextToken()) { GetOrderItemsByNextToken(list, requestInfo, result.NextToken, access, requestCounter); } return(list); } catch (MarketplaceWebServiceOrdersException) { return(null); } }
private void ParseOrderItems(AmazonOrderItemDetailsList list, IEnumerable <OrderItem> orderItemInfo) { orderItemInfo.AsParallel().ForAll(orderItem => list.Add(ParceOrderItem(orderItem))); }