public static PtsV2PaymentsRefundPost201Response Run()
        {
            var capturePaymentId = CapturePayment.Run().Id;

            var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation("test_refund_capture");

            var amountDetailsObj = new Ptsv2paymentsidcapturesOrderInformationAmountDetails("102.21", "USD");

            var billToObj = new Ptsv2paymentsidcapturesOrderInformationBillTo
            {
                Country            = "US",
                FirstName          = "John",
                LastName           = "Doe",
                Address1           = "1 Market St",
                PostalCode         = "94105",
                Locality           = "San Francisco",
                AdministrativeArea = "CA",
                Email = "*****@*****.**"
            };
            var orderInformationObj = new Ptsv2paymentsidrefundsOrderInformation(amountDetailsObj, billToObj);

            var bankAccountObj = new Ptsv2paymentsPaymentInformationBankAccount
            {
                Number      = "4100",
                Type        = "C",
                CheckNumber = "123456"
            };

            var bankObj = new Ptsv2paymentsPaymentInformationBank
            {
                Account = bankAccountObj
            };

            bankObj.RoutingNumber = "071923284";

            var paymentInformationObj = new Ptsv2paymentsidrefundsPaymentInformation();

            paymentInformationObj.Bank = bankObj;

            var requestBody = new RefundCaptureRequest(clientReferenceInformationObj, null, paymentInformationObj, orderInformationObj);

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

                var result = apiInstance.RefundCapture(requestBody, capturePaymentId);

                Console.WriteLine(result.Id);

                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
                return(null);
            }
        }
        public static PtsV2CreditsPost201Response Run()
        {
            var requestObj = new CreateCreditRequest();

            var v2PaymentsClientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation
            {
                Code = "TC46125-1"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;
            var processingInformation = new Ptsv2creditsProcessingInformation
            {
                CommerceIndicator = "internet"
            };

            requestObj.ProcessingInformation = processingInformation;

            var v2PaymentsOrderInformationObj           = new Ptsv2paymentsidrefundsOrderInformation();
            var v2paymentsOrderInformationBillToCompany = "Visa";
            var v2PaymentsOrderInformationBillToObj     = new Ptsv2paymentsidcapturesOrderInformationBillTo
            {
                Country            = "US",
                FirstName          = "John",
                LastName           = "Doe",
                PhoneNumber        = "4158880000",
                Address1           = "1 Market St",
                PostalCode         = "94105",
                Locality           = "san francisco",
                AdministrativeArea = "CA",
                Email = "*****@*****.**"
            };

            v2PaymentsOrderInformationBillToObj.Company = v2paymentsOrderInformationBillToCompany;
            v2PaymentsOrderInformationObj.BillTo        = v2PaymentsOrderInformationBillToObj;

            var v2PaymentsOrderInformationAmountDetailsObj = new Ptsv2paymentsidcapturesOrderInformationAmountDetails
            {
                TotalAmount      = "2325.00",
                Currency         = "usd",
                ServiceFeeAmount = "30.00"
            };

            v2PaymentsOrderInformationObj.AmountDetails = v2PaymentsOrderInformationAmountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var v2PaymentsPaymentInformationObj            = new Ptsv2paymentsidrefundsPaymentInformation();
            var v2paymentsPaymentInformationBankAccountObj = new Ptsv2paymentsPaymentInformationBankAccount
            {
                Number      = "4100",
                Type        = "C",
                CheckNumber = "123456"
            };
            var v2paymentsPaymentInformationBankObj = new Ptsv2paymentsPaymentInformationBank
            {
                RoutingNumber = "071923284"
            };

            v2paymentsPaymentInformationBankObj.Account = v2paymentsPaymentInformationBankAccountObj;
            v2PaymentsPaymentInformationObj.Bank        = v2paymentsPaymentInformationBankObj;
            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

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

                var result = apiInstance.CreateCredit(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
                return(null);
            }
        }
        public static PtsV2PaymentsPost201Response Run()
        {
            var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation {
                Code = "test_payment"
            };

            var processingInformationObj = new Ptsv2paymentsProcessingInformation()
            {
                CommerceIndicator = "internet"
            };

            var billToObj = new Ptsv2paymentsOrderInformationBillTo
            {
                Country            = "US",
                FirstName          = "John",
                LastName           = "Doe",
                Address1           = "1 Market St",
                PostalCode         = "94105",
                Locality           = "San Francisco",
                AdministrativeArea = "CA",
                Email = "*****@*****.**"
            };

            var amountDetailsObj = new Ptsv2paymentsOrderInformationAmountDetails
            {
                TotalAmount = "102.21",
                Currency    = "USD"
            };

            var orderInformationObj = new Ptsv2paymentsOrderInformation();

            orderInformationObj.BillTo        = billToObj;
            orderInformationObj.AmountDetails = amountDetailsObj;

            var bankAccountObj = new Ptsv2paymentsPaymentInformationBankAccount
            {
                Number      = "4100",
                Type        = "C",
                CheckNumber = "123456"
            };

            var bankObj = new Ptsv2paymentsPaymentInformationBank
            {
                Account = bankAccountObj
            };

            bankObj.RoutingNumber = "071923284";

            var paymentInformationObj = new Ptsv2paymentsPaymentInformation();

            paymentInformationObj.Bank = bankObj;

            var requestObj = new CreatePaymentRequest
            {
                ProcessingInformation      = processingInformationObj,
                PaymentInformation         = paymentInformationObj,
                ClientReferenceInformation = clientReferenceInformationObj,
                OrderInformation           = orderInformationObj
            };

            if (CaptureTrueForProcessPayment)
            {
                requestObj.ProcessingInformation.Capture = true;
            }

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

                var result = apiInstance.CreatePayment(requestObj);

                Console.WriteLine(result);

                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
                return(null);
            }
        }
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "TC50171_3";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );


            string paymentInformationBankAccountType   = "C";
            string paymentInformationBankAccountNumber = "4100";
            Ptsv2paymentsPaymentInformationBankAccount paymentInformationBankAccount = new Ptsv2paymentsPaymentInformationBankAccount(
                Type: paymentInformationBankAccountType,
                Number: paymentInformationBankAccountNumber
                );

            string paymentInformationBankRoutingNumber = "071923284";
            Ptsv2paymentsPaymentInformationBank paymentInformationBank = new Ptsv2paymentsPaymentInformationBank(
                Account: paymentInformationBankAccount,
                RoutingNumber: paymentInformationBankRoutingNumber
                );

            string paymentInformationPaymentTypeName = "CHECK";
            Ptsv2paymentsPaymentInformationPaymentType paymentInformationPaymentType = new Ptsv2paymentsPaymentInformationPaymentType(
                Name: paymentInformationPaymentTypeName
                );

            Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
                Bank: paymentInformationBank,
                PaymentType: paymentInformationPaymentType
                );

            string orderInformationAmountDetailsTotalAmount = "100";
            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 = "*****@*****.**";
            Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo(
                FirstName: orderInformationBillToFirstName,
                LastName: orderInformationBillToLastName,
                Address1: orderInformationBillToAddress1,
                Locality: orderInformationBillToLocality,
                AdministrativeArea: orderInformationBillToAdministrativeArea,
                PostalCode: orderInformationBillToPostalCode,
                Country: orderInformationBillToCountry,
                Email: orderInformationBillToEmail
                );

            Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation(
                AmountDetails: orderInformationAmountDetails,
                BillTo: orderInformationBillTo
                );

            var requestObj = new CreatePaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                PaymentInformation: paymentInformation,
                OrderInformation: orderInformation
                );

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

                var apiInstance = new PaymentsApi(clientConfig);
                PtsV2PaymentsPost201Response result = apiInstance.CreatePayment(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }