private static List <OrderItemTwo> GetOrders(int umi, ElapsedTimeInfo elapsedTimeInfo, AmazonServiceConnectionInfo _ConnectionInfo, int days, bool useReporting) { var session = ObjectFactory.GetInstance <ISession>(); var marketplace = session.Get <MP_CustomerMarketPlace>(umi); var securityInfo = Serialized.Deserialize <AmazonSecurityInfo>(marketplace.SecurityData); var endDate = DateTime.UtcNow; var startDate = endDate.AddDays(-days); var errorRetryingInfo = new ErrorRetryingInfo((bool)CurrentValues.Instance.AmazonEnableRetrying, CurrentValues.Instance.AmazonMinorTimeoutInSeconds, CurrentValues.Instance.AmazonUseLastTimeOut); errorRetryingInfo.Info = new ErrorRetryingItemInfo[2]; errorRetryingInfo.Info[0] = new ErrorRetryingItemInfo(CurrentValues.Instance.AmazonIterationSettings1Index, CurrentValues.Instance.AmazonIterationSettings1CountRequestsExpectError, CurrentValues.Instance.AmazonIterationSettings1TimeOutAfterRetryingExpiredInMinutes); errorRetryingInfo.Info[1] = new ErrorRetryingItemInfo(CurrentValues.Instance.AmazonIterationSettings2Index, CurrentValues.Instance.AmazonIterationSettings2CountRequestsExpectError, CurrentValues.Instance.AmazonIterationSettings2TimeOutAfterRetryingExpiredInMinutes); var amazonOrdersRequestInfo = new AmazonOrdersRequestInfo { StartDate = startDate, EndDate = endDate, MarketplaceId = securityInfo.MarketplaceId, MerchantId = securityInfo.MerchantId, ErrorRetryingInfo = errorRetryingInfo, }; List <OrderItemTwo> orders; if (useReporting) { var configurator = AmazonServiceConfigurationFactory.CreateServiceReportsConfigurator(_ConnectionInfo); orders = ElapsedTimeHelper.CalculateAndStoreElapsedTimeForCallInSeconds( elapsedTimeInfo, umi, ElapsedDataMemberType.RetrieveDataFromExternalService, () => AmazonServiceReports.GetUserOrders(configurator, amazonOrdersRequestInfo, ActionAccessType.Full)) .Select(OrderItemTwo.FromOrderItem) .ToList(); } else { var ordersList = ElapsedTimeHelper.CalculateAndStoreElapsedTimeForCallInSeconds(elapsedTimeInfo, umi, ElapsedDataMemberType.RetrieveDataFromExternalService, () => AmazonServiceHelper.GetListOrders(_ConnectionInfo, amazonOrdersRequestInfo, ActionAccessType.Full, null)); //todo make it work again orders = new List <OrderItemTwo>(); } return(orders); }
public static AmazonOrdersList GetReportOrders(AmazonServiceConnectionInfo connectionInfo, AmazonOrdersRequestInfo requestInfo, ActionAccessType access) { var configurator = AmazonServiceConfigurationFactory.CreateServiceReportsConfigurator(connectionInfo); return(AmazonServiceReports.GetUserOrders(configurator, requestInfo, access)); }