/// <summary> /// 查询支付业务是否存在 /// </summary> /// <param name="payBUS"></param> /// <param name="cbsRespAction">cbs返回参数回调函数,主要用于记录日志</param> /// <param name="payParamAction">查询参数回调函数,主要用于记录日志,返回失败才会执行,第一个参数是请求参数,第二个参数是错误信息</param> /// <returns></returns> public string SearchPayBUS(PayBUSInfo payBUS, Action <string> cbsRespAction = null, Action <string, string> payParamAction = null) { string error = ""; //生成支付请求信息参数 string param = this.PayBUSInfoXMLStr(payBUS); string respStr = HttpHelper.Post(Url, param); cbsRespAction?.Invoke(respStr); respStr = this.GetXMLInnerData(respStr); CBSERPPGK respObj = XMLHelper.DeserializeToObject <CBSERPPGK>(respStr); if (!respObj.IsSucess) { bool flag1 = false; bool flag3 = false; if (respObj.INFO != null) { respObj.INFO.ERRMSG = respObj.INFO.ERRMSG.Replace("\n", ""); if (!string.IsNullOrEmpty(respObj.INFO.ERRMSG)) { error += "\n" + respObj.INFO.ERRMSG; } else { flag1 = !flag1; } } if (respObj.SYCOMRETZ != null) { respObj.SYCOMRETZ.ERRMSG = respObj.SYCOMRETZ.ERRMSG.Replace("\n", ""); if (!string.IsNullOrEmpty(respObj.SYCOMRETZ.ERRMSG)) { error += "\n" + respObj.SYCOMRETZ.ERRMSG; } else { flag3 = !flag3; } } payParamAction?.Invoke(param, error); return(""); } else { return(respObj.ERPAYBUSZ.BUSNBR); } }
/// <summary> /// 支付经办 /// </summary> /// <param name="payInfo">支付信息</param> /// <param name="startIndex">支付失败开启轮询的起始数字</param> /// <param name="endIndex">支付失败开启轮询的终止数字</param> /// <param name="cbsRespAction">cbs返回参数回调函数,主要用于记录日志</param> /// <param name="payParamAction">支付参数回调函数,主要用于记录日志,返回失败才会执行,第一个参数是请求参数,第二个参数是错误信息</param> /// <returns>item1:客户业务参考号 item2:业务流水号</returns> public Tuple <string, string> PaySAV(PaySAVInfo payInfo, int startIndex, int endIndex, Action <string> cbsRespAction = null, Action <string, string> payParamAction = null) { string error = ""; //生成支付请求信息参数 string param = this.PaySAVInfoXMLStr(payInfo); string respStr = HttpHelper.Post(Url, param); cbsRespAction?.Invoke(respStr); respStr = this.GetXMLInnerData(respStr); CBSERPPGK respObj = XMLHelper.DeserializeToObject <CBSERPPGK>(respStr); if (!respObj.IsSucess) { bool flag1 = false; bool flag2 = false; bool flag3 = false; if (respObj.INFO != null) { respObj.INFO.ERRMSG = respObj.INFO.ERRMSG.Replace("\n", ""); if (!string.IsNullOrEmpty(respObj.INFO.ERRMSG)) { error += "\n" + respObj.INFO.ERRMSG; } else { flag1 = !flag1; } } if (respObj.APPAYSAVZ != null) { respObj.APPAYSAVZ.ERRMSG = respObj.APPAYSAVZ.ERRMSG.Replace("\n", ""); if (!string.IsNullOrEmpty(respObj.APPAYSAVZ.ERRMSG)) { error += "\n" + respObj.APPAYSAVZ.ERRMSG; } else { flag2 = !flag2; } } if (respObj.SYCOMRETZ != null) { respObj.SYCOMRETZ.ERRMSG = respObj.SYCOMRETZ.ERRMSG.Replace("\n", ""); if (!string.IsNullOrEmpty(respObj.SYCOMRETZ.ERRMSG)) { error += "\n" + respObj.SYCOMRETZ.ERRMSG; } else { flag3 = !flag3; } } payParamAction?.Invoke(param, error); //非支付信息错误问题导致的支付失败,轮询请求 if (flag1 && flag2 && flag3 && startIndex <= endIndex) { startIndex += 1; this.PaySAV(payInfo, startIndex, endIndex, cbsRespAction, payParamAction); } return(new Tuple <string, string>(null, null)); } else { Tuple <string, string> tuple = new Tuple <string, string>(respObj.APPAYSAVZ.REFNBR, respObj.APPAYSAVZ.BUSNBR); return(tuple); } }