private static void Test()
        {
            var config = new MarketplaceWebServiceConfig();

            config.SetUserAgentHeader( "", "", "C#" );

            config.ServiceURL = "https://mws.amazonservices.com";

            MarketplaceWebService service = new MarketplaceWebServiceClient(
                Secret.AwsAccessKeyId,
                Secret.AwsSecretAccessKey,
                config );

            var request = new SubmitFeedRequest {
                Merchant = Secret.MerchantId,
                MWSAuthToken = null,//"",
                MarketplaceIdList = new IdList { Id = new List< string >( new string[] { Secret.MarketplaceId } ) },
                FeedContent = File.Open( Filename, FileMode.Open, FileAccess.Read ),
                FeedType = FeedType
            };
            request.ContentMD5 = MarketplaceWebServiceClient.CalculateContentMD5( request.FeedContent );
            request.FeedContent.Position = 0;

            SubmitFeedSample.InvokeSubmitFeed( service, request );
        }
		public void GetFeedSubmissionResultTest()
		{
			MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();
			config.ServiceURL = serviceURL;

			MarketplaceWebService.MarketplaceWebService service =
				new MarketplaceWebServiceClient(
					creds.AccessKey,
					creds.SecretKey,
					appName,
					appVersion,
					config);

			GetFeedSubmissionResultRequest req = new GetFeedSubmissionResultRequest();
			req.MWSAuthToken = mWSAuthToken;
			req.Merchant = sellerId;
			req.FeedSubmissionId = "50014017726";


			//50003017583
			//50002017580
			var response = service.GetFeedSubmissionResultAmazonEnvelope(req);

			Console.WriteLine(response.Message.First().ProcessingReport.ProcessingSummary.MessagesSuccessful);
			Console.WriteLine(response.Message.First().ProcessingReport.ProcessingSummary.MessagesWithError);


			if (response.Message.First().ProcessingReport.Result != null)
			{
				Console.WriteLine(response.Message.First().ProcessingReport.Result.ResultCode);
				Console.WriteLine(response.Message.First().ProcessingReport.Result.ResultMessageCode);
				Console.WriteLine(response.Message.First().ProcessingReport.Result.ResultDescription);
			}
		}
Exemple #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Preparing application...");

            string accessKeyId        = "<Your AWS Access Key>";
            string secretAccessKey    = "<Your AWS Secret Key>";
            string applicationName    = "<Your Application Name>";
            string applicationVersion = "<Your Application Version>";
            string merchantId         = "<Your Merchant ID>";
            string marketplaceId      = "<Your Marketplace ID>";

            MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();

            config.ServiceURL = "https://mws.amazonservices.com";

            Console.WriteLine("Contacting Amazon web services...");

            config.SetUserAgentHeader(
                applicationName,
                applicationVersion,
                "C#",
                "<Parameter 1>", "<Parameter 2>");
            MarketplaceWebService.MarketplaceWebService service = new MarketplaceWebServiceClient(accessKeyId, secretAccessKey, config);

            Console.WriteLine("Service client created. Downloading settlement report...");

            DownloadSettlementReport(service, merchantId);

            Console.Read();
        }
        public void GetFeedsTest()
        {
            MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();

            config.ServiceURL = serviceURL;

            MarketplaceWebService.MarketplaceWebService service =
                new MarketplaceWebServiceClient(
                    creds.AccessKey,
                    creds.SecretKey,
                    appName,
                    appVersion,
                    config);


            GetFeedSubmissionListRequest req = new GetFeedSubmissionListRequest();

            req.MWSAuthToken = mWSAuthToken;
            req.Merchant     = sellerId;
            var response = service.GetFeedSubmissionList(req);


            foreach (var item in response.GetFeedSubmissionListResult.FeedSubmissionInfo)
            {
                Console.WriteLine(item.FeedSubmissionId);
            }
        }
Exemple #5
0
        public MarketplaceWebServiceClient GetMWSClient()
        {
            MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();

            config.ServiceURL = "https://mws.amazonservices.com";

            config.SetUserAgentHeader(
                "berkeley",
                "1.0",
                "C#",
                "<Parameter 1>", "<Parameter 2>");


            MarketplaceWebServiceClient service =
                new MarketplaceWebServiceClient(
                    this.AccessKeyId,
                    this.SecretAccessKey,
                    "berkeley",
                    "1.0",
                    config);



            return(service);
        }
        public void SubmitFeedTest()
        {
            MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();

            config.ServiceURL = serviceURL;

            MarketplaceWebService.MarketplaceWebService service =
                new MarketplaceWebServiceClient(
                    creds.AccessKey,
                    creds.SecretKey,
                    appName,
                    appVersion,
                    config);

            SubmitFeedRequest submitFeedRequest = new SubmitFeedRequest();

            submitFeedRequest.MWSAuthToken = mWSAuthToken;
            submitFeedRequest.Merchant     = sellerId;
            submitFeedRequest.FeedType     = "_POST_PRODUCT_PRICING_DATA_";
            AmazonEnvelope priceFeed = PriceFeedBuilder.Build();

            priceFeed.Message.First().MessageID = "1";
            priceFeed.Message.First().Price.StandardPrice.Value = 67.00m;
            priceFeed.Message.First().Price.SKU = "8E-5FMM-A9HN";             //priceFeed.Message.Add(new Message() { MessageID = "123" });
            priceFeed.Header.MerchantIdentifier = sellerId;
            var stream = Util.GenerateStreamFromXml <AmazonEnvelope>(priceFeed);

            submitFeedRequest.FeedContent = stream;
            submitFeedRequest.ContentMD5  = Util.CalculateContentMD5(stream);
            SubmitFeedResponse submitFeedResponse = service.SubmitFeed(submitFeedRequest);

            //Util.GenerateFromXml<AmazonEnvelope>(priceFeed);

            Console.WriteLine(submitFeedResponse.SubmitFeedResult.FeedSubmissionInfo.FeedSubmissionId);
        }
Exemple #7
0
        public AmazonService(PlatformServiceFactory platformServiceFactory, string company, string connectionString)
        {
            m_platformServiceFactory = platformServiceFactory;
            m_company          = company;
            m_connectionString = connectionString;
            using (ERPContext context = new ERPContext(m_connectionString))
            {
                var q = from amazonAccount in context.AmazonAccount
                        select amazonAccount;
                foreach (var row in q)
                {
                    sellerIdDictionary[row.AccountName]     = row.SellerId;
                    mwsAuthTokenDictionary[row.AccountName] = row.MWSAuthToken;
                }
            }

            MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig();

            config.ServiceURL = serviceURL;
            client            = new MarketplaceWebServiceOrdersClient(accessKey, secretKey, appName, appVersion, config);

            MarketplaceWebServiceConfig mwsConfig = new MarketplaceWebServiceConfig();

            mwsConfig.ServiceURL = serviceURL;
            mwsClient            = new MarketplaceWebServiceClient(accessKey, secretKey, appName, appVersion, mwsConfig);
        }
Exemple #8
0
        protected override void RegisterServices(IKernel kernel)
        {
            kernel.Bind <MarketplaceWebServiceOrders.MarketplaceWebServiceOrders>().ToMethod(context =>
            {
                var amazonAppSettings = context.Kernel.Get <AmazonAppSettings>();
                var config            = new MarketplaceWebServiceOrdersConfig {
                    ServiceURL = amazonAppSettings.OrdersApiEndpoint
                };
                return(new MarketplaceWebServiceOrdersClient
                           ("MrCMS", MrCMSApplication.AssemblyVersion, amazonAppSettings.AWSAccessKeyId, amazonAppSettings.SecretKey, config));
            }).InRequestScope();

            kernel.Bind <MarketplaceWebServiceProducts.MarketplaceWebServiceProducts>().ToMethod(context =>
            {
                var amazonAppSettings = context.Kernel.Get <AmazonAppSettings>();
                var config            = new MarketplaceWebServiceProductsConfig {
                    ServiceURL = amazonAppSettings.ProductsApiEndpoint
                };
                return(new MarketplaceWebServiceProductsClient
                           ("MrCMS", MrCMSApplication.AssemblyVersion, amazonAppSettings.AWSAccessKeyId, amazonAppSettings.SecretKey, config));
            }).InRequestScope();
            kernel.Bind <MarketplaceWebService.MarketplaceWebService>().ToMethod(context =>
            {
                var amazonAppSettings = context.Kernel.Get <AmazonAppSettings>();
                var config            = new MarketplaceWebServiceConfig {
                    ServiceURL = amazonAppSettings.ProductsApiEndpoint
                };
                return(new MarketplaceWebServiceClient(amazonAppSettings.AWSAccessKeyId, amazonAppSettings.SecretKey, "MrCMS", MrCMSApplication.AssemblyVersion, config));
            }).InRequestScope();
        }
		public void RequestReportTest()
		{

			MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();
			config.ServiceURL = serviceURL;

			MarketplaceWebService.MarketplaceWebService service =
				new MarketplaceWebServiceClient(
					creds.AccessKey,
					creds.SecretKey,
					appName,
					appVersion,
					config);

			string reportType = "_GET_FLAT_FILE_ORDERS_DATA_";

			RequestReportRequest request = new RequestReportRequest();
			request.ReportType = reportType;
			request.Merchant = sellerId;
			request.MWSAuthToken = mWSAuthToken; // Optional
												 //@TODO: set additional request parameters here
			RequestReportResponse response = service.RequestReport(request);

			Assert.IsTrue(response.RequestReportResult.ReportRequestInfo.ReportType == reportType);
			Console.WriteLine("GeneratedReportId: " + response.RequestReportResult.ReportRequestInfo.GeneratedReportId);
		}
