public void PostauthSalesCancelTest() { var sw = new Stopwatch(); sw.Start(); while (string.IsNullOrWhiteSpace(OrderIdForPreAuthSales)) { System.Threading.Thread.SpinWait(1000); } sw.Stop(); sw = null; OrderIdForPreAuthSales = null; OrderRefNumberForPreaAuthSales = null; PreauthSalesTest(); var _pay = new GVPSClient() .Test(true) .Company(TerminalID_For_XML, MerchandID, ProvUserID_AUT, ProvUserPassword) .Customer(customer_email, customer_ipAddress) .Order(OrderIdForPreAuthSales) .Amount(95) .PostauthCancel(OrderRefNumberForPreaAuthSales); ValidateResult(_pay); PreAuthCancelTestSuccess = true; }
public void RefundCancelTest() { var sw = new Stopwatch(); sw.Start(); while (string.IsNullOrWhiteSpace(OrderRefNumberForRefundCancel) && (sw.ElapsedMilliseconds < 10000)) { System.Threading.Thread.SpinWait(1000); } sw.Stop(); sw = null; if (string.IsNullOrWhiteSpace(OrderRefNumberForRefundCancel)) { throw new ArgumentNullException("OrderRefNumberForRefundCancel"); } var _pay = new GVPSClient() .Test(true) .Company(TerminalID_For_XML, MerchandID, ProvUserID_AUT, ProvUserPassword) .Customer(customer_email, customer_ipAddress) .Order(OrderIdForRefundCancel) .Amount(95) .RefundCancel(OrderRefNumberForRefundCancel); ValidateResult(_pay); }
public void PostauthSalesTest() { var sw = new Stopwatch(); sw.Start(); while ((!PreAuthCancelTestSuccess) && (sw.ElapsedMilliseconds < 10000)) { System.Threading.Thread.SpinWait(1000); } sw.Stop(); sw = null; OrderIdForPreAuthSales = null; OrderRefNumberForPreaAuthSales = null; PreauthSalesTest(); if (string.IsNullOrWhiteSpace(OrderIdForPreAuthSales)) { throw new ArgumentNullException("OrderIdForPreAuthSales"); } var _pay = new GVPSClient() .Test(true) .Company(TerminalID_For_XML, MerchandID, ProvUserID_AUT, ProvUserPassword) .Customer(customer_email, customer_ipAddress) .CreditCard(credit_card_number, credit_card_cvv2, credit_card_month, credit_card_year) .Order(OrderIdForPreAuthSales) .Amount(95) .Postauth(OrderRefNumberForPreaAuthSales); ValidateResult(_pay); }
public void Sales_USD_Test() { var _pay = new GVPSClient() .Test(true) .Company(TerminalID_For_XML, MerchandID, ProvUserID_AUT, ProvUserPassword) .Customer(customer_email, customer_ipAddress) .CreditCard(credit_card_number, credit_card_cvv2, credit_card_month, credit_card_year) .Order(Guid.NewGuid().ToString("N")) .Amount(95, GVPSCurrencyCodeEnum.USD) .Sales(); ValidateResult(_pay); }
public void TCKNVerificationTest() { var tc_kimlik_no = "000000000000"; var _pay = new GVPSClient() .Test(true) .Company(TerminalID_For_XML, MerchandID, ProvUserID_AUT, ProvUserPassword) .Customer(customer_email, customer_ipAddress) .Order(Guid.NewGuid().ToString("N")) .CreditCard(credit_card_number, credit_card_cvv2, credit_card_month, credit_card_year) .Amount(1) .Verification(tc_kimlik_no); ValidateResult(_pay); }
public void PreauthSalesTest() { var _pay = new GVPSClient() .Test(true) .Company(TerminalID_For_XML, MerchandID, ProvUserID_AUT, ProvUserPassword) .Customer(customer_email, customer_ipAddress) .CreditCard(credit_card_number, credit_card_cvv2, credit_card_month, credit_card_year) .Order(Guid.NewGuid().ToString("N")) .Amount(95) .Preauth(); ValidateResult(_pay); OrderIdForPreAuthSales = _pay.Order.OrderID; OrderRefNumberForPreaAuthSales = _pay.Transaction.RetrefNum; }
public void SalesTest() { var _pay = new GVPSClient() .Test(true) .Company(TerminalID_For_XML, MerchandID, ProvUserID_AUT, ProvUserPassword, SubMerchandID) .Customer(customer_email, customer_ipAddress) .CreditCard(credit_card_number, credit_card_cvv2, credit_card_month, credit_card_year) .Order(Guid.NewGuid().ToString("N")) .Amount(1234.567, GVPSCurrencyCodeEnum.TRL) .Sales(); ValidateResult(_pay); OrderIdForCancel = _pay.Order.OrderID; OrderRefNumberForCancel = _pay.Transaction.RetrefNum; }
public void SalesWithDetailsTest() { var _pay = new GVPSClient() .Test(true) .Company(TerminalID_For_XML, MerchandID, ProvUserID_AUT, ProvUserPassword, SubMerchandID) .Customer(customer_email, customer_ipAddress) .CreditCard(credit_card_number, credit_card_cvv2, credit_card_month, credit_card_year) .Order(Guid.NewGuid().ToString("N")) .AddOrderAddress(GVPSAddressTypeEnum.Billing, order_address_city, order_address_district, order_address_text, order_address_phone, null, null, order_address_name, order_address_postalCode) .AddOrderItem(1, "0001", "ProductA ğüşiöçĞÜŞİÖÇ", 1.456, 3.456, "product A ğüşiöçĞÜŞİÖÇ description") .AddOrderItem(2, "0002", "ProductB", 1.4, 1.1, "product B description") .AddOrderComment(1, "COM1 ğüşiöçĞÜŞİÖÇ") .Amount(95, GVPSCurrencyCodeEnum.TRL) .Sales(); ValidateResult(_pay); OrderIdForRefund = _pay.Order.OrderID; }
public void DownPaymentRate_SalesTest() { var _pay = new GVPSClient().Test(true) .Company(TerminalID_For_XML, MerchandID, ProvUserID_AUT, ProvUserPassword) .Customer(customer_email, customer_ipAddress) .CreditCard(credit_card_number, credit_card_cvv2, credit_card_month, credit_card_year) .Order(Guid.NewGuid().ToString("N")) .DownPaymentRate(5) .Amount(95) .Sales(); Debug.WriteLine("Request: " + _pay.RawRequest); Debug.WriteLine("Response: " + _pay.RawResponse); Debug.WriteLine(_pay.Transaction.Response.Message); Debug.WriteLine(_pay.Transaction.Response.ErrorMsg); Debug.WriteLine(_pay.Transaction.Response.SysErrMsg); Assert.AreEqual("00", _pay.Transaction.Response.Code); Assert.AreEqual("Approved", _pay.Transaction.Response.Message); }
private void ValidateResultFunction(IOwinContext con, IEnumerable <KeyValuePair <string, string[]> > formData, ref string ret, ref GVPSClient VPClient, Uri successUri, Uri failUri) { //string ret = ""; //var formData = con.Request.ReadFormAsync() as IEnumerable<KeyValuePair<string, string[]>>; var formDataDic = formData.ToDictionary(k => k.Key, e => e.Value); ret += string.Format("\n</br><strong>Method</strong>\n</br>{0}", con.Request.Method); Debug.WriteLine("INCOMING HEADERS"); foreach (var item in con.Request.Headers) { Debug.WriteLine(string.Format("{0}={1}", item.Key, item.Value.FirstOrDefault())); ret += string.Format("\n</br><strong>Header {0}</strong> : {1}", item.Key, System.Net.WebUtility.HtmlEncode(string.Format("{0}", item.Value))); } if (con.Request.Method == "POST") { ret += SelfHost.CreateWebContent(formDataDic); var Result = VPClient.Sales3DEvaluatesResponseAndGetProvision(formDataDic, SecureKey, successUri, failUri); ValidateResult(Result); } }
public void Sale3DTest() { var IsFail = true; string FailMessage = null; var VPClient = new GVPSClient(); Uri successUri = new Uri(HostUri, HostUriSuccessPath); Uri failUri = new Uri(HostUri, HostUriFailPath); var Request = VPClient .Test(true) .Company(TerminalID_For_3D_FULL, MerchandID, ProvUserID_3DS, ProvUserPassword, SubMerchandID) .Customer(customer_email, customer_ipAddress) .CreditCard(credit_card_number_for_3D, credit_card_cvv2_for_3D, credit_card_month_for_3D, credit_card_year_for_3D) .Order("OID" + DateTime.Now.Ticks.ToString()) //.AddOrderAddress(GVPSAddressTypeEnum.Billing, order_address_city, order_address_district, order_address_text, order_address_phone, null, null, order_address_name, order_address_postalCode) //.AddOrderAddress(GVPSAddressTypeEnum.Shipping, order_address_city, order_address_district, order_address_text, order_address_phone, null, null, order_address_name, order_address_postalCode) //.AddOrderItem(1, "0001", "ProductA ğüşiöçĞÜŞİÖÇ", 1.456, 3.456, "product A ğüşiöçĞÜŞİÖÇ description") //.AddOrderItem(2, "0002", "ProductB", 1.4, 1.1, "product B description") //.AddOrderComment(1, "COM1 ğüşiöçĞÜŞİÖÇ") .Amount(95, GVPSCurrencyCodeEnum.TRL) .Sale3DRequest(SecureKey, successUri, failUri); Request.AddInput("", "Gönder", "submit"); var HTML = Request.OuterXml; Debug.WriteLine("Secure 3D Form: " + HTML); var i = SelfHost.Run(HostUri.ToString()) .Listen("/Sales3DTest", (IOwinContext con) => { Debug.WriteLine("REQUEST Sales3DTest"); con.Response.Expires = DateTimeOffset.Now.AddDays(-1); string strRegex = @"<input type=""hidden"" name=""(\w*)"" value=""([\w|\.|\:|\/|\@]*)"" />"; string strReplace = "\n" + @"<div class=""row"">" + "\n" + @"<div class=""col-md-2"">$1</div>" + "\n" + @"<div class=""col-md-2"">$2</div>" + "\n" + @"</div>" + "\n"; Regex myRegex = new Regex(strRegex, RegexOptions.None); HTML = myRegex.Replace(HTML, strReplace).Replace(@"<input type=""submit"" name="""" value=""Gönder"" />", "").Replace("<form", "<div").Replace("</form>", "</div>") + HTML; con.Response.Write(SelfHost.CreateWebContent(HTML, "Sales 3D test page")); }) .Listen(HostUriSuccessPath, async(IOwinContext con) => { Debug.WriteLine("REQUEST " + HostUriSuccessPath); con.Response.Expires = DateTimeOffset.Now.AddDays(-1); var ResponseHTML = ""; try { var formData = await con.Request.ReadFormAsync() as IEnumerable <KeyValuePair <string, string[]> >; ValidateResultFunction(con, formData, ref ResponseHTML, ref VPClient, successUri, failUri); con.Response.Write(SelfHost.CreateWebContent(ResponseHTML, "Sales 3D SUCCESS page")); IsFail = false; } catch (Exception exSuccess) { IsFail = true; FailMessage = exSuccess.ToString(); con.Response.Write(SelfHost.CreateWebContent("<pre>" + exSuccess.ToString() + "</pre>" + ResponseHTML, "Sales 3D INTERNAL ERROR SUCCESS page")); throw; } }) .Listen(HostUriFailPath, async(IOwinContext con) => { Debug.WriteLine("REQUEST " + HostUriFailPath); IsFail = true; var ResponseHTML = ""; try { var formData = (await con.Request.ReadFormAsync() as IEnumerable <KeyValuePair <string, string[]> >); ValidateResultFunction(con, formData, ref ResponseHTML, ref VPClient, successUri, failUri); con.Response.Write(SelfHost.CreateWebContent(ResponseHTML, "Sales 3D FAIL page")); } catch (Exception exFail) { FailMessage = exFail.ToString(); con.Response.Write(SelfHost.CreateWebContent("<pre>" + exFail.ToString() + "</pre>" + ResponseHTML, "Sales 3D INTERNAL ERROR FAIL page")); throw; } }) //.OpenWebClient("/", false) .OpenWebClient("/Sales3DTest") ; Assert.IsFalse(IsFail, FailMessage); //OpenWebUI(HTML, "Sales3DTest"); //var _pay = new GarantiVPClient() // .Test(true) // .Sales3DComplete(Request, Response); //ValidateResult(_pay); //OrderIdForCancel = _pay.Order.OrderID; //OrderRefNumberForCancel = _pay.Transaction.RetrefNum; }