diff --git a/Source/Samples/Authentication/CallHttpMethods/DeleteMethod.cs b/Source/Samples/Authentication/CallHttpMethods/DeleteMethod.cs index 4fc3bf8..77d5a67 100644 --- a/Source/Samples/Authentication/CallHttpMethods/DeleteMethod.cs +++ b/Source/Samples/Authentication/CallHttpMethods/DeleteMethod.cs @@ -1,59 +1,59 @@ -using System; -using ApiSdk.controller; -using AuthenticationSdk.core; -using AuthenticationSdk.util; +//using System; +//using ApiSdk.controller; +//using AuthenticationSdk.core; +//using AuthenticationSdk.util; -namespace Cybersource_rest_samples_dotnet.Samples.Authentication -{ - public class DeleteMethod - { +//namespace Cybersource_rest_samples_dotnet.Samples.Authentication +//{ +// public class DeleteMethod +// { // DELETE Request to Delete subscription of (Unsubscribe) a report name by organization // Below request unsubscribes 'TRR Report' Subscription for Organization ID: testrest - private const string RequestTarget = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest"; + //private const string RequestTarget = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest"; - public static void WriteLogAudit(int status) - { - var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); - var filename = filePath[filePath.Length - 1]; - Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); - } + //public static void WriteLogAudit(int status) + //{ + // var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); + // var filename = filePath[filePath.Length - 1]; + // Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); + //} - public static void Run() - { - try - { + //public static void Run() + //{ + // try + // { // Setting up Merchant Config - var merchantConfig = new MerchantConfig - { - RequestTarget = RequestTarget, - RequestType = Enumerations.RequestType.DELETE.ToString() - }; + //var merchantConfig = new MerchantConfig + //{ + // RequestTarget = RequestTarget, + // RequestType = Enumerations.RequestType.DELETE.ToString() + //}; // Call to the Controller of API_SDK - var apiController = new APIController(merchantConfig); - var response = apiController.DeletePayment(); + //var apiController = new APIController(merchantConfig); + //var response = apiController.DeletePayment(); // printing the response details - if (response != null) - { - Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); - Console.WriteLine("\n Response Code:{0}", response.StatusCode); - Console.WriteLine("\n Response Message:{0}", response.Data); - if (response.StatusCode == 200 || response.StatusCode == 404) - { - WriteLogAudit(200); - } - else - { - WriteLogAudit(response.StatusCode); - } - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - } - } - } -} +// if (response != null) +// { +// Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); +// Console.WriteLine("\n Response Code:{0}", response.StatusCode); +// Console.WriteLine("\n Response Message:{0}", response.Data); +// if (response.StatusCode == 200 || response.StatusCode == 404) +// { +// WriteLogAudit(200); +// } +// else +// { +// WriteLogAudit(response.StatusCode); +// } +// } +// } +// catch (Exception e) +// { +// Console.WriteLine(e.Message); +// Console.WriteLine(e.StackTrace); +// } +// } +// } +//} diff --git a/Source/Samples/Authentication/CallHttpMethods/GetMethod.cs b/Source/Samples/Authentication/CallHttpMethods/GetMethod.cs index 0443fb6..4570ffd 100644 --- a/Source/Samples/Authentication/CallHttpMethods/GetMethod.cs +++ b/Source/Samples/Authentication/CallHttpMethods/GetMethod.cs @@ -1,52 +1,52 @@ -using System; -using ApiSdk.controller; -using AuthenticationSdk.core; -using AuthenticationSdk.util; +//using System; +//using ApiSdk.controller; +//using AuthenticationSdk.core; +//using AuthenticationSdk.util; -namespace Cybersource_rest_samples_dotnet.Samples.Authentication -{ - public class GetMethod - { +//namespace Cybersource_rest_samples_dotnet.Samples.Authentication +//{ +// public class GetMethod +// { // GET request to retrieve the payment details of the provided Payment ID // Below Request fetches the payment details of payment ID: 5319754772076048103525 - private const string RequestTarget = "/pts/v2/payments/5526383152166546003003"; + // private const string RequestTarget = "/pts/v2/payments/5526383152166546003003"; - public static void WriteLogAudit(int status) - { - var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); - var filename = filePath[filePath.Length - 1]; - Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); - } + //public static void WriteLogAudit(int status) + //{ + // var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); + // var filename = filePath[filePath.Length - 1]; + // Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); + //} - public static void Run() - { - try - { + //public static void Run() + //{ + // try + // { // Setting up Merchant Config - var merchantConfig = new MerchantConfig - { - RequestTarget = RequestTarget, - RequestType = Enumerations.RequestType.GET.ToString() - }; + //var merchantConfig = new MerchantConfig + //{ + // RequestTarget = RequestTarget, + // RequestType = Enumerations.RequestType.GET.ToString() + //}; // Call to the Controller of API_SDK - var apiController = new APIController(merchantConfig); - var response = apiController.GetPayment(); + //var apiController = new APIController(merchantConfig); + //var response = apiController.GetPayment(); // printing the response details - if (response != null) - { - Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); - Console.WriteLine("\n Response Code:{0}", response.StatusCode); - Console.WriteLine("\n Response Message:{0}", response.Data); - WriteLogAudit(response.StatusCode); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - } - } - } -} \ No newline at end of file +// if (response != null) +// { +// Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); +// Console.WriteLine("\n Response Code:{0}", response.StatusCode); +// Console.WriteLine("\n Response Message:{0}", response.Data); +// WriteLogAudit(response.StatusCode); +// } +// } +// catch (Exception e) +// { +// Console.WriteLine(e.Message); +// Console.WriteLine(e.StackTrace); +// } +// } +// } +//} \ No newline at end of file diff --git a/Source/Samples/Authentication/CallHttpMethods/GetObjectMethod.cs b/Source/Samples/Authentication/CallHttpMethods/GetObjectMethod.cs index 64b3847..6219f14 100644 --- a/Source/Samples/Authentication/CallHttpMethods/GetObjectMethod.cs +++ b/Source/Samples/Authentication/CallHttpMethods/GetObjectMethod.cs @@ -1,56 +1,56 @@ -using System; -using ApiSdk.controller; -using AuthenticationSdk.core; -using AuthenticationSdk.util; -using SampleCode.data; +//using System; +//using ApiSdk.controller; +//using AuthenticationSdk.core; +//using AuthenticationSdk.util; +//using SampleCode.data; -namespace Cybersource_rest_samples_dotnet.Samples.Authentication -{ - public class GetObjectMethod - { +//namespace Cybersource_rest_samples_dotnet.Samples.Authentication +//{ +// public class GetObjectMethod +// { // GET request to retrieve the payment details of the provided Payment ID // Below Request fetches the payment details of payment ID: 5319754772076048103525 - private const string RequestTarget = "/pts/v2/payments/5526478103126428303006"; + //private const string RequestTarget = "/pts/v2/payments/5526478103126428303006"; - public static void WriteLogAudit(int status) - { - var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); - var filename = filePath[filePath.Length - 1]; - Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); - } + //public static void WriteLogAudit(int status) + //{ + // var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); + // var filename = filePath[filePath.Length - 1]; + // Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); + //} - public static void Run() - { - try - { + //public static void Run() + //{ + // try + // { // Creating a dictionary object which contains the merchant configuration - var config = new Configuration(); + // var config = new Configuration(); // Passing the dictionary object to the Merchant Config Constructor to bypass the config set up via App.Config File - var merchantConfig = new MerchantConfig(config.GetConfiguration()) - { - RequestTarget = RequestTarget, - RequestType = Enumerations.RequestType.GET.ToString() - }; + //var merchantConfig = new MerchantConfig(config.GetConfiguration()) + //{ + // RequestTarget = RequestTarget, + // RequestType = Enumerations.RequestType.GET.ToString() + //}; // Call to the Controller of API_SDK - var apiController = new APIController(merchantConfig); - var response = apiController.GetPayment(); + //var apiController = new APIController(merchantConfig); + //var response = apiController.GetPayment(); // printing the response details - if (response != null) - { - Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); - Console.WriteLine("\n Response Code:{0}", response.StatusCode); - Console.WriteLine("\n Response Message:{0}", response.Data); - WriteLogAudit(response.StatusCode); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - } - } - } -} +// if (response != null) +// { +// Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); +// Console.WriteLine("\n Response Code:{0}", response.StatusCode); +// Console.WriteLine("\n Response Message:{0}", response.Data); +// WriteLogAudit(response.StatusCode); +// } +// } +// catch (Exception e) +// { +// Console.WriteLine(e.Message); +// Console.WriteLine(e.StackTrace); +// } +// } +// } +//} diff --git a/Source/Samples/Authentication/CallHttpMethods/PostMethod.cs b/Source/Samples/Authentication/CallHttpMethods/PostMethod.cs index 70e2b68..660e459 100644 --- a/Source/Samples/Authentication/CallHttpMethods/PostMethod.cs +++ b/Source/Samples/Authentication/CallHttpMethods/PostMethod.cs @@ -1,58 +1,58 @@ -using System; -using System.IO; -using ApiSdk.controller; -using AuthenticationSdk.core; -using AuthenticationSdk.util; -using SampleCode.data; +//using System; +//using System.IO; +//using ApiSdk.controller; +//using AuthenticationSdk.core; +//using AuthenticationSdk.util; +//using SampleCode.data; -namespace Cybersource_rest_samples_dotnet.Samples.Authentication -{ - public class PostMethod - { +//namespace Cybersource_rest_samples_dotnet.Samples.Authentication +//{ +// public class PostMethod +// { // POST Request to Authorize the payment for a transaction. // Transaction details provided in the JSON File are sent along with the Request as Request Body - private const string RequestTarget = "/pts/v2/payments/"; - private static string RequestJsonFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Source/Resource/request_payments.json").ToString(); + // private const string RequestTarget = "/pts/v2/payments/"; + //private static string RequestJsonFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Source/Resource/request_payments.json").ToString(); - public static void WriteLogAudit(int status) - { - var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); - var filename = filePath[filePath.Length - 1]; - Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); - } + //public static void WriteLogAudit(int status) + //{ + // var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); + // var filename = filePath[filePath.Length - 1]; + // Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); + //} - public static void Run() - { - try - { - var requestData = new RequestData(); + //public static void Run() + //{ + // try + // { + // var requestData = new RequestData(); // Setting up Merchant Config - var merchantConfig = new MerchantConfig - { - RequestTarget = RequestTarget, - RequestType = Enumerations.RequestType.POST.ToString(), - RequestJsonData = requestData.JsonFileData(RequestJsonFilePath) - }; + //var merchantConfig = new MerchantConfig + //{ + // RequestTarget = RequestTarget, + // RequestType = Enumerations.RequestType.POST.ToString(), + // RequestJsonData = requestData.JsonFileData(RequestJsonFilePath) + //}; // Call to the Controller of API_SDK - var apiController = new APIController(merchantConfig); - var response = apiController.PostPayment(); + //var apiController = new APIController(merchantConfig); + //var response = apiController.PostPayment(); // printing the response details - if (response != null) - { - Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); - Console.WriteLine("\n Response Code:{0}", response.StatusCode); - Console.WriteLine("\n Response Message:{0}", response.Data); - WriteLogAudit(response.StatusCode); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - } - } - } -} \ No newline at end of file +// if (response != null) +// { +// Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); +// Console.WriteLine("\n Response Code:{0}", response.StatusCode); +// Console.WriteLine("\n Response Message:{0}", response.Data); +// WriteLogAudit(response.StatusCode); +// } +// } +// catch (Exception e) +// { +// Console.WriteLine(e.Message); +// Console.WriteLine(e.StackTrace); +// } +// } +// } +//} \ No newline at end of file diff --git a/Source/Samples/Authentication/CallHttpMethods/PostObjectMethod.cs b/Source/Samples/Authentication/CallHttpMethods/PostObjectMethod.cs index d84389a..7a2be91 100644 --- a/Source/Samples/Authentication/CallHttpMethods/PostObjectMethod.cs +++ b/Source/Samples/Authentication/CallHttpMethods/PostObjectMethod.cs @@ -1,59 +1,59 @@ -using System; -using ApiSdk.controller; -using AuthenticationSdk.core; -using AuthenticationSdk.util; -using SampleCode.data; +//using System; +//using ApiSdk.controller; +//using AuthenticationSdk.core; +//using AuthenticationSdk.util; +//using SampleCode.data; -namespace Cybersource_rest_samples_dotnet.Samples.Authentication -{ - public class PostObjectMethod - { +//namespace Cybersource_rest_samples_dotnet.Samples.Authentication +//{ +// public class PostObjectMethod +// { // POST Request to Authorize the payment for a transaction. // Transaction details are sent along with the Request as Request Body - private const string RequestTarget = "/pts/v2/payments/"; + //private const string RequestTarget = "/pts/v2/payments/"; - public static void WriteLogAudit(int status) - { - var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); - var filename = filePath[filePath.Length - 1]; - Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); - } + //public static void WriteLogAudit(int status) + //{ + // var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); + // var filename = filePath[filePath.Length - 1]; + // Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); + //} - public static void Run() - { - try - { + //public static void Run() + //{ + // try + // { // Setting up Merchant Config - var config = new Configuration(); + //var config = new Configuration(); // Setting RequestJson Data using the sample payments data (instead of reading a JSON file) - var requestData = new RequestData(); + //var requestData = new RequestData(); - var merchantConfig = new MerchantConfig(config.GetConfiguration()) - { - RequestTarget = RequestTarget, - RequestType = Enumerations.RequestType.POST.ToString(), - RequestJsonData = requestData.SamplePaymentsData() - }; + //var merchantConfig = new MerchantConfig(config.GetConfiguration()) + //{ + // RequestTarget = RequestTarget, + // RequestType = Enumerations.RequestType.POST.ToString(), + // RequestJsonData = requestData.SamplePaymentsData() + //}; // Call to the Controller of API_SDK - var apiController = new APIController(merchantConfig); - var response = apiController.PostPayment(); + //var apiController = new APIController(merchantConfig); + //var response = apiController.PostPayment(); // printing the response details - if (response != null) - { - Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); - Console.WriteLine("\n Response Code:{0}", response.StatusCode); - Console.WriteLine("\n Response Message:{0}", response.Data); - WriteLogAudit(response.StatusCode); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - } - } - } -} \ No newline at end of file +// if (response != null) +// { +// Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); +// Console.WriteLine("\n Response Code:{0}", response.StatusCode); +// Console.WriteLine("\n Response Message:{0}", response.Data); +// WriteLogAudit(response.StatusCode); +// } +// } +// catch (Exception e) +// { +// Console.WriteLine(e.Message); +// Console.WriteLine(e.StackTrace); +// } +// } +// } +//} \ No newline at end of file diff --git a/Source/Samples/Authentication/CallHttpMethods/PutMethod.cs b/Source/Samples/Authentication/CallHttpMethods/PutMethod.cs index 7d8f64d..433b5e7 100644 --- a/Source/Samples/Authentication/CallHttpMethods/PutMethod.cs +++ b/Source/Samples/Authentication/CallHttpMethods/PutMethod.cs @@ -1,59 +1,59 @@ -using System; -using System.IO; -using ApiSdk.controller; -using AuthenticationSdk.core; -using AuthenticationSdk.util; -using SampleCode.data; +//using System; +//using System.IO; +//using ApiSdk.controller; +//using AuthenticationSdk.core; +//using AuthenticationSdk.util; +//using SampleCode.data; -namespace Cybersource_rest_samples_dotnet.Samples.Authentication -{ - public class PutMethod - { +//namespace Cybersource_rest_samples_dotnet.Samples.Authentication +//{ +// public class PutMethod +// { // PUT Request to Create Report Subscription for a report name by organization // Report Details provided in the JSON File are sent along with the Request as Request Body // Below request subscribes 'TRR Report' for Organization ID: testrest - private const string RequestTarget = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest"; - private static string RequestJsonFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Source/Resource/TRRReport.json"); + //private const string RequestTarget = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest"; + //private static string RequestJsonFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Source/Resource/TRRReport.json"); - public static void WriteLogAudit(int status) - { - var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); - var filename = filePath[filePath.Length - 1]; - Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); - } + //public static void WriteLogAudit(int status) + //{ + // var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); + // var filename = filePath[filePath.Length - 1]; + // Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); + //} - public static void Run() - { - try - { + //public static void Run() + //{ + // try + // { // Setting up Merchant Config - var requestData = new RequestData(); + //var requestData = new RequestData(); - var merchantConfig = new MerchantConfig - { - RequestTarget = RequestTarget, - RequestType = Enumerations.RequestType.PUT.ToString(), - RequestJsonData = requestData.JsonFileData(RequestJsonFilePath) - }; + //var merchantConfig = new MerchantConfig + //{ + // RequestTarget = RequestTarget, + // RequestType = Enumerations.RequestType.PUT.ToString(), + // RequestJsonData = requestData.JsonFileData(RequestJsonFilePath) + //}; // Call to the Controller of API_SDK - var apiController = new APIController(merchantConfig); - var response = apiController.PutPayment(); + //var apiController = new APIController(merchantConfig); + //var response = apiController.PutPayment(); // printing the response details - if (response != null) - { - Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); - Console.WriteLine("\n Response Code:{0}", response.StatusCode); - Console.WriteLine("\n Response Message:{0}", response.Data); - WriteLogAudit(response.StatusCode); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - } - } - } -} \ No newline at end of file +// if (response != null) +// { +// Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id")); +// Console.WriteLine("\n Response Code:{0}", response.StatusCode); +// Console.WriteLine("\n Response Message:{0}", response.Data); +// WriteLogAudit(response.StatusCode); +// } +// } +// catch (Exception e) +// { +// Console.WriteLine(e.Message); +// Console.WriteLine(e.StackTrace); +// } +// } +// } +//} \ No newline at end of file diff --git a/Source/Samples/Authentication/GenerateHttpRequestHeaders/DeleteGenerateHeaders.cs b/Source/Samples/Authentication/GenerateHttpRequestHeaders/DeleteGenerateHeaders.cs index 3accef8..5d1ef2c 100644 --- a/Source/Samples/Authentication/GenerateHttpRequestHeaders/DeleteGenerateHeaders.cs +++ b/Source/Samples/Authentication/GenerateHttpRequestHeaders/DeleteGenerateHeaders.cs @@ -1,62 +1,62 @@ -using System; -using AuthenticationSdk.core; -using AuthenticationSdk.util; +//using System; +//using AuthenticationSdk.core; +//using AuthenticationSdk.util; -namespace Cybersource_rest_samples_dotnet.Samples.Authentication -{ - public class DeleteGenerateHeaders - { +//namespace Cybersource_rest_samples_dotnet.Samples.Authentication +//{ +// public class DeleteGenerateHeaders +// { // DELETE Request to Delete subscription of (Unsubscribe) a report name by organization // Below request unsubscribes 'TRR Report' Subscription for Organization ID: testrest - private const string RequestTarget = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest"; + // private const string RequestTarget = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest"; - public static void WriteLogAudit(int status) - { - var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); - var filename = filePath[filePath.Length - 1]; - Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); - } + //public static void WriteLogAudit(int status) + //{ + // var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); + // var filename = filePath[filePath.Length - 1]; + // Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); + //} - public static void Run() - { - try - { + //public static void Run() + //{ + // try + // { // Setting up Merchant Config - var merchantConfig = new MerchantConfig - { - RequestTarget = RequestTarget, - RequestType = Enumerations.RequestType.DELETE.ToString(), - }; + //var merchantConfig = new MerchantConfig + //{ + // RequestTarget = RequestTarget, + // RequestType = Enumerations.RequestType.DELETE.ToString(), + //}; // Call to the Authorize class of AuthSDK to get the signature and token objects - var authorizeObj = new Authorize(merchantConfig); +// var authorizeObj = new Authorize(merchantConfig); - if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.HTTP_SIGNATURE.ToString(), StringComparison.OrdinalIgnoreCase)) - { - var requestHeaders = authorizeObj.GetSignature(); +// if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.HTTP_SIGNATURE.ToString(), StringComparison.OrdinalIgnoreCase)) +// { +// var requestHeaders = authorizeObj.GetSignature(); - Console.WriteLine("{0} {1}", "Accept:", "application/hal+json"); - Console.WriteLine("{0} {1}", "v-c-merchant-id:", requestHeaders.MerchantId); - Console.WriteLine("{0} {1}", "Date:", requestHeaders.GmtDateTime); - Console.WriteLine("{0} {1}", "Host:", requestHeaders.HostName); - Console.WriteLine("{0} {1}", "signature:", requestHeaders.SignatureParam); - WriteLogAudit(200); - } - else if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.JWT.ToString(), StringComparison.OrdinalIgnoreCase)) - { - var requestHeaders = authorizeObj.GetToken(); +// Console.WriteLine("{0} {1}", "Accept:", "application/hal+json"); +// Console.WriteLine("{0} {1}", "v-c-merchant-id:", requestHeaders.MerchantId); +// Console.WriteLine("{0} {1}", "Date:", requestHeaders.GmtDateTime); +// Console.WriteLine("{0} {1}", "Host:", requestHeaders.HostName); +// Console.WriteLine("{0} {1}", "signature:", requestHeaders.SignatureParam); +// WriteLogAudit(200); +// } +// else if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.JWT.ToString(), StringComparison.OrdinalIgnoreCase)) +// { +// var requestHeaders = authorizeObj.GetToken(); - Console.WriteLine("{0} {1}", "Accept:", "application/hal+json"); - Console.WriteLine("{0} {1}", "Authorization:", requestHeaders.BearerToken); - WriteLogAudit(200); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - WriteLogAudit(400); - } - } - } -} +// Console.WriteLine("{0} {1}", "Accept:", "application/hal+json"); +// Console.WriteLine("{0} {1}", "Authorization:", requestHeaders.BearerToken); +// WriteLogAudit(200); +// } +// } +// catch (Exception e) +// { +// Console.WriteLine(e.Message); +// Console.WriteLine(e.StackTrace); +// WriteLogAudit(400); +// } +// } +// } +//} diff --git a/Source/Samples/Authentication/GenerateHttpRequestHeaders/GetGenerateHeaders.cs b/Source/Samples/Authentication/GenerateHttpRequestHeaders/GetGenerateHeaders.cs index fbb2a4b..a6fbebc 100644 --- a/Source/Samples/Authentication/GenerateHttpRequestHeaders/GetGenerateHeaders.cs +++ b/Source/Samples/Authentication/GenerateHttpRequestHeaders/GetGenerateHeaders.cs @@ -1,62 +1,62 @@ -using System; -using AuthenticationSdk.core; -using AuthenticationSdk.util; +//using System; +//using AuthenticationSdk.core; +//using AuthenticationSdk.util; -namespace Cybersource_rest_samples_dotnet.Samples.Authentication -{ - public class GetGenerateHeaders - { +//namespace Cybersource_rest_samples_dotnet.Samples.Authentication +//{ +// public class GetGenerateHeaders +// { // GET request to retrieve the payment details of the provided Payment ID // Below Request fetches the payment details of payment ID: 5289697403596987704107 - private const string RequestTarget = "/pts/v2/payments/5289697403596987704107"; + //private const string RequestTarget = "/pts/v2/payments/5289697403596987704107"; - public static void WriteLogAudit(int status) - { - var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); - var filename = filePath[filePath.Length - 1]; - Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); - } + //public static void WriteLogAudit(int status) + //{ + // var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); + // var filename = filePath[filePath.Length - 1]; + // Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); + //} - public static void Run() - { - try - { + //public static void Run() + //{ + // try + // { // Setting up Merchant Config - var merchantConfig = new MerchantConfig - { - RequestTarget = RequestTarget, - RequestType = Enumerations.RequestType.GET.ToString(), - }; + //var merchantConfig = new MerchantConfig + //{ + // RequestTarget = RequestTarget, + // RequestType = Enumerations.RequestType.GET.ToString(), + //}; // Call to the Authorize class of AuthSDK to get the signature and token objects - var authorizeObj = new Authorize(merchantConfig); +// var authorizeObj = new Authorize(merchantConfig); - if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.HTTP_SIGNATURE.ToString(), StringComparison.OrdinalIgnoreCase)) - { - var requestHeaders = authorizeObj.GetSignature(); +// if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.HTTP_SIGNATURE.ToString(), StringComparison.OrdinalIgnoreCase)) +// { +// var requestHeaders = authorizeObj.GetSignature(); - Console.WriteLine("{0} {1}", "Accept:", "application/hal+json"); - Console.WriteLine("{0} {1}", "v-c-merchant-id:", requestHeaders.MerchantId); - Console.WriteLine("{0} {1}", "Date:", requestHeaders.GmtDateTime); - Console.WriteLine("{0} {1}", "Host:", requestHeaders.HostName); - Console.WriteLine("{0} {1}", "signature:", requestHeaders.SignatureParam); - WriteLogAudit(200); - } - else if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.JWT.ToString(), StringComparison.OrdinalIgnoreCase)) - { - var requestHeaders = authorizeObj.GetToken(); +// Console.WriteLine("{0} {1}", "Accept:", "application/hal+json"); +// Console.WriteLine("{0} {1}", "v-c-merchant-id:", requestHeaders.MerchantId); +// Console.WriteLine("{0} {1}", "Date:", requestHeaders.GmtDateTime); +// Console.WriteLine("{0} {1}", "Host:", requestHeaders.HostName); +// Console.WriteLine("{0} {1}", "signature:", requestHeaders.SignatureParam); +// WriteLogAudit(200); +// } +// else if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.JWT.ToString(), StringComparison.OrdinalIgnoreCase)) +// { +// var requestHeaders = authorizeObj.GetToken(); - Console.WriteLine("{0} {1}", "Accept:", "application/hal+json"); - Console.WriteLine("{0} {1}", "Authorization:", requestHeaders.BearerToken); - WriteLogAudit(200); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - WriteLogAudit(400); - } - } - } -} \ No newline at end of file +// Console.WriteLine("{0} {1}", "Accept:", "application/hal+json"); +// Console.WriteLine("{0} {1}", "Authorization:", requestHeaders.BearerToken); +// WriteLogAudit(200); +// } +// } +// catch (Exception e) +// { +// Console.WriteLine(e.Message); +// Console.WriteLine(e.StackTrace); +// WriteLogAudit(400); +// } +// } +// } +//} \ No newline at end of file diff --git a/Source/Samples/Authentication/GenerateHttpRequestHeaders/PostGenerateHeaders.cs b/Source/Samples/Authentication/GenerateHttpRequestHeaders/PostGenerateHeaders.cs index df4d1c9..5b471c2 100644 --- a/Source/Samples/Authentication/GenerateHttpRequestHeaders/PostGenerateHeaders.cs +++ b/Source/Samples/Authentication/GenerateHttpRequestHeaders/PostGenerateHeaders.cs @@ -1,69 +1,69 @@ -using System; -using System.IO; -using AuthenticationSdk.core; -using AuthenticationSdk.util; -using SampleCode.data; +//using System; +//using System.IO; +//using AuthenticationSdk.core; +//using AuthenticationSdk.util; +//using SampleCode.data; -namespace Cybersource_rest_samples_dotnet.Samples.Authentication -{ - public class PostGenerateHeaders - { +//namespace Cybersource_rest_samples_dotnet.Samples.Authentication +//{ +// public class PostGenerateHeaders +// { // POST Request to Authorize the payment for a transaction. // Transaction details provided in the JSON File are sent along with the Request as Request Body - private const string RequestTarget = "/pts/v2/payments"; - private static string RequestJsonFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Source/Resource/request_payments.json"); + //private const string RequestTarget = "/pts/v2/payments"; + //private static string RequestJsonFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Source/Resource/request_payments.json"); - public static void WriteLogAudit(int status) - { - var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); - var filename = filePath[filePath.Length - 1]; - Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); - } + //public static void WriteLogAudit(int status) + //{ + // var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); + // var filename = filePath[filePath.Length - 1]; + // Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); + //} - public static void Run() - { - try - { - var requestData = new RequestData(); + //public static void Run() + //{ + // try + // { + // var requestData = new RequestData(); // Setting up Merchant Config - var merchantConfig = new MerchantConfig - { - RequestTarget = RequestTarget, - RequestType = Enumerations.RequestType.POST.ToString(), - RequestJsonData = requestData.JsonFileData(RequestJsonFilePath) - }; + //var merchantConfig = new MerchantConfig + //{ + // RequestTarget = RequestTarget, + // RequestType = Enumerations.RequestType.POST.ToString(), + // RequestJsonData = requestData.JsonFileData(RequestJsonFilePath) + //}; // Call to the Authorize class of AuthSDK to get the signature and token objects - var authorizeObj = new Authorize(merchantConfig); +// var authorizeObj = new Authorize(merchantConfig); - if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.HTTP_SIGNATURE.ToString(), StringComparison.OrdinalIgnoreCase)) - { - var requestHeaders = authorizeObj.GetSignature(); +// if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.HTTP_SIGNATURE.ToString(), StringComparison.OrdinalIgnoreCase)) +// { +// var requestHeaders = authorizeObj.GetSignature(); - Console.WriteLine("{0} {1}", "Content-Type:", "application/json"); - Console.WriteLine("{0} {1}", "v-c-merchant-id:", requestHeaders.MerchantId); - Console.WriteLine("{0} {1}", "Date:", requestHeaders.GmtDateTime); - Console.WriteLine("{0} {1}", "Host:", requestHeaders.HostName); - Console.WriteLine("{0} {1}", "digest:", requestHeaders.Digest); - Console.WriteLine("{0} {1}", "signature:", requestHeaders.SignatureParam); - WriteLogAudit(200); - } - else if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.JWT.ToString(), StringComparison.OrdinalIgnoreCase)) - { - var requestHeaders = authorizeObj.GetToken(); +// Console.WriteLine("{0} {1}", "Content-Type:", "application/json"); +// Console.WriteLine("{0} {1}", "v-c-merchant-id:", requestHeaders.MerchantId); +// Console.WriteLine("{0} {1}", "Date:", requestHeaders.GmtDateTime); +// Console.WriteLine("{0} {1}", "Host:", requestHeaders.HostName); +// Console.WriteLine("{0} {1}", "digest:", requestHeaders.Digest); +// Console.WriteLine("{0} {1}", "signature:", requestHeaders.SignatureParam); +// WriteLogAudit(200); +// } +// else if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.JWT.ToString(), StringComparison.OrdinalIgnoreCase)) +// { +// var requestHeaders = authorizeObj.GetToken(); - Console.WriteLine("{0} {1}", "Content-Type:", "application/json"); - Console.WriteLine("{0} {1}", "Authorization:", requestHeaders.BearerToken); - WriteLogAudit(200); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - WriteLogAudit(400); - } - } - } -} \ No newline at end of file +// Console.WriteLine("{0} {1}", "Content-Type:", "application/json"); +// Console.WriteLine("{0} {1}", "Authorization:", requestHeaders.BearerToken); +// WriteLogAudit(200); +// } +// } +// catch (Exception e) +// { +// Console.WriteLine(e.Message); +// Console.WriteLine(e.StackTrace); +// WriteLogAudit(400); +// } +// } +// } +//} \ No newline at end of file diff --git a/Source/Samples/Authentication/GenerateHttpRequestHeaders/PutGenerateHeaders.cs b/Source/Samples/Authentication/GenerateHttpRequestHeaders/PutGenerateHeaders.cs index 832bf31..bf20cbb 100644 --- a/Source/Samples/Authentication/GenerateHttpRequestHeaders/PutGenerateHeaders.cs +++ b/Source/Samples/Authentication/GenerateHttpRequestHeaders/PutGenerateHeaders.cs @@ -1,68 +1,68 @@ -using System; -using AuthenticationSdk.core; -using AuthenticationSdk.util; -using SampleCode.data; +//using System; +//using AuthenticationSdk.core; +//using AuthenticationSdk.util; +//using SampleCode.data; -namespace Cybersource_rest_samples_dotnet.Samples.Authentication -{ - public class PutGenerateHeaders - { +//namespace Cybersource_rest_samples_dotnet.Samples.Authentication +//{ +// public class PutGenerateHeaders +// { // PUT Request to Create Report Subscription for a report name by organization // Report Details provided in the JSON File are sent along with the Request as Request Body // Below request subscribes 'TRR Report' for Organization ID: testrest - private const string RequestTarget = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest"; + //private const string RequestTarget = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest"; - public static void WriteLogAudit(int status) - { - var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); - var filename = filePath[filePath.Length - 1]; - Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); - } - public static void Run() - { - string RequestJsonFilePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../", "Source/Resource/TRRReport.json"); - try - { + //public static void WriteLogAudit(int status) + //{ + // var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); + // var filename = filePath[filePath.Length - 1]; + // Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); + //} + //public static void Run() + //{ + // string RequestJsonFilePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../", "Source/Resource/TRRReport.json"); + // try + // { // Setting up Merchant Config - var requestData = new RequestData(); + //var requestData = new RequestData(); - var merchantConfig = new MerchantConfig - { - RequestTarget = RequestTarget, - RequestType = Enumerations.RequestType.PUT.ToString(), - RequestJsonData = requestData.JsonFileData(RequestJsonFilePath) - }; + //var merchantConfig = new MerchantConfig + //{ + // RequestTarget = RequestTarget, + // RequestType = Enumerations.RequestType.PUT.ToString(), + // RequestJsonData = requestData.JsonFileData(RequestJsonFilePath) + //}; // Call to the Authorize class of AuthSDK to get the signature and token objects - var authorizeObj = new Authorize(merchantConfig); +// var authorizeObj = new Authorize(merchantConfig); - if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.HTTP_SIGNATURE.ToString(), StringComparison.OrdinalIgnoreCase)) - { - var requestHeaders = authorizeObj.GetSignature(); +// if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.HTTP_SIGNATURE.ToString(), StringComparison.OrdinalIgnoreCase)) +// { +// var requestHeaders = authorizeObj.GetSignature(); - Console.WriteLine("{0} {1}", "Content-Type:", "application/json"); - Console.WriteLine("{0} {1}", "v-c-merchant-id:", requestHeaders.MerchantId); - Console.WriteLine("{0} {1}", "Date:", requestHeaders.GmtDateTime); - Console.WriteLine("{0} {1}", "Host:", requestHeaders.HostName); - Console.WriteLine("{0} {1}", "digest:", requestHeaders.Digest); - Console.WriteLine("{0} {1}", "signature:", requestHeaders.SignatureParam); - WriteLogAudit(200); - } - else if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.JWT.ToString(), StringComparison.OrdinalIgnoreCase)) - { - var requestHeaders = authorizeObj.GetToken(); +// Console.WriteLine("{0} {1}", "Content-Type:", "application/json"); +// Console.WriteLine("{0} {1}", "v-c-merchant-id:", requestHeaders.MerchantId); +// Console.WriteLine("{0} {1}", "Date:", requestHeaders.GmtDateTime); +// Console.WriteLine("{0} {1}", "Host:", requestHeaders.HostName); +// Console.WriteLine("{0} {1}", "digest:", requestHeaders.Digest); +// Console.WriteLine("{0} {1}", "signature:", requestHeaders.SignatureParam); +// WriteLogAudit(200); +// } +// else if (string.Equals(merchantConfig.AuthenticationType, Enumerations.AuthenticationType.JWT.ToString(), StringComparison.OrdinalIgnoreCase)) +// { +// var requestHeaders = authorizeObj.GetToken(); - Console.WriteLine("{0} {1}", "Content-Type:", "application/json"); - Console.WriteLine("{0} {1}", "Authorization:", requestHeaders.BearerToken); - WriteLogAudit(200); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - WriteLogAudit(400); - } - } - } -} \ No newline at end of file +// Console.WriteLine("{0} {1}", "Content-Type:", "application/json"); +// Console.WriteLine("{0} {1}", "Authorization:", requestHeaders.BearerToken); +// WriteLogAudit(200); +// } +// } +// catch (Exception e) +// { +// Console.WriteLine(e.Message); +// Console.WriteLine(e.StackTrace); +// WriteLogAudit(400); +// } +// } +// } +//} \ No newline at end of file