Exemple #10
0
        public override void Initialize()
        {
            var settingsManager = _container.Resolve <ISettingsManager>();


            var amazonManager = new AmazonManagerSettings(
                settingsManager,
                _merchantIdPropertyName,
                _serviceUrlPropertyName,
                _marketplaceIdPropertyName,
                _awsAccessKeyIdPropertyName,
                _awsSecretAccessKeyPropertyName);

            var feedConfig = new MarketplaceWebServiceConfig {
                ServiceURL = amazonManager.ServiceURL
            };

            //test mock registration
            _container.RegisterInstance <IMarketplaceWebServiceClient>(new MockMarketplaceWebServiceClient());

            //production registration
            //_container.RegisterInstance<IMarketplaceWebServiceClient>(new MarketplaceWebServiceClient(amazonManager.AwsAccessKeyId, amazonManager.AwsSecretAccessKey, "VirtoCommerce", "1.01", feedConfig));

            _container.RegisterInstance <IDateTimeProvider>(new DefaultDateTimeProvider());
            _container.RegisterInstance <IAmazonSettings>(amazonManager);

            _container.RegisterType <AmazonMerchantController>();
        }
        private MarketplaceWebService.MarketplaceWebService Configurations(string intergrationType, string accessKey, string secretKey)
        {
            MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();

            config.ServiceURL = SOHelper.GetIntegrationType(intergrationType.Trim(), SOConstants.serviceUrl);
            MarketplaceWebService.MarketplaceWebService serviceConfig = new MarketplaceWebService.MarketplaceWebServiceClient(accessKey, secretKey, SOConstants.appName, SOConstants.version, config);
            return(serviceConfig);
        }
        private MarketplaceWebServiceClient GetMwsClient()
        {
            var mwsConfig = new MarketplaceWebServiceConfig();

            mwsConfig.ServiceURL = "https://mws.amazonservices.com";
            mwsConfig.SetUserAgentHeader("Eshopo LLC", "1.0", "C#", null);

            return(new MarketplaceWebServiceClient(_awsAccessKey, _secretKey, mwsConfig));
        }
        private MarketplaceWebServiceClient _getWebServiceClient()
        {
            var feedConfig = new MarketplaceWebServiceConfig
            {
                ServiceURL = "https://mws.amazonservices.com"
            };

            return(new MarketplaceWebServiceClient(_awsAccessKey, _secretKey, "EIS", "1.01", feedConfig));
        }
        public MarketplaceWebServiceClient GetFeedsApiService()
        {
            var config = new MarketplaceWebServiceConfig()
            {
                ServiceURL = _amazonAppSettings.ApiEndpoint
            };

            return(new MarketplaceWebServiceClient(MrCMSApplication.Get <AmazonAppSettings>().AWSAccessKeyId,
                                                   MrCMSApplication.Get <AmazonAppSettings>().SecretKey, "MrCMS", MrCMSApplication.AssemblyVersion,
                                                   config));
        }
Exemple #15
0
        public AmazonMarketplaceReportProvider()
        {
            // create configuratin to use US marketplace
            var config = new MarketplaceWebServiceConfig {
                ServiceURL = RequestHelper.ServiceUrl
            };

            config.SetUserAgentHeader("EIS Inventory System", "3.0", "C#");

            _amazonClient = new MarketplaceWebServiceClient("AKIAJDQNAJIEJ2XZWVQA",
                                                            "iRJplr+w2vZ1felGmV/OuUqOSreEyAx6c7o8nF3J",
                                                            config);
        }
        private static MarketplaceWebServiceClient _getWebServiceClient()
        {
            var feedConfig = new MarketplaceWebServiceConfig
            {
                ServiceURL = RequestHelper.ServiceUrl
            };

            return(new MarketplaceWebServiceClient(RequestHelper.AccessKeyId,
                                                   RequestHelper.SecretKey,
                                                   "EIS System",
                                                   "1.01",
                                                   feedConfig));
        }
Exemple #17
0
        /// <summary>
        /// Default public contructor. All properties are set via the config file
        /// </summary>
        public AmazonIntegration()
        {
            // Verify that the settings in the config file are setup correctly.
            if (string.IsNullOrWhiteSpace(_AccessKeyId))
            {
                throw new InvalidOperationException("AWSAccessKeyId setting in the config file can't be whitespace, blank or null");
            }
            if (string.IsNullOrWhiteSpace(_SecretAccessKey))
            {
                throw new InvalidOperationException("AWSSecretAccessKey setting in the config file can't be whitespace, blank or null");
            }
            if (string.IsNullOrWhiteSpace(_ApplicationName))
            {
                throw new InvalidOperationException("AWSApplicationName setting in the config file can't be whitespace, blank or null");
            }
            if (string.IsNullOrWhiteSpace(_ApplicationVersion))
            {
                throw new InvalidOperationException("AWSApplicationVersion setting in the config file can't be whitespace, blank or null");
            }
            if (string.IsNullOrWhiteSpace(_MerchantId))
            {
                throw new InvalidOperationException("AWSMerchantId setting in the config file can't be whitespace, blank or null");
            }
            if (string.IsNullOrWhiteSpace(_MarketplaceId))
            {
                throw new InvalidOperationException("AWSMarketplaceId setting in the config file can't be whitespace, blank or null");
            }
            if (string.IsNullOrWhiteSpace(_TemporaryFileDirectory))
            {
                throw new InvalidOperationException("TempFileDirectory setting in the config file can't be whitespace, blank or null");
            }

            var config = new MarketplaceWebServiceConfig();

            // Set configuration to use US marketplace
            config.ServiceURL = "https://mws.amazonservices.com";
            // Set the HTTP Header for user agent for the application.
            config.SetUserAgentHeader(
                _ApplicationName,
                _ApplicationVersion,
                "C#");
            _AmazonClient = new MarketplaceWebServiceClient(_AccessKeyId, _SecretAccessKey, config);

            // Setup the orders service client
            var ordersConfig = new MarketplaceWebServiceOrdersConfig();

            ordersConfig.ServiceURL = "https://mws.amazonservices.com/Orders/2011-01-01";
            ordersConfig.SetUserAgent(_ApplicationName, _ApplicationVersion);
            _AmazonOrdersClient = new MarketplaceWebServiceOrdersClient(
                _ApplicationName, _ApplicationVersion, _AccessKeyId, _SecretAccessKey, ordersConfig);
        }
Exemple #18
0
        public AmazonReportController()
        {
            // init the reports directory
            _reportsDirectory = ConfigurationManager.AppSettings["ReportsPath"].ToString();
            _merchantId       = ConfigurationManager.AppSettings["MerchantId"].ToString();
            _accessKeyId      = ConfigurationManager.AppSettings["AccessKeyId"].ToString();
            _secretAccessKey  = ConfigurationManager.AppSettings["SecretAccessKey"].ToString();

            // create configuratin to use US marketplace
            var config = new MarketplaceWebServiceConfig {
                ServiceURL = "https://mws.amazonservices.com"
            };

            config.SetUserAgentHeader("EIS Reports Service", "3.0", "C#");
            _amazonClient = new MarketplaceWebServiceClient(_accessKeyId, _secretAccessKey, config);
        }
        public ReportHandler(ServiceContext serviceContext, ILogger nLogger)
        {
            this.serviceContext = serviceContext;
            this.nLogger        = nLogger;


            config            = new MarketplaceWebServiceConfig();
            config.ServiceURL = serviceContext.MwsServiceUrl;

            service = new MarketplaceWebServiceClient(
                serviceContext.AccessKey,
                serviceContext.SecretKey,
                serviceContext.ApplicationName,
                serviceContext.AppVersion,
                config);
        }
Exemple #20
0
        private MarketplaceWebServiceConfig CreateConfig(AmazonRegion region)
        {
            string rootUrl;

            switch (region)
            {
            case AmazonRegion.Australia:
                rootUrl = MwsEndpoint.Australia.RegionOrMarketPlaceEndpoint;
                break;

            case AmazonRegion.China:
                rootUrl = MwsEndpoint.China.RegionOrMarketPlaceEndpoint;
                break;

            case AmazonRegion.Europe:
                rootUrl = MwsEndpoint.Europe.RegionOrMarketPlaceEndpoint;
                break;

            case AmazonRegion.India:
                rootUrl = MwsEndpoint.India.RegionOrMarketPlaceEndpoint;
                break;

            case AmazonRegion.Japan:
                rootUrl = MwsEndpoint.Japan.RegionOrMarketPlaceEndpoint;
                break;

            case AmazonRegion.NorthAmerica:
                rootUrl = MwsEndpoint.NorthAmerica.RegionOrMarketPlaceEndpoint;
                break;

            case AmazonRegion.Brazil:
                rootUrl = MwsEndpoint.Brazil.RegionOrMarketPlaceEndpoint;
                break;

            default:
                throw new ArgumentException($"{region} is unknown - EasyMWS doesn't know the RootURL");
            }

            var config = new MarketplaceWebServiceConfig
            {
                ServiceURL = rootUrl
            };

            config = config.WithUserAgent("EasyMWS");

            return(config);
        }
