public static PtsV2PaymentsReversalsPost201Response Run()
        {
            AuthorizationForTimeoutReversalFlow.Run();
            var clientReferenceInformationTransactionId = SampleCode.TimeoutReversalTransactionId;
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                TransactionId: clientReferenceInformationTransactionId
                );

            string reversalInformationAmountDetailsTotalAmount = "102.21";

            Ptsv2paymentsidreversalsReversalInformationAmountDetails reversalInformationAmountDetails = new Ptsv2paymentsidreversalsReversalInformationAmountDetails(
                TotalAmount: reversalInformationAmountDetailsTotalAmount
                );

            string reversalInformationReason = "Testing";

            Ptsv2paymentsidreversalsReversalInformation reversalInformation = new Ptsv2paymentsidreversalsReversalInformation(
                AmountDetails: reversalInformationAmountDetails,
                Reason: reversalInformationReason
                );

            var requestObj = new MitReversalRequest(
                ClientReferenceInformation: clientReferenceInformation,
                ReversalInformation: reversalInformation
                );

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

                var apiInstance = new ReversalApi(clientConfig);
                PtsV2PaymentsReversalsPost201Response result = apiInstance.MitReversal(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
        public static PtsV2PaymentsRefundPost201Response Run()
        {
            SimpleAuthorizationInternet.CaptureTrueForProcessPayment = true;
            var id = SimpleAuthorizationInternet.Run().Id;

            string clientReferenceInformationCode = "TC50171_3";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string orderInformationAmountDetailsTotalAmount = "10";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsidcapturesOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsidcapturesOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            Ptsv2paymentsidrefundsOrderInformation orderInformation = new Ptsv2paymentsidrefundsOrderInformation(
                AmountDetails: orderInformationAmountDetails
                );

            var requestObj = new RefundPaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                OrderInformation: orderInformation
                );

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

                var apiInstance = new RefundApi(clientConfig);
                PtsV2PaymentsRefundPost201Response result = apiInstance.RefundPayment(requestObj, id);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
Beispiel #3
0
        public static void Run()
        {
            var capturePaymentId = CapturePayment.Run().Id;

            var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation("test_refund_capture");
            var amountDetailsObj    = new Ptsv2paymentsidcapturesOrderInformationAmountDetails("102.21", "USD");
            var orderInformationObj = new Ptsv2paymentsidrefundsOrderInformation(amountDetailsObj);
            var requestBody         = new RefundCaptureRequest(clientReferenceInformationObj, null, null, 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);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "TC_1231223";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            bool processingInformationCapture = false;

            if (CaptureTrueForProcessPayment)
            {
                processingInformationCapture = true;
            }
            string processingInformationPaymentSolution = "001";
            Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
                Capture: processingInformationCapture,
                PaymentSolution: processingInformationPaymentSolution
                );

            string paymentInformationTokenizedCardNumber          = "4111111111111111";
            string paymentInformationTokenizedCardExpirationMonth = "12";
            string paymentInformationTokenizedCardExpirationYear  = "2031";
            string paymentInformationTokenizedCardCryptogram      = "AceY+igABPs3jdwNaDg3MAACAAA=";
            string paymentInformationTokenizedCardTransactionType = "1";
            Ptsv2paymentsPaymentInformationTokenizedCard paymentInformationTokenizedCard = new Ptsv2paymentsPaymentInformationTokenizedCard(
                Number: paymentInformationTokenizedCardNumber,
                ExpirationMonth: paymentInformationTokenizedCardExpirationMonth,
                ExpirationYear: paymentInformationTokenizedCardExpirationYear,
                Cryptogram: paymentInformationTokenizedCardCryptogram,
                TransactionType: paymentInformationTokenizedCardTransactionType
                );

            Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
                TokenizedCard: paymentInformationTokenizedCard
                );

            string orderInformationAmountDetailsTotalAmount = "10";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            string orderInformationBillToFirstName          = "John";
            string orderInformationBillToLastName           = "Deo";
            string orderInformationBillToAddress1           = "901 Metro Center Blvd";
            string orderInformationBillToLocality           = "Foster City";
            string orderInformationBillToAdministrativeArea = "CA";
            string orderInformationBillToPostalCode         = "94404";
            string orderInformationBillToCountry            = "US";
            string orderInformationBillToEmail       = "*****@*****.**";
            string orderInformationBillToPhoneNumber = "6504327113";
            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 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);
            }
        }
        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);
            }
        }
Beispiel #6
0
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "123456";
            string clientReferenceInformationPartnerOriginalTransactionId = "510be4aef90711e6acbc7d88388d803d";
            Ptsv2paymentsClientReferenceInformationPartner clientReferenceInformationPartner = new Ptsv2paymentsClientReferenceInformationPartner(
                OriginalTransactionId: clientReferenceInformationPartnerOriginalTransactionId
                );

            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode,
                Partner: clientReferenceInformationPartner
                );

            bool   processingInformationCapture                      = false;
            string processingInformationCommerceIndicator            = "retail";
            Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
                Capture: processingInformationCapture,
                CommerceIndicator: processingInformationCommerceIndicator
                );

            string orderInformationAmountDetailsTotalAmount = "100.00";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation(
                AmountDetails: orderInformationAmountDetails
                );

            int    pointOfSaleInformationCatLevel           = 1;
            string pointOfSaleInformationEntryMode          = "contact";
            int    pointOfSaleInformationTerminalCapability = 4;
            string pointOfSaleInformationEmvTags            = "9F3303204000950500000000009F3704518823719F100706011103A000009F26081E1756ED0E2134E29F36020015820200009C01009F1A0208409A030006219F02060000000020005F2A0208409F0306000000000000";
            int    pointOfSaleInformationEmvCardholderVerificationMethodUsed = 2;
            string pointOfSaleInformationEmvCardSequenceNumber = "1";
            bool   pointOfSaleInformationEmvFallback           = false;
            Ptsv2paymentsPointOfSaleInformationEmv pointOfSaleInformationEmv = new Ptsv2paymentsPointOfSaleInformationEmv(
                Tags: pointOfSaleInformationEmvTags,
                CardholderVerificationMethodUsed: pointOfSaleInformationEmvCardholderVerificationMethodUsed,
                CardSequenceNumber: pointOfSaleInformationEmvCardSequenceNumber,
                Fallback: pointOfSaleInformationEmvFallback
                );

            string pointOfSaleInformationTrackData = "%B4111111111111111^TEST/CYBS         ^2012121019761100      00868000000?;";

            List <string> pointOfSaleInformationCardholderVerificationMethod = new List <string>();

            pointOfSaleInformationCardholderVerificationMethod.Add("pin");
            pointOfSaleInformationCardholderVerificationMethod.Add("signature");

            List <string> pointOfSaleInformationTerminalInputCapability = new List <string>();

            pointOfSaleInformationTerminalInputCapability.Add("contact");
            pointOfSaleInformationTerminalInputCapability.Add("contactless");
            pointOfSaleInformationTerminalInputCapability.Add("keyed");
            pointOfSaleInformationTerminalInputCapability.Add("swiped");
            string pointOfSaleInformationTerminalCardCaptureCapability = "1";
            string pointOfSaleInformationDeviceId = "123lkjdIOBK34981slviLI39bj";
            string pointOfSaleInformationEncryptedKeySerialNumber      = "01043191";
            Ptsv2paymentsPointOfSaleInformation pointOfSaleInformation = new Ptsv2paymentsPointOfSaleInformation(
                CatLevel: pointOfSaleInformationCatLevel,
                EntryMode: pointOfSaleInformationEntryMode,
                TerminalCapability: pointOfSaleInformationTerminalCapability,
                Emv: pointOfSaleInformationEmv,
                TrackData: pointOfSaleInformationTrackData,
                CardholderVerificationMethod: pointOfSaleInformationCardholderVerificationMethod,
                TerminalInputCapability: pointOfSaleInformationTerminalInputCapability,
                TerminalCardCaptureCapability: pointOfSaleInformationTerminalCardCaptureCapability,
                DeviceId: pointOfSaleInformationDeviceId,
                EncryptedKeySerialNumber: pointOfSaleInformationEncryptedKeySerialNumber
                );

            var requestObj = new CreatePaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                ProcessingInformation: processingInformation,
                OrderInformation: orderInformation,
                PointOfSaleInformation: pointOfSaleInformation
                );

            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);
            }
        }
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "TC50171_3";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string orderInformationAmountDetailsTotalAmount = "102.21";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            string orderInformationBillToFirstName          = "RTS";
            string orderInformationBillToLastName           = "VDP";
            string orderInformationBillToAddress1           = "201 S. Division St.";
            string orderInformationBillToLocality           = "Ann Arbor";
            string orderInformationBillToAdministrativeArea = "MI";
            string orderInformationBillToPostalCode         = "48104-2201";
            string orderInformationBillToCountry            = "US";
            string orderInformationBillToDistrict           = "MI";
            string orderInformationBillToBuildingNumber     = "123";
            string orderInformationBillToEmail       = "*****@*****.**";
            string orderInformationBillToPhoneNumber = "999999999";
            Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo(
                FirstName: orderInformationBillToFirstName,
                LastName: orderInformationBillToLastName,
                Address1: orderInformationBillToAddress1,
                Locality: orderInformationBillToLocality,
                AdministrativeArea: orderInformationBillToAdministrativeArea,
                PostalCode: orderInformationBillToPostalCode,
                Country: orderInformationBillToCountry,
                District: orderInformationBillToDistrict,
                BuildingNumber: orderInformationBillToBuildingNumber,
                Email: orderInformationBillToEmail,
                PhoneNumber: orderInformationBillToPhoneNumber
                );

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

            string tokenInformationTransientTokenJwt       = "eyJraWQiOiIwN0JwSE9abkhJM3c3UVAycmhNZkhuWE9XQlhwa1ZHTiIsImFsZyI6IlJTMjU2In0.eyJkYXRhIjp7ImV4cGlyYXRpb25ZZWFyIjoiMjAyMCIsIm51bWJlciI6IjQxMTExMVhYWFhYWDExMTEiLCJleHBpcmF0aW9uTW9udGgiOiIxMCIsInR5cGUiOiIwMDEifSwiaXNzIjoiRmxleC8wNyIsImV4cCI6MTU5MTc0NjAyNCwidHlwZSI6Im1mLTAuMTEuMCIsImlhdCI6MTU5MTc0NTEyNCwianRpIjoiMUMzWjdUTkpaVjI4OVM5MTdQM0JHSFM1T0ZQNFNBRERCUUtKMFFKMzMzOEhRR0MwWTg0QjVFRTAxREU4NEZDQiJ9.cfwzUMJf115K2T9-wE_A_k2jZptXlovls8-fKY0muO8YzGatE5fu9r6aC4q7n0YOvEU6G7XdH4ASG32mWnYu-kKlqN4IY_cquRJeUvV89ZPZ5WTttyrgVH17LSTE2EvwMawKNYnjh0lJwqYJ51cLnJiVlyqTdEAv3DJ3vInXP1YeQjLX5_vF-OWEuZfJxahHfUdsjeGhGaaOGVMUZJSkzpTu9zDLTvpb1px3WGGPu8FcHoxrcCGGpcKk456AZgYMBSHNjr-pPkRr3Dnd7XgNF6shfzIPbcXeWDYPTpS4PNY8ZsWKx8nFQIeROMWCSxIZOmu3Wt71KN9iK6DfOPro7w";
            Ptsv2paymentsTokenInformation tokenInformation = new Ptsv2paymentsTokenInformation(
                TransientTokenJwt: tokenInformationTransientTokenJwt
                );

            var requestObj = new CreatePaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                OrderInformation: orderInformation,
                TokenInformation: tokenInformation
                );

            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);
            }
        }
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "TC50171_3";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );


            List <string> processingInformationActionList = new List <string>();

            processingInformationActionList.Add("TOKEN_CREATE");

            List <string> processingInformationActionTokenTypes = new List <string>();

            processingInformationActionTokenTypes.Add("customer");
            processingInformationActionTokenTypes.Add("paymentInstrument");
            processingInformationActionTokenTypes.Add("shippingAddress");
            bool processingInformationCapture = false;
            Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
                ActionList: processingInformationActionList,
                ActionTokenTypes: processingInformationActionTokenTypes,
                Capture: processingInformationCapture
                );

            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       = "*****@*****.**";
            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
                );

            string orderInformationShipToFirstName                     = "John";
            string orderInformationShipToLastName                      = "Doe";
            string orderInformationShipToAddress1                      = "1 Market St";
            string orderInformationShipToLocality                      = "san francisco";
            string orderInformationShipToAdministrativeArea            = "CA";
            string orderInformationShipToPostalCode                    = "94105";
            string orderInformationShipToCountry                       = "US";
            Ptsv2paymentsOrderInformationShipTo orderInformationShipTo = new Ptsv2paymentsOrderInformationShipTo(
                FirstName: orderInformationShipToFirstName,
                LastName: orderInformationShipToLastName,
                Address1: orderInformationShipToAddress1,
                Locality: orderInformationShipToLocality,
                AdministrativeArea: orderInformationShipToAdministrativeArea,
                PostalCode: orderInformationShipToPostalCode,
                Country: orderInformationShipToCountry
                );

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

            string tokenInformationTransientTokenJwt       = "eyJraWQiOiIwOHAwWWVyTTBJSnpvYlpMMENyalVsRnQ4QXlIdXc4TSIsImFsZyI6IlJTMjU2In0.eyJkYXRhIjp7ImV4cGlyYXRpb25ZZWFyIjoiMjAyMyIsIm51bWJlciI6IjQxMTExMVhYWFhYWDExMTEiLCJleHBpcmF0aW9uTW9udGgiOiIwNyIsInR5cGUiOiIwMDEifSwiaXNzIjoiRmxleC8wOCIsImV4cCI6MTU5OTU2MDU3OSwidHlwZSI6Im1mLTAuMTEuMCIsImlhdCI6MTU5OTU1OTY3OSwianRpIjoiMUUyWjRMNjYxMENPSExHUUIxMlBXQk5OUjE1WFUwU1ROTTQ5UlA5WlJaUEtBVE1NOVo5UzVGNTc1QjgzNEFDOCJ9.Va9-Rf3nBtxHXVvb1M-mQqzOa86Uj5wY3qejFmYmMiSjMOSF_DpNepjOYat-8WqdacmhUemtwQfOtDEVDpd6X3YpBNydZ4dzVt3baq2Z1KAH1lEJxyvAyHX77tnO-wzfZrQm-HH-qtrGmt6ZvuNknvYPxwPcqnOryGaIQE70znBK6GVf3vgdE0xedxAQWl97ZfpZKafVjCvtGIMuJ0QdtrqM0OmtkoDKrqmXGzKlfSbpEep_yaDdpRkX_NdOgiVomRb3P6nqkT1OO0Czzu4HyxaMfVyCgGUAHd_SjXrwqM2vuchE4Scg1DicjWAJxXb_tZoAuUU0EN8HwVnrHiFAiQ";
            Ptsv2paymentsTokenInformation tokenInformation = new Ptsv2paymentsTokenInformation(
                TransientTokenJwt: tokenInformationTransientTokenJwt
                );

            var requestObj = new CreatePaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                ProcessingInformation: processingInformation,
                OrderInformation: orderInformation,
                TokenInformation: tokenInformation
                );

            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);
            }
        }
        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);
            }
        }
