Beispiel #1
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);
            }
        }
Beispiel #2
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);
            }
        }
Beispiel #3
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new Body();

            var cardObj = new InstrumentidentifiersCard();

            cardObj.Number  = "1234567890987654";
            requestObj.Card = cardObj;

            var processingInformationObj = new InstrumentidentifiersProcessingInformation();

            var authorizationOptionsObj = new InstrumentidentifiersProcessingInformationAuthorizationOptions();

            var initiatorObj = new InstrumentidentifiersProcessingInformationAuthorizationOptionsInitiator();

            var merchantInitiatedTransactionObj = new InstrumentidentifiersProcessingInformationAuthorizationOptionsInitiatorMerchantInitiatedTransaction();

            merchantInitiatedTransactionObj.PreviousTransactionId = "123456789012345";
            initiatorObj.MerchantInitiatedTransaction             = merchantInitiatedTransactionObj;

            authorizationOptionsObj.Initiator = initiatorObj;

            processingInformationObj.AuthorizationOptions = authorizationOptionsObj;

            requestObj.ProcessingInformation = processingInformationObj;

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

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new InstrumentIdentifierApi(configurationSwagger);
                var result = apiInstance.InstrumentidentifiersPost("93B32398-AD51-4CC2-A682-EA3E93614EB1", requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }