public static void Run()
        {
            try
            {
                // File will be created with the Data received in the Response Body

                // Provide the File Name
                const string fileName = "DownloadFileWithFileIdentifier.csv";

                // Provide the path where the file needs to be downloaded
                // This can be either a relative path or an absolute path
                const string downloadFilePath = @".\Resource\" + fileName;

                var fileId         = "VFJSUmVwb3J0LTc4NTVkMTNmLTkzOTgtNTExMy1lMDUzLWEyNTg4ZTBhNzE5Mi5jc3YtMjAxOC0xMC0yMA==";
                var organizationId = "testrest";

                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
                var apiInstance      = new SecureFileShareApi(clientConfig);

                apiInstance.GetFile(fileId, organizationId);
                Console.WriteLine("\nFile downloaded at the below location:");
                Console.WriteLine($"{Path.GetFullPath(downloadFilePath)}\n");
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("File Not Found: Kindly verify the path");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Esempio n. 2
0
        public static void Run()
        {
            var          fileId           = "QmF0Y2hGaWxlc0RldGFpbFJlcG9ydC5jc3YtMjAyMC0wMS0zMA==";
            const string fileName         = "DownloadedFileWithFileID.csv";
            const string downloadFilePath = @".\Resource\" + fileName;
            string       organizationId   = "testrest";

            try
            {
                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);

                var apiInstance = new SecureFileShareApi(clientConfig);
                var content     = apiInstance.GetFileWithHttpInfo(fileId, organizationId);

                // START : FILE DOWNLOAD FUNCTIONALITY
                File.WriteAllText(downloadFilePath, CreateXml(content.Data));

                Console.WriteLine("\nFile Downloaded at the following location : ");
                Console.WriteLine($"{Path.GetFullPath(downloadFilePath)}\n");
                // END : FILE DOWNLOAD FUNCTIONALITY
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("File Not Found : Kindly verify the path.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
            }
        }
Esempio n. 3
0
        public static void Run()
        {
            try
            {
                var startDate      = "2018-10-20";
                var endDate        = "2018-10-30";
                var organizationId = "testrest";

                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
                var apiInstance      = new SecureFileShareApi(clientConfig);
                var result           = apiInstance.GetFileDetails(startDate, endDate, organizationId);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Esempio n. 4
0
        public static void Run()
        {
            try
            {
                var startDate      = DateTime.ParseExact("2020-04-20", "yyyy-MM-dd", CultureInfo.InvariantCulture);
                var endDate        = DateTime.ParseExact("2020-04-30", "yyyy-MM-dd", CultureInfo.InvariantCulture);
                var organizationId = "testrest";

                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
                var apiInstance      = new SecureFileShareApi(clientConfig);
                var result           = apiInstance.GetFileDetail(startDate, endDate, organizationId);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        public static void Run()
        {
            try
            {
                // File will be created with the Data received in the Response Body

                // Provide the File Name
                const string fileName = "DownloadFileWithFileIdentifier.csv";

                // Provide the path where the file needs to be downloaded
                // This can be either a relative path or an absolute path
                const string downloadFilePath = @".\Resource\" + fileName;

                var fileId         = "dGVzdHJlc3Rfc3ViY3JpcHRpb25fdjI5ODktYTM3ZmI2ZjUtM2QzYi0wOGVhLWUwNTMtYTI1ODhlMGFkOTJjLnhtbC0yMDIwLTA0LTMw";
                var organizationId = "testrest";

                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
                var apiInstance      = new SecureFileShareApi(clientConfig);

                var content = apiInstance.GetFileWithHttpInfo(fileId, organizationId);

                File.WriteAllText(downloadFilePath, CreateXml(content.Data));

                Console.WriteLine("\nFile downloaded at the below location:");
                Console.WriteLine($"{Path.GetFullPath(downloadFilePath)}\n");
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("File Not Found: Kindly verify the path");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
 public void Init()
 {
     instance = new SecureFileShareApi();
 }