public static void Run(IReadOnlyDictionary <string, string> configDictionary) { var requestObj = new CreatePaymentRequest(); var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation { Code = "TC50171_3" }; requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj; var v2PaymentsProcessingInformationObj = new V2paymentsProcessingInformation { CommerceIndicator = "internet" }; requestObj.ProcessingInformation = v2PaymentsProcessingInformationObj; var v2PaymentsAggregatorInformationObj = new V2paymentsAggregatorInformation(); var v2PaymentsAggregatorInformationSubMerchantObj = new V2paymentsAggregatorInformationSubMerchant { Country = "US", PhoneNumber = "650-432-0000", Address1 = "900 Metro Center", PostalCode = "94404-2775", Locality = "Foster City", Name = "Visa Inc", AdministrativeArea = "CA", Region = "PEN", Email = "*****@*****.**" }; // v2paymentsAggregatorInformationSubMerchantObj.CardAcceptorID = "1234567890"; v2PaymentsAggregatorInformationObj.SubMerchant = v2PaymentsAggregatorInformationSubMerchantObj; v2PaymentsAggregatorInformationObj.Name = "V-Internatio"; v2PaymentsAggregatorInformationObj.AggregatorId = "123456789"; requestObj.AggregatorInformation = v2PaymentsAggregatorInformationObj; var v2PaymentsOrderInformationObj = new V2paymentsOrderInformation(); var v2PaymentsOrderInformationBillToObj = new V2paymentsOrderInformationBillTo { Country = "US", LastName = "Deo", Address2 = "Address 2", 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 v2PaymentsOrderInformationAmountDetailsObj = new V2paymentsOrderInformationAmountDetails { TotalAmount = "102.21", Currency = "USD" }; // v2paymentsOrderInformationAmountDetailsObj.ServiceFeeAmount = "30.0"; v2PaymentsOrderInformationObj.AmountDetails = v2PaymentsOrderInformationAmountDetailsObj; requestObj.OrderInformation = v2PaymentsOrderInformationObj; var v2PaymentsPaymentInformationObj = new V2paymentsPaymentInformation(); var v2PaymentsPaymentInformationCardObj = new V2paymentsPaymentInformationCard { ExpirationYear = "2031", Number = "5555555555554444", SecurityCode = "123", ExpirationMonth = "12", Type = "002" }; v2PaymentsPaymentInformationObj.Card = v2PaymentsPaymentInformationCardObj; requestObj.PaymentInformation = v2PaymentsPaymentInformationObj; var merchantInformationObj = new V2paymentsMerchantInformation(); /* * var serviceFeeDescriptorObj = new ServiceFeeDescriptor(); * * serviceFeeDescriptorObj.Name = "ABC"; * serviceFeeDescriptorObj.Contact = "12345"; * serviceFeeDescriptorObj.State = "TEXAS"; * merchantInformationObj.ServiceFeeDescriptor = serviceFeeDescriptorObj; */ requestObj.MerchantInformation = merchantInformationObj; 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); } }
public static void Run(IReadOnlyDictionary <string, string> configDictionary) { var requestObj = new CreatePaymentRequest(); var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation { Code = "1234567890" }; requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj; 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 = "72210", Currency = "USD" }; v2PaymentsOrderInformationObj.AmountDetails = v2PaymentsOrderInformationAmountDetailsObj; requestObj.OrderInformation = v2PaymentsOrderInformationObj; var v2PaymentsPaymentInformationObj = new V2paymentsPaymentInformation(); var v2PaymentsPaymentInformationCardObj = new V2paymentsPaymentInformationCard { ExpirationYear = "2031", Number = "4111111111111111", SecurityCode = "123", ExpirationMonth = "12" }; v2PaymentsPaymentInformationObj.Card = v2PaymentsPaymentInformationCardObj; requestObj.PaymentInformation = v2PaymentsPaymentInformationObj; var merchantInformationObj = new V2paymentsMerchantInformation(); var merchantDescriptorObj = new V2paymentsMerchantInformationMerchantDescriptor { Name = "TestDescriptionInformation", Contact = "123-456-7890" }; merchantInformationObj.MerchantDescriptor = merchantDescriptorObj; requestObj.MerchantInformation = merchantInformationObj; 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); } }