/// <summary> /// 预下单,获取订单号 /// </summary> public static string PreOrder(PayParam param) { string orderUrl = param.SeverUrl + "?" + "TYPE=PreOrder" + "&" + param.ToString(); string data = WebTool.getWebData(orderUrl); string orderId = WebTool.getNodeData(data, "Result", false).Trim(); return(orderId); }
// 支付结果处理逻辑 private void PayResult(string param) { string isSuccess = WebTool.getNodeData(param, "isSuccess", false).ToLower(); if (isSuccess.Equals("true")) { string serial = MachineInfo_Serial.RegSerial(SoftName); RegistryTool.RegistrySave(AuthorName + @"\" + SoftName + @"\Set", "Serial", serial); MessageBox.Show("恭喜,您已成功注册!(即时注册)"); } }
/// <summary> /// 查询KEY列对应的数据信息 /// </summary> /// <param name="KEY">列名称</param> /// <param name="machinCode">机器码</param> /// <param name="soft">软件名称</param> /// <returns></returns> public string GetValue(string KEY, string machinCode, string soft) { string Url = "http://" + QrPayServerAddress + "/pages/onlineserial.aspx?TYPE=GetValue&KEY=" + KEY + "&machinCode=" + machinCode + "&soft=" + soft; string data = WebTool.getWebData(Url).Trim(); if (!data.Equals("")) { data = Locker.Decrypt(data, machinCode + soft); data = WebTool.getNodeData(data, KEY, false); } return(data); }
/// <summary> /// 获取获取ext附加参数中的信息 /// </summary> /// <returns></returns> public string ExtInfo(string extKey) { string Url = "http://" + QrPayServerAddress + "/pages/softinfo.aspx?TYPE=Select&softName=" + SoftName + "&key=ext"; string data = WebTool.getWebData(Url).Trim(); if (!data.Equals("")) { data = Locker.Decrypt(data, SoftName); // 使用软件名称解密,加密的金额信息 price = WebTool.getNodeData(data, "ext", false); } string extValue = WebTool.getNodeData(data, extKey, false); return(extValue); }
/// <summary> /// 查询订单支付结果 /// </summary> public static string OrderResult(PayParam param, string preOrderId) { string url = param.SeverUrl + "?" + "TYPE=OrderResult" + "&" + "preOrderId=" + preOrderId; string paramStr = param.ToString(); string data = WebTool.getWebData(url); string result = WebTool.getNodeData(data, "Result", false).Trim(); // 使用创建订单时的参数信息,解密查询结果 if (paramStr != null && !paramStr.Equals("")) { result = Locker.Decrypt(result, preOrderId + paramStr); } return(result); }
/// <summary> /// 获取软件的支付金额信息 /// </summary> /// <returns></returns> public string getPrice() { //if (!price.Equals("")) return price; string Url = "http://" + QrPayServerAddress + "/pages/softinfo.aspx?TYPE=Select&softName=" + SoftName + "&key=price"; string data = WebTool.getWebData(Url).Trim(); if (!data.Equals("")) { data = Locker.Decrypt(data, SoftName); // 使用软件名称解密,加密的金额信息 price = WebTool.getNodeData(data, "price", false); } if (price.Equals("")) { price = "10.00"; } return(price); }
private void timerRefresh_Tick(object sender, EventArgs e) { if (orderId.Equals("")) { orderId = PreOrder(param); // 1、下单,获取订单号 string url = ShowPreOrderUrl(param.SeverUrl, orderId); contentWebBrowser.Navigate(url); // 2、显示二维码支付页面 } else { string result = OrderResult(param, orderId); // 3、查询支付结果 string isSuccess = WebTool.getNodeData(result, "isSuccess", false).ToLower(); if (isSuccess.Equals("true")) { timerRefresh.Enabled = false; if (call != null) { call(result); } this.Close(); } } }