Beispiel #10
0
        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";
            string paymentInformationCardSecurityCode    = "123";
            Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard(
                Number: paymentInformationCardNumber,
                ExpirationMonth: paymentInformationCardExpirationMonth,
                ExpirationYear: paymentInformationCardExpirationYear,
                SecurityCode: paymentInformationCardSecurityCode
                );

            Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
                Card: paymentInformationCard
                );

            string orderInformationAmountDetailsTotalAmount      = "2325.00";
            string orderInformationAmountDetailsCurrency         = "USD";
            string orderInformationAmountDetailsServiceFeeAmount = "30.0";
            Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency,
                ServiceFeeAmount: orderInformationAmountDetailsServiceFeeAmount
                );

            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       = "*****@*****.**";
            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
                );

            string merchantInformationServiceFeeDescriptorName    = "Vacations Service Fee";
            string merchantInformationServiceFeeDescriptorContact = "8009999999";
            string merchantInformationServiceFeeDescriptorState   = "CA";
            Ptsv2paymentsMerchantInformationServiceFeeDescriptor merchantInformationServiceFeeDescriptor = new Ptsv2paymentsMerchantInformationServiceFeeDescriptor(
                Name: merchantInformationServiceFeeDescriptorName,
                Contact: merchantInformationServiceFeeDescriptorContact,
                State: merchantInformationServiceFeeDescriptorState
                );

            Ptsv2paymentsMerchantInformation merchantInformation = new Ptsv2paymentsMerchantInformation(
                ServiceFeeDescriptor: merchantInformationServiceFeeDescriptor
                );

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

            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);
            }
        }
        public static PtsV2CreditsPost201Response Run()
        {
            string clientReferenceInformationCode = "demomerchant";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string processingInformationCommerceIndicator           = "retail";
            Ptsv2creditsProcessingInformation processingInformation = new Ptsv2creditsProcessingInformation(
                CommerceIndicator: processingInformationCommerceIndicator
                );

            string paymentInformationCardExpirationMonth = "12";
            string paymentInformationCardExpirationYear  = "2050";
            Ptsv2paymentsidrefundsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsidrefundsPaymentInformationCard(
                ExpirationMonth: paymentInformationCardExpirationMonth,
                ExpirationYear: paymentInformationCardExpirationYear
                );

            string paymentInformationFluidDataDescriptor = "Ymx1ZWZpbg==";
            string paymentInformationFluidDataValue      = "02d700801f3c20008383252a363031312a2a2a2a2a2a2a2a303030395e46444d53202020202020202020202020202020202020202020205e323231322a2a2a2a2a2a2a2a3f2a3b363031312a2a2a2a2a2a2a2a303030393d323231322a2a2a2a2a2a2a2a3f2a7a75ad15d25217290c54b3d9d1c3868602136c68d339d52d98423391f3e631511d548fff08b414feac9ff6c6dede8fb09bae870e4e32f6f462d6a75fa0a178c3bd18d0d3ade21bc7a0ea687a2eef64551751e502d97cb98dc53ea55162cdfa395431323439323830303762994901000001a000731a8003";
            Ptsv2paymentsPaymentInformationFluidData paymentInformationFluidData = new Ptsv2paymentsPaymentInformationFluidData(
                Descriptor: paymentInformationFluidDataDescriptor,
                Value: paymentInformationFluidDataValue
                );

            Ptsv2paymentsidrefundsPaymentInformation paymentInformation = new Ptsv2paymentsidrefundsPaymentInformation(
                Card: paymentInformationCard,
                FluidData: paymentInformationFluidData
                );

            string orderInformationAmountDetailsTotalAmount = "100.00";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsidcapturesOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsidcapturesOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            string orderInformationBillToFirstName          = "John";
            string orderInformationBillToLastName           = "Deo";
            string orderInformationBillToAddress1           = "201 S. Division St.";
            string orderInformationBillToLocality           = "Ann Arbor";
            string orderInformationBillToAdministrativeArea = "MI";
            string orderInformationBillToPostalCode         = "48104-2201";
            string orderInformationBillToCountry            = "US";
            string orderInformationBillToEmail       = "*****@*****.**";
            string orderInformationBillToPhoneNumber = "999999999";
            Ptsv2paymentsidcapturesOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsidcapturesOrderInformationBillTo(
                FirstName: orderInformationBillToFirstName,
                LastName: orderInformationBillToLastName,
                Address1: orderInformationBillToAddress1,
                Locality: orderInformationBillToLocality,
                AdministrativeArea: orderInformationBillToAdministrativeArea,
                PostalCode: orderInformationBillToPostalCode,
                Country: orderInformationBillToCountry,
                Email: orderInformationBillToEmail,
                PhoneNumber: orderInformationBillToPhoneNumber
                );

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

            int    pointOfSaleInformationCatLevel                      = 1;
            string pointOfSaleInformationEntryMode                     = "keyed";
            int    pointOfSaleInformationTerminalCapability            = 2;
            Ptsv2paymentsPointOfSaleInformation pointOfSaleInformation = new Ptsv2paymentsPointOfSaleInformation(
                CatLevel: pointOfSaleInformationCatLevel,
                EntryMode: pointOfSaleInformationEntryMode,
                TerminalCapability: pointOfSaleInformationTerminalCapability
                );

            var requestObj = new CreateCreditRequest(
                ClientReferenceInformation: clientReferenceInformation,
                ProcessingInformation: processingInformation,
                PaymentInformation: paymentInformation,
                OrderInformation: orderInformation,
                PointOfSaleInformation: pointOfSaleInformation
                );

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

                var apiInstance = new CreditApi(clientConfig);
                PtsV2CreditsPost201Response 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()
        {
            string clientReferenceInformationCode = "TC_123122";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            bool processingInformationCapture = false;

            if (CaptureTrueForProcessPayment)
            {
                processingInformationCapture = true;
            }

            string processingInformationCommerceIndicator            = "vbv";
            Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
                Capture: processingInformationCapture,
                CommerceIndicator: processingInformationCommerceIndicator
                );

            string paymentInformationTokenizedCardNumber          = "4111111111111111";
            string paymentInformationTokenizedCardExpirationMonth = "12";
            string paymentInformationTokenizedCardExpirationYear  = "2031";
            string paymentInformationTokenizedCardTransactionType = "1";
            Ptsv2paymentsPaymentInformationTokenizedCard paymentInformationTokenizedCard = new Ptsv2paymentsPaymentInformationTokenizedCard(
                Number: paymentInformationTokenizedCardNumber,
                ExpirationMonth: paymentInformationTokenizedCardExpirationMonth,
                ExpirationYear: paymentInformationTokenizedCardExpirationYear,
                TransactionType: paymentInformationTokenizedCardTransactionType
                );

            Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
                TokenizedCard: paymentInformationTokenizedCard
                );

            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       = "*****@*****.**";
            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
                );

            string consumerAuthenticationInformationCavv = "AAABCSIIAAAAAAACcwgAEMCoNh+=";
            string consumerAuthenticationInformationXid  = "T1Y0OVcxMVJJdkI0WFlBcXptUzE=";
            Ptsv2paymentsConsumerAuthenticationInformation consumerAuthenticationInformation = new Ptsv2paymentsConsumerAuthenticationInformation(
                Cavv: consumerAuthenticationInformationCavv,
                Xid: consumerAuthenticationInformationXid
                );

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

            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);
            }
        }
