示例#1
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new CreatePaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation
            {
                Code = "TC_MPOS_Paymentech_3"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            var v2PaymentsProcessingInformationObj = new V2paymentsProcessingInformation
            {
                CommerceIndicator = "internet"
            };

            requestObj.ProcessingInformation = v2PaymentsProcessingInformationObj;

            var v2PaymentsOrderInformationObj = new V2paymentsOrderInformation();

            var v2PaymentsOrderInformationBillToObj = new V2paymentsOrderInformationBillTo
            {
                Country            = "US",
                FirstName          = "John",
                LastName           = "Deo",
                PhoneNumber        = "6504327113",
                Address1           = "901 Metro Center Blvd",
                PostalCode         = "94404",
                Locality           = "Foster City",
                AdministrativeArea = "CA",
                Email = "*****@*****.**"
            };

            v2PaymentsOrderInformationObj.BillTo = v2PaymentsOrderInformationBillToObj;

            var amountDetailsObj = new V2paymentsOrderInformationAmountDetails
            {
                TotalAmount = "100",
                Currency    = "USD"
            };

            v2PaymentsOrderInformationObj.AmountDetails = amountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var v2PaymentsPaymentInformationObj = new V2paymentsPaymentInformation();

            var tokenizedCardObj = new V2paymentsPaymentInformationTokenizedCard
            {
                ExpirationYear  = "2031",
                Number          = "4111111111111111",
                ExpirationMonth = "12",
                TransactionType = "1"
            };

            v2PaymentsPaymentInformationObj.TokenizedCard = tokenizedCardObj;

            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

            var consumerAuthenticationInformationObj = new V2paymentsConsumerAuthenticationInformation
            {
                Cavv = "AAABCSIIAAAAAAACcwgAEMCoNh+=",
                Xid  = "T1Y0OVcxMVJJdkI0WFlBcXptUzE="
            };

            requestObj.ConsumerAuthenticationInformation = consumerAuthenticationInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentApi(configurationSwagger);
                var result = apiInstance.CreatePayment(requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
示例#2
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new CreatePaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation
            {
                Code = "TC45555-1"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            var consumerAuthenticationInformationObj = new V2paymentsConsumerAuthenticationInformation
            {
                Cavv = "EHuWW9PiBkWvqE5juRwDzAUFBAk=",
                UcafCollectionIndicator = "2",
                UcafAuthenticationData  = "EHuWW9PiBkWvqE5juRwDzAUFBAk"
            };

            requestObj.ConsumerAuthenticationInformation = consumerAuthenticationInformationObj;

            var v2PaymentsProcessingInformationObj = new V2paymentsProcessingInformation
            {
                CommerceIndicator = "spa"
            };

            requestObj.ProcessingInformation = v2PaymentsProcessingInformationObj;

            var v2PaymentsOrderInformationObj = new V2paymentsOrderInformation();

            var v2PaymentsOrderInformationBillToObj = new V2paymentsOrderInformationBillTo
            {
                Country            = "SG",
                LastName           = "Deo",
                Address2           = "test",
                Address1           = "201 S. Division St.",
                PostalCode         = "48104-2201",
                Locality           = "Ann Arbor",
                AdministrativeArea = "MI",
                FirstName          = "John",
                PhoneNumber        = "999999999",
                District           = "MI",
                BuildingNumber     = "123",
                Company            = "Visa",
                Email = "*****@*****.**"
            };

            v2PaymentsOrderInformationObj.BillTo = v2PaymentsOrderInformationBillToObj;

            var amountDetailsObj = new V2paymentsOrderInformationAmountDetails
            {
                TotalAmount = "2016.05",
                Currency    = "USD"
            };

            v2PaymentsOrderInformationObj.AmountDetails = amountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var v2PaymentsPaymentInformationObj = new V2paymentsPaymentInformation();

            var v2PaymentsPaymentInformationCardObj = new V2paymentsPaymentInformationCard
            {
                ExpirationYear  = "2031",
                Number          = "5641821111166669",
                SecurityCode    = "123",
                ExpirationMonth = "12",
                Type            = "042"
            };

            v2PaymentsPaymentInformationObj.Card = v2PaymentsPaymentInformationCardObj;

            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentApi(configurationSwagger);
                var result = apiInstance.CreatePayment(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 requestObj = new CreatePaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation
            {
                Code = "TC54853-4"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            var v2PaymentsProcessingInformationObj = new V2paymentsProcessingInformation
            {
                Capture = true,
                CommerceIndicator = "JS"
            };

            requestObj.ProcessingInformation = v2PaymentsProcessingInformationObj;

            var v2PaymentsOrderInformationObj = new V2paymentsOrderInformation();

            var v2PaymentsOrderInformationBillToObj = new V2paymentsOrderInformationBillTo
            {
                Country = "US",
                FirstName = "John",
                LastName = "Deo",
                PhoneNumber = "6504327113",
                Address2 = "Desk M3-5573",
                Address1 = "901 Metro Center Blvd",
                PostalCode = "94404",
                Locality = "Foster City",
                Company = "Visa",
                AdministrativeArea = "CA",
                Email = "*****@*****.**"
            };

            v2PaymentsOrderInformationObj.BillTo = v2PaymentsOrderInformationBillToObj;

            var v2PaymentsOrderInformationAmountDetailsObj = new V2paymentsOrderInformationAmountDetails
            {
                TotalAmount = "100",
                Currency = "JPY"
            };

            v2PaymentsOrderInformationObj.AmountDetails = v2PaymentsOrderInformationAmountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var v2PaymentsPaymentInformationObj = new V2paymentsPaymentInformation();

            var v2PaymentsPaymentInformationCardObj = new V2paymentsPaymentInformationCard
            {
                ExpirationYear = "2031",
                Number = "3540599999991047",
                SecurityCode = "123",
                ExpirationMonth = "12",
                Type = "007"
            };

            v2PaymentsPaymentInformationObj.Card = v2PaymentsPaymentInformationCardObj;

            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

            var consumerAuthenticationInformationObj = new V2paymentsConsumerAuthenticationInformation
            {
                Cavv = "EHuWW9PiBkWvqE5juRwDzAUFBAk=",
                EciRaw = "05",
                Xid = "lEmYpm61EduaVZjPG1/HsgkAAQc="
            };

            requestObj.ConsumerAuthenticationInformation = consumerAuthenticationInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType = "POST",
                RequestTarget = "/pts/v2/payments",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance = new PaymentApi(configurationSwagger);
                var result = apiInstance.CreatePayment(requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }