public void Test_CommonPayment_Post_Payment_Then_Return_GetAnyResponse() { string serviceUrl = "https://sanalpos.innova.com.tr/VposClient/CpWeb/api/RegisterTransaction"; var commonPaymentRequest = new PayFlex.Client.CommonPaymentRequest() { ServiceUrl = serviceUrl, TransactionId = Guid.NewGuid().ToString(), ClientMerchantCode = "1B18B80EF00A41C2BC4AF2628EA88xxx", Password = "******", CreditCard = new CreditCard { CardHolderIp = "127.0.0.1", CardHolderEmail = "*****@*****.**", CardHolderName = "xxx" }, Apply3DS = true, SupportHalfSecure = true, ReturnUrl = "https://www.innova.com.tr", Amount = (decimal)2.99, AmountCode = Currency.TRY, TransactionType = PaymentTransactionType.Sale, IsSaveCard = true, IsHideSaveCard = false }; var result = _paymentManager.PostProcess(commonPaymentRequest); var registerTransactionResponse = JsonConvert.DeserializeObject(result.Response, typeof(RegisterTransactionResponse)); Assert.AreNotEqual("", result.Response); }
public void Test_CommonPayment_Post_Payment_Then_Return_GetAnyResponse() { string serviceUrl = "https://sp-test.innova.com.tr/VAKIFBANK_V4/CPTest"; string cpPageUrl = "https://sp-test.innova.com.tr/VAKIFBANK_v4/CPWeb/SecurePayment?Ptkn={0}&RequestPage=Payment"; var commonPaymentRequest = new PayFlex.Client.CommonPaymentRequest() { ServiceUrl = serviceUrl, TransactionId = Guid.NewGuid().ToString(), HostMerchantId = "000000000006528", MerchantPassword = "******", HostTerminalId = "VP000095", OrderId = "cptest20140814o1", OrderDescription = "cptest20140814o1", Amount = (decimal)1.23, AmountCode = Currency.TRY, TransactionType = TransactionType.Sale, IsSecure = false, AllowNotEnrolledCard = false, SuccessUrl = "https://sp-test.innova.com.tr/VAKIFBANK_V4/CPTest/Success.aspx", FailUrl = "https://sp-test.innova.com.tr/VAKIFBANK_V4/CPTest/Fail.aspx", CreditCard = new CreditCard { Pan = "4289450189088488", CVV = "060", ExpireMonth = "04", ExpireYear = "2023", CardHolderIp = "190.20.13.12", BrandName = BrandName.Visa }, RequestLanguage = "tr-TR" }; var result = _paymentManager.PostProcess(commonPaymentRequest); Assert.AreNotEqual("", result.Response); #region HtmlNode Parse string PaymentTokenNode = ""; string ErrorCodeNode = ""; string ErrorMessageNode = ""; var str = result.Response.Replace("{", ""); result.Response = str.Replace("}", ""); var stringArray = result.Response.Split(','); if (stringArray.Length == 4) { PaymentTokenNode = stringArray[1].Split(':')[1].Replace(@"""", ""); ErrorCodeNode = stringArray[2].Split(':')[1].Replace(@"""", ""); ErrorMessageNode = stringArray[3].Split(':')[1].Replace(@"""", ""); } cpPageUrl = string.Format(cpPageUrl, PaymentTokenNode); #endregion }