Beispiel #13
0
        public static PtsV2PaymentsCapturesPost201Response Run()
        {
            var processPaymentId = ProcessPayment.Run().Id;

            var requestObj = new CapturePaymentRequest();

            var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation
            {
                Code = "test_capture"
            };

            requestObj.ClientReferenceInformation = clientReferenceInformationObj;

            var pointOfSaleInformationObj = new Ptsv2paymentsidcapturesPointOfSaleInformation
            {
                CardPresent        = false,
                CatLevel           = "6",
                TerminalCapability = "4"
            };

            requestObj.PointOfSaleInformation = pointOfSaleInformationObj;

            var orderInformationObj = new Ptsv2paymentsidcapturesOrderInformation();

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

            orderInformationObj.BillTo = billToObj;

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

            orderInformationObj.AmountDetails = amountDetailsObj;

            requestObj.OrderInformation = orderInformationObj;

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

                var result = apiInstance.CapturePayment(requestObj, processPaymentId);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
                return(null);
            }
        }
Beispiel #14
0
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "123456";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            bool   processingInformationCapture           = false;
            string processingInformationCommerceIndicator = "retail";
            bool   processingInformationAuthorizationOptionsPartialAuthIndicator = true;
            bool   processingInformationAuthorizationOptionsIgnoreAvsResult      = false;
            bool   processingInformationAuthorizationOptionsIgnoreCvResult       = false;
            Ptsv2paymentsProcessingInformationAuthorizationOptions processingInformationAuthorizationOptions = new Ptsv2paymentsProcessingInformationAuthorizationOptions(
                PartialAuthIndicator: processingInformationAuthorizationOptionsPartialAuthIndicator,
                IgnoreAvsResult: processingInformationAuthorizationOptionsIgnoreAvsResult,
                IgnoreCvResult: processingInformationAuthorizationOptionsIgnoreCvResult
                );

            Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
                Capture: processingInformationCapture,
                CommerceIndicator: processingInformationCommerceIndicator,
                AuthorizationOptions: processingInformationAuthorizationOptions
                );

            string orderInformationAmountDetailsTotalAmount = "100.00";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation(
                AmountDetails: orderInformationAmountDetails
                );

            int    pointOfSaleInformationCatLevel              = 1;
            string pointOfSaleInformationEntryMode             = "contact";
            int    pointOfSaleInformationTerminalCapability    = 4;
            string pointOfSaleInformationEmvTags               = "9F3303204000950500000000009F3704518823719F100706011103A000009F26081E1756ED0E2134E29F36020015820200009C01009F1A0208409A030006219F02060000000020005F2A0208409F0306000000000000";
            string pointOfSaleInformationEmvCardSequenceNumber = "1";
            bool   pointOfSaleInformationEmvFallback           = false;
            Ptsv2paymentsPointOfSaleInformationEmv pointOfSaleInformationEmv = new Ptsv2paymentsPointOfSaleInformationEmv(
                Tags: pointOfSaleInformationEmvTags,
                CardSequenceNumber: pointOfSaleInformationEmvCardSequenceNumber,
                Fallback: pointOfSaleInformationEmvFallback
                );

            string pointOfSaleInformationTrackData = "%B4111111111111111^TEST/CYBS         ^2012121019761100      00868000000?;";
            Ptsv2paymentsPointOfSaleInformation pointOfSaleInformation = new Ptsv2paymentsPointOfSaleInformation(
                CatLevel: pointOfSaleInformationCatLevel,
                EntryMode: pointOfSaleInformationEntryMode,
                TerminalCapability: pointOfSaleInformationTerminalCapability,
                Emv: pointOfSaleInformationEmv,
                TrackData: pointOfSaleInformationTrackData
                );

            var requestObj = new CreatePaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                ProcessingInformation: processingInformation,
                OrderInformation: orderInformation,
                PointOfSaleInformation: pointOfSaleInformation
                );

            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);
            }
        }
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "TC50171_3";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );


            List <string> processingInformationActionList = new List <string>();

            processingInformationActionList.Add("CONSUMER_AUTHENTICATION");
            bool processingInformationCapture = false;
            Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
                ActionList: processingInformationActionList,
                Capture: processingInformationCapture
                );

            string paymentInformationCardNumber          = "4000000000001091";
            string paymentInformationCardExpirationMonth = "12";
            string paymentInformationCardExpirationYear  = "2023";
            Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard(
                Number: paymentInformationCardNumber,
                ExpirationMonth: paymentInformationCardExpirationMonth,
                ExpirationYear: paymentInformationCardExpirationYear
                );

            Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
                Card: paymentInformationCard
                );

            string orderInformationAmountDetailsTotalAmount = "100.00";
            string orderInformationAmountDetailsCurrency    = "usd";
            Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            string orderInformationBillToFirstName          = "John";
            string orderInformationBillToLastName           = "Smith";
            string orderInformationBillToAddress1           = "201 S. Division St._1";
            string orderInformationBillToAddress2           = "Suite 500";
            string orderInformationBillToLocality           = "Foster City";
            string orderInformationBillToAdministrativeArea = "CA";
            string orderInformationBillToPostalCode         = "94404";
            string orderInformationBillToCountry            = "US";
            string orderInformationBillToEmail       = "*****@*****.**";
            string orderInformationBillToPhoneNumber = "6504327113";
            Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo(
                FirstName: orderInformationBillToFirstName,
                LastName: orderInformationBillToLastName,
                Address1: orderInformationBillToAddress1,
                Address2: orderInformationBillToAddress2,
                Locality: orderInformationBillToLocality,
                AdministrativeArea: orderInformationBillToAdministrativeArea,
                PostalCode: orderInformationBillToPostalCode,
                Country: orderInformationBillToCountry,
                Email: orderInformationBillToEmail,
                PhoneNumber: orderInformationBillToPhoneNumber
                );

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

            string consumerAuthenticationInformationRequestorId = "123123197675";
            string consumerAuthenticationInformationReferenceId = "CybsCruiseTester-8ac0b02f";
            Ptsv2paymentsConsumerAuthenticationInformation consumerAuthenticationInformation = new Ptsv2paymentsConsumerAuthenticationInformation(
                RequestorId: consumerAuthenticationInformationRequestorId,
                ReferenceId: consumerAuthenticationInformationReferenceId
                );

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

            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);
            }
        }
        public static PtsV2CreditsPost201Response Run()
        {
            var requestObj = new CreateCreditRequest();

            var v2PaymentsClientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation
            {
                Code = "12345678"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            var v2PaymentsOrderInformationObj           = new Ptsv2paymentsidrefundsOrderInformation();
            var v2paymentsOrderInformationBillToCompany = new Ptsv2paymentsOrderInformationBillToCompany
            {
                Name = "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 v2PaymentsPaymentInformationCardObj = new Ptsv2paymentsidrefundsPaymentInformationCard
            {
                ExpirationYear  = "2031",
                Number          = "4111111111111111",
                ExpirationMonth = "03"
            };

            v2PaymentsPaymentInformationObj.Card = v2PaymentsPaymentInformationCardObj;

            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()
        {
            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);
            }
        }
Beispiel #18
0
        public static PtsV2CreditsPost201Response Run()
        {
            string clientReferenceInformationCode = "12345678";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string paymentInformationCardExpirationMonth = "03";
            string paymentInformationCardExpirationYear  = "2031";
            string paymentInformationCardType            = "001";
            Ptsv2paymentsidrefundsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsidrefundsPaymentInformationCard(
                ExpirationMonth: paymentInformationCardExpirationMonth,
                ExpirationYear: paymentInformationCardExpirationYear,
                Type: paymentInformationCardType
                );

            string paymentInformationInstrumentIdentifierId = "7010000000016241111";
            Ptsv2paymentsPaymentInformationInstrumentIdentifier paymentInformationInstrumentIdentifier = new Ptsv2paymentsPaymentInformationInstrumentIdentifier(
                Id: paymentInformationInstrumentIdentifierId
                );

            Ptsv2paymentsidrefundsPaymentInformation paymentInformation = new Ptsv2paymentsidrefundsPaymentInformation(
                Card: paymentInformationCard,
                InstrumentIdentifier: paymentInformationInstrumentIdentifier
                );

            string orderInformationAmountDetailsTotalAmount = "200";
            string orderInformationAmountDetailsCurrency    = "usd";
            Ptsv2paymentsidcapturesOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsidcapturesOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            string orderInformationBillToFirstName          = "John";
            string orderInformationBillToLastName           = "Deo";
            string orderInformationBillToAddress1           = "900 Metro Center Blvd";
            string orderInformationBillToLocality           = "Foster City";
            string orderInformationBillToAdministrativeArea = "CA";
            string orderInformationBillToPostalCode         = "48104-2201";
            string orderInformationBillToCountry            = "US";
            string orderInformationBillToEmail       = "*****@*****.**";
            string orderInformationBillToPhoneNumber = "9321499232";
            Ptsv2paymentsidcapturesOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsidcapturesOrderInformationBillTo(
                FirstName: orderInformationBillToFirstName,
                LastName: orderInformationBillToLastName,
                Address1: orderInformationBillToAddress1,
                Locality: orderInformationBillToLocality,
                AdministrativeArea: orderInformationBillToAdministrativeArea,
                PostalCode: orderInformationBillToPostalCode,
                Country: orderInformationBillToCountry,
                Email: orderInformationBillToEmail,
                PhoneNumber: orderInformationBillToPhoneNumber
                );

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

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

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

                var apiInstance = new CreditApi(clientConfig);
                PtsV2CreditsPost201Response result = apiInstance.CreateCredit(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
Beispiel #19
0
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "123456";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            bool   processingInformationCapture                      = true;
            string processingInformationCommerceIndicator            = "retail";
            Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
                Capture: processingInformationCapture,
                CommerceIndicator: processingInformationCommerceIndicator
                );

            string paymentInformationCardNumber          = "4111111111111111";
            string paymentInformationCardExpirationMonth = "12";
            string paymentInformationCardExpirationYear  = "2031";
            string paymentInformationCardSecurityCode    = "123";
            Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard(
                Number: paymentInformationCardNumber,
                ExpirationMonth: paymentInformationCardExpirationMonth,
                ExpirationYear: paymentInformationCardExpirationYear,
                SecurityCode: paymentInformationCardSecurityCode
                );

            Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
                Card: paymentInformationCard
                );

            string orderInformationAmountDetailsTotalAmount = "100.00";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation(
                AmountDetails: orderInformationAmountDetails
                );

            string pointOfSaleInformationEntryMode                     = "keyed";
            int    pointOfSaleInformationTerminalCapability            = 2;
            Ptsv2paymentsPointOfSaleInformation pointOfSaleInformation = new Ptsv2paymentsPointOfSaleInformation(
                EntryMode: pointOfSaleInformationEntryMode,
                TerminalCapability: pointOfSaleInformationTerminalCapability
                );

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

            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);
            }
        }
