public static PtsV2PaymentsVoidsPost201Response Run() { var id = Credit.Run().Id; string clientReferenceInformationCode = "test_void"; Ptsv2paymentsidreversalsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsidreversalsClientReferenceInformation( Code: clientReferenceInformationCode ); var requestObj = new VoidCreditRequest( ClientReferenceInformation: clientReferenceInformation ); try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new VoidApi(clientConfig); PtsV2PaymentsVoidsPost201Response result = apiInstance.VoidCredit(requestObj, id); Console.WriteLine(result); return(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); return(null); } }
public static void Run() { var processCreditId = ProcessCredit.Run().Id; var clientReferenceInformationObj = new Ptsv2paymentsidreversalsClientReferenceInformation("test_credit_void"); var requestBody = new VoidCreditRequest(clientReferenceInformationObj); try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new VoidApi(clientConfig); var result = apiInstance.VoidCredit(requestBody, processCreditId); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API: " + e.Message); } }
public static void Run(IReadOnlyDictionary <string, string> configDictionary) { var clientReferenceInformationObj = new V2paymentsidreversalsClientReferenceInformation("test_void"); var requestBody = new VoidCreditRequest(clientReferenceInformationObj); var merchantConfig = new MerchantConfig(configDictionary) { RequestType = "POST", RequestTarget = "/pts/v2/credits/5335461889256917903529/voids", RequestJsonData = JsonConvert.SerializeObject(requestBody) }; try { var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig); var apiInstance = new VoidApi(configurationSwagger); var result = apiInstance.VoidCredit(requestBody, "5335461889256917903529"); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API: " + e.Message); } }