Example #1
0
        /// <summary>
        /// Constructor to be used for UnitTesting/Mocking (in the absence of a dedicated DependencyInjection framework)
        /// </summary>
        internal EasyMwsClient(AmazonRegion region, string merchantId, string accessKeyId, string mwsSecretAccessKey, string mWSAuthToken,
                               IReportQueueingProcessor reportProcessor,
                               IFeedQueueingProcessor feedProcessor, IEasyMwsLogger easyMwsLogger,
                               EasyMwsOptions options)
            : this(region, merchantId, accessKeyId, mwsSecretAccessKey, mWSAuthToken, easyMwsLogger, options)
        {
            _reportProcessor = reportProcessor;
            _feedProcessor   = feedProcessor;

            RegisterEvents();
        }
Example #2
0
        /// <param name="region">The region of the account. Required parameter. A finer grained region or country can be specified on a PropertiesContainer by specifying its marketplaceIdList constructor argument.</param>
        /// <param name="merchantId">Seller ID / Merchant ID. Required parameter.</param>
        /// <param name="accessKeyId">Amazon account access key. Required parameter. This key can either belong to a seller or to a developer account authorized by a seller. If the key belongs to a developer account authorized by the seller then also make sure to specify the MWSAuthToken argument.</param>
        /// <param name="mwsSecretAccessKey">Amazon account secret access key. Required parameter. This key can either belong to a seller or to a developer account authorized by a seller. If the key belongs to a developer account authorized by the seller then also make sure to specify the MWSAuthToken argument.</param>
        /// <param name="mwsAuthToken">MWS Authorization Token. Optional parameter. If the provided access keys belong to a developer account authorized by a seller, this argument is the MWS Authorization Token provided by the seller to the authorized developer.</param>
        /// <param name="easyMwsLogger">An optional IEasyMwsLogger instance that can provide access to logs. It is strongly recommended to use a logger implementation already existing in the EasyMws package.</param>
        /// <param name="options">Configuration options for EasyMwsClient</param>
        public EasyMwsClient(AmazonRegion region, string merchantId, string accessKeyId, string mwsSecretAccessKey, string mwsAuthToken = null,
                             IEasyMwsLogger easyMwsLogger = null, EasyMwsOptions options = null)
        {
            if (string.IsNullOrEmpty(merchantId) || string.IsNullOrEmpty(accessKeyId) ||
                string.IsNullOrEmpty(mwsSecretAccessKey))
            {
                throw new ArgumentNullException(
                          "One or more required parameters provided to initialize the EasyMwsClient were null or empty");
            }

            _amazonRegion = region;
            _merchantId   = merchantId;
            _options      = options ?? new EasyMwsOptions();

            _easyMwsLogger = easyMwsLogger ?? new EasyMwsLogger(isEnabled: false);
            var mwsClient = new MarketplaceWebServiceClient(accessKeyId, mwsSecretAccessKey, CreateConfig(_amazonRegion));

            _reportProcessor = _reportProcessor ?? new ReportProcessor(_amazonRegion, _merchantId, mwsAuthToken, _options, mwsClient, _easyMwsLogger);
            _feedProcessor   = _feedProcessor ?? new FeedProcessor(_amazonRegion, _merchantId, mwsAuthToken, _options, mwsClient, _easyMwsLogger);

            RegisterEvents();
        }