Example #1
0
        /// <summary>
        /// Uploads the RN transaction report to RN ftp
        /// </summary>
        /// <param name="reportTuple">Tuple of transaction file name and transaction data</param>
        private void UploadReport(Tuple <string, string> reportTuple)
        {
            MemoryStream memoryStream = new MemoryStream(Encoding.ASCII.GetBytes(reportTuple.Item2));

            DefaultSftpClient defaultSftpClient = new DefaultSftpClient(FtpUserName, FtpPassword, FtpUri);

            defaultSftpClient.UploadFileAsync(reportTuple.Item1, memoryStream, FtpFolder).Wait();
        }
Example #2
0
        public async Task <MemoryStream> DownloadFeedFileAsync(RewardNetworkFeedInformation rnFeedInformation)
        {
            feedFile = string.Format(rnFeedInformation.FeedFileName, DateTime.UtcNow.AddDays(-1).ToString("yyyyMMdd"));
            Log.Info($"Downloading reward network feed file {feedFile} from {rnFeedInformation.Url}");
            MemoryStream      rewardNetworkDataStream = new MemoryStream();
            DefaultSftpClient sftpClient = new DefaultSftpClient(rnFeedInformation.UserName, rnFeedInformation.Password, rnFeedInformation.Url);
            await sftpClient.DownloadFileAsync(feedFile, rewardNetworkDataStream, rnFeedInformation.FeedFolder);

            Log.Info($"Finished downloading reward network feed file {feedFile} from {rnFeedInformation.Url}");

            return(rewardNetworkDataStream);
        }