Example #1
0
        public static V1FileDetailsGet200Response Run()
        {
            var    startDate      = DateTime.ParseExact("2020-07-20", "yyyy-MM-dd", CultureInfo.InvariantCulture);
            var    endDate        = DateTime.ParseExact("2020-07-30", "yyyy-MM-dd", CultureInfo.InvariantCulture);
            string organizationId = "testrest";
            string name           = null;

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

                var apiInstance = new SecureFileShareApi(clientConfig);
                V1FileDetailsGet200Response result = apiInstance.GetFileDetail(startDate, endDate, organizationId, name);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
Example #2
0
        public static ShippingAddressListForCustomer Run()
        {
            string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC";
            string profileid       = null;
            long?  offset          = (long?)null;
            long?  limit           = (long?)null;

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

                var apiInstance = new CustomerShippingAddressApi(clientConfig);
                ShippingAddressListForCustomer result = apiInstance.GetCustomerShippingAddressesList(customerTokenId, profileid, offset, limit);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
        public static UmsV1UsersGet200Response Run()
        {
            string organizationId = "testrest";
            string userName       = null;
            string permissionId   = "CustomerProfileViewPermission";
            string roleId         = null;

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

                var apiInstance = new UserManagementApi(clientConfig);
                UmsV1UsersGet200Response result = apiInstance.GetUsers(organizationId, userName, permissionId, roleId);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
Example #4
0
        public static ReportingV3ChargebackDetailsGet200Response Run()
        {
            // QUERY PARAMETERS
            string organizationId = "testrest";
            var    startTime      = DateTime.ParseExact("2021-08-01T00:00:00Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture);
            var    endTime        = DateTime.ParseExact("2021-09-01T23:59:59Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture);

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

                var apiInstance = new ChargebackDetailsApi(clientConfig);
                ReportingV3ChargebackDetailsGet200Response result = apiInstance.GetChargebackDetails(startTime, endTime, organizationId);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
Example #5
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 void Run()
        {
            string instrumentIdentifierTokenId = "7010000000016241111";
            string processingInformationAuthorizationOptionsInitiatorMerchantInitiatedTransactionPreviousTransactionId = "123456789012345";
            Tmsv2customersEmbeddedDefaultPaymentInstrumentEmbeddedInstrumentIdentifierProcessingInformationAuthorizationOptionsInitiatorMerchantInitiatedTransaction processingInformationAuthorizationOptionsInitiatorMerchantInitiatedTransaction = new Tmsv2customersEmbeddedDefaultPaymentInstrumentEmbeddedInstrumentIdentifierProcessingInformationAuthorizationOptionsInitiatorMerchantInitiatedTransaction(
                PreviousTransactionId: processingInformationAuthorizationOptionsInitiatorMerchantInitiatedTransactionPreviousTransactionId
                );

            Tmsv2customersEmbeddedDefaultPaymentInstrumentEmbeddedInstrumentIdentifierProcessingInformationAuthorizationOptionsInitiator processingInformationAuthorizationOptionsInitiator = new Tmsv2customersEmbeddedDefaultPaymentInstrumentEmbeddedInstrumentIdentifierProcessingInformationAuthorizationOptionsInitiator(
                MerchantInitiatedTransaction: processingInformationAuthorizationOptionsInitiatorMerchantInitiatedTransaction
                );

            Tmsv2customersEmbeddedDefaultPaymentInstrumentEmbeddedInstrumentIdentifierProcessingInformationAuthorizationOptions processingInformationAuthorizationOptions = new Tmsv2customersEmbeddedDefaultPaymentInstrumentEmbeddedInstrumentIdentifierProcessingInformationAuthorizationOptions(
                Initiator: processingInformationAuthorizationOptionsInitiator
                );

            Tmsv2customersEmbeddedDefaultPaymentInstrumentEmbeddedInstrumentIdentifierProcessingInformation processingInformation = new Tmsv2customersEmbeddedDefaultPaymentInstrumentEmbeddedInstrumentIdentifierProcessingInformation(
                AuthorizationOptions: processingInformationAuthorizationOptions
                );

            var requestObj = new PatchInstrumentIdentifierRequest(
                ProcessingInformation: processingInformation
                );

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

                var apiInstance = new InstrumentIdentifierApi(clientConfig);
                apiInstance.PatchInstrumentIdentifier(instrumentIdentifierTokenId, requestObj);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
            }
        }
Example #7
0
        public static RiskV1AuthenticationSetupsPost201Response Run()
        {
            string clientReferenceInformationCode = "cybs_test";
            Riskv1decisionsClientReferenceInformation clientReferenceInformation = new Riskv1decisionsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string paymentInformationCustomerCustomerId = "AB695DA801DD1BB6E05341588E0A3BDC";
            Riskv1authenticationsetupsPaymentInformationCustomer paymentInformationCustomer = new Riskv1authenticationsetupsPaymentInformationCustomer(
                CustomerId: paymentInformationCustomerCustomerId
                );

            Riskv1authenticationsetupsPaymentInformation paymentInformation = new Riskv1authenticationsetupsPaymentInformation(
                Customer: paymentInformationCustomer
                );

            var requestObj = new PayerAuthSetupRequest(
                ClientReferenceInformation: clientReferenceInformation,
                PaymentInformation: paymentInformation
                );

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

                var apiInstance = new PayerAuthenticationApi(clientConfig);
                RiskV1AuthenticationSetupsPost201Response result = apiInstance.PayerAuthSetup(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
Example #8
0
        public static void Run()
        {
            // File will be created with the Data received in the Response Body

            // Provide the File Name
            const string fileName = "DownloadReport.csv";

            // Provide the path where the file needs to be downloaded
            // This can be either a relative path or an absolute path
            const string downloadFilePath = @".\Resource\" + fileName;

            const string organizationId = "testrest";
            const string reportName     = "testrest_v2";
            var          reportDate     = "2018-09-02";

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

                var result = apiInstance.DownloadReportWithHttpInfo(reportDate, reportName, organizationId);
                Console.WriteLine(result);

                File.WriteAllText(downloadFilePath, CreateXml(result.Data));
                Console.WriteLine("\nFile downloaded at the below location:");
                Console.WriteLine($"{Path.GetFullPath(downloadFilePath)}\n");
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("File Not Found: Kindly verify the path");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        public static void Run()
        {
            try
            {
                // File will be created with the Data received in the Response Body

                // Provide the File Name
                const string fileName = "DownloadFileWithFileIdentifier.csv";

                // Provide the path where the file needs to be downloaded
                // This can be either a relative path or an absolute path
                const string downloadFilePath = @".\Resource\" + fileName;

                var fileId         = "dGVzdHJlc3Rfc3ViY3JpcHRpb25fdjI5ODktYTM3ZmI2ZjUtM2QzYi0wOGVhLWUwNTMtYTI1ODhlMGFkOTJjLnhtbC0yMDIwLTA0LTMw";
                var organizationId = "testrest";

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

                var content = apiInstance.GetFileWithHttpInfo(fileId, organizationId);

                File.WriteAllText(downloadFilePath, CreateXml(content.Data));

                Console.WriteLine("\nFile downloaded at the below location:");
                Console.WriteLine($"{Path.GetFullPath(downloadFilePath)}\n");
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("File Not Found: Kindly verify the path");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        public static void Run()
        {
            if (string.IsNullOrEmpty(ReportNameToDelete))
            {
                ReportNameToDelete = "testrest_subcription_v1";
            }

            string reportName     = ReportNameToDelete;
            string organizationId = null;

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

                var apiInstance = new ReportSubscriptionsApi(clientConfig);
                apiInstance.DeleteSubscription(reportName, organizationId);
                ReportNameToDelete = null;
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
            }
        }
Example #11
0
        public static void Run()
        {
            try
            {
                // File will be created with the Data received in the Response Body

                // Provide the File Name
                const string fileName = "DownloadFileWithFileIdentifier.csv";

                // Provide the path where the file needs to be downloaded
                // This can be either a relative path or an absolute path
                const string downloadFilePath = @".\Resource\" + fileName;

                var fileId         = "VFJSUmVwb3J0LTc4NTVkMTNmLTkzOTgtNTExMy1lMDUzLWEyNTg4ZTBhNzE5Mi5jc3YtMjAxOC0xMC0yMA==";
                var organizationId = "testrest";

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

                var content = apiInstance.GetFileWithHttpInfo(fileId, organizationId);

                File.WriteAllText(downloadFilePath, CreateXml(content.Data));

                Console.WriteLine("\nFile downloaded at the below location:");
                Console.WriteLine($"{Path.GetFullPath(downloadFilePath)}\n");
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("File Not Found: Kindly verify the path");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        public static void Run()
        {
            string reportDefinitionName = "TransactionRequestClass";
            string subscriptionType     = "CLASSIC";
            var    requestObj           = new PredefinedSubscriptionRequestBean(
                ReportDefinitionName: reportDefinitionName,
                SubscriptionType: subscriptionType
                );

            string organizationId = null;

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

                var apiInstance = new ReportSubscriptionsApi(clientConfig);
                apiInstance.CreateStandardOrClassicSubscription(requestObj, organizationId);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
            }
        }
        public static RiskV1UpdatePost201Response Run()
        {
            string id = "5825489395116729903003";
            string riskInformationMarkingDetailsNotes  = "Adding this transaction as suspect";
            string riskInformationMarkingDetailsReason = "suspected";
            string riskInformationMarkingDetailsAction = "hide";
            Riskv1decisionsidmarkingRiskInformationMarkingDetails riskInformationMarkingDetails = new Riskv1decisionsidmarkingRiskInformationMarkingDetails(
                Notes: riskInformationMarkingDetailsNotes,
                Reason: riskInformationMarkingDetailsReason,
                Action: riskInformationMarkingDetailsAction
                );

            Riskv1decisionsidmarkingRiskInformation riskInformation = new Riskv1decisionsidmarkingRiskInformation(
                MarkingDetails: riskInformationMarkingDetails
                );

            var requestObj = new FraudMarkingActionRequest(
                RiskInformation: riskInformation
                );

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

                var apiInstance = new DecisionManagerApi(clientConfig);
                RiskV1UpdatePost201Response result = apiInstance.FraudUpdate(id, requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
        public static RiskV1DecisionsPost201Response Run()
        {
            var requestObj = new CreateDecisionManagerCaseRequest();

            var clientReferenceInformation = new Riskv1decisionsClientReferenceInformation();

            clientReferenceInformation.Code       = "54323007";
            requestObj.ClientReferenceInformation = clientReferenceInformation;

            var paymentInformation = new Riskv1decisionsPaymentInformation();

            var card = new Riskv1decisionsPaymentInformationCard();

            card.Number             = "4444444444444448";
            card.ExpirationMonth    = "12";
            card.ExpirationYear     = "2020";
            paymentInformation.Card = card;

            requestObj.PaymentInformation = paymentInformation;

            var orderInformation = new Riskv1decisionsOrderInformation();

            var amountDetails = new Riskv1decisionsOrderInformationAmountDetails("USD");

            amountDetails.Currency         = "USD";
            amountDetails.TotalAmount      = "144.14";
            orderInformation.AmountDetails = amountDetails;

            var billTo = new Riskv1decisionsOrderInformationBillTo();

            billTo.Address1           = "96, powers street";
            billTo.AdministrativeArea = "NH";
            billTo.Country            = "US";
            billTo.Locality           = "Clearwater milford";
            billTo.FirstName          = "James";
            billTo.LastName           = "Smith";
            billTo.PhoneNumber        = "7606160717";
            billTo.Email            = "*****@*****.**";
            billTo.PostalCode       = "03055";
            orderInformation.BillTo = billTo;

            requestObj.OrderInformation = orderInformation;

            var merchantDefinedInformation = new List <Riskv1decisionsMerchantDefinedInformation>();

            var merchantDefinedInformation0 = new Riskv1decisionsMerchantDefinedInformation();

            merchantDefinedInformation0.Key   = "1";
            merchantDefinedInformation0.Value = "Test";
            merchantDefinedInformation.Add(merchantDefinedInformation0);

            var merchantDefinedInformation1 = new Riskv1decisionsMerchantDefinedInformation();

            merchantDefinedInformation1.Key   = "2";
            merchantDefinedInformation1.Value = "Test2";
            merchantDefinedInformation.Add(merchantDefinedInformation1);

            requestObj.MerchantDefinedInformation = merchantDefinedInformation;

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

                var result = apiInstance.CreateDecisionManagerCase(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);
            }
        }
Example #16
0
        public static RiskV1ExportComplianceInquiriesPost201Response Run()
        {
            string clientReferenceInformationCode     = "verification example";
            string clientReferenceInformationComments = "Export-basic";
            Riskv1addressverificationsClientReferenceInformation clientReferenceInformation = new Riskv1addressverificationsClientReferenceInformation(
                Code: clientReferenceInformationCode,
                Comments: clientReferenceInformationComments
                );

            string orderInformationBillToAddress1           = "901 Metro Centre Blvd";
            string orderInformationBillToAdministrativeArea = "CA";
            string orderInformationBillToCountry            = "US";
            string orderInformationBillToLocality           = "Foster City";
            string orderInformationBillToPostalCode         = "94404";
            string orderInformationBillToCompanyName        = "A & C International Trade, Inc";
            Riskv1exportcomplianceinquiriesOrderInformationBillToCompany orderInformationBillToCompany = new Riskv1exportcomplianceinquiriesOrderInformationBillToCompany(
                Name: orderInformationBillToCompanyName
                );

            string orderInformationBillToFirstName = "ANDREE";
            string orderInformationBillToLastName  = "AGNESE";
            string orderInformationBillToEmail     = "*****@*****.**";
            Riskv1exportcomplianceinquiriesOrderInformationBillTo orderInformationBillTo = new Riskv1exportcomplianceinquiriesOrderInformationBillTo(
                Address1: orderInformationBillToAddress1,
                AdministrativeArea: orderInformationBillToAdministrativeArea,
                Country: orderInformationBillToCountry,
                Locality: orderInformationBillToLocality,
                PostalCode: orderInformationBillToPostalCode,
                Company: orderInformationBillToCompany,
                FirstName: orderInformationBillToFirstName,
                LastName: orderInformationBillToLastName,
                Email: orderInformationBillToEmail
                );

            string orderInformationShipToCountry   = "IN";
            string orderInformationShipToFirstName = "DumbelDore";
            string orderInformationShipToLastName  = "Albus";
            Riskv1exportcomplianceinquiriesOrderInformationShipTo orderInformationShipTo = new Riskv1exportcomplianceinquiriesOrderInformationShipTo(
                Country: orderInformationShipToCountry,
                FirstName: orderInformationShipToFirstName,
                LastName: orderInformationShipToLastName
                );


            List <Riskv1exportcomplianceinquiriesOrderInformationLineItems> orderInformationLineItems = new List <Riskv1exportcomplianceinquiriesOrderInformationLineItems>();
            string orderInformationLineItemsUnitPrice1   = "120.50";
            int    orderInformationLineItemsQuantity1    = 3;
            string orderInformationLineItemsProductSKU1  = "123456";
            string orderInformationLineItemsProductName1 = "Qwe";
            string orderInformationLineItemsProductCode1 = "physical_software";

            orderInformationLineItems.Add(new Riskv1exportcomplianceinquiriesOrderInformationLineItems(
                                              UnitPrice: orderInformationLineItemsUnitPrice1,
                                              Quantity: orderInformationLineItemsQuantity1,
                                              ProductSKU: orderInformationLineItemsProductSKU1,
                                              ProductName: orderInformationLineItemsProductName1,
                                              ProductCode: orderInformationLineItemsProductCode1
                                              ));

            Riskv1exportcomplianceinquiriesOrderInformation orderInformation = new Riskv1exportcomplianceinquiriesOrderInformation(
                BillTo: orderInformationBillTo,
                ShipTo: orderInformationShipTo,
                LineItems: orderInformationLineItems
                );

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

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

                var apiInstance = new VerificationApi(clientConfig);
                RiskV1ExportComplianceInquiriesPost201Response result = apiInstance.ValidateExportCompliance(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);
            }
        }
        public static Tmsv2customersEmbeddedDefaultPaymentInstrument Run()
        {
            string customerTokenId     = "AB695DA801DD1BB6E05341588E0A3BDC";
            string cardExpirationMonth = "12";
            string cardExpirationYear  = "2031";
            string cardType            = "001";
            Tmsv2customersEmbeddedDefaultPaymentInstrumentCard card = new Tmsv2customersEmbeddedDefaultPaymentInstrumentCard(
                ExpirationMonth: cardExpirationMonth,
                ExpirationYear: cardExpirationYear,
                Type: cardType
                );

            string billToFirstName          = "John";
            string billToLastName           = "Doe";
            string billToCompany            = "CyberSource";
            string billToAddress1           = "1 Market St";
            string billToLocality           = "San Francisco";
            string billToAdministrativeArea = "CA";
            string billToPostalCode         = "94105";
            string billToCountry            = "US";
            string billToEmail       = "*****@*****.**";
            string billToPhoneNumber = "4158880000";
            Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo billTo = new Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo(
                FirstName: billToFirstName,
                LastName: billToLastName,
                Company: billToCompany,
                Address1: billToAddress1,
                Locality: billToLocality,
                AdministrativeArea: billToAdministrativeArea,
                PostalCode: billToPostalCode,
                Country: billToCountry,
                Email: billToEmail,
                PhoneNumber: billToPhoneNumber
                );

            string instrumentIdentifierId = "7010000000016241111";
            Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier instrumentIdentifier = new Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
                Id: instrumentIdentifierId
                );

            var requestObj = new PostCustomerPaymentInstrumentRequest(
                Card: card,
                BillTo: billTo,
                InstrumentIdentifier: instrumentIdentifier
                );

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

                var apiInstance = new CustomerPaymentInstrumentApi(clientConfig);
                Tmsv2customersEmbeddedDefaultPaymentInstrument result = apiInstance.PostCustomerPaymentInstrument(customerTokenId, requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
Example #19
0
        public static RiskV1AuthenticationsPost201Response Run()
        {
            string clientReferenceInformationCode = "UNKNOWN";
            Riskv1authenticationsetupsClientReferenceInformation clientReferenceInformation = new Riskv1authenticationsetupsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string orderInformationAmountDetailsCurrency    = "USD";
            string orderInformationAmountDetailsTotalAmount = "10.99";
            Riskv1authenticationsOrderInformationAmountDetails orderInformationAmountDetails = new Riskv1authenticationsOrderInformationAmountDetails(
                Currency: orderInformationAmountDetailsCurrency,
                TotalAmount: orderInformationAmountDetailsTotalAmount
                );

            string orderInformationBillToAddress1           = "1 Market St";
            string orderInformationBillToAddress2           = "Address 2";
            string orderInformationBillToAdministrativeArea = "CA";
            string orderInformationBillToCountry            = "US";
            string orderInformationBillToLocality           = "san francisco";
            string orderInformationBillToFirstName          = "John";
            string orderInformationBillToLastName           = "Doe";
            string orderInformationBillToPhoneNumber        = "4158880000";
            string orderInformationBillToEmail      = "*****@*****.**";
            string orderInformationBillToPostalCode = "94105";
            Riskv1authenticationsOrderInformationBillTo orderInformationBillTo = new Riskv1authenticationsOrderInformationBillTo(
                Address1: orderInformationBillToAddress1,
                Address2: orderInformationBillToAddress2,
                AdministrativeArea: orderInformationBillToAdministrativeArea,
                Country: orderInformationBillToCountry,
                Locality: orderInformationBillToLocality,
                FirstName: orderInformationBillToFirstName,
                LastName: orderInformationBillToLastName,
                PhoneNumber: orderInformationBillToPhoneNumber,
                Email: orderInformationBillToEmail,
                PostalCode: orderInformationBillToPostalCode
                );

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

            string paymentInformationCardType            = "001";
            string paymentInformationCardExpirationMonth = "12";
            string paymentInformationCardExpirationYear  = "2025";
            string paymentInformationCardNumber          = "4012001037490014";
            Riskv1authenticationsPaymentInformationCard paymentInformationCard = new Riskv1authenticationsPaymentInformationCard(
                Type: paymentInformationCardType,
                ExpirationMonth: paymentInformationCardExpirationMonth,
                ExpirationYear: paymentInformationCardExpirationYear,
                Number: paymentInformationCardNumber
                );

            Riskv1authenticationsPaymentInformation paymentInformation = new Riskv1authenticationsPaymentInformation(
                Card: paymentInformationCard
                );

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

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

                var apiInstance = new PayerAuthenticationApi(clientConfig);
                RiskV1AuthenticationsPost201Response result = apiInstance.CheckPayerAuthEnrollment(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
Example #20
0
        public static Tmsv2customersEmbeddedDefaultPaymentInstrument Run()
        {
            var profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1";

            string cardExpirationMonth = "12";
            string cardExpirationYear  = "2031";
            string cardType            = "visa";
            string cardIssueNumber     = "01";
            string cardStartMonth      = "01";
            string cardStartYear       = "2020";
            string cardUseAs           = "pinless debit";
            Tmsv2customersEmbeddedDefaultPaymentInstrumentCard card = new Tmsv2customersEmbeddedDefaultPaymentInstrumentCard(
                ExpirationMonth: cardExpirationMonth,
                ExpirationYear: cardExpirationYear,
                Type: cardType,
                IssueNumber: cardIssueNumber,
                StartMonth: cardStartMonth,
                StartYear: cardStartYear,
                UseAs: cardUseAs
                );

            string billToFirstName          = "John";
            string billToLastName           = "Doe";
            string billToCompany            = "CyberSource";
            string billToAddress1           = "1 Market St";
            string billToLocality           = "San Francisco";
            string billToAdministrativeArea = "CA";
            string billToPostalCode         = "94105";
            string billToCountry            = "US";
            string billToEmail       = "*****@*****.**";
            string billToPhoneNumber = "4158880000";
            Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo billTo = new Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo(
                FirstName: billToFirstName,
                LastName: billToLastName,
                Company: billToCompany,
                Address1: billToAddress1,
                Locality: billToLocality,
                AdministrativeArea: billToAdministrativeArea,
                PostalCode: billToPostalCode,
                Country: billToCountry,
                Email: billToEmail,
                PhoneNumber: billToPhoneNumber
                );

            string instrumentIdentifierId = "7010000000016241111";

            Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier instrumentIdentifier = new Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
                Id: instrumentIdentifierId
                );

            var requestObj = new PostPaymentInstrumentRequest(
                Card: card,
                BillTo: billTo,
                InstrumentIdentifier: instrumentIdentifier
                );

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

                var apiInstance = new PaymentInstrumentApi(clientConfig);
                Tmsv2customersEmbeddedDefaultPaymentInstrument result = apiInstance.PostPaymentInstrument(requestObj, profileid);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
        public static void Run()
        {
            var generateKeyResult = GenerateKey.Run();
            var keyId             = generateKeyResult.KeyId;
            var derFormat         = generateKeyResult.Der.Format;
            var derAlgo           = generateKeyResult.Der.Algorithm;
            var derPublicKey      = generateKeyResult.Der.PublicKey;

            var requestObj = new TokenizeRequest
                             (
                KeyId: keyId,
                CardInfo: new Flexv1tokensCardInfo
                (
                    CardExpirationYear: "2031",
                    CardNumber: "5555555555554444",
                    CardType: "002",
                    CardExpirationMonth: "03"
                )
                             );

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

                var result = apiInstance.Tokenize(requestObj);
                Console.WriteLine(result);

                TokenVerificationUtility tokenVerifier = new TokenVerificationUtility();

                var flexPublicKey = new FlexPublicKey(keyId, new FlexDerPublicKey(derFormat, derAlgo, derPublicKey), null);
                var flexToken     = new FlexToken()
                {
                    keyId                = result.KeyId,
                    token                = result.Token,
                    maskedPan            = result.MaskedPan,
                    cardType             = result.CardType,
                    timestamp            = (long)result.Timestamp,
                    signedFields         = result.SignedFields,
                    signature            = result.Signature,
                    discoverableServices = result.DiscoverableServices
                };

                IDictionary <string, string> postParameters = new Dictionary <string, string>();
                postParameters["signedFields"] = flexToken.signedFields;
                postParameters["signature"]    = flexToken.signature;
                postParameters["cardType"]     = flexToken.cardType;
                postParameters["keyId"]        = flexToken.keyId;
                postParameters["maskedPan"]    = flexToken.maskedPan;
                postParameters["token"]        = flexToken.token;
                postParameters["timestamp"]    = Convert.ToString(flexToken.timestamp);

                var tokenVerificationResult = tokenVerifier.Verify(flexPublicKey, postParameters);
                Console.WriteLine("TOKEN VERIFICATION : " + tokenVerificationResult);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        public static RiskV1ExportComplianceInquiriesPost201Response Run()
        {
            string clientReferenceInformationCode     = "verification example";
            string clientReferenceInformationComments = "All fields";
            Riskv1addressverificationsClientReferenceInformation clientReferenceInformation = new Riskv1addressverificationsClientReferenceInformation(
                Code: clientReferenceInformationCode,
                Comments: clientReferenceInformationComments
                );

            string orderInformationBillToAddress1           = "901 Metro Centre Blvd";
            string orderInformationBillToAddress2           = " ";
            string orderInformationBillToAddress3           = "";
            string orderInformationBillToAddress4           = "Foster City";
            string orderInformationBillToAdministrativeArea = "NH";
            string orderInformationBillToCountry            = "US";
            string orderInformationBillToLocality           = "CA";
            string orderInformationBillToPostalCode         = "03055";
            string orderInformationBillToCompanyName        = "A & C International Trade, Inc.";
            Riskv1exportcomplianceinquiriesOrderInformationBillToCompany orderInformationBillToCompany = new Riskv1exportcomplianceinquiriesOrderInformationBillToCompany(
                Name: orderInformationBillToCompanyName
                );

            string orderInformationBillToFirstName = "Suman";
            string orderInformationBillToLastName  = "Kumar";
            string orderInformationBillToEmail     = "*****@*****.**";
            Riskv1exportcomplianceinquiriesOrderInformationBillTo orderInformationBillTo = new Riskv1exportcomplianceinquiriesOrderInformationBillTo(
                Address1: orderInformationBillToAddress1,
                Address2: orderInformationBillToAddress2,
                Address3: orderInformationBillToAddress3,
                Address4: orderInformationBillToAddress4,
                AdministrativeArea: orderInformationBillToAdministrativeArea,
                Country: orderInformationBillToCountry,
                Locality: orderInformationBillToLocality,
                PostalCode: orderInformationBillToPostalCode,
                Company: orderInformationBillToCompany,
                FirstName: orderInformationBillToFirstName,
                LastName: orderInformationBillToLastName,
                Email: orderInformationBillToEmail
                );

            string orderInformationShipToCountry   = "IN";
            string orderInformationShipToFirstName = "DumbelDore";
            string orderInformationShipToLastName  = "Albus";
            Riskv1exportcomplianceinquiriesOrderInformationShipTo orderInformationShipTo = new Riskv1exportcomplianceinquiriesOrderInformationShipTo(
                Country: orderInformationShipToCountry,
                FirstName: orderInformationShipToFirstName,
                LastName: orderInformationShipToLastName
                );


            List <Riskv1exportcomplianceinquiriesOrderInformationLineItems> orderInformationLineItems = new List <Riskv1exportcomplianceinquiriesOrderInformationLineItems>();
            string orderInformationLineItemsUnitPrice1   = "120.50";
            int    orderInformationLineItemsQuantity1    = 3;
            string orderInformationLineItemsProductSKU1  = "610009";
            string orderInformationLineItemsProductName1 = "Xer";
            string orderInformationLineItemsProductCode1 = "physical_software";

            orderInformationLineItems.Add(new Riskv1exportcomplianceinquiriesOrderInformationLineItems(
                                              UnitPrice: orderInformationLineItemsUnitPrice1,
                                              Quantity: orderInformationLineItemsQuantity1,
                                              ProductSKU: orderInformationLineItemsProductSKU1,
                                              ProductName: orderInformationLineItemsProductName1,
                                              ProductCode: orderInformationLineItemsProductCode1
                                              ));

            Riskv1exportcomplianceinquiriesOrderInformation orderInformation = new Riskv1exportcomplianceinquiriesOrderInformation(
                BillTo: orderInformationBillTo,
                ShipTo: orderInformationShipTo,
                LineItems: orderInformationLineItems
                );

            string buyerInformationMerchantCustomerId = "Export1";
            Riskv1addressverificationsBuyerInformation buyerInformation = new Riskv1addressverificationsBuyerInformation(
                MerchantCustomerId: buyerInformationMerchantCustomerId
                );

            string deviceInformationIpAddress = "127.0.0.1";
            string deviceInformationHostName  = "www.cybersource.ir";
            Riskv1exportcomplianceinquiriesDeviceInformation deviceInformation = new Riskv1exportcomplianceinquiriesDeviceInformation(
                IpAddress: deviceInformationIpAddress,
                HostName: deviceInformationHostName
                );

            string exportComplianceInformationAddressOperator = "and";
            string exportComplianceInformationWeightsAddress  = "low";
            string exportComplianceInformationWeightsCompany  = "exact";
            string exportComplianceInformationWeightsName     = "exact";
            Riskv1exportcomplianceinquiriesExportComplianceInformationWeights exportComplianceInformationWeights = new Riskv1exportcomplianceinquiriesExportComplianceInformationWeights(
                Address: exportComplianceInformationWeightsAddress,
                Company: exportComplianceInformationWeightsCompany,
                Name: exportComplianceInformationWeightsName
                );


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

            exportComplianceInformationSanctionLists.Add("Bureau Of Industry and Security");
            exportComplianceInformationSanctionLists.Add("DOS_DTC");
            exportComplianceInformationSanctionLists.Add("AUSTRALIA");
            Riskv1exportcomplianceinquiriesExportComplianceInformation exportComplianceInformation = new Riskv1exportcomplianceinquiriesExportComplianceInformation(
                AddressOperator: exportComplianceInformationAddressOperator,
                Weights: exportComplianceInformationWeights,
                SanctionLists: exportComplianceInformationSanctionLists
                );

            var requestObj = new ValidateExportComplianceRequest(
                ClientReferenceInformation: clientReferenceInformation,
                OrderInformation: orderInformation,
                BuyerInformation: buyerInformation,
                DeviceInformation: deviceInformation,
                ExportComplianceInformation: exportComplianceInformation
                );

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

                var apiInstance = new VerificationApi(clientConfig);
                RiskV1ExportComplianceInquiriesPost201Response result = apiInstance.ValidateExportCompliance(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
        public static Tmsv2customersEmbeddedDefaultPaymentInstrument Run()
        {
            string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC";
            string bankAccountType = "savings";
            Tmsv2customersEmbeddedDefaultPaymentInstrumentBankAccount bankAccount = new Tmsv2customersEmbeddedDefaultPaymentInstrumentBankAccount(
                Type: bankAccountType
                );

            string   buyerInformationCompanyTaxID = "12345";
            string   buyerInformationCurrency     = "USD";
            DateTime buyerInformationDateOfBirth  = Convert.ToDateTime("2000-12-13");

            List <Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationPersonalIdentification> buyerInformationPersonalIdentification = new List <Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationPersonalIdentification>();
            string buyerInformationPersonalIdentificationId1   = "57684432111321";
            string buyerInformationPersonalIdentificationType1 = "driver license";
            string buyerInformationPersonalIdentificationIssuedByAdministrativeArea1 = "CA";
            Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationIssuedBy buyerInformationPersonalIdentificationIssuedBy1 = new Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationIssuedBy(
                AdministrativeArea: buyerInformationPersonalIdentificationIssuedByAdministrativeArea1
                );

            buyerInformationPersonalIdentification.Add(new Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationPersonalIdentification(
                                                           Id: buyerInformationPersonalIdentificationId1,
                                                           Type: buyerInformationPersonalIdentificationType1,
                                                           IssuedBy: buyerInformationPersonalIdentificationIssuedBy1
                                                           ));

            Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformation buyerInformation = new Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformation(
                CompanyTaxID: buyerInformationCompanyTaxID,
                Currency: buyerInformationCurrency,
                DateOfBirth: buyerInformationDateOfBirth,
                PersonalIdentification: buyerInformationPersonalIdentification
                );

            string billToFirstName          = "John";
            string billToLastName           = "Doe";
            string billToCompany            = "CyberSource";
            string billToAddress1           = "1 Market St";
            string billToLocality           = "San Francisco";
            string billToAdministrativeArea = "CA";
            string billToPostalCode         = "94105";
            string billToCountry            = "US";
            string billToEmail       = "*****@*****.**";
            string billToPhoneNumber = "4158880000";
            Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo billTo = new Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo(
                FirstName: billToFirstName,
                LastName: billToLastName,
                Company: billToCompany,
                Address1: billToAddress1,
                Locality: billToLocality,
                AdministrativeArea: billToAdministrativeArea,
                PostalCode: billToPostalCode,
                Country: billToCountry,
                Email: billToEmail,
                PhoneNumber: billToPhoneNumber
                );

            string processingInformationBankTransferOptionsSeCCode = "WEB";
            Tmsv2customersEmbeddedDefaultPaymentInstrumentProcessingInformationBankTransferOptions processingInformationBankTransferOptions = new Tmsv2customersEmbeddedDefaultPaymentInstrumentProcessingInformationBankTransferOptions(
                SECCode: processingInformationBankTransferOptionsSeCCode
                );

            Tmsv2customersEmbeddedDefaultPaymentInstrumentProcessingInformation processingInformation = new Tmsv2customersEmbeddedDefaultPaymentInstrumentProcessingInformation(
                BankTransferOptions: processingInformationBankTransferOptions
                );

            string instrumentIdentifierId = "A7A91A2CA872B272E05340588D0A0699";
            Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier instrumentIdentifier = new Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier(
                Id: instrumentIdentifierId
                );

            var requestObj = new PostCustomerPaymentInstrumentRequest(
                BankAccount: bankAccount,
                BuyerInformation: buyerInformation,
                BillTo: billTo,
                ProcessingInformation: processingInformation,
                InstrumentIdentifier: instrumentIdentifier
                );

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

                var apiInstance = new CustomerPaymentInstrumentApi(clientConfig);
                Tmsv2customersEmbeddedDefaultPaymentInstrument result = apiInstance.PostCustomerPaymentInstrument(customerTokenId, requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
        public static RiskV1DecisionsPost201Response Run()
        {
            string clientReferenceInformationCode = "54323007";
            Riskv1decisionsClientReferenceInformation clientReferenceInformation = new Riskv1decisionsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

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

            Riskv1decisionsPaymentInformation paymentInformation = new Riskv1decisionsPaymentInformation(
                Card: paymentInformationCard
                );

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

            string orderInformationShipToAddress1           = "96, powers street";
            string orderInformationShipToAddress2           = "";
            string orderInformationShipToAdministrativeArea = "KA";
            string orderInformationShipToCountry            = "IN";
            string orderInformationShipToLocality           = "Clearwater milford";
            string orderInformationShipToFirstName          = "James";
            string orderInformationShipToLastName           = "Smith";
            string orderInformationShipToPhoneNumber        = "7606160717";
            string orderInformationShipToPostalCode         = "560056";
            Riskv1decisionsOrderInformationShipTo orderInformationShipTo = new Riskv1decisionsOrderInformationShipTo(
                Address1: orderInformationShipToAddress1,
                Address2: orderInformationShipToAddress2,
                AdministrativeArea: orderInformationShipToAdministrativeArea,
                Country: orderInformationShipToCountry,
                Locality: orderInformationShipToLocality,
                FirstName: orderInformationShipToFirstName,
                LastName: orderInformationShipToLastName,
                PhoneNumber: orderInformationShipToPhoneNumber,
                PostalCode: orderInformationShipToPostalCode
                );

            string orderInformationBillToAddress1           = "96, powers street";
            string orderInformationBillToAdministrativeArea = "NH";
            string orderInformationBillToCountry            = "US";
            string orderInformationBillToLocality           = "Clearwater milford";
            string orderInformationBillToFirstName          = "James";
            string orderInformationBillToLastName           = "Smith";
            string orderInformationBillToPhoneNumber        = "7606160717";
            string orderInformationBillToEmail      = "*****@*****.**";
            string orderInformationBillToPostalCode = "03055";
            Riskv1decisionsOrderInformationBillTo orderInformationBillTo = new Riskv1decisionsOrderInformationBillTo(
                Address1: orderInformationBillToAddress1,
                AdministrativeArea: orderInformationBillToAdministrativeArea,
                Country: orderInformationBillToCountry,
                Locality: orderInformationBillToLocality,
                FirstName: orderInformationBillToFirstName,
                LastName: orderInformationBillToLastName,
                PhoneNumber: orderInformationBillToPhoneNumber,
                Email: orderInformationBillToEmail,
                PostalCode: orderInformationBillToPostalCode
                );

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

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

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

                var apiInstance = new DecisionManagerApi(clientConfig);
                RiskV1DecisionsPost201Response result = apiInstance.CreateBundledDecisionManagerCase(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
        public static RiskV1AddressVerificationsPost201Response Run()
        {
            string clientReferenceInformationCode               = "addressEg";
            string clientReferenceInformationComments           = "dav-All fields";
            string clientReferenceInformationPartnerDeveloperId = "7891234";
            string clientReferenceInformationPartnerSolutionId  = "89012345";
            Riskv1decisionsClientReferenceInformationPartner clientReferenceInformationPartner = new Riskv1decisionsClientReferenceInformationPartner(
                DeveloperId: clientReferenceInformationPartnerDeveloperId,
                SolutionId: clientReferenceInformationPartnerSolutionId
                );

            Riskv1decisionsClientReferenceInformation clientReferenceInformation = new Riskv1decisionsClientReferenceInformation(
                Code: clientReferenceInformationCode,
                Comments: clientReferenceInformationComments,
                Partner: clientReferenceInformationPartner
                );

            string orderInformationBillToAddress1           = "12301 research st";
            string orderInformationBillToAddress2           = "1";
            string orderInformationBillToAddress3           = "2";
            string orderInformationBillToAddress4           = "3";
            string orderInformationBillToAdministrativeArea = "TX";
            string orderInformationBillToCountry            = "US";
            string orderInformationBillToLocality           = "Austin";
            string orderInformationBillToPostalCode         = "78759";
            Riskv1addressverificationsOrderInformationBillTo orderInformationBillTo = new Riskv1addressverificationsOrderInformationBillTo(
                Address1: orderInformationBillToAddress1,
                Address2: orderInformationBillToAddress2,
                Address3: orderInformationBillToAddress3,
                Address4: orderInformationBillToAddress4,
                AdministrativeArea: orderInformationBillToAdministrativeArea,
                Country: orderInformationBillToCountry,
                Locality: orderInformationBillToLocality,
                PostalCode: orderInformationBillToPostalCode
                );

            string orderInformationShipToAddress1           = "1715 oaks apt # 7";
            string orderInformationShipToAddress2           = " ";
            string orderInformationShipToAddress3           = "";
            string orderInformationShipToAddress4           = "";
            string orderInformationShipToAdministrativeArea = "WI";
            string orderInformationShipToCountry            = "US";
            string orderInformationShipToLocality           = "SUPERIOR";
            string orderInformationShipToPostalCode         = "29681";
            Riskv1addressverificationsOrderInformationShipTo orderInformationShipTo = new Riskv1addressverificationsOrderInformationShipTo(
                Address1: orderInformationShipToAddress1,
                Address2: orderInformationShipToAddress2,
                Address3: orderInformationShipToAddress3,
                Address4: orderInformationShipToAddress4,
                AdministrativeArea: orderInformationShipToAdministrativeArea,
                Country: orderInformationShipToCountry,
                Locality: orderInformationShipToLocality,
                PostalCode: orderInformationShipToPostalCode
                );


            List <Riskv1addressverificationsOrderInformationLineItems> orderInformationLineItems = new List <Riskv1addressverificationsOrderInformationLineItems>();
            string orderInformationLineItemsUnitPrice1   = "120.50";
            int    orderInformationLineItemsQuantity1    = 3;
            string orderInformationLineItemsProductSKU1  = "9966223";
            string orderInformationLineItemsProductName1 = "headset";
            string orderInformationLineItemsProductCode1 = "electronic";

            orderInformationLineItems.Add(new Riskv1addressverificationsOrderInformationLineItems(
                                              UnitPrice: orderInformationLineItemsUnitPrice1,
                                              Quantity: orderInformationLineItemsQuantity1,
                                              ProductSKU: orderInformationLineItemsProductSKU1,
                                              ProductName: orderInformationLineItemsProductName1,
                                              ProductCode: orderInformationLineItemsProductCode1
                                              ));

            Riskv1addressverificationsOrderInformation orderInformation = new Riskv1addressverificationsOrderInformation(
                BillTo: orderInformationBillTo,
                ShipTo: orderInformationShipTo,
                LineItems: orderInformationLineItems
                );

            string buyerInformationMerchantCustomerId = "ABCD";
            Riskv1addressverificationsBuyerInformation buyerInformation = new Riskv1addressverificationsBuyerInformation(
                MerchantCustomerId: buyerInformationMerchantCustomerId
                );

            var requestObj = new VerifyCustomerAddressRequest(
                ClientReferenceInformation: clientReferenceInformation,
                OrderInformation: orderInformation,
                BuyerInformation: buyerInformation
                );

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

                var apiInstance = new VerificationApi(clientConfig);
                RiskV1AddressVerificationsPost201Response result = apiInstance.VerifyCustomerAddress(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
Example #26
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
                );


            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);
            }
        }
Example #28
0
        public static InvoicingV2InvoicesPost201Response Run()
        {
            string customerInformationName  = "Tanya Lee";
            string customerInformationEmail = "*****@*****.**";
            Invoicingv2invoicesCustomerInformation customerInformation = new Invoicingv2invoicesCustomerInformation(
                Name: customerInformationName,
                Email: customerInformationEmail
                );

            string   invoiceInformationDescription                   = "This is a test invoice";
            DateTime invoiceInformationDueDate                       = DateTime.Parse("2019-07-11");
            bool     invoiceInformationSendImmediately               = false;
            bool     invoiceInformationAllowPartialPayments          = true;
            string   invoiceInformationDeliveryMode                  = "none";
            Invoicingv2invoicesInvoiceInformation invoiceInformation = new Invoicingv2invoicesInvoiceInformation(
                Description: invoiceInformationDescription,
                DueDate: invoiceInformationDueDate,
                SendImmediately: invoiceInformationSendImmediately,
                AllowPartialPayments: invoiceInformationAllowPartialPayments,
                DeliveryMode: invoiceInformationDeliveryMode
                );

            string  orderInformationAmountDetailsTotalAmount          = "2623.64";
            string  orderInformationAmountDetailsCurrency             = "USD";
            string  orderInformationAmountDetailsDiscountAmount       = "126.08";
            decimal orderInformationAmountDetailsDiscountPercent      = 5.00M;
            decimal orderInformationAmountDetailsSubAmount            = 2749.72M;
            decimal orderInformationAmountDetailsMinimumPartialAmount = 20.00M;
            string  orderInformationAmountDetailsTaxDetailsType       = "State Tax";
            string  orderInformationAmountDetailsTaxDetailsAmount     = "208.00";
            string  orderInformationAmountDetailsTaxDetailsRate       = "8.25";
            Invoicingv2invoicesOrderInformationAmountDetailsTaxDetails orderInformationAmountDetailsTaxDetails = new Invoicingv2invoicesOrderInformationAmountDetailsTaxDetails(
                Type: orderInformationAmountDetailsTaxDetailsType,
                Amount: orderInformationAmountDetailsTaxDetailsAmount,
                Rate: orderInformationAmountDetailsTaxDetailsRate
                );

            string orderInformationAmountDetailsFreightAmount  = "20.00";
            bool   orderInformationAmountDetailsFreightTaxable = true;
            Invoicingv2invoicesOrderInformationAmountDetailsFreight orderInformationAmountDetailsFreight = new Invoicingv2invoicesOrderInformationAmountDetailsFreight(
                Amount: orderInformationAmountDetailsFreightAmount,
                Taxable: orderInformationAmountDetailsFreightTaxable
                );

            Invoicingv2invoicesOrderInformationAmountDetails orderInformationAmountDetails = new Invoicingv2invoicesOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency,
                DiscountAmount: orderInformationAmountDetailsDiscountAmount,
                DiscountPercent: orderInformationAmountDetailsDiscountPercent,
                SubAmount: orderInformationAmountDetailsSubAmount,
                MinimumPartialAmount: orderInformationAmountDetailsMinimumPartialAmount,
                TaxDetails: orderInformationAmountDetailsTaxDetails,
                Freight: orderInformationAmountDetailsFreight
                );


            List <Invoicingv2invoicesOrderInformationLineItems> orderInformationLineItems = new List <Invoicingv2invoicesOrderInformationLineItems>();
            string orderInformationLineItemsProductSku1  = "P653727383";
            string orderInformationLineItemsProductName1 = "First line item's name";
            int    orderInformationLineItemsQuantity1    = 21;
            string orderInformationLineItemsUnitPrice1   = "120.08";

            orderInformationLineItems.Add(new Invoicingv2invoicesOrderInformationLineItems(
                                              ProductSku: orderInformationLineItemsProductSku1,
                                              ProductName: orderInformationLineItemsProductName1,
                                              Quantity: orderInformationLineItemsQuantity1,
                                              UnitPrice: orderInformationLineItemsUnitPrice1
                                              ));

            Invoicingv2invoicesOrderInformation orderInformation = new Invoicingv2invoicesOrderInformation(
                AmountDetails: orderInformationAmountDetails,
                LineItems: orderInformationLineItems
                );

            var requestObj = new CreateInvoiceRequest(
                CustomerInformation: customerInformation,
                InvoiceInformation: invoiceInformation,
                OrderInformation: orderInformation
                );

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

                var apiInstance = new InvoicesApi(clientConfig);
                InvoicingV2InvoicesPost201Response result = apiInstance.CreateInvoice(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
Example #29
0
        public static RiskV1UpdatePost201Response Run()
        {
            string type = "positive";
            string orderInformationAddressAddress1           = "1234 Sample St.";
            string orderInformationAddressAddress2           = "Mountain View";
            string orderInformationAddressLocality           = "California";
            string orderInformationAddressCountry            = "US";
            string orderInformationAddressAdministrativeArea = "CA";
            string orderInformationAddressPostalCode         = "94043";
            Riskv1liststypeentriesOrderInformationAddress orderInformationAddress = new Riskv1liststypeentriesOrderInformationAddress(
                Address1: orderInformationAddressAddress1,
                Address2: orderInformationAddressAddress2,
                Locality: orderInformationAddressLocality,
                Country: orderInformationAddressCountry,
                AdministrativeArea: orderInformationAddressAdministrativeArea,
                PostalCode: orderInformationAddressPostalCode
                );

            string orderInformationBillToFirstName = "John";
            string orderInformationBillToLastName  = "Doe";
            string orderInformationBillToEmail     = "*****@*****.**";
            Riskv1liststypeentriesOrderInformationBillTo orderInformationBillTo = new Riskv1liststypeentriesOrderInformationBillTo(
                FirstName: orderInformationBillToFirstName,
                LastName: orderInformationBillToLastName,
                Email: orderInformationBillToEmail
                );

            Riskv1liststypeentriesOrderInformation orderInformation = new Riskv1liststypeentriesOrderInformation(
                Address: orderInformationAddress,
                BillTo: orderInformationBillTo
                );

            Riskv1liststypeentriesPaymentInformation paymentInformation = new Riskv1liststypeentriesPaymentInformation(
                );

            string clientReferenceInformationCode = "54323007";
            Riskv1decisionsClientReferenceInformation clientReferenceInformation = new Riskv1decisionsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string riskInformationMarkingDetailsAction = "add";
            Riskv1liststypeentriesRiskInformationMarkingDetails riskInformationMarkingDetails = new Riskv1liststypeentriesRiskInformationMarkingDetails(
                Action: riskInformationMarkingDetailsAction
                );

            Riskv1liststypeentriesRiskInformation riskInformation = new Riskv1liststypeentriesRiskInformation(
                MarkingDetails: riskInformationMarkingDetails
                );

            var requestObj = new AddNegativeListRequest(
                OrderInformation: orderInformation,
                PaymentInformation: paymentInformation,
                ClientReferenceInformation: clientReferenceInformation,
                RiskInformation: riskInformation
                );

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

                var apiInstance = new DecisionManagerApi(clientConfig);
                RiskV1UpdatePost201Response result = apiInstance.AddNegative(type, requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
        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);
            }
        }