Beispiel #20
0
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "TC50171_14";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            bool processingInformationCapture = false;

            if (CaptureTrueForProcessPayment)
            {
                processingInformationCapture = true;
            }

            string processingInformationPurchaseLevel = "3";
            Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
                Capture: processingInformationCapture,
                PurchaseLevel: processingInformationPurchaseLevel
                );

            string paymentInformationCardNumber          = "4111111111111111";
            string paymentInformationCardExpirationMonth = "12";
            string paymentInformationCardExpirationYear  = "2031";
            string paymentInformationCardType            = "001";
            string paymentInformationCardSecurityCode    = "123";
            Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard(
                Number: paymentInformationCardNumber,
                ExpirationMonth: paymentInformationCardExpirationMonth,
                ExpirationYear: paymentInformationCardExpirationYear,
                Type: paymentInformationCardType,
                SecurityCode: paymentInformationCardSecurityCode
                );

            Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
                Card: paymentInformationCard
                );

            string orderInformationAmountDetailsTotalAmount = "100.00";
            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       = "*****@*****.**";
            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
                );


            List <Ptsv2paymentsOrderInformationLineItems> orderInformationLineItems = new List <Ptsv2paymentsOrderInformationLineItems>();
            string orderInformationLineItemsProductCode1       = "default";
            int    orderInformationLineItemsQuantity1          = 10;
            string orderInformationLineItemsUnitPrice1         = "10.00";
            string orderInformationLineItemsTotalAmount1       = "100";
            bool   orderInformationLineItemsAmountIncludesTax1 = false;
            bool   orderInformationLineItemsDiscountApplied1   = false;

            orderInformationLineItems.Add(new Ptsv2paymentsOrderInformationLineItems(
                                              ProductCode: orderInformationLineItemsProductCode1,
                                              Quantity: orderInformationLineItemsQuantity1,
                                              UnitPrice: orderInformationLineItemsUnitPrice1,
                                              TotalAmount: orderInformationLineItemsTotalAmount1,
                                              AmountIncludesTax: orderInformationLineItemsAmountIncludesTax1,
                                              DiscountApplied: orderInformationLineItemsDiscountApplied1
                                              ));

            string orderInformationInvoiceDetailsPurchaseOrderNumber = "LevelIII Auth Po";
            Ptsv2paymentsOrderInformationInvoiceDetails orderInformationInvoiceDetails = new Ptsv2paymentsOrderInformationInvoiceDetails(
                PurchaseOrderNumber: orderInformationInvoiceDetailsPurchaseOrderNumber
                );

            Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation(
                AmountDetails: orderInformationAmountDetails,
                BillTo: orderInformationBillTo,
                LineItems: orderInformationLineItems,
                InvoiceDetails: orderInformationInvoiceDetails
                );

            var requestObj = new CreatePaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                ProcessingInformation: processingInformation,
                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);
            }
        }
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "54323007";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string paymentInformationCardNumber          = "4444444444444448";
            string paymentInformationCardExpirationMonth = "12";
            string paymentInformationCardExpirationYear  = "2020";
            Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard(
                Number: paymentInformationCardNumber,
                ExpirationMonth: paymentInformationCardExpirationMonth,
                ExpirationYear: paymentInformationCardExpirationYear
                );

            Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
                Card: paymentInformationCard
                );

            string orderInformationAmountDetailsTotalAmount = "144.14";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            string orderInformationBillToFirstName          = "James";
            string orderInformationBillToLastName           = "Smith";
            string orderInformationBillToAddress1           = "96, powers street";
            string orderInformationBillToLocality           = "Clearwater milford";
            string orderInformationBillToAdministrativeArea = "NH";
            string orderInformationBillToPostalCode         = "03055";
            string orderInformationBillToCountry            = "US";
            string orderInformationBillToEmail       = "*****@*****.**";
            string orderInformationBillToPhoneNumber = "7606160717";
            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
                );

            string deviceInformationHostName                 = "host.com";
            string deviceInformationIpAddress                = "64.124.61.215";
            string deviceInformationUserAgent                = "Chrome";
            string deviceInformationHttpBrowserEmail         = "*****@*****.**";
            Ptsv2paymentsDeviceInformation deviceInformation = new Ptsv2paymentsDeviceInformation(
                HostName: deviceInformationHostName,
                IpAddress: deviceInformationIpAddress,
                UserAgent: deviceInformationUserAgent,
                HttpBrowserEmail: deviceInformationHttpBrowserEmail
                );

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

            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);
            }
        }
        public static PtsV2PaymentsPost201Response Run()
        {
            var processingInformationObj = new Ptsv2paymentsProcessingInformation()
            {
                CommerceIndicator = "internet"
            };

            var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation {
                Code = "test_payment"
            };

            var pointOfSaleInformationObj = new Ptsv2paymentsPointOfSaleInformation
            {
                CatLevel           = 6,
                TerminalCapability = 4
            };

            var orderInformationObj = new Ptsv2paymentsOrderInformation();

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

            orderInformationObj.BillTo = billToObj;

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

            orderInformationObj.AmountDetails = amountDetailsObj;

            var paymentInformationObj = new Ptsv2paymentsPaymentInformation();

            var cardObj = new Ptsv2paymentsPaymentInformationCard
            {
                ExpirationYear  = "2031",
                Number          = "4111111111111111",
                SecurityCode    = "123",
                ExpirationMonth = "12"
            };

            paymentInformationObj.Card = cardObj;

            var requestObj = new CreatePaymentRequest
            {
                ProcessingInformation      = processingInformationObj,
                PaymentInformation         = paymentInformationObj,
                ClientReferenceInformation = clientReferenceInformationObj,
                PointOfSaleInformation     = pointOfSaleInformationObj,
                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 = "123456";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            bool   processingInformationCapture           = true;
            string processingInformationCommerceIndicator = "retail";
            bool   processingInformationAuthorizationOptionsPartialAuthIndicator = true;
            bool   processingInformationAuthorizationOptionsIgnoreAvsResult      = false;
            bool   processingInformationAuthorizationOptionsIgnoreCvResult       = false;
            Ptsv2paymentsProcessingInformationAuthorizationOptions processingInformationAuthorizationOptions = new Ptsv2paymentsProcessingInformationAuthorizationOptions(
                PartialAuthIndicator: processingInformationAuthorizationOptionsPartialAuthIndicator,
                IgnoreAvsResult: processingInformationAuthorizationOptionsIgnoreAvsResult,
                IgnoreCvResult: processingInformationAuthorizationOptionsIgnoreCvResult
                );

            Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
                Capture: processingInformationCapture,
                CommerceIndicator: processingInformationCommerceIndicator,
                AuthorizationOptions: processingInformationAuthorizationOptions
                );

            string orderInformationAmountDetailsTotalAmount = "100.00";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation(
                AmountDetails: orderInformationAmountDetails
                );

            string pointOfSaleInformationEntryMode                     = "swiped";
            int    pointOfSaleInformationTerminalCapability            = 2;
            string pointOfSaleInformationTrackData                     = "%B38000000000006^TEST/CYBS         ^2012121019761100      00868000000?;38000000000006=20121210197611868000?";
            Ptsv2paymentsPointOfSaleInformation pointOfSaleInformation = new Ptsv2paymentsPointOfSaleInformation(
                EntryMode: pointOfSaleInformationEntryMode,
                TerminalCapability: pointOfSaleInformationTerminalCapability,
                TrackData: pointOfSaleInformationTrackData
                );

            var requestObj = new CreatePaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                ProcessingInformation: processingInformation,
                OrderInformation: orderInformation,
                PointOfSaleInformation: pointOfSaleInformation
                );

            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);
            }
        }
