/// <summary> /// 返回消息 /// </summary> /// <param name="code">编码</param> /// <param name="message">消息</param> /// <returns></returns> private string Return(string code, string message) { var xml = new Xml(); xml.AddCDataNode(code, WechatpayConst.ReturnCode); xml.AddCDataNode(message, WechatpayConst.ReturnMessage); return(xml.ToString()); }
/// <summary> /// 添加Xml节点 /// </summary> /// <param name="xml">Xml操作</param> /// <param name="key">键</param> /// <param name="value">值</param> private void AddNode(Xml xml, string key, object value) { if (key.SafeString().ToLower() == WechatpayConst.TotalFee) { xml.AddNode(key, value); return; } xml.AddCDataNode(value, key); }
/// <summary> /// 获取Xml文档 /// </summary> /// <param name="builder">参数生成器</param> /// <returns></returns> private XmlDocument ToXmlDocument(ParameterBuilder builder) { var xml = new Xml(); foreach (var param in builder.GetDictionary()) { AddNode(xml, param.Key, param.Value); } return(xml.Document); }