/// <summary> /// 获取指定SKU的商品信息(Quantity,Price,Description等) /// </summary> /// <param name="request">IngramRequest</param> /// <returns>IngramResponse</returns> public void HandleEvent(AbandonUnicomMessage eventMessage) { AbandonUnicomRequestMessage request = InitRequest(eventMessage); string strURL = AppSettingHelper.UnicomURL; string reqXML = BuildRequest(request); string rspXML = null; string orderSysNo = eventMessage.OrderNumber; try { WriteLog(reqXML, orderSysNo); //访问Ingram服务获取批定SKU的Item信息 rspXML = GetResponse(reqXML, strURL); UnicomResponseMessage response = BuildUnicomResponseMessage(rspXML); ValidataResponse(response); WriteLog(rspXML, orderSysNo); } catch (Exception ex) { WriteLog(ex.Message, orderSysNo); } }
private void ValidataResponse(UnicomResponseMessage response) { Dictionary <string, string> errorCodeList = new Dictionary <string, string>(); errorCodeList.Add("100000", "请求串不合法"); errorCodeList.Add("100001", "服务器名称不正确"); errorCodeList.Add("100002", "用户名与密码不符"); errorCodeList.Add("100003", "代理商不正确"); errorCodeList.Add("100004", "WebServiceKey不正确"); errorCodeList.Add("100005", "号码查询失败"); errorCodeList.Add("100006", "号码预占失败"); errorCodeList.Add("100007", "号码取消预占失败"); errorCodeList.Add("100008", "套餐查询失败"); errorCodeList.Add("100009", "下单失败"); errorCodeList.Add("100010", "订单取消失败"); errorCodeList.Add("100011", "合作方订单号查询失败"); errorCodeList.Add("100012", "订单状态查询失败"); errorCodeList.Add("100013", "sim卡绑定失败"); errorCodeList.Add("100014", "无可选择的sim卡"); errorCodeList.Add("100015", "通知开户失败"); errorCodeList.Add("100016", "订单状态修改失败"); errorCodeList.Add("999999", "未知异常"); if (response != null && response.MsgInfo != null && !string.IsNullOrEmpty(response.MsgInfo.MsgCode)) { foreach (var errorCode in errorCodeList) { if (response.MsgInfo.MsgCode == errorCode.Key) { ThrowBizException(errorCode.Value); } } } }