public static IAmazonServiceProductsConfigurator Create(AmazonServiceConnectionInfo connectionInfo) { switch (connectionInfo.ServiceType) { case AmazonServiceType.Live: return(new AmazonServiceProductsConfiguratorLive(AmazonApiType.Products, connectionInfo.MarketCountry, connectionInfo.AccessInfo, connectionInfo.ApplicationInfo)); case AmazonServiceType.Mock: return(new AmazonServiceProductsConfiguratorMock()); default: throw new NotImplementedException(); } }
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 AmazonProductItemBase GetProductCategories(AmazonServiceConnectionInfo connectionInfo, AmazonProductsRequestInfoBySellerSku requestInfo, ActionAccessType access, RequestsCounterData requestCounter) { var configurator = AmazonServiceConfigurationFactory.CreateServiceProductsConfigurator(connectionInfo); return(AmazonServiceProducts.GetProductCategories(configurator, requestInfo, access, requestCounter)); }
public static AmazonOrderItemDetailsList GetListItemsOrdered(AmazonServiceConnectionInfo connectionInfo, AmazonOrdersItemsRequestInfo requestInfo, ActionAccessType access, RequestsCounterData requestCounter) { var configurator = AmazonServiceConfigurationFactory.CreateServiceOrdersConfigurator(connectionInfo); return(AmazonServiceOrders.GetListItemsOrdered(configurator, requestInfo, access, requestCounter)); }
public static RequestsCounterData GetListOrders(AmazonServiceConnectionInfo connectionInfo, AmazonOrdersRequestInfo requestInfo, ActionAccessType access, Func <List <AmazonOrderItem>, bool> func) { var configurator = AmazonServiceConfigurationFactory.CreateServiceOrdersConfigurator(connectionInfo); return(AmazonServiceOrders.GetListOrders(configurator, requestInfo, access, func)); }
public static AmazonOrdersList GetReportOrders(AmazonServiceConnectionInfo connectionInfo, AmazonOrdersRequestInfo requestInfo, ActionAccessType access) { var configurator = AmazonServiceConfigurationFactory.CreateServiceReportsConfigurator(connectionInfo); return(AmazonServiceReports.GetUserOrders(configurator, requestInfo, access)); }