public static string SortedDictionary2XmlStr(JdPayDictionary dic) { var xmldoc = new XmlDocument(); SortedDictionary2Xml(xmldoc, dic); return(ConvertXmlToString(xmldoc)); }
public IDictionary <string, string> GetParameters() { var parameters = new JdPayDictionary() { { "payMerchant", PayMerchant }, { "device", Device }, { "tradeNum", TradeNum }, { "tradeName", TradeName }, { "tradeDesc", TradeDesc }, { "tradeTime", TradeTime }, { "amount", Amount }, { "orderType", OrderType }, { "industryCategoryCode", IndustryCategoryCode }, { "currency", Currency }, { "note", Note }, { "callbackUrl", CallbackUrl }, { "notifyUrl", NotifyUrl }, { "ip", Ip }, { "specCardNo", SpecCardNo }, { "specId", SpecId }, { "specName", SpecName }, { "tradeType", TradeType }, { "userId", UserId }, { "expireTime", ExpireTime }, { "orderGoodsNum", OrderGoodsNum }, { "vendorId", VendorId }, { "goodsInfo", GoodsInfo }, { "receiverInfo", ReceiverInfo }, { "termInfo", TermInfo }, { "riskInfo", RiskInfo }, }; return(parameters); }
public T Parse(JdPayDictionary dic) { if (dic == null || dic.Count == 0) { throw new ArgumentNullException(nameof(dic)); } if (!DicProperties.ContainsKey(typeof(T))) { DicProperties[typeof(T)] = GetPropertiesMap(typeof(T)); } var propertiesMap = DicProperties[typeof(T)]; var result = Activator.CreateInstance <T>(); foreach (var item in dic) { if (propertiesMap.ContainsKey(item.Key)) { propertiesMap[item.Key].SetValue(result, item.Value.TryTo(propertiesMap[item.Key].PropertyType)); } } return(result); }
public static XmlDocument SortedDictionary2AllXml(JdPayDictionary dic) { var xmldoc = new XmlDocument(); var xmldecl = xmldoc.CreateXmlDeclaration("1.0", "UTF-8", null); xmldoc.AppendChild(xmldecl); SortedDictionary2Xml(xmldoc, dic); return(xmldoc); }
public IDictionary <string, string> GetParameters() { var parameters = new JdPayDictionary() { { "tradeNum", TradeNum }, { "oTradeNum", OTradeNum }, { "tradeType", 1 }, // 退款 }; return(parameters); }
public static void SortedDictionary2Xml(XmlDocument xmldoc, JdPayDictionary dic) { var xmlelem = xmldoc.CreateElement("", "jdpay", ""); xmldoc.AppendChild(xmlelem); foreach (var kv in dic) { var xe = xmldoc.CreateElement(kv.Key); xe.InnerText = kv.Value; xmlelem.AppendChild(xe); } }
public IDictionary <string, string> GetParameters() { var parameters = new JdPayDictionary() { { "tradeNum", TradeNum }, { "oTradeNum", OTradeNum }, { "amount", Amount }, { "currency", Currency }, { "tradeTime", TradeTime }, { "note", Note }, }; return(parameters); }