Beispiel #24
0
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "TSYS_Eh_FE_01";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string paymentInformationCardNumber          = "4111111111111111";
            string paymentInformationCardExpirationMonth = "11";
            string paymentInformationCardExpirationYear  = "2025";
            Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard(
                Number: paymentInformationCardNumber,
                ExpirationMonth: paymentInformationCardExpirationMonth,
                ExpirationYear: paymentInformationCardExpirationYear
                );

            Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
                Card: paymentInformationCard
                );

            string orderInformationAmountDetailsTotalAmount = "10";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            string orderInformationBillToFirstName          = "JSON";
            string orderInformationBillToLastName           = "RTS";
            string orderInformationBillToAddress1           = "201 S. Division St._1";
            string orderInformationBillToLocality           = "Foster City";
            string orderInformationBillToAdministrativeArea = "CA";
            string orderInformationBillToPostalCode         = "94404";
            string orderInformationBillToCountry            = "US";
            string orderInformationBillToEmail       = "*****@*****.**";
            string orderInformationBillToPhoneNumber = "6504327113";
            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,
                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);
            }
        }
Beispiel #25
0
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "1234567890";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string paymentInformationCardNumber          = "4111111111111111";
            string paymentInformationCardExpirationMonth = "12";
            string paymentInformationCardExpirationYear  = "2031";
            string paymentInformationCardSecurityCode    = "123";
            Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard(
                Number: paymentInformationCardNumber,
                ExpirationMonth: paymentInformationCardExpirationMonth,
                ExpirationYear: paymentInformationCardExpirationYear,
                SecurityCode: paymentInformationCardSecurityCode
                );

            Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation(
                Card: paymentInformationCard
                );

            string orderInformationAmountDetailsTotalAmount = "7012.00";
            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       = "*****@*****.**";
            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
                );

            int  pointOfSaleInformationCatLevel             = 6;
            int  pointOfSaleInformationTerminalCapability   = 4;
            bool pointOfSaleInformationEmvFallback          = false;
            int  pointOfSaleInformationEmvFallbackCondition = 1;
            Ptsv2paymentsPointOfSaleInformationEmv pointOfSaleInformationEmv = new Ptsv2paymentsPointOfSaleInformationEmv(
                Fallback: pointOfSaleInformationEmvFallback,
                FallbackCondition: pointOfSaleInformationEmvFallbackCondition
                );

            Ptsv2paymentsPointOfSaleInformation pointOfSaleInformation = new Ptsv2paymentsPointOfSaleInformation(
                CatLevel: pointOfSaleInformationCatLevel,
                TerminalCapability: pointOfSaleInformationTerminalCapability,
                Emv: pointOfSaleInformationEmv
                );

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

            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);
            }
        }
