/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { if (this.IsValid) { bool result = false; string supp = this.ddlSupp.SelectedValue; decimal amt = decimal.Parse(this.txtOrderAmt.Text.Trim()); if (amt <= 0M) { AlertAndRedirect("金额不能为0"); return; } if (!string.IsNullOrEmpty(supp)) { // viviapi.ETAPI.ETAPIBase cmd = new viviapi.ETAPI.ETAPIBase(int.Parse(supp)); string orderclass = rblOrdClass.SelectedValue; if (orderclass == "1") { BLL.OrderBank bll = new viviapi.BLL.OrderBank(); //result = bll.DoBankComplete(int.Parse(supp), this.txtOrder.Text.Trim(), "ResetOrder", 2, "0", "", amt, 0M, true, false, false); } else if (orderclass == "2") { BLL.OrderCard bll = new viviapi.BLL.OrderCard(); //result = bll.DoCardComplete(int.Parse(supp), this.txtOrder.Text.Trim(), "ResetOrder", 2, "0", "", amt, 0M, false); //result = bll.RepairOrder(int.Parse(supp), this.txtOrder.Text.Trim(), "ResetOrder", 2, "0", "", "", amt, 0M, string.Empty, 1); } else if (orderclass == "3") { } } if (result) { AlertAndRedirect("操作成功"); return; } else { AlertAndRedirect("操作失败"); return; } } }
/// <summary> /// /// </summary> public void Notify() { //string MerchantKey = suppKey; string name = GetValue("Name"); string version = GetValue("Version"); string charset = GetValue("Charset"); string traceNo = GetValue("TraceNo"); string msgSender = GetValue("MsgSender"); string sendTime = GetValue("SendTime"); string instCode = GetValue("InstCode"); string orderNo = GetValue("OrderNo"); string orderAmount = GetValue("OrderAmount"); string transNo = GetValue("TransNo"); string transAmount = GetValue("TransAmount"); string transStatus = GetValue("TransStatus"); string transType = GetValue("TransType"); string transTime = GetValue("TransTime"); string merchantNo = GetValue("MerchantNo"); string errorCode = GetValue("ErrorCode"); string errorMsg = GetValue("ErrorMsg"); string ext1 = GetValue("Ext1"); string signType = GetValue("SignType"); string signMsg = GetValue("SignMsg"); string sign = name + version + charset + traceNo + msgSender + sendTime + instCode + orderNo + orderAmount + transNo + transAmount + transStatus + transType + transTime + merchantNo + errorCode + errorMsg + ext1 + signType + MerchantKey; string localsignMsg = MD5(sign); if (signMsg == localsignMsg) { var bll = new viviapi.BLL.OrderCard(); string opstate = "-1"; int status = (transStatus == "01") ? 2 : 4; string viewMsg = ""; string errCode = ""; string errMsg = ""; if (!string.IsNullOrEmpty(errorMsg)) { var ja = (Newtonsoft.Json.Linq.JArray)JsonConvert.DeserializeObject(errorMsg); foreach (Newtonsoft.Json.Linq.JObject item in ja) { if (item["errorCode"] != null) { errCode = item["errorCode"].ToString().Replace("\"", ""); } if (item["errorMsg"] != null) { errMsg = item["errorMsg"].ToString().Replace("\"", ""); } } } if (status == 2) { opstate = "0"; errorCode = "0"; viewMsg = "支付成功"; } else { opstate = ConvertCode(errCode); viewMsg = SysInterface.Card.MyAPI.Utility.GetMessageByCode(opstate); } var response = new CardOrderSupplierResponse() { SupplierId = SuppId, SuppTransNo = transNo, SysOrderNo = orderNo, OrderAmt = decimal.Parse(transAmount), SuppAmt = 0M, OrderStatus = status, SuppErrorCode = errCode, SuppErrorMsg = errMsg, Opstate = opstate, ViewMsg = viewMsg, Method = 1 }; OrderCardUtils.SuppNotify(response, "OK"); } }
/// <summary> /// /// </summary> public void CardNotify() { HttpRequest req = HttpContext.Current.Request; string _orderid = req.QueryString["orderid"]; string _opstate = req.QueryString["opstate"]; string _ovalue = req.QueryString["ovalue"]; string _sign = req.QueryString["sign"]; string _sysorderid = req.QueryString["sysorderid"]; string _systime = req.QueryString["systime"]; // //'生成MD5签名 String plain = string.Format("orderid={0}&opstate={1}&ovalue={2}{3}", _orderid, _opstate, _ovalue, SuppKey); String localSign = viviLib.Security.Cryptography.MD5(plain); try { if (localSign == _sign) { string opstate = "-1"; int status = 4; if (_opstate.ToLower() == "0") { opstate = "0"; status = 2; } BLL.OrderCard bll = new viviapi.BLL.OrderCard(); string suppmsg = GetMsgInfo("opstate=" + opstate, _ovalue); string viewMsg = suppmsg; //bll.ReceiveSuppResult(suppId // , _orderid // , _sysorderid // , status // , opstate // , suppmsg // , viewMsg // , decimal.Parse(_ovalue) // , 0M // , opstate // , 1); //HttpContext.Current.Response.Write("opstate=0"); var response = new CardOrderSupplierResponse() { SupplierId = SuppId, SuppTransNo = _sysorderid, SysOrderNo = _orderid, OrderAmt = decimal.Parse(_ovalue), SuppAmt = 0M, OrderStatus = status, SuppErrorCode = opstate, Opstate = opstate, SuppErrorMsg = suppmsg, ViewMsg = viewMsg, Method = 1 }; OrderCardUtils.SuppNotify(response, succflag); } else { } } catch (Exception ex) { viviLib.ExceptionHandling.ExceptionHandler.HandleException(ex); } }
/// <summary> /// /// </summary> /// <param name="stateInfo"></param> public void Process(Object stateInfo) { CardProcessResultInfo procRes = (CardProcessResultInfo)stateInfo; BLL.OrderCard bll = new viviapi.BLL.OrderCard(); var response = new CardOrderSupplierResponse() { SupplierId = procRes.supplierId, SuppTransNo = procRes.supplierOrder, SysOrderNo = procRes.orderid, OrderAmt = procRes.tranAMT, SuppAmt = 0M, OrderStatus = procRes.status, SuppErrorCode = procRes.errtype, Opstate = procRes.opstate, SuppErrorMsg = procRes.msg, ViewMsg = procRes.userViewMsg, Method = procRes.method }; OrderCardUtils.Finish(response); //bll.ReceiveSuppResult( // procRes.supplierId // , procRes.orderid // , procRes.supplierOrder // , procRes.status // , procRes.opstate // , procRes.msg // , procRes.userViewMsg // , procRes.tranAMT // , procRes.suppAmt // , procRes.errtype // , procRes.method); procRes.count++; bool timerflag = false; if (procRes.tmr != null) { switch (procRes.count) { case 1: timerflag = (procRes.tmr).Change(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(200)); break; case 2: timerflag = (procRes.tmr).Change(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(200)); //1分钟 break; case 3: timerflag = (procRes.tmr).Change(TimeSpan.FromMinutes(2), TimeSpan.FromSeconds(200)); //2分钟 break; } } if (procRes != null) { if (procRes.count >= 4) { if (procRes != null) { procRes.tmr.Dispose(); procRes.tmr = null; } } } }