コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: VoidCredit.cs プロジェクト: oscartorresGL/unaPay
        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);
            }
        }
コード例 #3
0
        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);
            }
        }