Beispiel #26
0
        public ActionResult Receipt()
        {
            dynamic flexObj = Request.Params["flexResponse"];


            /**
             * Processing Authorization Request
             * Code developed from CyberSource Rest Samples csharp
             * https://github.com/CyberSource/cybersource-rest-samples-csharp
             */

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

            var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation {
                Code = "test_payment"
            };


            var orderInformationObj = new Ptsv2paymentsOrderInformation();

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

            orderInformationObj.BillTo = billToObj;

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

            orderInformationObj.AmountDetails = amountDetailsObj;


            // Passing Transient token

            var transientTokenObj = new Ptsv2paymentsTokenInformation {
                TransientTokenJwt = flexObj
            };


            var requestObj = new CreatePaymentRequest
            {
                ProcessingInformation      = processingInformationObj,
                ClientReferenceInformation = clientReferenceInformationObj,
                OrderInformation           = orderInformationObj,
                TokenInformation           = transientTokenObj
            };


            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);

                //Making response pretty & passing to page
                ViewBag.paymentResponse = result;
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
                return(null);
            }



            return(View());
        }
        public static PtsV2PaymentsRefundPost201Response Run()
        {
            ProcessPayment.CaptureTrueForProcessPayment = true;

            var processPaymentId = ProcessPayment.Run().Id;

            var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation("test_refund_payment");

            var amountDetailsObj = new Ptsv2paymentsidcapturesOrderInformationAmountDetails
            {
                TotalAmount      = "2325.00",
                Currency         = "USD",
                ServiceFeeAmount = "30.00"
            };

            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 RefundPaymentRequest
            {
                PaymentInformation         = paymentInformationObj,
                ClientReferenceInformation = clientReferenceInformationObj,
                OrderInformation           = orderInformationObj
            };

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

                var result = apiInstance.RefundPayment(requestBody, processPaymentId);

                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 = "123456";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            bool   processingInformationCapture                      = false;
            string processingInformationCommerceIndicator            = "retail";
            Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
                Capture: processingInformationCapture,
                CommerceIndicator: processingInformationCommerceIndicator
                );

            string orderInformationAmountDetailsTotalAmount = "100.00";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation(
                AmountDetails: orderInformationAmountDetails
                );

            int    pointOfSaleInformationCatLevel              = 2;
            string pointOfSaleInformationEntryMode             = "contactless";
            int    pointOfSaleInformationTerminalCapability    = 2;
            string pointOfSaleInformationEmvCardSequenceNumber = "999";
            bool   pointOfSaleInformationEmvFallback           = false;
            Ptsv2paymentsPointOfSaleInformationEmv pointOfSaleInformationEmv = new Ptsv2paymentsPointOfSaleInformationEmv(
                CardSequenceNumber: pointOfSaleInformationEmvCardSequenceNumber,
                Fallback: pointOfSaleInformationEmvFallback
                );

            string pointOfSaleInformationTrackData = "%B38000000000006^TEST/CYBS         ^2012121019761100      00868000000?;38000000000006=20121210197611868000?";
            Ptsv2paymentsPointOfSaleInformation pointOfSaleInformation = new Ptsv2paymentsPointOfSaleInformation(
                CatLevel: pointOfSaleInformationCatLevel,
                EntryMode: pointOfSaleInformationEntryMode,
                TerminalCapability: pointOfSaleInformationTerminalCapability,
                Emv: pointOfSaleInformationEmv,
                TrackData: pointOfSaleInformationTrackData
                );

            var requestObj = new CreatePaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                ProcessingInformation: processingInformation,
                OrderInformation: orderInformation,
                PointOfSaleInformation: pointOfSaleInformation
                );

            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);
            }
        }
        public static PtsV2PaymentsPost201Response Run()
        {
            string clientReferenceInformationCode = "TC50171_3";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );


            List <string> processingInformationActionList = new List <string>();

            processingInformationActionList.Add("TOKEN_CREATE");

            List <string> processingInformationActionTokenTypes = new List <string>();

            processingInformationActionTokenTypes.Add("instrumentIdentifier");
            bool   processingInformationCapture                      = false;
            string processingInformationCommerceIndicator            = "internet";
            Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation(
                ActionList: processingInformationActionList,
                ActionTokenTypes: processingInformationActionTokenTypes,
                Capture: processingInformationCapture,
                CommerceIndicator: processingInformationCommerceIndicator
                );

            string paymentInformationCardNumber          = "4111111111111111";
            string paymentInformationCardExpirationMonth = "12";
            string paymentInformationCardExpirationYear  = "2031";
            string paymentInformationCardSecurityCode    = "123";
            Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard(
                Number: paymentInformationCardNumber,
                ExpirationMonth: paymentInformationCardExpirationMonth,
                ExpirationYear: paymentInformationCardExpirationYear,
                SecurityCode: paymentInformationCardSecurityCode
                );

            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       = "*****@*****.**";
            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
                );

            string orderInformationShipToFirstName                     = "John";
            string orderInformationShipToLastName                      = "Doe";
            string orderInformationShipToAddress1                      = "1 Market St";
            string orderInformationShipToLocality                      = "san francisco";
            string orderInformationShipToAdministrativeArea            = "CA";
            string orderInformationShipToPostalCode                    = "94105";
            string orderInformationShipToCountry                       = "US";
            Ptsv2paymentsOrderInformationShipTo orderInformationShipTo = new Ptsv2paymentsOrderInformationShipTo(
                FirstName: orderInformationShipToFirstName,
                LastName: orderInformationShipToLastName,
                Address1: orderInformationShipToAddress1,
                Locality: orderInformationShipToLocality,
                AdministrativeArea: orderInformationShipToAdministrativeArea,
                PostalCode: orderInformationShipToPostalCode,
                Country: orderInformationShipToCountry
                );

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

            var requestObj = new CreatePaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                ProcessingInformation: processingInformation,
                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);
            }
        }
        public static PtsV2CreditsPost201Response Run()
        {
            string clientReferenceInformationCode = "12345678";
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string paymentInformationCustomerId = "AB695DA801DD1BB6E05341588E0A3BDC";
            Ptsv2paymentsPaymentInformationCustomer paymentInformationCustomer = new Ptsv2paymentsPaymentInformationCustomer(
                Id: paymentInformationCustomerId
                );

            string paymentInformationPaymentInstrumentId = "AB6A54B982A6FCB6E05341588E0A3935";
            Ptsv2paymentsPaymentInformationPaymentInstrument paymentInformationPaymentInstrument = new Ptsv2paymentsPaymentInformationPaymentInstrument(
                Id: paymentInformationPaymentInstrumentId
                );

            string paymentInformationShippingAddressId = "AB6A54B97C00FCB6E05341588E0A3935";
            Ptsv2paymentsPaymentInformationShippingAddress paymentInformationShippingAddress = new Ptsv2paymentsPaymentInformationShippingAddress(
                Id: paymentInformationShippingAddressId
                );

            Ptsv2paymentsidrefundsPaymentInformation paymentInformation = new Ptsv2paymentsidrefundsPaymentInformation(
                Customer: paymentInformationCustomer,
                PaymentInstrument: paymentInformationPaymentInstrument,
                ShippingAddress: paymentInformationShippingAddress
                );

            string orderInformationAmountDetailsTotalAmount = "200";
            string orderInformationAmountDetailsCurrency    = "usd";
            Ptsv2paymentsidcapturesOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsidcapturesOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            Ptsv2paymentsidrefundsOrderInformation orderInformation = new Ptsv2paymentsidrefundsOrderInformation(
                AmountDetails: orderInformationAmountDetails
                );

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

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

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