示例#1
0
        public static TmsV1InstrumentIdentifiersPaymentInstrumentsGet200ResponseEmbeddedPaymentInstruments Run()
        {
            var profileId  = "93B32398-AD51-4CC2-A682-EA3E93614EB1";
            var requestObj = new CreatePaymentInstrumentRequest();

            var cardObj = new TmsV1InstrumentIdentifiersPaymentInstrumentsGet200ResponseEmbeddedCard
                          (
                ExpirationMonth: "09",
                ExpirationYear: "2022",
                Type: "visa"
                          );

            requestObj.Card = cardObj;

            var billToObj = new TmsV1InstrumentIdentifiersPaymentInstrumentsGet200ResponseEmbeddedBillTo
            {
                FirstName          = "John",
                LastName           = "Smith",
                Company            = "CyberSource",
                Address1           = "12 Main Street",
                Address2           = "20 My Street",
                Locality           = "San Francisco",
                AdministrativeArea = "CA",
                PostalCode         = "90200",
                Country            = "US",
                Email       = "*****@*****.**",
                PhoneNumber = "555123456"
            };

            requestObj.BillTo = billToObj;

            var instrumentIdentifierObj = new TmsV1InstrumentIdentifiersPaymentInstrumentsGet200ResponseEmbeddedInstrumentIdentifier();

            var cardObj2 = new TmsV1InstrumentIdentifiersPost200ResponseCard
            {
                Number = "4111111111111111"
            };

            instrumentIdentifierObj.Card = cardObj2;

            requestObj.InstrumentIdentifier = instrumentIdentifierObj;

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

                var result = apiInstance.CreatePaymentInstrument(profileId, requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
                return(null);
            }
        }
示例#2
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new Body2();

            var paymentInformationCardObj = new PaymentinstrumentsCard();

            paymentInformationCardObj.ExpirationMonth = "09";
            paymentInformationCardObj.ExpirationYear  = "2022";
            paymentInformationCardObj.Type            = PaymentinstrumentsCard.TypeEnum.Visa;
            requestObj.Card = paymentInformationCardObj;

            var v2paymentsOrderInformationBillToObj = new PaymentinstrumentsBillTo();

            v2paymentsOrderInformationBillToObj.FirstName          = "John";
            v2paymentsOrderInformationBillToObj.LastName           = "Smith";
            v2paymentsOrderInformationBillToObj.Company            = "CyberSource";
            v2paymentsOrderInformationBillToObj.Address1           = "12 Main Street";
            v2paymentsOrderInformationBillToObj.Address2           = "20 My Street";
            v2paymentsOrderInformationBillToObj.Locality           = "Foster City";
            v2paymentsOrderInformationBillToObj.AdministrativeArea = "CA";
            v2paymentsOrderInformationBillToObj.PostalCode         = "90200";
            v2paymentsOrderInformationBillToObj.Country            = "US";
            v2paymentsOrderInformationBillToObj.Email       = "*****@*****.**";
            v2paymentsOrderInformationBillToObj.PhoneNumber = "555123456";
            requestObj.BillTo = v2paymentsOrderInformationBillToObj;

            var instrumentIdentifierObj = new PaymentinstrumentsInstrumentIdentifier();

            var v2paymentsPaymentInformationCardObj = new InstrumentidentifiersCard();

            v2paymentsPaymentInformationCardObj.Number = "4111111111111111";
            instrumentIdentifierObj.Card = v2paymentsPaymentInformationCardObj;

            requestObj.InstrumentIdentifier = instrumentIdentifierObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/tms/v1/paymentinstruments",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentInstrumentApi(configurationSwagger);
                var result = apiInstance.PaymentinstrumentsPost("93B32398-AD51-4CC2-A682-EA3E93614EB1", requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
示例#3
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1";
            var tokenId   = "7020000000000137654";

            var requestObj = new Body3();

            var cardObj = new PaymentinstrumentsCard();

            cardObj.ExpirationMonth = "09";
            cardObj.ExpirationYear  = "2022";
            cardObj.Type            = PaymentinstrumentsCard.TypeEnum.Visa;
            requestObj.Card         = cardObj;

            var billToObj = new PaymentinstrumentsBillTo();

            billToObj.FirstName          = "John";
            billToObj.LastName           = "Smith";
            billToObj.Company            = "CyberSource";
            billToObj.Address1           = "12 Main Street";
            billToObj.Address2           = "20 My Street";
            billToObj.Locality           = "San Francisco";
            billToObj.AdministrativeArea = "CA";
            billToObj.PostalCode         = "90200";
            billToObj.Country            = "US";
            billToObj.Email       = "*****@*****.**";
            billToObj.PhoneNumber = "555123456";
            requestObj.BillTo     = billToObj;

            var instrumentIdentifierObj = new PaymentinstrumentsInstrumentIdentifier();

            var cardObj2 = new InstrumentidentifiersCard();

            cardObj2.Number = "4111111111111111";
            instrumentIdentifierObj.Card = cardObj2;

            requestObj.InstrumentIdentifier = instrumentIdentifierObj;

            try
            {
                var apiInstance = new PaymentInstrumentApi();
                var result      = apiInstance.PaymentinstrumentsTokenIdPatch(profileId, tokenId, requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
示例#4
0
        public static void Run()
        {
            var profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1";
            var tokenId   = CreatePaymentInstrument.Run().Id;

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

                apiInstance.DeletePaymentInstrument(profileId, tokenId);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        public static Tmsv2customersEmbeddedDefaultPaymentInstrument Run()
        {
            var profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1";
            var tokenId   = "888454C31FB6150CE05340588D0AA9BE";

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

                var apiInstance = new PaymentInstrumentApi(clientConfig);
                Tmsv2customersEmbeddedDefaultPaymentInstrument result = apiInstance.GetPaymentInstrument(tokenId, profileid);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
示例#6
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var profileId = "93B32398-AD51-4CC2-A682-EA3E93614EB1";
            var tokenId   = "72EC3E658278F10FE05340588D0A86AB";

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType   = "DELETE",
                RequestTarget = "/tms/v1/paymentinstruments/" + tokenId
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentInstrumentApi(configurationSwagger);
                var result = apiInstance.PaymentinstrumentsTokenIdDeleteWithHttpInfo(profileId, tokenId);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        public static Tmsv2customersEmbeddedDefaultPaymentInstrument Run()
        {
            var profileid = "93B32398-AD51-4CC2-A682-EA3E93614EB1";

            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 PostPaymentInstrumentRequest(
                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 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);
            }
        }
示例#8
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 void Init()
 {
     instance = new PaymentInstrumentApi();
 }