Exemple #21
0
        public string GetReport(string ReportId, string Path)
        {
            string amazonFileLocation = "";

            GetReportRequest requestReport = new GetReportRequest();

#pragma warning disable CS0618 // Type or member is obsolete
            requestReport.Marketplace = api.MarketplaceId;
#pragma warning restore CS0618 // Type or member is obsolete
            requestReport.Merchant = api.Merchant;

            requestReport.ReportId = ReportId;

            string Extension = string.Format("{1}{0}", ".txt", DateTime.Now.ToString("hh.mm.ss.ffffff"));

            string FullPath = Path + Extension;

            if (!File.Exists(FullPath))
            {
                var stream = File.Create(FullPath);
                stream.Close();
            }

            // string fileLocation = FileAmazon.createFile(reportId, "txt", ReportModule, ""); -> METHOD TO CREATE THE PATH

            if (FullPath != "")
            {
                var stream = File.Open(FullPath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                requestReport.Report = stream;

                MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();
                config.ServiceURL = webService.SERVICE_URL;
                config.WithUserAgent(webService.USER_AGENT);

                MarketplaceWebServiceClient client = new MarketplaceWebServiceClient(api.AccessKey, api.SecretKey, config);

                InvokeGetReport(client, requestReport);

                stream.Close();

                amazonFileLocation = FullPath;
            }

            return(amazonFileLocation);
        }
Exemple #22
0
        public MwsProductsApi(string sellerId, string marketPlaceId, string accessKeyId, string secretAccessKeyId, string serviceUrl)
        {
            m_sellerId      = sellerId;
            m_marketPlaceId = marketPlaceId;

            MarketplaceWebServiceProductsConfig config = new MarketplaceWebServiceProductsConfig {
                ServiceURL = serviceUrl
            };

            m_productClient = new MarketplaceWebServiceProductsClient(string.Empty, string.Empty, accessKeyId, secretAccessKeyId, config);

            MarketplaceWebServiceConfig configService = new MarketplaceWebServiceConfig()
                                                        .WithServiceURL("https://mws.amazonservices.com");

            configService.SetUserAgentHeader(string.Empty, string.Empty, "C#");

            m_service = new MarketplaceWebServiceClient(accessKeyId, secretAccessKeyId, configService);
        }
Exemple #23
0
        public MwsFeedsApi(string sellerId, string marketPlaceId, string accessKeyId, string secretAccessKeyId, string merchantIdentifier)
        {
            m_merchantId    = sellerId;
            m_marketPlaceId = marketPlaceId;

            m_merchantId         = sellerId;
            m_merchantIdentifier = merchantIdentifier;

            const string serviceUrl = "https://mws.amazonservices.com";

            MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig {
                ServiceURL = serviceUrl
            };

            config.ServiceURL = serviceUrl;
            config.SetUserAgentHeader("applicationName", "applicationVersion", "C#", "<Parameter 1>", "<Parameter 1>");

            m_service = new MarketplaceWebServiceClient(accessKeyId, secretAccessKeyId, config);
        }
		public void SubmitFeedTestRedCarpet()
		{
			MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();
			config.ServiceURL = serviceURL;

			MarketplaceWebService.MarketplaceWebService service =
				new MarketplaceWebServiceClient(
					creds.AccessKey,
					creds.SecretKey,
					appName,
					appVersion,
					config);

			SubmitFeedRequest submitFeedRequest = new SubmitFeedRequest();
			submitFeedRequest.MWSAuthToken = mWSAuthToken;
			submitFeedRequest.Merchant = sellerId;
			submitFeedRequest.FeedType = "_POST_PRODUCT_PRICING_DATA_";
			AmazonEnvelope priceFeed = PriceFeedBuilder.Build();
			Message msg = PriceFeedBuilder.BuildMessage();
			msg.MessageID = "1";
			msg.Price.StandardPrice.Value = 154.40m;
			msg.Price.SKU = "HEWD9P29A";
			priceFeed.Message.Add(msg);

			Message msg2 = PriceFeedBuilder.BuildMessage();
			msg2.MessageID = "2";
			msg2.Price.StandardPrice.Value = 62.05m;
			msg2.Price.SKU = "HEW35S";
			priceFeed.Message.Add(msg2);

			priceFeed.Header.MerchantIdentifier = sellerId;
			var stream = Util.GenerateStreamFromXml<AmazonEnvelope>(priceFeed);

			Util.GenerateXmlFile<AmazonEnvelope>(priceFeed);

			submitFeedRequest.FeedContent = stream;
			submitFeedRequest.ContentMD5 = Util.CalculateContentMD5(stream);
			SubmitFeedResponse submitFeedResponse = service.SubmitFeed(submitFeedRequest);


			Console.WriteLine(submitFeedResponse.SubmitFeedResult.FeedSubmissionInfo.FeedSubmissionId);
		}
        public FeedHandler(SellerInfo sellerInfo, ILogger nLogger)
        {
            this.sellerInfo = sellerInfo;
            this.nLogger    = nLogger;

            var            chain = new CredentialProfileStoreChain();
            AWSCredentials awsCredentials;

            chain.TryGetAWSCredentials("DD MWS", out awsCredentials);
            ImmutableCredentials creds = awsCredentials.GetCredentials();

            config            = new MarketplaceWebServiceConfig();
            config.ServiceURL = sellerInfo.MwsServiceUrl;

            service = new MarketplaceWebServiceClient(
                creds.AccessKey,
                creds.SecretKey,
                "RC",
                sellerInfo.AppVersion,
                config);
        }
        public void GetReportCountTest()
        {
            MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();

            config.ServiceURL = serviceURL;

            MarketplaceWebService.MarketplaceWebService service =
                new MarketplaceWebServiceClient(
                    creds.AccessKey,
                    creds.SecretKey,
                    appName,
                    appVersion,
                    config);

            GetReportCountRequest request = new GetReportCountRequest();

            request.Merchant     = sellerId;
            request.MWSAuthToken = "";             // Optional
            //@TODO: set additional request parameters here
            GetReportCountResponse response = service.GetReportCount(request);
        }
Exemple #27
0
        public string RequestReport(string Type, DateTime From, DateTime To)
        {
            try
            {
                RequestReportRequest requestReport = new RequestReportRequest();
#pragma warning disable CS0618 // Type or member is obsolete
                requestReport.Marketplace = api.MarketplaceId;
#pragma warning restore CS0618 // Type or member is obsolete
                requestReport.Merchant = api.Merchant;

                requestReport.StartDate = From;
                requestReport.EndDate   = To;

                requestReport.ReportOptions = "true";

                IdList idList = new IdList();
                idList.Id = new List <string>()
                {
                    api.MarketplaceId
                };
                requestReport.MarketplaceIdList = idList;

                requestReport.ReportType = Type;

                MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();
                config.ServiceURL = webService.SERVICE_URL;
                config.WithUserAgent(webService.USER_AGENT);

                MarketplaceWebServiceClient client = new MarketplaceWebServiceClient(api.AccessKey, api.SecretKey, config);

                return(InvokeRequestReport(client, requestReport));
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Exemple #28
0
        private IMarketplaceWebService CreateService()
        {
            /**********************************************************************
             * Access Key ID and Secret Access Key ID
             ***********************************************************************/
            string accessKeyId     = base.AccessInfo.KeyId;
            string secretAccessKey = base.AccessInfo.SecretKeyId;

            /**********************************************************************
             * The application name and version are included in each MWS call's
             * HTTP User-Agent field. These are required fields.
             ***********************************************************************/
            string applicationName    = base.ApplicationInfo.Name;
            string applicationVersion = base.ApplicationInfo.Version;

            /**********************************************************************
             * Instantiate  Implementation of Marketplace Web Service
             ***********************************************************************/
            var config = new MarketplaceWebServiceConfig {
                ServiceURL = base.ServiceUrl.Value
            };

            return(new MarketplaceWebServiceClient(accessKeyId, secretAccessKey, applicationName, applicationVersion, config));
        }
        /**
         * Samples for Marketplace Web Service functionality
         */
        public static void Main(string[] args)
        {
            Console.WriteLine("===========================================");
            Console.WriteLine("Welcome to Marketplace Web Service Samples!");
            Console.WriteLine("===========================================");

            Console.WriteLine("To get started:");
            Console.WriteLine("===========================================");
            Console.WriteLine("  - Fill in your AWS credentials");
            Console.WriteLine("  - Uncomment sample you're interested in trying");
            Console.WriteLine("  - Set request with desired parameters");
            Console.WriteLine("  - Hit F5 to run!");
            Console.WriteLine();

            Console.WriteLine("===========================================");
            Console.WriteLine("Samples Output");
            Console.WriteLine("===========================================");
            Console.WriteLine();

            /************************************************************************
             * Access Key ID and Secret Acess Key ID, obtained from:
             * http://aws.amazon.com
             *
             * IMPORTANT: Your Secret Access Key is a secret, and should be known
             * only by you and AWS. You should never include your Secret Access Key
             * in your requests to AWS. You should never e-mail your Secret Access Key
             * to anyone. It is important to keep your Secret Access Key confidential
             * to protect your account.
             ***********************************************************************/
            String accessKeyId     = "AKIAIKYYTE7TYRWSAIEA";
            String secretAccessKey = "jFA0WUoRP1yJty5pp8BXWfHN/UwMOecXQ6grn2D9";

            /************************************************************************
             * Instantiate  Implementation of Marketplace Web Service
             ***********************************************************************/

            //MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();

            /************************************************************************
             * The application name and version are included in each MWS call's
             * HTTP User-Agent field. These are required fields.
             ***********************************************************************/

            const string applicationName    = "T-Tek Seller Tool";
            const string applicationVersion = "0.1";

            /*MarketplaceWebService service =
             *  new MarketplaceWebServiceClient(
             *      accessKeyId,
             *      secretAccessKey,
             *      applicationName,
             *      applicationVersion,
             *      config);*/


            /************************************************************************
             * All MWS requests must contain the seller's merchant ID and
             * marketplace ID.
             ***********************************************************************/
            const string merchantId    = "A380610PV1XE6A";
            const string marketplaceId = "ATVPDKIKX0DER";

            /************************************************************************
             * Uncomment to configure the client instance. Configuration settings
             * include:
             *
             *  - MWS Service endpoint URL
             *  - Proxy Host and Proxy Port
             *  - User Agent String to be sent to Marketplace Web Service  service
             *
             ***********************************************************************/
            MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();

            config.ProxyHost = "https://PROXY_URL";
            config.ProxyPort = 9090;
            //
            // IMPORTANT: Uncomment out the appropiate line for the country you wish
            // to sell in:
            //
            // United States:
            config.ServiceURL = "https://mws.amazonservices.com";
            //
            // United Kingdom:
            // config.ServiceURL = "https://mws.amazonservices.co.uk";
            //
            // Germany:
            // config.ServiceURL = "https://mws.amazonservices.de";
            //
            // France:
            // config.ServiceURL = "https://mws.amazonservices.fr";
            //
            // Japan:
            // config.ServiceURL = "https://mws.amazonservices.jp";
            //
            // China:
            // config.ServiceURL = "https://mws.amazonservices.com.cn";
            //
            // Canada:
            // config.ServiceURL = "https://mws.amazonservices.ca";
            //
            // Italy:
            // config.ServiceURL = "https://mws.amazonservices.it";
            //
            config.SetUserAgentHeader(
                applicationName,
                applicationVersion,
                "C#",
                "<Parameter 1>", "<Parameter 2>");
            MarketplaceWebService service = new MarketplaceWebServiceClient(accessKeyId, secretAccessKey, config);


            /************************************************************************
             * Uncomment to try out Mock Service that simulates Marketplace Web Service
             * responses without calling Marketplace Web Service  service.
             *
             * Responses are loaded from local XML files. You can tweak XML files to
             * experiment with various outputs during development
             *
             * XML files available under MarketplaceWebService\Mock tree
             *
             ***********************************************************************/
            //MarketplaceWebService service = new MarketplaceWebServiceMock();


            /************************************************************************
             * Uncomment to invoke Get Report Action
             ***********************************************************************/
            {
                GetReportRequest request = new GetReportRequest();
                request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional

                // Note that depending on the type of report being downloaded, a report can reach
                // sizes greater than 1GB. For this reason we recommend that you _always_ program to
                // MWS in a streaming fashion. Otherwise, as your business grows you may silently reach
                // the in-memory size limit and have to re-work your solution.
                // NOTE: Due to Content-MD5 validation, the stream must be read/write.
                request.ReportId = "REPORT_ID";
                request.Report   = File.Open("report.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite);
                GetReportSample.InvokeGetReport(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Get Report Schedule Count Action
             ***********************************************************************/
            {
                GetReportScheduleCountRequest request = new GetReportScheduleCountRequest();
                request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                // @TODO: set additional request parameters here
                GetReportScheduleCountSample.InvokeGetReportScheduleCount(service, request);
            }


            /************************************************************************
             * Uncomment to invoke Get Report Request List By Next Token Action
             ***********************************************************************/
            {
                //GetReportRequestListByNextTokenRequest request = new GetReportRequestListByNextTokenRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                //request.NextToken = "NextToken from GetReportRequestList";
                // @TODO: set additional request parameters here
                //GetReportRequestListByNextTokenSample.InvokeGetReportRequestListByNextToken(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Update Report Acknowledgements Action
             ***********************************************************************/
            {
                //UpdateReportAcknowledgementsRequest request = new UpdateReportAcknowledgementsRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                //request.WithReportIdList(new IdList().WithId("REPORT_ID"));
                // @TODO: set additional request parameters here
                //UpdateReportAcknowledgementsSample.InvokeUpdateReportAcknowledgements(service, request);
            }


            /************************************************************************
             * Uncomment to invoke Submit Feed Action
             ***********************************************************************/
            {
                // SubmitFeedRequest request = new SubmitFeedRequest();
                // request.Merchant = merchantId;
                // request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                // request.MarketplaceIdList = new IdList();
                // request.MarketplaceIdList.Id = new List<string>( new string [] { marketplaceId } );

                // MWS exclusively offers a streaming interface for uploading your feeds. This is because
                // feed sizes can grow to the 1GB+ range - and as your business grows you could otherwise
                // silently reach the feed size where your in-memory solution will no longer work, leaving you
                // puzzled as to why a solution that worked for a long time suddenly stopped working though
                // you made no changes. For the same reason, we strongly encourage you to generate your feeds to
                // local disk then upload them directly from disk to MWS.

                //request.FeedContent = File.Open("feed.xml", FileMode.Open, FileAccess.Read);

                // Calculating the MD5 hash value exhausts the stream, and therefore we must either reset the
                // position, or create another stream for the calculation.
                //request.ContentMD5 = MarketplaceWebServiceClient.CalculateContentMD5(request.FeedContent);
                //request.FeedContent.Position = 0;

                //request.FeedType = "FEED_TYPE";

                //SubmitFeedSample.InvokeSubmitFeed(service, request);
            }


            /************************************************************************
             * Uncomment to invoke Get Report Count Action
             ***********************************************************************/
            {
                // GetReportCountRequest request = new GetReportCountRequest();
                // request.Merchant = merchantId;
                // request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                // @TODO: set additional request parameters here
                // GetReportCountSample.InvokeGetReportCount(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Get Feed Submission List By Next Token Action
             ***********************************************************************/
            {
                //GetFeedSubmissionListByNextTokenRequest request = new GetFeedSubmissionListByNextTokenRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                //request.NextToken = "NextToken from GetFeedSubmissionList";
                // @TODO: set additional request parameters here
                //GetFeedSubmissionListByNextTokenSample.InvokeGetFeedSubmissionListByNextToken(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Cancel Feed Submissions Action
             ***********************************************************************/
            {
                //CancelFeedSubmissionsRequest request = new CancelFeedSubmissionsRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                // @TODO: set additional request parameters here
                //CancelFeedSubmissionsSample.InvokeCancelFeedSubmissions(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Request Report Action
             ***********************************************************************/
            {
                //RequestReportRequest request = new RequestReportRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                //request.MarketplaceIdList = new IdList();
                //request.MarketplaceIdList.Id = new List<string>( new string [] { marketplaceId } );

                //request.ReportType = "Desired Report Type";
                // @TODO: set additional request parameters here
                //request.ReportOptions = "ShowSalesChannel=true";
                //RequestReportSample.InvokeRequestReport(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Get Feed Submission Count Action
             ***********************************************************************/
            {
                //GetFeedSubmissionCountRequest request = new GetFeedSubmissionCountRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                // @TODO: set additional request parameters here
                //GetFeedSubmissionCountSample.InvokeGetFeedSubmissionCount(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Cancel Report Requests Action
             ***********************************************************************/
            {
                //CancelReportRequestsRequest request = new CancelReportRequestsRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                // @TODO: set additional request parameters here
                //CancelReportRequestsSample.InvokeCancelReportRequests(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Get Report List Action
             ***********************************************************************/
            {
                //GetReportListRequest request = new GetReportListRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                // @TODO: set additional request parameters here
                //GetReportListSample.InvokeGetReportList(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Get Feed Submission Result Action
             ***********************************************************************/
            {
                //GetFeedSubmissionResultRequest request = new GetFeedSubmissionResultRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional

                // Note that depending on the size of the feed sent in, and the number of errors and warnings,
                // the result can reach sizes greater than 1GB. For this reason we recommend that you _always_
                // program to MWS in a streaming fashion. Otherwise, as your business grows you may silently reach
                // the in-memory size limit and have to re-work your solution.
                // NOTE: Due to Content-MD5 validation, the stream must be read/write.
                //request.FeedSubmissionId = "FEED_SUBMISSION_ID";
                //request.FeedSubmissionResult = File.Open("feedSubmissionResult.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite);

                //GetFeedSubmissionResultSample.InvokeGetFeedSubmissionResult(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Get Feed Submission List Action
             ***********************************************************************/
            {
                //GetFeedSubmissionListRequest request = new GetFeedSubmissionListRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                // @TODO: set additional request parameters here
                //GetFeedSubmissionListSample.InvokeGetFeedSubmissionList(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Get Report Request List Action
             ***********************************************************************/
            {
                //GetReportRequestListRequest request = new GetReportRequestListRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                // @TODO: set additional request parameters here
                //GetReportRequestListSample.InvokeGetReportRequestList(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Get Report Schedule List By Next Token Action
             ***********************************************************************/
            {
                //GetReportScheduleListByNextTokenRequest request = new GetReportScheduleListByNextTokenRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                //request.NextToken = "NextToken from GetReportScheduleList";
                // @TODO: set additional request parameters here
                //GetReportScheduleListByNextTokenSample.InvokeGetReportScheduleListByNextToken(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Get Report List By Next Token Action
             ***********************************************************************/
            {
                // GetReportListByNextTokenRequest request = new GetReportListByNextTokenRequest();
                // request.Merchant = merchantId;
                // request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                //request.NextToken = "NextToken from GetReportList";
                // @TODO: set additional request parameters here
                // GetReportListByNextTokenSample.InvokeGetReportListByNextToken(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Manage Report Schedule Action
             ***********************************************************************/
            {
                //ManageReportScheduleRequest request = new ManageReportScheduleRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                //request.ReportType = "Report Type";
                //request.Schedule = "Schedule";
                // @TODO: set additional request parameters here
                //ManageReportScheduleSample.InvokeManageReportSchedule(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Get Report Request Count Action
             ***********************************************************************/
            {
                //GetReportRequestCountRequest request = new GetReportRequestCountRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                // @TODO: set additional request parameters here
                //GetReportRequestCountSample.InvokeGetReportRequestCount(service, request);
            }

            /************************************************************************
             * Uncomment to invoke Get Report Schedule List Action
             ***********************************************************************/
            {
                //GetReportScheduleListRequest request = new GetReportScheduleListRequest();
                //request.Merchant = merchantId;
                //request.MWSAuthToken = "<Your MWS Auth Token>"; // Optional
                // @TODO: set additional request parameters here
                //GetReportScheduleListSample.InvokeGetReportScheduleList(service, request);
            }


            Console.WriteLine();
            Console.WriteLine("===========================================");
            Console.WriteLine("End of output. You can close this window");
            Console.WriteLine("===========================================");

            System.Threading.Thread.Sleep(50000);
        }
Exemple #30
0
        private static string AdlsAccountName   = "";                                // Name of the Azure Data Lake Store

        static void Main(string[] args)
        {
            // Fetching Prerequisites Data from Azure SQL Server
            using (SqlConnection con = new SqlConnection(connectionString))
            {
                // Fetching data from Report Config Table
                SqlCommand cmd = new SqlCommand("USE CommerceLabsDW;OPEN SYMMETRIC KEY SymmetricKey1 DECRYPTION BY CERTIFICATE Certificate1; SELECT CONVERT(varchar(max), DECRYPTBYKEY(SellerCentral_LoginID)), CONVERT(varchar(max), DECRYPTBYKEY(SellerCentral_LoginPWD)), CONVERT(varchar(max), DECRYPTBYKEY(ADS_RefreshToken)), CONVERT(varchar(max), DECRYPTBYKEY(ADS_ClientID)), CONVERT(varchar(max), DECRYPTBYKEY(ADS_ClientSecret)), CONVERT(varchar(max), DECRYPTBYKEY(ADS_Scope)), CONVERT(varchar(max), DECRYPTBYKEY(WP_Authorization)), CONVERT(varchar(max), DECRYPTBYKEY(MWS_AccessID)), CONVERT(varchar(max), DECRYPTBYKEY(MWS_SecretKey)), CONVERT(varchar(max), DECRYPTBYKEY(MWS_MerchantID)), CONVERT(varchar(max), DECRYPTBYKEY(MWS_AuthToken)), CONVERT(varchar(max), DECRYPTBYKEY(Azure_ClientID)), CONVERT(varchar(max), DECRYPTBYKEY(Azure_ClientSecret)), CONVERT(varchar(max), DECRYPTBYKEY(Azure_TenantID)), CONVERT(varchar(max), DECRYPTBYKEY(Azure_DataLakeName)) FROM stage.rpt_ConfigTable WHERE ID = 1; ", con);
                //Opening the Connection
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    SC_LoginID        = reader.GetString(0);
                    SC_LoginPwd       = reader.GetString(1);
                    ADS_RefreshToken  = reader.GetString(2);
                    ADS_ClientID      = reader.GetString(3);
                    ADS_ClientSecret  = reader.GetString(4);
                    ADS_Scope         = reader.GetString(5);
                    WP_Authorization  = reader.GetString(6);
                    MWS_AccessID      = reader.GetString(7);
                    MWS_SecretKey     = reader.GetString(8);
                    MWS_MerchantID    = reader.GetString(9);
                    MWS_AuthToken     = reader.GetString(10);
                    AzureClientId     = reader.GetString(11);
                    AzureClientSecret = reader.GetString(12);
                    AzureTenantId     = reader.GetString(13);
                    AdlsAccountName   = reader.GetString(14);
                }
                //Closing the Connection
                con.Close();
            }

            // Azure Data Lake Initialisation
            SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
            var clientCredential = new ClientCredential(AzureClientId, AzureClientSecret);
            var creds            = ApplicationTokenProvider.LoginSilentAsync(AzureTenantId, clientCredential).Result;

            adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient(creds);
            string Azuresource = "", Azuredestination = "";  // Azure Source and Destination Variable

            // Creating a Folder in the App Path
            var directoryFullPath = AppDomain.CurrentDomain.BaseDirectory + @"DownloadedReports\";    // Creating a Folder in Current Directory if not exists

            Directory.CreateDirectory(directoryFullPath);

            // Web Driver Object
            IWebDriver driver;

            // Setting the needed Chrome Options
            ChromeOptions options = new ChromeOptions();

            options.AddUserProfilePreference("download.default_directory", directoryFullPath); // Setting the default directory for the report to be downloaded
            options.AddUserProfilePreference("intl.accept_languages", "en-us");                // Setting the language as English
            // options.AddArgument("--headless"); // Setting headless browser option

            driver = new ChromeDriver(options);  // Assigning all the above options to Chrome Driver
            Console.WriteLine("Started");

            // Amazon Seller Central Login Page
            driver.Navigate().GoToUrl("https://sellercentral.amazon.com/");
            driver.FindElement(By.ClassName("secondary")).Click();
            driver.FindElement(By.Id("ap_email")).SendKeys(SC_LoginID);
            driver.FindElement(By.Id("ap_password")).SendKeys(SC_LoginPwd);
            driver.FindElement(By.Id("signInSubmit")).Click();

            /*// Generating OTP
             * var otpKeyStr = "WGHSYZEE2RJOO6OFMCBMB6HKNHDZRADH4TK2FDJ77YWQ5YFRWDBQ"; //  2FA secret key.
             * var otpKeyBytes = Base32Encoding.ToBytes(otpKeyStr);
             * var totp = new Totp(otpKeyBytes);
             * var twoFactorCode = totp.ComputeTotp(DateTime.UtcNow); // 2FA code at this time!
             * Console.WriteLine(twoFactorCode);*/

            // OTP
            Console.WriteLine("Please enter the OTP : ");
            var input = Console.ReadLine();

            driver.FindElement(By.Id("auth-mfa-otpcode")).SendKeys(input);
            driver.FindElement(By.Id("auth-mfa-remember-device")).Click();
            driver.FindElement(By.Id("auth-signin-button")).Click();

            // ------------------ REPORT 1 ------------------ // ---- Automating Scraping Method -----
            // Downloading Business Report
            driver.Navigate().GoToUrl("https://sellercentral.amazon.com/gp/site-metrics/report.html#reportID=102%3ADetailSalesTrafficBySKU&runDate=&fromDate=&toDate=");
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1000);
            Thread.Sleep(1000);

            // Downloading Past 3 Days' Reports by looping through dates
            for (int i = -1; i > -4; i--)
            {
                // Looping through Dates and setting the Date Value
                var DateValue = DateTime.Now.AddDays(i).ToString("MM/dd/yyyy").Replace("-", "/");

                // Setting From Date
                IWebElement FromDateBox = driver.FindElement(By.Id("fromDate2"));
                FromDateBox.Clear();
                FromDateBox.SendKeys(DateValue + Keys.Enter);
                // Setting To Date
                IWebElement ToDateBox = driver.FindElement(By.Id("toDate2"));
                ToDateBox.Clear();
                ToDateBox.SendKeys(DateValue + Keys.Enter);

                // Downloading the Report
                Thread.Sleep(1000);
                driver.FindElement(By.Id("export")).Click();
                Thread.Sleep(1000);
                driver.FindElement(By.Id("downloadCSV")).Click();
                Thread.Sleep(1000);

                // Editing the Business Report CSV
                string BusRepfilePath = directoryFullPath + "BusinessReport-" + DateTime.Now.AddDays(-1).ToString("MM/dd/yy") + ".csv";
                Thread.Sleep(1000);

                // Transaction Date
                var Buscol1 = File.ReadLines(BusRepfilePath).Select((line, index) => index == 0 ? line + ", Transaction Date"
                                                                                             : line + "," + DateValue.Replace("/", "-")).ToList();
                File.WriteAllLines(BusRepfilePath, Buscol1);

                // Account
                var Buscol2 = File.ReadLines(BusRepfilePath).Select((line, index) => index == 0 ? line + ",Account"
                                                                                             : line + ",Meal Prep Haven").ToList();
                File.WriteAllLines(BusRepfilePath, Buscol2);

                // Country
                var Buscol3 = File.ReadLines(BusRepfilePath).Select((line, index) => index == 0 ? line + ",Country"
                                                                                             : line + ",US").ToList();
                File.WriteAllLines(BusRepfilePath, Buscol3);

                // Reference URL
                var Buscol4 = File.ReadLines(BusRepfilePath).Select((line, index) => index == 0 ? line + ",Reference"
                                                                                       : line + "," + driver.Url).ToList();
                File.WriteAllLines(BusRepfilePath, Buscol4);

                // Renaming the Report File
                File.Move(BusRepfilePath, directoryFullPath + "BusinessReport" + i + ".csv");
            }

            // Combining all the CSV Files into 1
            string BussourceFolder    = directoryFullPath;
            string BusdestinationFile = directoryFullPath + "BusinessReport-" + DateTime.Now.ToString("dd/MM/yyyy") + ".csv";

            // Matches the CSV files by searching the specified wildcard and combines them to single file
            string[]     filePaths = Directory.GetFiles(BussourceFolder, "BusinessReport-?.csv");
            StreamWriter fileDest  = new StreamWriter(BusdestinationFile, true);

            for (int j = 0; j < filePaths.Length; j++)
            {
                string file = filePaths[j];

                string[] lines = File.ReadAllLines(file);

                if (j > 0)
                {
                    lines = lines.Skip(1).ToArray(); // Skipping Header row for all except first file
                }

                foreach (string line in lines)
                {
                    fileDest.WriteLine(line);
                }
            }

            fileDest.Close();

            // Uploading Business Report to Azure Data Lake
            Azuresource      = directoryFullPath + @"BusinessReport-" + DateTime.Now.ToString("dd/MM/yyyy") + ".csv";
            Azuredestination = "Meal prep haven/CA_AO/Business Reports/" + "BusinessReport-" + DateTime.Now.ToString("dd/MM/yyyy") + ".csv";
            adlsFileSystemClient.FileSystem.UploadFile(AdlsAccountName, Azuresource, Azuredestination, 1, false, true);
            Console.WriteLine("Uploaded Business Report");

            // Deleting the Business Report Files
            Array.ForEach(Directory.GetFiles(directoryFullPath), File.Delete);


            // ------------------ REPORT 2 ------------------ // ---- Automating Scraping Method ----
            // Downloading Reserved Inventory Report
            driver.Navigate().GoToUrl("https://sellercentral.amazon.com/gp/ssof/reports/search.html#orderAscending=&recordType=ReserveBreakdown&noResultType=&merchantSku=&fnSku=&FnSkuXORMSku=&reimbursementId=&orderId=&genericOrderId=&asin=&lpn=&shipmentId=&problemType=ALL_DEFECT_TYPES&hazmatStatus=&inventoryEventTransactionType=&fulfillmentCenterId=&transactionItemId=&inventoryAdjustmentReasonGroup=&eventDateOption=1&fromDate=mm%2Fdd%2Fyyyy&toDate=mm%2Fdd%2Fyyyy&startDate=&endDate=&fromMonth=1&fromYear=2019&toMonth=1&toYear=2019&startMonth=&startYear=&endMonth=&endYear=&specificMonth=1&specificYear=2019");
            Thread.Sleep(1000);
            driver.FindElement(By.XPath("//*[@id=\"requestCsvTsvDownload\"]/tr[1]/td[2]/button")).Click();
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1000);
            Thread.Sleep(10000);
            driver.FindElement(By.XPath("//*[@id=\"downloadArchive\"]/table/tbody/tr[1]/td[5]/a")).Click();

            // Editing the Reserved Inventory CSV
            // Appending Columns and Values in Existing CSV File
            string ResRepfilePath = "";

            foreach (string filename in Directory.GetFiles(directoryFullPath))
            {
                ResRepfilePath = directoryFullPath + Path.GetFileName(filename);  // Getting the File Name
            }

            // Account
            var Rescol1 = File.ReadLines(ResRepfilePath).Select((line, index) => index == 0 ? line + ",Account"
                                                                                         : line + ",Meal Prep Haven").ToList();

            File.WriteAllLines(ResRepfilePath, Rescol1);

            // Country
            var Rescol2 = File.ReadLines(ResRepfilePath).Select((line, index) => index == 0 ? line + ",Country"
                                                                                         : line + ",US").ToList();

            File.WriteAllLines(ResRepfilePath, Rescol2);

            // Reference URL
            var Rescol3 = File.ReadLines(ResRepfilePath).Select((line, index) => index == 0 ? line + ",Reference"
                                                                                         : line + "," + driver.Url).ToList();

            File.WriteAllLines(ResRepfilePath, Rescol3);

            // Transaction Date
            var Rescol4 = File.ReadLines(ResRepfilePath).Select((line, index) => index == 0 ? line + ", Transaction Date"
                                                                                         : line + "," + DateTime.Now.ToString("MM/dd/yyyy")).ToList();

            File.WriteAllLines(ResRepfilePath, Rescol4);

            // Renaming the Report File
            File.Move(ResRepfilePath, directoryFullPath + "ReservedInventoryReport.csv");

            // Uploading Reserved Inventory Report to Azure Data Lake
            Azuresource      = directoryFullPath + "ReservedInventoryReport.csv";
            Azuredestination = "Meal prep haven/CA_AO/Reserved Inventory Reports/" + "ReservedInventoryReport-" + DateTime.Now.ToString("dd/MM/yyyy") + ".csv";
            adlsFileSystemClient.FileSystem.UploadFile(AdlsAccountName, Azuresource, Azuredestination, 1, false, true);
            Console.WriteLine("Uploaded Reserved Inventory Report");

            // Deleting the Reserved Inventory Report File
            Array.ForEach(Directory.GetFiles(directoryFullPath), File.Delete);


            // ------------------ REPORT 3 ------------------ // ---- Automating Scraping Method ----
            // Downloading Managed Inventory Report
            driver.Navigate().GoToUrl("https://sellercentral.amazon.com/gp/ssof/reports/search.html?#orderAscending=&recordType=FBA_MYI_UNSUPPRESSED_INVENTORY&noResultType=&merchantSku=&fnSku=&FnSkuXORMSku=&reimbursementId=&orderId=&genericOrderId=&asin=&lpn=&shipmentId=&problemType=ALL_DEFECT_TYPES&hazmatStatus=&inventoryEventTransactionType=&fulfillmentCenterId=&transactionItemId=&inventoryAdjustmentReasonGroup=&eventDateOption=1&fromDate=mm%2Fdd%2Fyyyy&toDate=mm%2Fdd%2Fyyyy&startDate=&endDate=&fromMonth=1&fromYear=2019&toMonth=1&toYear=2019&startMonth=&startYear=&endMonth=&endYear=&specificMonth=1&specificYear=2019");
            Thread.Sleep(1000);
            driver.FindElement(By.XPath("//*[@id=\"requestCsvTsvDownload\"]/tr[1]/td[2]/button")).Click();
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1000);
            Thread.Sleep(10000);
            driver.FindElement(By.XPath("//*[@id=\"downloadArchive\"]/table/tbody/tr[1]/td[5]/a")).Click();

            // Editing the Managed Inventory CSV
            // Appending Columns and Values in Existing CSV File
            string ManRepfilePath = "";

            foreach (string filename in Directory.GetFiles(directoryFullPath))
            {
                ManRepfilePath = directoryFullPath + Path.GetFileName(filename);  // Getting the File Name
            }

            // Account
            var Mancol1 = File.ReadLines(ManRepfilePath).Select((line, index) => index == 0 ? line + ",Account"
                                                                                            : line + ",Meal Prep Haven").ToList();

            File.WriteAllLines(ManRepfilePath, Mancol1);

            // Country
            var Mancol2 = File.ReadLines(ManRepfilePath).Select((line, index) => index == 0 ? line + ",Country"
                                                                                            : line + ",US").ToList();

            File.WriteAllLines(ManRepfilePath, Mancol2);

            // Reference URL
            var Mancol3 = File.ReadLines(ManRepfilePath).Select((line, index) => index == 0 ? line + ",Reference"
                                                                                            : line + "," + driver.Url).ToList();

            File.WriteAllLines(ManRepfilePath, Mancol3);

            // Transaction Date
            var Mancol4 = File.ReadLines(ManRepfilePath).Select((line, index) => index == 0 ? line + ", Transaction Date"
                                                                                         : line + "," + DateTime.Now.ToString("MM/dd/yyyy")).ToList();

            File.WriteAllLines(ManRepfilePath, Mancol4);

            // Renaming the Report File
            File.Move(ManRepfilePath, directoryFullPath + "ManagedInventoryReport.csv");

            // Uploading Reserved Inventory Report to Azure Data Lake
            Azuresource      = directoryFullPath + "ManagedInventoryReport.csv";
            Azuredestination = "Meal prep haven/CA_AO/Managed Inventory Reports/" + "ManagedInventoryReport-" + DateTime.Now.ToString("dd/MM/yyyy") + ".csv";
            adlsFileSystemClient.FileSystem.UploadFile(AdlsAccountName, Azuresource, Azuredestination, 1, false, true);
            Console.WriteLine("Uploaded Managed Inventory Report");

            // Deleting the Managed Inventory Report File
            Array.ForEach(Directory.GetFiles(directoryFullPath), File.Delete);


            // ------------------ REPORT 4 ------------------ // ---- Automating Scraping Method ----
            // Downloading Payment Report
            driver.Navigate().GoToUrl("https://sellercentral.amazon.com/payments/reports/custom/request?tbla_daterangereportstable=sort:%7B%22sortOrder%22%3A%22DESCENDING%22%7D;search:undefined;pagination:1;");
            Thread.Sleep(1000);
            driver.FindElement(By.XPath("//*[@id=\"drrGenerateReportButton\"]/span/input")).Click();
            driver.FindElement(By.XPath("//*[@id=\"drrReportTypeRadioTransaction\"]")).Click();
            driver.FindElement(By.XPath("//*[@id=\"drrReportRangeTypeRadioCustom\"]")).Click();
            driver.FindElement(By.XPath("//*[@id=\"drrFromDate\"]")).SendKeys(DateTime.Now.AddDays(-2).ToString("MM/dd/yyyy").Replace("-", "/") + Keys.Enter);
            driver.FindElement(By.XPath("//*[@id=\"drrToDate\"]")).SendKeys(DateTime.Now.AddDays(-2).ToString("MM/dd/yyyy").Replace("-", "/") + Keys.Enter);
            driver.FindElement(By.XPath("//*[@id=\"drrGenerateReportsGenerateButton\"]/span/input")).Click();
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1000);
            driver.FindElement(By.ClassName("drrRefreshTable")).Click();
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1000);
            Thread.Sleep(10000);
            driver.FindElement(By.XPath("//*[@id=\"downloadButton\"]")).Click();

            // Editing the Payment CSV
            // Appending Columns and Values in Existing CSV File
            string PayRepfilePath = "";

            foreach (string filename in Directory.GetFiles(directoryFullPath))
            {
                PayRepfilePath = directoryFullPath + Path.GetFileName(filename);  // Getting the File Name
            }

            // Account
            var Paycol1 = File.ReadLines(PayRepfilePath).Select((line, index) => index == 0 ? line + ",Account"
                                                                                            : line + ",Meal Prep Haven").ToList();

            File.WriteAllLines(PayRepfilePath, Paycol1);

            // Country
            var Paycol2 = File.ReadLines(PayRepfilePath).Select((line, index) => index == 0 ? line + ",Country"
                                                                                            : line + ",US").ToList();

            File.WriteAllLines(PayRepfilePath, Paycol2);

            // Reference URL
            var Paycol3 = File.ReadLines(PayRepfilePath).Select((line, index) => index == 0 ? line + ",Reference"
                                                                                            : line + ",https://sellercentral.amazon.com/payments/reports/custom/request?tbla_daterangereportstable=sort:%7B%22sortOrder%22%3A%22DESCENDING%22%7D;search:undefined;pagination:1;").ToList(); //+ driver.Url).ToList();

            File.WriteAllLines(PayRepfilePath, Paycol3);

            // Renaming the Report File
            File.Move(PayRepfilePath, directoryFullPath + "PaymentReport.csv");

            // Uploading Payment Report to Azure Data Lake
            Azuresource      = directoryFullPath + "PaymentReport.csv";
            Azuredestination = "Meal prep haven/CA_AO/Payment Reports/" + "PaymentReport-17-10-2019.csv"; //+ DateTime.Now.ToString("dd/MM/yyyy") + ".csv";
            adlsFileSystemClient.FileSystem.UploadFile(AdlsAccountName, Azuresource, Azuredestination, 1, false, true);
            Console.WriteLine("Uploaded Payment Report");

            // Deleting the Payment Report File
            Array.ForEach(Directory.GetFiles(directoryFullPath), File.Delete);


            // ------------------ REPORT 5 ------------------ // ---- Automating Scraping Method ----
            // Downloading Storage Fees Report
            driver.Navigate().GoToUrl("https://sellercentral.amazon.com/gp/ssof/reports/search.html#orderAscending=&recordType=STORAGE_FEE_CHARGES&noResultType=&merchantSku=&fnSku=&FnSkuXORMSku=&reimbursementId=&orderId=&genericOrderId=&asin=&lpn=&shipmentId=&problemType=ALL_DEFECT_TYPES&hazmatStatus=&inventoryEventTransactionType=&fulfillmentCenterId=&transactionItemId=&inventoryAdjustmentReasonGroup=&eventDateOption=1&fromDate=mm%2Fdd%2Fyyyy&toDate=mm%2Fdd%2Fyyyy&startDate=&endDate=&fromMonth=1&fromYear=2019&toMonth=1&toYear=2019&startMonth=&startYear=&endMonth=&endYear=&specificMonth=1&specificYear=2019");
            Thread.Sleep(1000);
            driver.FindElement(By.XPath("//*[@id=\"specificMonthDownload\"]/option[9]")).Click();
            driver.FindElement(By.XPath("//*[@id=\"specificYearDownload\"]/option[1]")).Click();
            driver.FindElement(By.XPath("//*[@id=\"requestCsvTsvDownload\"]/tr[1]/td[2]/button")).Click();
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(4000);
            Thread.Sleep(10000);
            driver.FindElement(By.XPath("//*[@id=\"downloadArchive\"]/table/tbody/tr[1]/td[5]/a")).Click();

            // Editing the Storage Fees CSV
            // Appending Columns and Values in Existing CSV File
            string StoRepfilePath = "";

            foreach (string filename in Directory.GetFiles(directoryFullPath))
            {
                StoRepfilePath = directoryFullPath + Path.GetFileName(filename);  // Getting the File Name
            }

            // Account
            var Stocol1 = File.ReadLines(StoRepfilePath).Select((line, index) => index == 0 ? line + ",Account"
                                                                                            : line + ",Meal Prep Haven").ToList();

            File.WriteAllLines(StoRepfilePath, Stocol1);

            // Country
            var Stocol2 = File.ReadLines(StoRepfilePath).Select((line, index) => index == 0 ? line + ",Country"
                                                                                            : line + ",US").ToList();

            File.WriteAllLines(StoRepfilePath, Stocol2);

            // Reference URL
            var Stocol3 = File.ReadLines(StoRepfilePath).Select((line, index) => index == 0 ? line + ",Reference"
                                                                                            : line + "," + driver.Url).ToList();

            File.WriteAllLines(StoRepfilePath, Stocol3);

            // Transaction Date
            var Stocol4 = File.ReadLines(StoRepfilePath).Select((line, index) => index == 0 ? line + ", Transaction Date"
                                                                                         : line + "," + DateTime.Now.ToString("MM/dd/yyyy")).ToList();

            File.WriteAllLines(StoRepfilePath, Stocol4);

            // Renaming the Report File
            File.Move(StoRepfilePath, directoryFullPath + "StorageFeesReport.csv");

            // Uploading Storage Fees Report to Azure Data Lake
            Azuresource      = directoryFullPath + "StorageFeesReport.csv";
            Azuredestination = "Meal prep haven/CA_AO/Storage Fees Reports/" + "StorageFeesReport-" + DateTime.Now.ToString("dd/MM/yyyy") + ".csv";
            adlsFileSystemClient.FileSystem.UploadFile(AdlsAccountName, Azuresource, Azuredestination, 1, false, true);
            Console.WriteLine("Uploaded Storage Fees Report");

            // Deleting the Storage Fees Report File
            Array.ForEach(Directory.GetFiles(directoryFullPath), File.Delete);


            // ------------------ REPORT 6 ------------------ // ---- API Method ----
            // Downloading Amazon ADS Product Report through API
            // Refreshing Access Token
            var client1  = new RestClient("https://api.amazon.com/auth/o2/token");
            var request1 = new RestRequest(Method.POST);

            request1.AddHeader("Content-Type", "application/x-www-form-urlencoded");
            request1.AddParameter("grant_type", "refresh_token");
            request1.AddParameter("refresh_token", ADS_RefreshToken);
            request1.AddParameter("client_id", ADS_ClientID);
            request1.AddParameter("client_secret", ADS_ClientSecret);
            IRestResponse response1       = client1.Execute(request1);
            dynamic       result1         = JsonConvert.DeserializeObject(response1.Content);
            string        ADS_AccessToken = result1.access_token;

            // Getting the Report ID
            var client2  = new RestClient("https://advertising-api.amazon.com/v2/sp/productAds/report");
            var request2 = new RestRequest(Method.POST);

            request2.AddHeader("Content-Type", "application/json");
            request2.AddHeader("Authorization", "Bearer " + ADS_AccessToken);
            request2.AddHeader("Amazon-Advertising-API-ClientId", ADS_ClientID);
            request2.AddHeader("Amazon-Advertising-API-Scope", ADS_Scope);
            request2.AddParameter("undefined", "{\"reportDate\":\"20190930\", \"metrics\":\"campaignName,campaignId,adGroupName,adGroupId,currency,asin,sku,impressions,clicks,cost,attributedConversions1d,attributedConversions7d,attributedConversions14d,attributedConversions30d,attributedConversions1dSameSKU,attributedConversions7dSameSKU,attributedConversions14dSameSKU,attributedConversions30dSameSKU,attributedUnitsOrdered1d,attributedUnitsOrdered7d,attributedUnitsOrdered14d,attributedUnitsOrdered30d,attributedSales1d,attributedSales7d,attributedSales14d,attributedSales30d,attributedSales1dSameSKU,attributedSales7dSameSKU,attributedSales14dSameSKU,attributedSales30dSameSKU\"}", ParameterType.RequestBody);
            IRestResponse response2 = client2.Execute(request2);
            dynamic       result2   = JsonConvert.DeserializeObject(response2.Content);
            string        ReportID  = result2.reportId;

            Thread.Sleep(3000);

            // Retrieving the Report Status
            var client3  = new RestClient("https://advertising-api.amazon.com/v2/reports/" + ReportID);
            var request3 = new RestRequest(Method.GET);

            request3.AddHeader("Content-Type", "application/json");
            request3.AddHeader("Authorization", "Bearer " + ADS_AccessToken);
            request3.AddHeader("Amazon-Advertising-API-ClientId", ADS_ClientID);
            request3.AddHeader("Amazon-Advertising-API-Scope", ADS_Scope);
            IRestResponse response3        = client3.Execute(request3);
            dynamic       result3          = JsonConvert.DeserializeObject(response3.Content);
            string        DownloadLocation = result3.location;

            if (result3.status == "SUCCESS")
            {
                // Retrieving Report Download URL
                var client4  = new RestClient(DownloadLocation);
                var request4 = new RestRequest(Method.GET);
                request4.AddHeader("Authorization", "Bearer " + ADS_AccessToken);
                request4.AddHeader("Amazon-Advertising-API-Scope", ADS_Scope);
                IRestResponse response4   = client4.Execute(request4);
                string        DownloadURL = response4.ResponseUri.ToString();

                // Downloading the Report
                driver.Navigate().GoToUrl(DownloadURL);
            }

            // Extracting .gz Zip file
            DirectoryInfo directorySelected = new DirectoryInfo(directoryFullPath);

            foreach (FileInfo fileToDecompress in directorySelected.GetFiles("*.gz"))
            {
                Decompress(fileToDecompress);
            }

            // Uploading Amazon ADS Product Report to Azure Data Lake
            Azuresource      = directoryFullPath + "ADSProductReport.json";
            Azuredestination = "Meal prep haven/CA_AO/Advertised Product Reports/" + "AmazonADSProductReport-" + DateTime.Now.ToString("dd/MM/yyyy") + ".json";
            adlsFileSystemClient.FileSystem.UploadFile(AdlsAccountName, Azuresource, Azuredestination, 1, false, true);
            Console.WriteLine("Uploaded Amazon ADS Product Report");

            // Deleting the Amazon ADS Product Report File
            Array.ForEach(Directory.GetFiles(directoryFullPath), File.Delete);


            // ------------------ REPORT 7 ------------------ // ---- API Method ----
            // Downloading WorldPack Report through API
            // Getting the Access Token
            var clientw1  = new RestClient("http://secure-wms.com/AuthServer/api/Token");
            var requestw1 = new RestRequest(Method.POST);

            requestw1.AddHeader("Content-Type", "application/json; charset=utf-8");
            requestw1.AddHeader("Accept", "application/json");
            requestw1.AddHeader("Authorization", "Basic " + WP_Authorization);
            requestw1.AddParameter("undefined", "{\"grant_type\": \"client_credentials\",\"tpl\": \"{1ddbea91-a4ff-4b42-a25d-81a25b8cb727}\",\"user_login_id\": \"759\"}", ParameterType.RequestBody);
            IRestResponse responsew1     = clientw1.Execute(requestw1);
            dynamic       resultw1       = JsonConvert.DeserializeObject(responsew1.Content);
            string        WP_AccessToken = resultw1.access_token;

            // Getting the Inventory Details
            var clientw2  = new RestClient("https://secure-wms.com/inventory/stockdetails?customerid=194&facilityid=4");
            var requestw2 = new RestRequest(Method.GET);

            requestw2.AddHeader("Content-Type", "application/hal+json; charset=utf-8");
            requestw2.AddHeader("Accept", "application/hal+json");
            requestw2.AddHeader("Authorization", "Bearer " + WP_AccessToken);
            IRestResponse responsew2 = clientw2.Execute(requestw2);
            dynamic       resultw2   = JsonConvert.DeserializeObject(responsew2.Content);
            string        jsonstr    = resultw2._embedded.ToString();

            // Uploading WorldPack Report to Azure Data Lake
            Azuresource      = directoryFullPath + "WorldPackReport.json";
            Azuredestination = "Third Party Reports/WorldPack Reports/" + "WorldPackReport-" + DateTime.Now.ToString("dd/MM/yyyy") + ".json";
            adlsFileSystemClient.FileSystem.UploadFile(AdlsAccountName, Azuresource, Azuredestination, 1, false, true);
            Console.WriteLine("Uploaded World Pack Report");

            // Deleting the Amazon ADS Product Report File
            Array.ForEach(Directory.GetFiles(directoryFullPath), File.Delete);


            // ------------------ REPORT 8 ------------------ // ---- API Method ----
            // Downloading Amazon MWS Reports - FBA_StorageFees Report through API
            string accessKeyId                 = MWS_AccessID;
            string secretAccessKey             = MWS_SecretKey;
            MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();

            config.ServiceURL = "https://mws.amazonservices.com";
            const string applicationName    = "ApplicationName";
            const string applicationVersion = "0.1a";

            MarketplaceWebServiceClient service =
                new MarketplaceWebServiceClient(
                    accessKeyId,
                    secretAccessKey,
                    applicationName,
                    applicationVersion,
                    config);

            string merchantID   = MWS_MerchantID;
            string mwsauthtoken = MWS_AuthToken;

            // Requesting the Report
            RequestReportRequest reportRequest = new RequestReportRequest();

            reportRequest.Merchant      = merchantID;
            reportRequest.MWSAuthToken  = mwsauthtoken;
            reportRequest.ReportType    = "_GET_FBA_STORAGE_FEE_CHARGES_DATA_";
            reportRequest.StartDate     = DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("dd/MM/yyyy"));
            reportRequest.EndDate       = DateTime.Now;
            reportRequest.ReportOptions = "true"; //shows sales channel to certain reports

            // Handling the Response of RequestReport
            RequestReportResponse reportResponse = service.RequestReport(reportRequest);

            Thread.Sleep(30000); //sleep for 30 seconds to allow report request to generate prior to requesting the reportRequestID

            string requestID    = reportResponse.RequestReportResult.ReportRequestInfo.ReportRequestId;
            string reportStatus = ""; // holds the status of the report

            // Getting the Report Request List
            GetReportRequestListRequest reportRequestList = new GetReportRequestListRequest();

            reportRequestList.Merchant     = merchantID;
            reportRequestList.MWSAuthToken = mwsauthtoken;

            // Handling the Response of Report Request List
            GetReportRequestListResponse reportRequestListReponse = service.GetReportRequestList(reportRequestList);

            foreach (ReportRequestInfo info in reportRequestListReponse.GetReportRequestListResult.ReportRequestInfo)
            {
                if (info.ReportRequestId.Equals(requestID))
                {
                    reportStatus = info.ReportProcessingStatus;

                    if (reportStatus == "_DONE_")
                    {
                        // Getting the Report using Report ID
                        GetReportRequest getReport = new GetReportRequest();
                        getReport.ReportId     = info.GeneratedReportId;
                        getReport.Merchant     = merchantID;
                        getReport.MWSAuthToken = mwsauthtoken;

                        // Writting the Report as a File
                        string filename = Path.Combine(directoryFullPath, "FBA_StorageFeesReport-" + DateTime.Now.ToString("dd/MM/yyyy") + ".csv");
                        getReport.Report = File.Open(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                        GetReportResponse report_response = service.GetReport(getReport);
                        Console.WriteLine("Sleeping for 1 minute to allow processes to settle. ");
                        Thread.Sleep(60000);
                        getReport.Report.Close();

                        // Uploading FBA Storage Fees to Azure Data Lake
                        Azuresource      = filename;
                        Azuredestination = "Amazon MWS Reports/" + "FBA_StorageFeesReport-" + System.DateTime.Now.ToString("dd/MM/yyyy") + ".csv";
                        adlsFileSystemClient.FileSystem.UploadFile(AdlsAccountName, Azuresource, Azuredestination, 1, false, true);
                        Console.WriteLine("Uploaded Amazon MWS FBA_StorageFees Report");

                        break;
                    }
                }
                else
                {
                    continue; // Only concerning about the requested report, not all the reports being generated
                }
            }

            // Closing the Browser
            driver.Quit();
        }
        public static string SubmitAmazonTrackingFeed(string filepath, string merchantId, string marketplaceId, string accessKeyId, string secretAccessKey)
        {
            string            feedSubmissionId = "";
            SubmitFeedRequest request          = new SubmitFeedRequest();

            request.Merchant             = merchantId;
            request.MarketplaceIdList    = new IdList();
            request.MarketplaceIdList.Id = new List <string>(new string[] { marketplaceId });
            request.FeedContent          = File.Open(filepath, FileMode.Open, FileAccess.Read);
            request.ContentMD5           = MarketplaceWebServiceClient.CalculateContentMD5(request.FeedContent);
            request.FeedContent.Position = 0;
            request.FeedType             = "_POST_ORDER_FULFILLMENT_DATA_";

            const string applicationName       = "<Your Application Name>";
            const string applicationVersion    = "<Your Application Version>";
            MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();

            config.ServiceURL = "https://mws.amazonservices.com";
            config.SetUserAgentHeader(
                applicationName,
                applicationVersion,
                "C#",
                "<Parameter 1>", "<Parameter 2>");
            MarketplaceWebService.MarketplaceWebService service = new MarketplaceWebServiceClient(accessKeyId, secretAccessKey, config);

            try
            {
                SubmitFeedResponse response = service.SubmitFeed(request);


                Console.WriteLine("Service Response");
                Console.WriteLine("=============================================================================");
                Console.WriteLine();

                Console.WriteLine("        SubmitFeedResponse");
                if (response.IsSetSubmitFeedResult())
                {
                    Console.WriteLine("            SubmitFeedResult");
                    SubmitFeedResult submitFeedResult = response.SubmitFeedResult;
                    if (submitFeedResult.IsSetFeedSubmissionInfo())
                    {
                        Console.WriteLine("                FeedSubmissionInfo");
                        FeedSubmissionInfo feedSubmissionInfo = submitFeedResult.FeedSubmissionInfo;
                        if (feedSubmissionInfo.IsSetFeedSubmissionId())
                        {
                            Console.WriteLine("                    FeedSubmissionId");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.FeedSubmissionId);
                            feedSubmissionId = feedSubmissionInfo.FeedSubmissionId;
                        }
                        if (feedSubmissionInfo.IsSetFeedType())
                        {
                            Console.WriteLine("                    FeedType");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.FeedType);
                        }
                        if (feedSubmissionInfo.IsSetSubmittedDate())
                        {
                            Console.WriteLine("                    SubmittedDate");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.SubmittedDate);
                        }
                        if (feedSubmissionInfo.IsSetFeedProcessingStatus())
                        {
                            Console.WriteLine("                    FeedProcessingStatus");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.FeedProcessingStatus);
                        }
                        if (feedSubmissionInfo.IsSetStartedProcessingDate())
                        {
                            Console.WriteLine("                    StartedProcessingDate");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.StartedProcessingDate);
                        }
                        if (feedSubmissionInfo.IsSetCompletedProcessingDate())
                        {
                            Console.WriteLine("                    CompletedProcessingDate");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.CompletedProcessingDate);
                        }
                    }
                }
                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);
            }
            catch (MarketplaceWebServiceException ex)
            {
                ExceptionUtility exceptionUtility = new ExceptionUtility();
                exceptionUtility.CatchMethod(ex, "SubmitAmazonTrackingFeed Error:", ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);

                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);
            }

            return(feedSubmissionId);
        }