From 13cded8794f12e2ed25984952a4e6af863ac5529 Mon Sep 17 00:00:00 2001 From: mahmishr Date: Wed, 12 Mar 2025 10:17:32 +0530 Subject: [PATCH 01/10] "samples updated" --- Source/ConfigurationWithMLE.cs | 80 ++++++++++++ .../MLEFeature/PaymentsWithGlobalMLE.cs | 116 ++++++++++++++++++ .../MLEFeature/PaymentsWithMapToContol1.cs | 116 ++++++++++++++++++ .../MLEFeature/PaymentsWithMapToContol2.cs | 116 ++++++++++++++++++ 4 files changed, 428 insertions(+) create mode 100644 Source/ConfigurationWithMLE.cs create mode 100644 Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs create mode 100644 Source/Samples/MLEFeature/PaymentsWithMapToContol1.cs create mode 100644 Source/Samples/MLEFeature/PaymentsWithMapToContol2.cs diff --git a/Source/ConfigurationWithMLE.cs b/Source/ConfigurationWithMLE.cs new file mode 100644 index 0000000..914adec --- /dev/null +++ b/Source/ConfigurationWithMLE.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Cybersource_rest_samples_dotnet.Samples.Payments; + +namespace SampleCodeNetCore.Source +{ + class ConfigurationWithMLE + { + // initialize dictionary object + private readonly Dictionary _configurationDictionary = new Dictionary(); + private readonly Dictionary _configurationDictionaryforMLE = new Dictionary(); + + public Dictionary GetMapToControlMLE() + { + _configurationDictionaryforMLE.Add("CreatePayment", true); //CreatePayment function will have MLE=true i.e. (/pts/v2/payments POST API) + _configurationDictionaryforMLE.Add("CapturePayment", false); //capturePayment function will have MLE=false i.e. (/pts/v2/payments/{id}/captures POST API) + + return _configurationDictionaryforMLE; + } + + public Dictionary GetConfiguration1() + { + _configurationDictionary.Add("authenticationType", "JWT"); + _configurationDictionary.Add("merchantID", "testrest"); + _configurationDictionary.Add("merchantsecretKey", "yBJxy6LjM2TmcPGu+GaJrHtkke25fPpUX+UY6/L/1tE="); + _configurationDictionary.Add("merchantKeyId", "08c94330-f618-42a3-b09d-e1e43be5efda"); + _configurationDictionary.Add("keysDirectory", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\Source\\Resource")); + _configurationDictionary.Add("keyFilename", "testrest"); + _configurationDictionary.Add("runEnvironment", "apitest.cybersource.com"); + _configurationDictionary.Add("keyAlias", "testrest"); + _configurationDictionary.Add("keyPass", "testrest"); + _configurationDictionary.Add("useMLEGlobally", "true"); //globally MLE will be enabled for all the MLE supported APIs by Cybs in SDK + _configurationDictionary.Add("mleKeyAlias", "CyberSource_SJC_US"); //this is optional paramter, not required to set the parameter/value if custom value is not required for MLE key alias. Default value is "CyberSource_SJC_US". + + + // Configs related to meta key + _configurationDictionary.Add("portfolioID", string.Empty); + _configurationDictionary.Add("useMetaKey", "false"); + + /* + * Add the property if required to override the cybs default developerId in all request body + */ + _configurationDictionary.Add("defaultDeveloperId", ""); + + return _configurationDictionary; + } + + + public Dictionary GetConfiguration2() + { + _configurationDictionary.Add("authenticationType", "JWT"); + _configurationDictionary.Add("merchantID", "testrest"); + _configurationDictionary.Add("merchantsecretKey", "yBJxy6LjM2TmcPGu+GaJrHtkke25fPpUX+UY6/L/1tE="); + _configurationDictionary.Add("merchantKeyId", "08c94330-f618-42a3-b09d-e1e43be5efda"); + _configurationDictionary.Add("keysDirectory", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\Source\\Resource")); + _configurationDictionary.Add("keyFilename", "testrest"); + _configurationDictionary.Add("runEnvironment", "apitest.cybersource.com"); + _configurationDictionary.Add("keyAlias", "testrest"); + _configurationDictionary.Add("keyPass", "testrest"); + _configurationDictionary.Add("useMLEGlobally", "false"); //globally MLE will be disabled for all the MLE supported APIs by Cybs in SDK + _configurationDictionary.Add("mleKeyAlias", "CyberSource_SJC_US"); //this is optional paramter, not required to set the parameter/value if custom value is not required for MLE key alias. Default value is "CyberSource_SJC_US". + + + // Configs related to meta key + _configurationDictionary.Add("portfolioID", string.Empty); + _configurationDictionary.Add("useMetaKey", "false"); + + /* + * Add the property if required to override the cybs default developerId in all request body + */ + _configurationDictionary.Add("defaultDeveloperId", ""); + + return _configurationDictionary; + } + } +} + + \ No newline at end of file diff --git a/Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs b/Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs new file mode 100644 index 0000000..2215a64 --- /dev/null +++ b/Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Text; +using CyberSource.Api; +using CyberSource.Client; +using CyberSource.Model; + +namespace SampleCodeNetCore.Source.Samples.MLEFeature +{ + class PaymentsWithGlobalMLE + { + + + 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 bool CaptureTrueForProcessPayment { get; set; } = false; + + public static PtsV2PaymentsPost201Response Run() + { + string clientReferenceInformationCode = "TC50171_3"; + Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( + Code: clientReferenceInformationCode + ); + + bool processingInformationCapture = false; + if (CaptureTrueForProcessPayment) + { + processingInformationCapture = true; + } + + Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation( + Capture: processingInformationCapture + ); + + string paymentInformationCardNumber = "4111111111111111"; + string paymentInformationCardExpirationMonth = "12"; + string paymentInformationCardExpirationYear = "2031"; + Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard( + Number: paymentInformationCardNumber, + ExpirationMonth: paymentInformationCardExpirationMonth, + ExpirationYear: paymentInformationCardExpirationYear + ); + + Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation( + Card: paymentInformationCard + ); + + string orderInformationAmountDetailsTotalAmount = "102.21"; + string orderInformationAmountDetailsCurrency = "USD"; + Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails( + TotalAmount: orderInformationAmountDetailsTotalAmount, + Currency: orderInformationAmountDetailsCurrency + ); + + string orderInformationBillToFirstName = "John"; + string orderInformationBillToLastName = "Doe"; + string orderInformationBillToAddress1 = "1 Market St"; + string orderInformationBillToLocality = "san francisco"; + string orderInformationBillToAdministrativeArea = "CA"; + string orderInformationBillToPostalCode = "94105"; + string orderInformationBillToCountry = "US"; + string orderInformationBillToEmail = "test@cybs.com"; + string orderInformationBillToPhoneNumber = "4158880000"; + Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo( + FirstName: orderInformationBillToFirstName, + LastName: orderInformationBillToLastName, + Address1: orderInformationBillToAddress1, + Locality: orderInformationBillToLocality, + AdministrativeArea: orderInformationBillToAdministrativeArea, + PostalCode: orderInformationBillToPostalCode, + Country: orderInformationBillToCountry, + Email: orderInformationBillToEmail, + PhoneNumber: orderInformationBillToPhoneNumber + ); + + Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( + AmountDetails: orderInformationAmountDetails, + BillTo: orderInformationBillTo + ); + + var requestObj = new CreatePaymentRequest( + ClientReferenceInformation: clientReferenceInformation, + ProcessingInformation: processingInformation, + PaymentInformation: paymentInformation, + OrderInformation: orderInformation + ); + + try + { + + var configDictionary = new ConfigurationWithMLE().GetConfiguration1(); + var mapToControlMLE = new ConfigurationWithMLE().GetMapToControlMLE(); + var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary, null); + + var apiInstance = new PaymentsApi(clientConfig); + PtsV2PaymentsPost201Response result = apiInstance.CreatePayment(requestObj); + Console.WriteLine(result); + WriteLogAudit(apiInstance.GetStatusCode()); + return result; + } + catch (ApiException e) + { + Console.WriteLine("Error Code: " + e.ErrorCode); + Console.WriteLine("Error Message: " + e.Message); + Console.WriteLine("Exception on calling the API : " + e.Message); + WriteLogAudit(e.ErrorCode); + return null; + } + } +} +} diff --git a/Source/Samples/MLEFeature/PaymentsWithMapToContol1.cs b/Source/Samples/MLEFeature/PaymentsWithMapToContol1.cs new file mode 100644 index 0000000..915f79f --- /dev/null +++ b/Source/Samples/MLEFeature/PaymentsWithMapToContol1.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Text; +using CyberSource.Api; +using CyberSource.Client; +using CyberSource.Model; + +namespace SampleCodeNetCore.Source.Samples.MLEFeature +{ + class PaymentsWithMapToContol1 + { + + + 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 bool CaptureTrueForProcessPayment { get; set; } = false; + + public static PtsV2PaymentsPost201Response Run() + { + string clientReferenceInformationCode = "TC50171_3"; + Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( + Code: clientReferenceInformationCode + ); + + bool processingInformationCapture = false; + if (CaptureTrueForProcessPayment) + { + processingInformationCapture = true; + } + + Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation( + Capture: processingInformationCapture + ); + + string paymentInformationCardNumber = "4111111111111111"; + string paymentInformationCardExpirationMonth = "12"; + string paymentInformationCardExpirationYear = "2031"; + Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard( + Number: paymentInformationCardNumber, + ExpirationMonth: paymentInformationCardExpirationMonth, + ExpirationYear: paymentInformationCardExpirationYear + ); + + Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation( + Card: paymentInformationCard + ); + + string orderInformationAmountDetailsTotalAmount = "102.21"; + string orderInformationAmountDetailsCurrency = "USD"; + Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails( + TotalAmount: orderInformationAmountDetailsTotalAmount, + Currency: orderInformationAmountDetailsCurrency + ); + + string orderInformationBillToFirstName = "John"; + string orderInformationBillToLastName = "Doe"; + string orderInformationBillToAddress1 = "1 Market St"; + string orderInformationBillToLocality = "san francisco"; + string orderInformationBillToAdministrativeArea = "CA"; + string orderInformationBillToPostalCode = "94105"; + string orderInformationBillToCountry = "US"; + string orderInformationBillToEmail = "test@cybs.com"; + string orderInformationBillToPhoneNumber = "4158880000"; + Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo( + FirstName: orderInformationBillToFirstName, + LastName: orderInformationBillToLastName, + Address1: orderInformationBillToAddress1, + Locality: orderInformationBillToLocality, + AdministrativeArea: orderInformationBillToAdministrativeArea, + PostalCode: orderInformationBillToPostalCode, + Country: orderInformationBillToCountry, + Email: orderInformationBillToEmail, + PhoneNumber: orderInformationBillToPhoneNumber + ); + + Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( + AmountDetails: orderInformationAmountDetails, + BillTo: orderInformationBillTo + ); + + var requestObj = new CreatePaymentRequest( + ClientReferenceInformation: clientReferenceInformation, + ProcessingInformation: processingInformation, + PaymentInformation: paymentInformation, + OrderInformation: orderInformation + ); + + try + { + + var configDictionary = new ConfigurationWithMLE().GetConfiguration1(); + var mapToControlMLE = new ConfigurationWithMLE().GetMapToControlMLE(); + var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary, mapToControlMLEonAPI: mapToControlMLE); + + var apiInstance = new PaymentsApi(clientConfig); + PtsV2PaymentsPost201Response result = apiInstance.CreatePayment(requestObj); + Console.WriteLine(result); + WriteLogAudit(apiInstance.GetStatusCode()); + return result; + } + catch (ApiException e) + { + Console.WriteLine("Error Code: " + e.ErrorCode); + Console.WriteLine("Error Message: " + e.Message); + Console.WriteLine("Exception on calling the API : " + e.Message); + WriteLogAudit(e.ErrorCode); + return null; + } + } + } +} diff --git a/Source/Samples/MLEFeature/PaymentsWithMapToContol2.cs b/Source/Samples/MLEFeature/PaymentsWithMapToContol2.cs new file mode 100644 index 0000000..cfdc50b --- /dev/null +++ b/Source/Samples/MLEFeature/PaymentsWithMapToContol2.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Text; +using CyberSource.Api; +using CyberSource.Client; +using CyberSource.Model; + +namespace SampleCodeNetCore.Source.Samples.MLEFeature +{ + class PaymentsWithMapToContol2 + { + + + 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 bool CaptureTrueForProcessPayment { get; set; } = false; + + public static PtsV2PaymentsPost201Response Run() + { + string clientReferenceInformationCode = "TC50171_3"; + Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( + Code: clientReferenceInformationCode + ); + + bool processingInformationCapture = false; + if (CaptureTrueForProcessPayment) + { + processingInformationCapture = true; + } + + Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation( + Capture: processingInformationCapture + ); + + string paymentInformationCardNumber = "4111111111111111"; + string paymentInformationCardExpirationMonth = "12"; + string paymentInformationCardExpirationYear = "2031"; + Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard( + Number: paymentInformationCardNumber, + ExpirationMonth: paymentInformationCardExpirationMonth, + ExpirationYear: paymentInformationCardExpirationYear + ); + + Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation( + Card: paymentInformationCard + ); + + string orderInformationAmountDetailsTotalAmount = "102.21"; + string orderInformationAmountDetailsCurrency = "USD"; + Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails( + TotalAmount: orderInformationAmountDetailsTotalAmount, + Currency: orderInformationAmountDetailsCurrency + ); + + string orderInformationBillToFirstName = "John"; + string orderInformationBillToLastName = "Doe"; + string orderInformationBillToAddress1 = "1 Market St"; + string orderInformationBillToLocality = "san francisco"; + string orderInformationBillToAdministrativeArea = "CA"; + string orderInformationBillToPostalCode = "94105"; + string orderInformationBillToCountry = "US"; + string orderInformationBillToEmail = "test@cybs.com"; + string orderInformationBillToPhoneNumber = "4158880000"; + Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo( + FirstName: orderInformationBillToFirstName, + LastName: orderInformationBillToLastName, + Address1: orderInformationBillToAddress1, + Locality: orderInformationBillToLocality, + AdministrativeArea: orderInformationBillToAdministrativeArea, + PostalCode: orderInformationBillToPostalCode, + Country: orderInformationBillToCountry, + Email: orderInformationBillToEmail, + PhoneNumber: orderInformationBillToPhoneNumber + ); + + Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( + AmountDetails: orderInformationAmountDetails, + BillTo: orderInformationBillTo + ); + + var requestObj = new CreatePaymentRequest( + ClientReferenceInformation: clientReferenceInformation, + ProcessingInformation: processingInformation, + PaymentInformation: paymentInformation, + OrderInformation: orderInformation + ); + + try + { + + var configDictionary = new ConfigurationWithMLE().GetConfiguration2(); + var mapToControlMLE = new ConfigurationWithMLE().GetMapToControlMLE(); + var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary, mapToControlMLEonAPI: mapToControlMLE); + + var apiInstance = new PaymentsApi(clientConfig); + PtsV2PaymentsPost201Response result = apiInstance.CreatePayment(requestObj); + Console.WriteLine(result); + WriteLogAudit(apiInstance.GetStatusCode()); + return result; + } + catch (ApiException e) + { + Console.WriteLine("Error Code: " + e.ErrorCode); + Console.WriteLine("Error Message: " + e.Message); + Console.WriteLine("Exception on calling the API : " + e.Message); + WriteLogAudit(e.ErrorCode); + return null; + } + } + } +} From fb318b73e71c8e54603ca29cb7ddcc27f5273101 Mon Sep 17 00:00:00 2001 From: mahmishr Date: Wed, 12 Mar 2025 15:20:14 +0530 Subject: [PATCH 02/10] refactoring --- Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs b/Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs index 2215a64..a573fe8 100644 --- a/Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs +++ b/Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs @@ -95,7 +95,7 @@ public static PtsV2PaymentsPost201Response Run() var configDictionary = new ConfigurationWithMLE().GetConfiguration1(); var mapToControlMLE = new ConfigurationWithMLE().GetMapToControlMLE(); - var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary, null); + var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new PaymentsApi(clientConfig); PtsV2PaymentsPost201Response result = apiInstance.CreatePayment(requestObj); From 76c280896f38b23e2099a198956684a976048ad0 Mon Sep 17 00:00:00 2001 From: gaubansa Date: Wed, 12 Mar 2025 15:48:48 +0530 Subject: [PATCH 03/10] correcting namespace and formatting code --- Source/ConfigurationWithMLE.cs | 10 +- .../MLEFeature/PaymentsWithGlobalMLE.cs | 189 +++++++++--------- .../MLEFeature/PaymentsWithMapToContol1.cs | 18 +- .../MLEFeature/PaymentsWithMapToContol2.cs | 18 +- 4 files changed, 119 insertions(+), 116 deletions(-) diff --git a/Source/ConfigurationWithMLE.cs b/Source/ConfigurationWithMLE.cs index 914adec..d17055b 100644 --- a/Source/ConfigurationWithMLE.cs +++ b/Source/ConfigurationWithMLE.cs @@ -4,7 +4,7 @@ using System.Text; using Cybersource_rest_samples_dotnet.Samples.Payments; -namespace SampleCodeNetCore.Source +namespace Cybersource_rest_samples_dotnet { class ConfigurationWithMLE { @@ -22,8 +22,8 @@ public Dictionary GetMapToControlMLE() public Dictionary GetConfiguration1() { - _configurationDictionary.Add("authenticationType", "JWT"); - _configurationDictionary.Add("merchantID", "testrest"); + _configurationDictionary.Add("authenticationType", "JWT"); //mle only supoort with JWT Auth Type + _configurationDictionary.Add("merchantID", "testrest"); _configurationDictionary.Add("merchantsecretKey", "yBJxy6LjM2TmcPGu+GaJrHtkke25fPpUX+UY6/L/1tE="); _configurationDictionary.Add("merchantKeyId", "08c94330-f618-42a3-b09d-e1e43be5efda"); _configurationDictionary.Add("keysDirectory", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\Source\\Resource")); @@ -31,6 +31,8 @@ public Dictionary GetConfiguration1() _configurationDictionary.Add("runEnvironment", "apitest.cybersource.com"); _configurationDictionary.Add("keyAlias", "testrest"); _configurationDictionary.Add("keyPass", "testrest"); + + //MLE configs _configurationDictionary.Add("useMLEGlobally", "true"); //globally MLE will be enabled for all the MLE supported APIs by Cybs in SDK _configurationDictionary.Add("mleKeyAlias", "CyberSource_SJC_US"); //this is optional paramter, not required to set the parameter/value if custom value is not required for MLE key alias. Default value is "CyberSource_SJC_US". @@ -59,6 +61,8 @@ public Dictionary GetConfiguration2() _configurationDictionary.Add("runEnvironment", "apitest.cybersource.com"); _configurationDictionary.Add("keyAlias", "testrest"); _configurationDictionary.Add("keyPass", "testrest"); + + //mle configs _configurationDictionary.Add("useMLEGlobally", "false"); //globally MLE will be disabled for all the MLE supported APIs by Cybs in SDK _configurationDictionary.Add("mleKeyAlias", "CyberSource_SJC_US"); //this is optional paramter, not required to set the parameter/value if custom value is not required for MLE key alias. Default value is "CyberSource_SJC_US". diff --git a/Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs b/Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs index a573fe8..8223419 100644 --- a/Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs +++ b/Source/Samples/MLEFeature/PaymentsWithGlobalMLE.cs @@ -5,112 +5,111 @@ using CyberSource.Client; using CyberSource.Model; -namespace SampleCodeNetCore.Source.Samples.MLEFeature +namespace Cybersource_rest_samples_dotnet.Samples.MLEFeature { class PaymentsWithGlobalMLE { 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 bool CaptureTrueForProcessPayment { get; set; } = false; - - public static PtsV2PaymentsPost201Response Run() - { - string clientReferenceInformationCode = "TC50171_3"; - Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( - Code: clientReferenceInformationCode - ); - - bool processingInformationCapture = false; - if (CaptureTrueForProcessPayment) { - processingInformationCapture = true; + var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); + var filename = filePath[filePath.Length - 1]; + Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); } - Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation( - Capture: processingInformationCapture - ); - - string paymentInformationCardNumber = "4111111111111111"; - string paymentInformationCardExpirationMonth = "12"; - string paymentInformationCardExpirationYear = "2031"; - Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard( - Number: paymentInformationCardNumber, - ExpirationMonth: paymentInformationCardExpirationMonth, - ExpirationYear: paymentInformationCardExpirationYear - ); - - Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation( - Card: paymentInformationCard - ); - - string orderInformationAmountDetailsTotalAmount = "102.21"; - string orderInformationAmountDetailsCurrency = "USD"; - Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails( - TotalAmount: orderInformationAmountDetailsTotalAmount, - Currency: orderInformationAmountDetailsCurrency - ); - - string orderInformationBillToFirstName = "John"; - string orderInformationBillToLastName = "Doe"; - string orderInformationBillToAddress1 = "1 Market St"; - string orderInformationBillToLocality = "san francisco"; - string orderInformationBillToAdministrativeArea = "CA"; - string orderInformationBillToPostalCode = "94105"; - string orderInformationBillToCountry = "US"; - string orderInformationBillToEmail = "test@cybs.com"; - string orderInformationBillToPhoneNumber = "4158880000"; - Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo( - FirstName: orderInformationBillToFirstName, - LastName: orderInformationBillToLastName, - Address1: orderInformationBillToAddress1, - Locality: orderInformationBillToLocality, - AdministrativeArea: orderInformationBillToAdministrativeArea, - PostalCode: orderInformationBillToPostalCode, - Country: orderInformationBillToCountry, - Email: orderInformationBillToEmail, - PhoneNumber: orderInformationBillToPhoneNumber - ); - - Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( - AmountDetails: orderInformationAmountDetails, - BillTo: orderInformationBillTo - ); - - var requestObj = new CreatePaymentRequest( - ClientReferenceInformation: clientReferenceInformation, - ProcessingInformation: processingInformation, - PaymentInformation: paymentInformation, - OrderInformation: orderInformation - ); - - try - { - - var configDictionary = new ConfigurationWithMLE().GetConfiguration1(); - var mapToControlMLE = new ConfigurationWithMLE().GetMapToControlMLE(); - var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); + public static bool CaptureTrueForProcessPayment { get; set; } = false; - var apiInstance = new PaymentsApi(clientConfig); - PtsV2PaymentsPost201Response result = apiInstance.CreatePayment(requestObj); - Console.WriteLine(result); - WriteLogAudit(apiInstance.GetStatusCode()); - return result; - } - catch (ApiException e) + public static PtsV2PaymentsPost201Response Run() { - Console.WriteLine("Error Code: " + e.ErrorCode); - Console.WriteLine("Error Message: " + e.Message); - Console.WriteLine("Exception on calling the API : " + e.Message); - WriteLogAudit(e.ErrorCode); - return null; + string clientReferenceInformationCode = "TC50171_3"; + Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( + Code: clientReferenceInformationCode + ); + + bool processingInformationCapture = false; + if (CaptureTrueForProcessPayment) + { + processingInformationCapture = true; + } + + Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation( + Capture: processingInformationCapture + ); + + string paymentInformationCardNumber = "4111111111111111"; + string paymentInformationCardExpirationMonth = "12"; + string paymentInformationCardExpirationYear = "2031"; + Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard( + Number: paymentInformationCardNumber, + ExpirationMonth: paymentInformationCardExpirationMonth, + ExpirationYear: paymentInformationCardExpirationYear + ); + + Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation( + Card: paymentInformationCard + ); + + string orderInformationAmountDetailsTotalAmount = "102.21"; + string orderInformationAmountDetailsCurrency = "USD"; + Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails( + TotalAmount: orderInformationAmountDetailsTotalAmount, + Currency: orderInformationAmountDetailsCurrency + ); + + string orderInformationBillToFirstName = "John"; + string orderInformationBillToLastName = "Doe"; + string orderInformationBillToAddress1 = "1 Market St"; + string orderInformationBillToLocality = "san francisco"; + string orderInformationBillToAdministrativeArea = "CA"; + string orderInformationBillToPostalCode = "94105"; + string orderInformationBillToCountry = "US"; + string orderInformationBillToEmail = "test@cybs.com"; + string orderInformationBillToPhoneNumber = "4158880000"; + Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo( + FirstName: orderInformationBillToFirstName, + LastName: orderInformationBillToLastName, + Address1: orderInformationBillToAddress1, + Locality: orderInformationBillToLocality, + AdministrativeArea: orderInformationBillToAdministrativeArea, + PostalCode: orderInformationBillToPostalCode, + Country: orderInformationBillToCountry, + Email: orderInformationBillToEmail, + PhoneNumber: orderInformationBillToPhoneNumber + ); + + Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( + AmountDetails: orderInformationAmountDetails, + BillTo: orderInformationBillTo + ); + + var requestObj = new CreatePaymentRequest( + ClientReferenceInformation: clientReferenceInformation, + ProcessingInformation: processingInformation, + PaymentInformation: paymentInformation, + OrderInformation: orderInformation + ); + + try + { + + var configDictionary = new ConfigurationWithMLE().GetConfiguration1(); + var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); + + var apiInstance = new PaymentsApi(clientConfig); + PtsV2PaymentsPost201Response result = apiInstance.CreatePayment(requestObj); + Console.WriteLine(result); + WriteLogAudit(apiInstance.GetStatusCode()); + return result; + } + catch (ApiException e) + { + Console.WriteLine("Error Code: " + e.ErrorCode); + Console.WriteLine("Error Message: " + e.Message); + Console.WriteLine("Exception on calling the API : " + e.Message); + WriteLogAudit(e.ErrorCode); + return null; + } } } } -} diff --git a/Source/Samples/MLEFeature/PaymentsWithMapToContol1.cs b/Source/Samples/MLEFeature/PaymentsWithMapToContol1.cs index 915f79f..361e6d3 100644 --- a/Source/Samples/MLEFeature/PaymentsWithMapToContol1.cs +++ b/Source/Samples/MLEFeature/PaymentsWithMapToContol1.cs @@ -5,7 +5,7 @@ using CyberSource.Client; using CyberSource.Model; -namespace SampleCodeNetCore.Source.Samples.MLEFeature +namespace Cybersource_rest_samples_dotnet.Samples.MLEFeature { class PaymentsWithMapToContol1 { @@ -25,7 +25,7 @@ public static PtsV2PaymentsPost201Response Run() string clientReferenceInformationCode = "TC50171_3"; Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( Code: clientReferenceInformationCode - ); + ); bool processingInformationCapture = false; if (CaptureTrueForProcessPayment) @@ -35,7 +35,7 @@ public static PtsV2PaymentsPost201Response Run() Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation( Capture: processingInformationCapture - ); + ); string paymentInformationCardNumber = "4111111111111111"; string paymentInformationCardExpirationMonth = "12"; @@ -44,18 +44,18 @@ public static PtsV2PaymentsPost201Response Run() Number: paymentInformationCardNumber, ExpirationMonth: paymentInformationCardExpirationMonth, ExpirationYear: paymentInformationCardExpirationYear - ); + ); Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation( Card: paymentInformationCard - ); + ); string orderInformationAmountDetailsTotalAmount = "102.21"; string orderInformationAmountDetailsCurrency = "USD"; Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails( TotalAmount: orderInformationAmountDetailsTotalAmount, Currency: orderInformationAmountDetailsCurrency - ); + ); string orderInformationBillToFirstName = "John"; string orderInformationBillToLastName = "Doe"; @@ -76,19 +76,19 @@ public static PtsV2PaymentsPost201Response Run() Country: orderInformationBillToCountry, Email: orderInformationBillToEmail, PhoneNumber: orderInformationBillToPhoneNumber - ); + ); Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( AmountDetails: orderInformationAmountDetails, BillTo: orderInformationBillTo - ); + ); var requestObj = new CreatePaymentRequest( ClientReferenceInformation: clientReferenceInformation, ProcessingInformation: processingInformation, PaymentInformation: paymentInformation, OrderInformation: orderInformation - ); + ); try { diff --git a/Source/Samples/MLEFeature/PaymentsWithMapToContol2.cs b/Source/Samples/MLEFeature/PaymentsWithMapToContol2.cs index cfdc50b..960f3df 100644 --- a/Source/Samples/MLEFeature/PaymentsWithMapToContol2.cs +++ b/Source/Samples/MLEFeature/PaymentsWithMapToContol2.cs @@ -5,7 +5,7 @@ using CyberSource.Client; using CyberSource.Model; -namespace SampleCodeNetCore.Source.Samples.MLEFeature +namespace Cybersource_rest_samples_dotnet.Samples.MLEFeature { class PaymentsWithMapToContol2 { @@ -25,7 +25,7 @@ public static PtsV2PaymentsPost201Response Run() string clientReferenceInformationCode = "TC50171_3"; Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( Code: clientReferenceInformationCode - ); + ); bool processingInformationCapture = false; if (CaptureTrueForProcessPayment) @@ -35,7 +35,7 @@ public static PtsV2PaymentsPost201Response Run() Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation( Capture: processingInformationCapture - ); + ); string paymentInformationCardNumber = "4111111111111111"; string paymentInformationCardExpirationMonth = "12"; @@ -44,18 +44,18 @@ public static PtsV2PaymentsPost201Response Run() Number: paymentInformationCardNumber, ExpirationMonth: paymentInformationCardExpirationMonth, ExpirationYear: paymentInformationCardExpirationYear - ); + ); Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation( Card: paymentInformationCard - ); + ); string orderInformationAmountDetailsTotalAmount = "102.21"; string orderInformationAmountDetailsCurrency = "USD"; Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails( TotalAmount: orderInformationAmountDetailsTotalAmount, Currency: orderInformationAmountDetailsCurrency - ); + ); string orderInformationBillToFirstName = "John"; string orderInformationBillToLastName = "Doe"; @@ -76,19 +76,19 @@ public static PtsV2PaymentsPost201Response Run() Country: orderInformationBillToCountry, Email: orderInformationBillToEmail, PhoneNumber: orderInformationBillToPhoneNumber - ); + ); Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( AmountDetails: orderInformationAmountDetails, BillTo: orderInformationBillTo - ); + ); var requestObj = new CreatePaymentRequest( ClientReferenceInformation: clientReferenceInformation, ProcessingInformation: processingInformation, PaymentInformation: paymentInformation, OrderInformation: orderInformation - ); + ); try { From 2e27376644a3c8c88b1bfe0b3dbe8a092abca468 Mon Sep 17 00:00:00 2001 From: gaubansa Date: Wed, 12 Mar 2025 15:55:40 +0530 Subject: [PATCH 04/10] adding mle files in csproj --- cybersource-rest-samples-csharp.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cybersource-rest-samples-csharp.csproj b/cybersource-rest-samples-csharp.csproj index 7730f5d..18482ec 100644 --- a/cybersource-rest-samples-csharp.csproj +++ b/cybersource-rest-samples-csharp.csproj @@ -105,6 +105,7 @@ + @@ -159,6 +160,9 @@ + + + From 6647c39608450f3bdd6557bdbb039f5d6c04b3e9 Mon Sep 17 00:00:00 2001 From: Bansal Date: Wed, 26 Mar 2025 13:43:45 +0530 Subject: [PATCH 05/10] changing the target framework to 4.6.1 --- cybersource-rest-samples-csharp.csproj | 2 +- packages.config | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cybersource-rest-samples-csharp.csproj b/cybersource-rest-samples-csharp.csproj index 1bd4717..6d7038a 100644 --- a/cybersource-rest-samples-csharp.csproj +++ b/cybersource-rest-samples-csharp.csproj @@ -9,7 +9,7 @@ Properties Cybersource_rest_samples_dotnet SampleCode - v4.7.2 + v4.6.1 512 true diff --git a/packages.config b/packages.config index cf04cce..f140ab0 100644 --- a/packages.config +++ b/packages.config @@ -2,21 +2,21 @@ - - + + - + - - + + - + \ No newline at end of file From 6bcd3f29311b7949d9d87f9c55b8c3cb458f4532 Mon Sep 17 00:00:00 2001 From: Bansal Date: Wed, 26 Mar 2025 14:16:14 +0530 Subject: [PATCH 06/10] adding app.config back --- Source/App.config | 62 ++++++++++++++++++++++++++ cybersource-rest-samples-csharp.csproj | 13 +++--- 2 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 Source/App.config diff --git a/Source/App.config b/Source/App.config new file mode 100644 index 0000000..16eb9d1 --- /dev/null +++ b/Source/App.config @@ -0,0 +1,62 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cybersource-rest-samples-csharp.csproj b/cybersource-rest-samples-csharp.csproj index 6d7038a..a8adcff 100644 --- a/cybersource-rest-samples-csharp.csproj +++ b/cybersource-rest-samples-csharp.csproj @@ -12,7 +12,6 @@ v4.6.1 512 true - AnyCPU @@ -50,9 +49,8 @@ packages\jose-jwt.4.1.0\lib\net461\jose-jwt.dll - - False - ..\..\cybersource-rest-samples-csharp\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + + packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll @@ -79,8 +77,7 @@ packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - - False + packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll @@ -429,10 +426,12 @@ - Always + + Designer + Designer Always From 14bdcac8afb4c5d454206c412ae256f046ff50a3 Mon Sep 17 00:00:00 2001 From: Bansal Date: Wed, 26 Mar 2025 14:25:56 +0530 Subject: [PATCH 07/10] correcting the dependency for 4.6.1 dotnet framework --- cybersource-rest-samples-csharp.csproj | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cybersource-rest-samples-csharp.csproj b/cybersource-rest-samples-csharp.csproj index a8adcff..c4376b4 100644 --- a/cybersource-rest-samples-csharp.csproj +++ b/cybersource-rest-samples-csharp.csproj @@ -70,7 +70,7 @@ - + packages\System.Memory.4.5.5\lib\net461\System.Memory.dll @@ -82,13 +82,11 @@ - - False - packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll + + packages\System.Text.Encodings.Web.8.0.0\lib\netstandard2.0\System.Text.Encodings.Web.dll - - False - packages\System.Text.Json.8.0.5\lib\net462\System.Text.Json.dll + + packages\System.Text.Json.8.0.5\lib\netstandard2.0\System.Text.Json.dll packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll From 08996e3445c3b594c8498d4f70cb33c552a55a43 Mon Sep 17 00:00:00 2001 From: Bansal Date: Wed, 26 Mar 2025 14:57:40 +0530 Subject: [PATCH 08/10] changing samples due to spec changes --- Source/Samples/AccountUpdater/ListBatches.cs | 2 +- .../AccountUpdater/RetrieveBatchReport.cs | 2 +- .../AccountUpdater/RetrieveBatchStatus.cs | 2 +- ...eAlternativePaymentsNotificationWebhook.cs | 8 +-- .../CreateDecisionManagerWebhook.cs | 6 +- .../CreateFraudManagementWebhook.cs | 6 +- .../CreateInvoicingWebhook.cs | 6 +- ...tageAndKeyExpirationNotificationWebhook.cs | 4 +- .../CreateRecurringBillingWebhook.cs | 4 +- .../CreateSecureAcceptanceWebhook.cs | 4 +- .../CreateTerminalManagementWebhook.cs | 4 +- .../CreateTokenManagementWebhook.cs | 4 +- ...eWebhookUsingOAuthWithClientCredentials.cs | 4 +- .../CreateWebhookUsingOAuthWithJWT.cs | 4 +- .../FindProductsYouCanSubscribeTo.cs | 2 +- .../DeleteWebhookSubscription.cs | 2 +- .../GetDetailsOnAllCreatedWebhooks.cs | 4 +- .../GetDetailsOnSingleWebhook.cs | 2 +- ...yFailedTransactionsBySetStartAndEndTime.cs | 56 +++++++++---------- .../ReplayFailedTransactionsInLast24Hours.cs | 4 +- .../ReplaySpecificListOfTransactions.cs | 4 +- .../Webhooks/ManageWebhooks/UpdateWebhook.cs | 4 +- 22 files changed, 69 insertions(+), 69 deletions(-) diff --git a/Source/Samples/AccountUpdater/ListBatches.cs b/Source/Samples/AccountUpdater/ListBatches.cs index 2e47e83..24cc2ee 100644 --- a/Source/Samples/AccountUpdater/ListBatches.cs +++ b/Source/Samples/AccountUpdater/ListBatches.cs @@ -19,7 +19,7 @@ public static void Run() var apiInstance = new BatchesApi(clientConfig); string fromDate = "20230101T123000Z"; string toDate = "20230410T123000Z"; - InlineResponse2005 result = apiInstance.GetBatchesList(0, 10, fromDate, toDate); + InlineResponse2002 result = apiInstance.GetBatchesList(0, 10, fromDate, toDate); Console.WriteLine(result); } catch (Exception e) diff --git a/Source/Samples/AccountUpdater/RetrieveBatchReport.cs b/Source/Samples/AccountUpdater/RetrieveBatchReport.cs index ad99eb8..d007b30 100644 --- a/Source/Samples/AccountUpdater/RetrieveBatchReport.cs +++ b/Source/Samples/AccountUpdater/RetrieveBatchReport.cs @@ -19,7 +19,7 @@ public static void Run() var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new BatchesApi(clientConfig); - InlineResponse2007 result = apiInstance.GetBatchReport(batchId); + InlineResponse2004 result = apiInstance.GetBatchReport(batchId); Console.WriteLine(result); } catch (Exception e) diff --git a/Source/Samples/AccountUpdater/RetrieveBatchStatus.cs b/Source/Samples/AccountUpdater/RetrieveBatchStatus.cs index 6c74497..ff0b9cc 100644 --- a/Source/Samples/AccountUpdater/RetrieveBatchStatus.cs +++ b/Source/Samples/AccountUpdater/RetrieveBatchStatus.cs @@ -19,7 +19,7 @@ public static void Run() var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new BatchesApi(clientConfig); - InlineResponse2006 result = apiInstance.GetBatchStatus(batchId); + InlineResponse2003 result = apiInstance.GetBatchStatus(batchId); Console.WriteLine(result); } catch (Exception e) diff --git a/Source/Samples/Webhooks/CreateNewWebhooks/CreateAlternativePaymentsNotificationWebhook.cs b/Source/Samples/Webhooks/CreateNewWebhooks/CreateAlternativePaymentsNotificationWebhook.cs index 43866a6..8be33fa 100644 --- a/Source/Samples/Webhooks/CreateNewWebhooks/CreateAlternativePaymentsNotificationWebhook.cs +++ b/Source/Samples/Webhooks/CreateNewWebhooks/CreateAlternativePaymentsNotificationWebhook.cs @@ -11,7 +11,7 @@ public class CreateAlternativePaymentsNotificationWebhook { public static void Run() { - string name = "My Custom Webhook"; + /*string name = "My Custom Webhook"; string description = "Sample Webhook from Developer Center"; string organizationId = ""; string productId = "alternativePaymentMethods"; @@ -56,7 +56,7 @@ public static void Run() NotificationScope: notificationScope, RetryPolicy: retryPolicy, SecurityPolicy: securityPolicy - ); + );*/ try { @@ -64,8 +64,8 @@ public static void Run() var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new CreateNewWebhooksApi(clientConfig); - apiInstance.CreateWebhookSubscription(requestObj); - } + //apiInstance.CreateWebhookSubscription(requestObj); + } catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); diff --git a/Source/Samples/Webhooks/CreateNewWebhooks/CreateDecisionManagerWebhook.cs b/Source/Samples/Webhooks/CreateNewWebhooks/CreateDecisionManagerWebhook.cs index 7e64a61..b643394 100644 --- a/Source/Samples/Webhooks/CreateNewWebhooks/CreateDecisionManagerWebhook.cs +++ b/Source/Samples/Webhooks/CreateNewWebhooks/CreateDecisionManagerWebhook.cs @@ -11,7 +11,7 @@ public class CreateDecisionManagerWebhook { public static void Run() { - string name = "My Custom Webhook"; + /*string name = "My Custom Webhook"; string description = "Sample Webhook from Developer Center"; string organizationId = ""; string productId = "decisionManager"; @@ -59,7 +59,7 @@ public static void Run() NotificationScope: notificationScope, RetryPolicy: retryPolicy, SecurityPolicy: securityPolicy - ); + );*/ try { @@ -67,7 +67,7 @@ public static void Run() var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new CreateNewWebhooksApi(clientConfig); - apiInstance.CreateWebhookSubscription(requestObj); + //apiInstance.CreateWebhookSubscription(requestObj); } catch (Exception e) { diff --git a/Source/Samples/Webhooks/CreateNewWebhooks/CreateFraudManagementWebhook.cs b/Source/Samples/Webhooks/CreateNewWebhooks/CreateFraudManagementWebhook.cs index f8d1fb8..0393390 100644 --- a/Source/Samples/Webhooks/CreateNewWebhooks/CreateFraudManagementWebhook.cs +++ b/Source/Samples/Webhooks/CreateNewWebhooks/CreateFraudManagementWebhook.cs @@ -11,7 +11,7 @@ public class CreateFraudManagementWebhook { public static void Run() { - string name = "My Custom Webhook"; + /*string name = "My Custom Webhook"; string description = "Sample Webhook from Developer Center"; string organizationId = ""; string productId = "fraudManagementEssentials"; @@ -61,7 +61,7 @@ public static void Run() NotificationScope: notificationScope, RetryPolicy: retryPolicy, SecurityPolicy: securityPolicy - ); + );*/ try { @@ -69,7 +69,7 @@ public static void Run() var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new CreateNewWebhooksApi(clientConfig); - apiInstance.CreateWebhookSubscription(requestObj); + //apiInstance.CreateWebhookSubscription(requestObj); } catch (Exception e) { diff --git a/Source/Samples/Webhooks/CreateNewWebhooks/CreateInvoicingWebhook.cs b/Source/Samples/Webhooks/CreateNewWebhooks/CreateInvoicingWebhook.cs index a3d57d9..c8f9aa8 100644 --- a/Source/Samples/Webhooks/CreateNewWebhooks/CreateInvoicingWebhook.cs +++ b/Source/Samples/Webhooks/CreateNewWebhooks/CreateInvoicingWebhook.cs @@ -11,7 +11,7 @@ public class CreateInvoicingWebhook { public static void Run() { - string name = "My Custom Webhook"; + /*string name = "My Custom Webhook"; string description = "Sample Webhook from Developer Center"; string organizationId = ""; string productId = "customerInvoicing"; @@ -63,14 +63,14 @@ public static void Run() RetryPolicy: retryPolicy, SecurityPolicy: securityPolicy ); - +*/ try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new CreateNewWebhooksApi(clientConfig); - apiInstance.CreateWebhookSubscription(requestObj); + //apiInstance.CreateWebhookSubscription(requestObj); } catch (Exception e) { diff --git a/Source/Samples/Webhooks/CreateNewWebhooks/CreateOutageAndKeyExpirationNotificationWebhook.cs b/Source/Samples/Webhooks/CreateNewWebhooks/CreateOutageAndKeyExpirationNotificationWebhook.cs index a95a830..a07cd1b 100644 --- a/Source/Samples/Webhooks/CreateNewWebhooks/CreateOutageAndKeyExpirationNotificationWebhook.cs +++ b/Source/Samples/Webhooks/CreateNewWebhooks/CreateOutageAndKeyExpirationNotificationWebhook.cs @@ -11,7 +11,7 @@ public class CreateOutageAndKeyExpirationNotificationWebhook { public static void Run() { - string name = "My Custom Webhook"; + /*string name = "My Custom Webhook"; string description = "Sample Webhook from Developer Center"; string organizationId = ""; string productId = "cns"; @@ -70,7 +70,7 @@ public static void Run() catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); - } + }*/ } } } \ No newline at end of file diff --git a/Source/Samples/Webhooks/CreateNewWebhooks/CreateRecurringBillingWebhook.cs b/Source/Samples/Webhooks/CreateNewWebhooks/CreateRecurringBillingWebhook.cs index efa95b5..71c777f 100644 --- a/Source/Samples/Webhooks/CreateNewWebhooks/CreateRecurringBillingWebhook.cs +++ b/Source/Samples/Webhooks/CreateNewWebhooks/CreateRecurringBillingWebhook.cs @@ -11,7 +11,7 @@ public class CreateRecurringBillingWebhook { public static void Run() { - string name = "My Custom Webhook"; + /*string name = "My Custom Webhook"; string description = "Sample Webhook from Developer Center"; string organizationId = ""; string productId = "recurringBilling"; @@ -71,7 +71,7 @@ public static void Run() catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); - } + }*/ } } } \ No newline at end of file diff --git a/Source/Samples/Webhooks/CreateNewWebhooks/CreateSecureAcceptanceWebhook.cs b/Source/Samples/Webhooks/CreateNewWebhooks/CreateSecureAcceptanceWebhook.cs index fc244d1..10a6100 100644 --- a/Source/Samples/Webhooks/CreateNewWebhooks/CreateSecureAcceptanceWebhook.cs +++ b/Source/Samples/Webhooks/CreateNewWebhooks/CreateSecureAcceptanceWebhook.cs @@ -11,7 +11,7 @@ public class CreateSecureAcceptanceWebhook { public static void Run() { - string name = "My Custom Webhook"; + /*string name = "My Custom Webhook"; string description = "Sample Webhook from Developer Center"; string organizationId = ""; string productId = "secureAcceptance"; @@ -71,7 +71,7 @@ public static void Run() catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); - } + }*/ } } } \ No newline at end of file diff --git a/Source/Samples/Webhooks/CreateNewWebhooks/CreateTerminalManagementWebhook.cs b/Source/Samples/Webhooks/CreateNewWebhooks/CreateTerminalManagementWebhook.cs index ab92489..3b3af1e 100644 --- a/Source/Samples/Webhooks/CreateNewWebhooks/CreateTerminalManagementWebhook.cs +++ b/Source/Samples/Webhooks/CreateNewWebhooks/CreateTerminalManagementWebhook.cs @@ -11,7 +11,7 @@ public class CreateTerminalManagementWebhook { public static void Run() { - string name = "My Custom Webhook"; + /*string name = "My Custom Webhook"; string description = "Sample Webhook from Developer Center"; string organizationId = ""; string productId = "terminalManagement"; @@ -71,7 +71,7 @@ public static void Run() catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); - } + }*/ } } } \ No newline at end of file diff --git a/Source/Samples/Webhooks/CreateNewWebhooks/CreateTokenManagementWebhook.cs b/Source/Samples/Webhooks/CreateNewWebhooks/CreateTokenManagementWebhook.cs index 2054cff..71c8a67 100644 --- a/Source/Samples/Webhooks/CreateNewWebhooks/CreateTokenManagementWebhook.cs +++ b/Source/Samples/Webhooks/CreateNewWebhooks/CreateTokenManagementWebhook.cs @@ -11,7 +11,7 @@ public class CreateTokenManagementWebhook { public static void Run() { - string name = "My Custom Webhook"; + /*string name = "My Custom Webhook"; string description = "Sample Webhook from Developer Center"; string organizationId = ""; string productId = "tokenManagement"; @@ -73,7 +73,7 @@ public static void Run() catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); - } + }*/ } } } \ No newline at end of file diff --git a/Source/Samples/Webhooks/CreateNewWebhooks/CreateWebhookUsingOAuthWithClientCredentials.cs b/Source/Samples/Webhooks/CreateNewWebhooks/CreateWebhookUsingOAuthWithClientCredentials.cs index 7410a0a..708cf59 100644 --- a/Source/Samples/Webhooks/CreateNewWebhooks/CreateWebhookUsingOAuthWithClientCredentials.cs +++ b/Source/Samples/Webhooks/CreateNewWebhooks/CreateWebhookUsingOAuthWithClientCredentials.cs @@ -11,7 +11,7 @@ public class CreateWebhookUsingOAuthWithClientCredentials { public static void Run() { - string name = "My Custom Webhook"; + /*string name = "My Custom Webhook"; string description = "Sample Webhook from Developer Center"; string organizationId = ""; string productId = "terminalManagement"; @@ -79,7 +79,7 @@ public static void Run() catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); - } + }*/ } } } \ No newline at end of file diff --git a/Source/Samples/Webhooks/CreateNewWebhooks/CreateWebhookUsingOAuthWithJWT.cs b/Source/Samples/Webhooks/CreateNewWebhooks/CreateWebhookUsingOAuthWithJWT.cs index aca9051..fe05403 100644 --- a/Source/Samples/Webhooks/CreateNewWebhooks/CreateWebhookUsingOAuthWithJWT.cs +++ b/Source/Samples/Webhooks/CreateNewWebhooks/CreateWebhookUsingOAuthWithJWT.cs @@ -11,7 +11,7 @@ public class CreateWebhookUsingOAuthWithJWT { public static void Run() { - string name = "My Custom Webhook"; + /*string name = "My Custom Webhook"; string description = "Sample Webhook from Developer Center"; string organizationId = ""; string productId = "terminalManagement"; @@ -91,7 +91,7 @@ public static void Run() catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); - } + }*/ } } } \ No newline at end of file diff --git a/Source/Samples/Webhooks/CreateNewWebhooks/FindProductsYouCanSubscribeTo.cs b/Source/Samples/Webhooks/CreateNewWebhooks/FindProductsYouCanSubscribeTo.cs index d20fa61..3e347d0 100644 --- a/Source/Samples/Webhooks/CreateNewWebhooks/FindProductsYouCanSubscribeTo.cs +++ b/Source/Samples/Webhooks/CreateNewWebhooks/FindProductsYouCanSubscribeTo.cs @@ -19,7 +19,7 @@ public static void Run() var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new CreateNewWebhooksApi(clientConfig); - apiInstance.FindProductsToSubscribe(organizationId); + //apiInstance.FindProductsToSubscribe(organizationId); } catch (Exception e) { diff --git a/Source/Samples/Webhooks/ManageWebhooks/DeleteWebhookSubscription.cs b/Source/Samples/Webhooks/ManageWebhooks/DeleteWebhookSubscription.cs index df80d99..5d4cb6e 100644 --- a/Source/Samples/Webhooks/ManageWebhooks/DeleteWebhookSubscription.cs +++ b/Source/Samples/Webhooks/ManageWebhooks/DeleteWebhookSubscription.cs @@ -17,7 +17,7 @@ public static void Run(string webhookId) var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new ManageWebhooksApi(clientConfig); - apiInstance.DeleteWebhookSubscription(webhookId); + //apiInstance.DeleteWebhookSubscription(webhookId); } catch (Exception e) { diff --git a/Source/Samples/Webhooks/ManageWebhooks/GetDetailsOnAllCreatedWebhooks.cs b/Source/Samples/Webhooks/ManageWebhooks/GetDetailsOnAllCreatedWebhooks.cs index 3f95284..fde54d5 100644 --- a/Source/Samples/Webhooks/ManageWebhooks/GetDetailsOnAllCreatedWebhooks.cs +++ b/Source/Samples/Webhooks/ManageWebhooks/GetDetailsOnAllCreatedWebhooks.cs @@ -9,7 +9,7 @@ namespace Cybersource_rest_samples_dotnet.Samples.Webhooks.ManageWebhooks { public class GetDetailsOnAllCreatedWebhooks { - public static List Run() + /*public static List Run() { // QUERY PARAMETERS string organizationId = "testrest"; @@ -30,6 +30,6 @@ public static List Run() Console.WriteLine("Exception on calling the API : " + e.Message); return null; } - } + }*/ } } \ No newline at end of file diff --git a/Source/Samples/Webhooks/ManageWebhooks/GetDetailsOnSingleWebhook.cs b/Source/Samples/Webhooks/ManageWebhooks/GetDetailsOnSingleWebhook.cs index 4e91f33..be2a37d 100644 --- a/Source/Samples/Webhooks/ManageWebhooks/GetDetailsOnSingleWebhook.cs +++ b/Source/Samples/Webhooks/ManageWebhooks/GetDetailsOnSingleWebhook.cs @@ -18,7 +18,7 @@ public static void Run() var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new ManageWebhooksApi(clientConfig); - apiInstance.GetWebhookSubscriptionById(webhookId); + //apiInstance.GetWebhookSubscriptionById(webhookId); } catch (Exception e) { diff --git a/Source/Samples/Webhooks/ManageWebhooks/ReplayFailedTransactionsBySetStartAndEndTime.cs b/Source/Samples/Webhooks/ManageWebhooks/ReplayFailedTransactionsBySetStartAndEndTime.cs index 96440a5..de54dbc 100644 --- a/Source/Samples/Webhooks/ManageWebhooks/ReplayFailedTransactionsBySetStartAndEndTime.cs +++ b/Source/Samples/Webhooks/ManageWebhooks/ReplayFailedTransactionsBySetStartAndEndTime.cs @@ -11,36 +11,36 @@ public class ReplayFailedTransactionsBySetStartAndEndTime { public static void Run() { - string webhookId = ""; - string byDeliveryStatusStatus = "FAILED"; - var byDeliveryStatusStartTime = DateTime.Parse("2021-01-01T15:05:52.284+05:30"); - var byDeliveryStatusEndTime = DateTime.Parse("2021-01-02T03:05:52.284+05:30"); - string byDeliveryStatusProductId = "tokenManagement"; - string byDeliveryStatusEventType = "tms.token.created"; - Nrtfv1webhookswebhookIdreplaysByDeliveryStatus byDeliveryStatus = new Nrtfv1webhookswebhookIdreplaysByDeliveryStatus( - Status: byDeliveryStatusStatus, - StartTime: byDeliveryStatusStartTime, - EndTime: byDeliveryStatusEndTime, - ProductId: byDeliveryStatusProductId, - EventType: byDeliveryStatusEventType - ); + /*string webhookId = ""; + string byDeliveryStatusStatus = "FAILED"; + var byDeliveryStatusStartTime = DateTime.Parse("2021-01-01T15:05:52.284+05:30"); + var byDeliveryStatusEndTime = DateTime.Parse("2021-01-02T03:05:52.284+05:30"); + string byDeliveryStatusProductId = "tokenManagement"; + string byDeliveryStatusEventType = "tms.token.created"; + Nrtfv1webhookswebhookIdreplaysByDeliveryStatus byDeliveryStatus = new Nrtfv1webhookswebhookIdreplaysByDeliveryStatus( + Status: byDeliveryStatusStatus, + StartTime: byDeliveryStatusStartTime, + EndTime: byDeliveryStatusEndTime, + ProductId: byDeliveryStatusProductId, + EventType: byDeliveryStatusEventType + ); - var requestObj = new ReplayWebhooksRequest( - ByDeliveryStatus: byDeliveryStatus - ); + var requestObj = new ReplayWebhooksRequest( + ByDeliveryStatus: byDeliveryStatus + ); - try - { - var configDictionary = new Configuration().GetConfiguration(); - var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); + try + { + var configDictionary = new Configuration().GetConfiguration(); + var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); - var apiInstance = new ReplayWebhooksApi(clientConfig); - apiInstance.ReplayPreviousWebhooks(webhookId, requestObj); - } - catch (Exception e) - { - Console.WriteLine("Exception on calling the API : " + e.Message); - } - } + var apiInstance = new ReplayWebhooksApi(clientConfig); + apiInstance.ReplayPreviousWebhooks(webhookId, requestObj); + } + catch (Exception e) + { + Console.WriteLine("Exception on calling the API : " + e.Message); + } +*/ } } } \ No newline at end of file diff --git a/Source/Samples/Webhooks/ManageWebhooks/ReplayFailedTransactionsInLast24Hours.cs b/Source/Samples/Webhooks/ManageWebhooks/ReplayFailedTransactionsInLast24Hours.cs index c69927d..a87a196 100644 --- a/Source/Samples/Webhooks/ManageWebhooks/ReplayFailedTransactionsInLast24Hours.cs +++ b/Source/Samples/Webhooks/ManageWebhooks/ReplayFailedTransactionsInLast24Hours.cs @@ -11,7 +11,7 @@ public class ReplayFailedTransactionsInLast24Hours { public static void Run() { - string webhookId = ""; + /*string webhookId = ""; string byDeliveryStatusStatus = "FAILED"; int byDeliveryStatusHoursBack = 24; string byDeliveryStatusProductId = "tokenManagement"; @@ -38,7 +38,7 @@ public static void Run() catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); - } + }*/ } } } \ No newline at end of file diff --git a/Source/Samples/Webhooks/ManageWebhooks/ReplaySpecificListOfTransactions.cs b/Source/Samples/Webhooks/ManageWebhooks/ReplaySpecificListOfTransactions.cs index 391f032..b779558 100644 --- a/Source/Samples/Webhooks/ManageWebhooks/ReplaySpecificListOfTransactions.cs +++ b/Source/Samples/Webhooks/ManageWebhooks/ReplaySpecificListOfTransactions.cs @@ -11,7 +11,7 @@ public class ReplaySpecificListOfTransactions { public static void Run() { - string webhookId = ""; + /*string webhookId = ""; List byTransactionTraceIdentifiers = new List (); byTransactionTraceIdentifiers.Add("1f1d0bf4-9299-418d-99d8-faa3313829f1"); byTransactionTraceIdentifiers.Add("d19fb205-20e5-43a2-867e-bd0f574b771e"); @@ -33,7 +33,7 @@ public static void Run() catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); - } + }*/ } } } \ No newline at end of file diff --git a/Source/Samples/Webhooks/ManageWebhooks/UpdateWebhook.cs b/Source/Samples/Webhooks/ManageWebhooks/UpdateWebhook.cs index 190ca04..9ab98de 100644 --- a/Source/Samples/Webhooks/ManageWebhooks/UpdateWebhook.cs +++ b/Source/Samples/Webhooks/ManageWebhooks/UpdateWebhook.cs @@ -11,7 +11,7 @@ public class UpdateWebhook { public static void Run() { - string webhookId = ""; + /*string webhookId = ""; string name = "My Sample Webhook"; string description = "Update to my sample webhook"; string organizationId = ""; @@ -51,7 +51,7 @@ public static void Run() catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); - } + }*/ } } } \ No newline at end of file From c60000e1b2b3aff986d2a68c10504cdecf8c26a7 Mon Sep 17 00:00:00 2001 From: gaubansa Date: Thu, 10 Apr 2025 16:07:58 +0530 Subject: [PATCH 09/10] version update --- cybersource-rest-samples-csharp.csproj | 4 ++-- cybersource-rest-samples-netcore.csproj | 4 ++-- packages.config | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cybersource-rest-samples-csharp.csproj b/cybersource-rest-samples-csharp.csproj index c4376b4..7c4b8e2 100644 --- a/cybersource-rest-samples-csharp.csproj +++ b/cybersource-rest-samples-csharp.csproj @@ -38,13 +38,13 @@ Source\lib\net461\ApiSdk.dll - packages\CyberSource.Authentication.0.0.0.22\lib\AuthenticationSdk.dll + packages\CyberSource.Authentication.0.0.0.23\lib\AuthenticationSdk.dll packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll - packages\CyberSource.Rest.Client.0.0.1.50\lib\cybersource-rest-client-dotnet.dll + packages\CyberSource.Rest.Client.0.0.1.51\lib\cybersource-rest-client-dotnet.dll packages\jose-jwt.4.1.0\lib\net461\jose-jwt.dll diff --git a/cybersource-rest-samples-netcore.csproj b/cybersource-rest-samples-netcore.csproj index e559e2c..75a2155 100644 --- a/cybersource-rest-samples-netcore.csproj +++ b/cybersource-rest-samples-netcore.csproj @@ -39,8 +39,8 @@ - - + + diff --git a/packages.config b/packages.config index f140ab0..1b09241 100644 --- a/packages.config +++ b/packages.config @@ -1,7 +1,7 @@  - - + + From 43d2cbdf3724351eb53d4d0c0d31106ef2b0fde9 Mon Sep 17 00:00:00 2001 From: gaubansa Date: Thu, 10 Apr 2025 16:28:30 +0530 Subject: [PATCH 10/10] removing app config --- Source/App.config | 62 -------------------------- cybersource-rest-samples-csharp.csproj | 3 -- 2 files changed, 65 deletions(-) delete mode 100644 Source/App.config diff --git a/Source/App.config b/Source/App.config deleted file mode 100644 index 16eb9d1..0000000 --- a/Source/App.config +++ /dev/null @@ -1,62 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/cybersource-rest-samples-csharp.csproj b/cybersource-rest-samples-csharp.csproj index 7c4b8e2..7709777 100644 --- a/cybersource-rest-samples-csharp.csproj +++ b/cybersource-rest-samples-csharp.csproj @@ -427,9 +427,6 @@ Always - - Designer - Designer Always