/// <summary> /// 处理支付信息 /// </summary> /// <param name="OpenId">OpenId</param> /// <param name="Id">支付编号</param> private void InitMember(string OpenId, string Id) { var model = new BWeiXin().GetInfo2(OpenId); if (model != null) { //取得支付信息 var PayModel = new Eyousoft_yhq.BLL.BChongZhi().GetModel(Id); if (PayModel != null) { this.lblAccount.Text = PayModel.OptMoney.ToString("F2"); this.lblCope.Text = PayModel.OptMoney.ToString("F2"); #region 初始化支付信息 Tenpay pay = new Tenpay(); TenPayTradeModel.OPENID = OpenId; TenPayTradeModel.Totalfee = PayModel.OptMoney; TenPayTradeModel.UserIP = Utils.GetRemoteIP(); TenPayTradeModel.OutTradeNo = PayModel.OrderCode; TenPayTradeModel.OrderInfo.Body = "充值金额:" + PayModel.OptMoney.ToString("F2") + "元"; _TenPayTradeModel = pay.Create_url(TenPayTradeModel); #endregion } } }
public static AccountServiceResponse ValidatePrePayForDeal_PrePay(PrePay prePay) { if (prePay.State != PrePayStates.Processing) { return(new AccountServiceResponse(ResponseCode.NonFoundDeal)); } return(new AccountServiceResponse(ResponseCode.Success)); }
public int Save(PrePay prePay) { if (prePay.PrePayId != 0) { prePay.UpdateTime = DateTime.Now; return(_databaseInstance.Update(prePay, "PrePays")); } else { prePay.UpdateTime = prePay.SubmitTime; prePay.PrePayId = _databaseInstance.Insert(prePay, "PrePays"); return(prePay.PrePayId); } }
/// <summary> /// 构造支付 /// </summary> /// <param name="trade">交易业务实体</param> /// <returns></returns> public PrePay Create_url(TenPayTrade trade) { string s = ""; if (trade.OrderInfo.OrderID.Count > 0) { StringBuilder builder = new StringBuilder(); foreach (string str2 in trade.OrderInfo.OrderID) { builder.Append(str2 + ","); } if (builder.Length > 0) { builder.Remove(builder.Length - 1, 1); } Attach model = new Attach(); model.Key = "OId"; model.Value = builder.ToString(); trade.AttachList.Add(model); model = null; } s = trade.AttachList.ToString(); RequestHandler handler = new RequestHandler(HttpContext.Current); handler.init(); handler.setKey(TenPaySystem.Key); handler.setParameter("mch_id", TenPaySystem.BargainorId); handler.setParameter("trade_type", "JSAPI"); handler.setParameter("out_trade_no", trade.OutTradeNo); handler.setParameter("total_fee", (trade.Totalfee * 100M).ToString("F0")); handler.setParameter("notify_url", TenPaySystem.NotifyUrl); handler.setParameter("body", trade.OrderInfo.Body /*trade.OrderInfo.Subject*/); handler.setParameter("spbill_create_ip", trade.UserIP); handler.setParameter("openid", trade.OPENID); handler.setParameter("appid", TenPaySystem.appid); handler.setParameter("nonce_str", TenpayUtil.getNoncestr()); handler.createMd5Sign(); string xml = Toolkit.request.post("https://api.mch.weixin.qq.com/pay/unifiedorder", handler.parseXML(), ""); var xrss = XElement.Parse(xml); var return_code = Toolkit.StringExtensions.GetXElement(xrss, "return_code").Value; var return_msg = Toolkit.StringExtensions.GetXElement(xrss, "return_msg").Value; var result_code = Toolkit.StringExtensions.GetXElement(xrss, "result_code").Value; var prepay_id = Toolkit.StringExtensions.GetXElement(xrss, "prepay_id").Value; var nonce_str = Toolkit.StringExtensions.GetXElement(xrss, "nonce_str").Value; var sign = Toolkit.StringExtensions.GetXElement(xrss, "sign").Value; PrePay Pay = new PrePay(); if (return_code == "SUCCESS") { Pay.ReqState = true; } if (result_code == "SUCCESS") { Pay.IsSuccess = true; } string timeStamp = TenpayUtil.getTimestamp(); string Noncestr = TenpayUtil.getNoncestr(); RequestHandler reponse = new RequestHandler(HttpContext.Current); reponse.init(); reponse.setKey(TenPaySystem.Key); reponse.setParameter("appId", TenPaySystem.appid); reponse.setParameter("timeStamp", timeStamp); reponse.setParameter("package", "prepay_id=" + prepay_id); reponse.setParameter("nonceStr", Noncestr); reponse.setParameter("signType", "MD5"); sign = reponse.createMd5Sign(); Pay.ReturnMsg = return_msg; Pay.NonceStr = Noncestr; Pay.PrepayId = prepay_id; Pay.Sign = sign; Pay.TimeStamp = timeStamp; return(Pay); }
public ListPrePay(PrePay adminUser) { _innerObject = adminUser; }
public ListPrePay() { _innerObject = new PrePay(); }
protected void SetInnerObject(PrePay prePay) { _innerObject = prePay; }
public void Delete(PrePay prePay) { var sql = "delete prepays where prepayId = @prepayId "; _databaseInstance.ExecuteNonQuery(sql, new { prepayId = prePay.PrePayId }); }
public void Delete(PrePay item) { _databaseInstance.Delete(item, TableName); }
public void Update(PrePay item) { _databaseInstance.Update(item, TableName); }
public void Create(PrePay item) { item.UpdateTime = item.SubmitTime; item.PrePayId = _databaseInstance.Insert(item, TableName); }