/// <summary> /// 设置客户端参数 /// </summary> /// <param name="Key"></param> /// <param name="Value"></param> /// <param name="retmsg"></param> /// <returns></returns> public static int DoSetConfigInfo(Dictionary <Global.ConfigInfo, string> configlist, out string retmsg) { int res = -1; try { string jsonStr = JsonDeal.ConfigInfolist2JsonData(configlist); WRAliPay.AliPayWebService ws = new WRAliPay.AliPayWebService(); RecvRes retres = TransRes(ws.SetNetConfigInfo(jsonStr)); retmsg = retres.Description; if (retres.IsOK) { //配置成功 res = 0; } else { throw new Exception("配置参数失败"); } } catch (Exception ex) { retmsg = ex.Message; throw; } return(res); }
public static int DoGetPayPrarms(out List <CommonData.PayPrarmsData> paylist, out string retmsg) { int res = -1; try { WRAliPay.AliPayWebService ws = new WRAliPay.AliPayWebService(); RecvRes retres = TransRes(ws.GetRenewalPriceInfo()); retmsg = retres.Description; if (retres.IsOK) { if (!string.IsNullOrEmpty(retres.ExtData)) { string jsondata = retres.ExtData; paylist = JsonDeal.JsonData2PayInfolist(jsondata); res = 0; } else { throw new Exception("accpect PayPrarmData is null"); } } else { paylist = null; } } catch (Exception ex) { retmsg = ex.Message; paylist = null; throw; } return(res); }
/// <summary> /// 查询订单是否已付款 /// </summary> /// <param name="account"></param> /// <param name="orderNum"></param> /// <param name="retmsg"></param> /// <returns></returns> public static int DoQueryByOrder(string account, string orderNum, out string retmsg, out bool IsPay) { int res = -1; try { IsPay = false; WRAliPay.AliPayWebService ws = new WRAliPay.AliPayWebService(); RecvRes retres = TransRes(ws.QueryByOrderNo(account, orderNum)); retmsg = retres.Description; if (retres.IsOK) { if (retres.StateCodeID == 1) { IsPay = true; } res = 0; } } catch (Exception ex) { retmsg = ex.Message; throw; } return(res); }
/// <summary> /// 预下单获取支付地址与订单号 /// </summary> /// <param name="account"></param> /// <param name="renewalWay"></param> /// <param name="retmsg"></param> /// <returns></returns> public static int DoPreCreate(string account, string renewalWay, out string retmsg, out string QRStr, out string orderNo) { int res = -1; try { WRAliPay.AliPayWebService ws = new WRAliPay.AliPayWebService(); RecvRes retres = TransRes(ws.PreCreate(account, renewalWay)); retmsg = retres.Description; QRStr = ""; orderNo = ""; if (retres.IsOK) { if (!string.IsNullOrEmpty(retres.ExtData)) { QRStr = retres.ExtData; if (!string.IsNullOrEmpty(retres.SucceedDescription)) { orderNo = retres.SucceedDescription; res = 0; } } else { throw new Exception("accpect extData is null"); } } } catch (Exception ex) { retmsg = ex.Message; throw; } return(res); }
/// <summary> /// 获取客户端参数配置 /// </summary> /// <param name="configlist"></param> /// <param name="retmsg"></param> /// <returns></returns> public static int DoGetConfiginfo(out Dictionary <Global.ConfigInfo, string> configlist, out string retmsg) { int res = -1; //#if DEBUG // configlist = new Dictionary<Global.ConfigInfo, string>(); // configlist.Add(Global.ConfigInfo.FtpPath, "39.108.188.162"); // configlist.Add(Global.ConfigInfo.InitAddr, ""); // configlist.Add(Global.ConfigInfo.WebAddAddr, "www.baidu.com"); // configlist.Add(Global.ConfigInfo.YeMeiMsg, "维修秘籍"); // retmsg = "调试状态,获取客户端参数配置返回成功!"; // res = 0; // return res; //#endif try { WRAliPay.AliPayWebService ws = new WRAliPay.AliPayWebService(); RecvRes retres = TransRes(ws.GetNetConfigInfo()); retmsg = retres.Description; if (retres.IsOK) { //string jsonStr = JsonDeal.JsonData2ConfigInfolist(Global.ConfigInfoList); if (!string.IsNullOrEmpty(retres.ExtData)) { string jsondata = retres.ExtData; configlist = JsonDeal.JsonData2ConfigInfolist(jsondata); res = 0; } else { throw new Exception("accpect ConfigData is null"); } res = 0; } else { configlist = null; } } catch (Exception ex) { retmsg = ex.Message; configlist = null; throw; } return(res); }
/// <summary> /// 设置支付参数 /// </summary> /// <param name="priceF"></param> /// <param name="renewalTimeF"></param> /// <param name="priceS"></param> /// <param name="renewalTimeS"></param> /// <param name="retmsg"></param> /// <returns></returns> public static int DoSetPayPrarms(string priceF, string renewalTimeF, string priceS, string renewalTimeS, out string retmsg) { int res = -1; try { WRAliPay.AliPayWebService ws = new WRAliPay.AliPayWebService(); RecvRes retres = TransRes(ws.SetRenewalInfo(priceF, renewalTimeF, priceS, renewalTimeS)); retmsg = retres.Description; if (retres.IsOK) { res = 0; } } catch (Exception ex) { retmsg = ex.Message; throw; } return(res); }
/// <summary> /// 取消预下单 /// </summary> /// <param name="account"></param> /// <param name="orderNum"></param> /// <param name="retmsg"></param> /// <returns></returns> public static int DoCancelPreOrder(string account, string orderNum, out string retmsg) { int res = -1; try { WRAliPay.AliPayWebService ws = new WRAliPay.AliPayWebService(); RecvRes retres = TransRes(ws.CancelPreOrder(account, orderNum)); retmsg = retres.Description; if (retres.IsOK) { res = 0; } } catch (Exception ex) { retmsg = ex.Message; throw; } return(res); }