MxWeiXinPF.API/Payment/Tenpay/TenpayUtil.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Xml;
using System.Text;
using System.Web;
using MxWeiXinPF.Common;
namespace MxWeiXinPF.API.Payment.Tenpay
{
/// <summary>
/// TenpayUtil 的摘要说明。
/// </summary>
public class TenpayUtil
{
public static string tenpay = "1";
public static string partner = ""; //财付通商户号
public static string key = ""; //财付通密钥;
public static string type = "1"; //接口类型1即时到帐2担保交易
public static string return_url = ""; //显示支付通知页面;
public static string notify_url = ""; //支付完成后的回调处理页面;
static TenpayUtil()
{
//读取XML配置信息
string fullPath = Utils.GetMapPath("~/xmlconfig/tenpay.config");
XmlDocument doc = new XmlDocument();
doc.Load(fullPath);
XmlNode _partner = doc.SelectSingleNode(@"Root/partner");
XmlNode _key = doc.SelectSingleNode(@"Root/key");
XmlNode _type = doc.SelectSingleNode(@"Root/type");
XmlNode _return_url = doc.SelectSingleNode(@"Root/return_url");
XmlNode _notify_url = doc.SelectSingleNode(@"Root/notify_url");
//读取站点配置信息
Model.siteconfig model = new BLL.siteconfig().loadConfig();
partner = _partner.InnerText;
key = _key.InnerText;
type = _type.InnerText;
return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _return_url.InnerText;
notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _notify_url.InnerText;
}
/** 对字符串进行URL编码 */
public static string UrlEncode(string instr, string charset)
{
//return instr;
if(instr == null || instr.Trim() == "")
return "";
else
{
string res;
try
{
res = HttpUtility.UrlEncode(instr,Encoding.GetEncoding(charset));
}
catch (Exception ex)
{
res = HttpUtility.UrlEncode(instr,Encoding.GetEncoding("GB2312"));
}
后面还有 63 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
