public object getPposWxPay(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; //string orderId = dicParas.ContainsKey("orderId") ? dicParas["orderId"].ToString() : string.Empty; string orderId = System.DateTime.Now.ToString("yyyyMMddHHmmss"); string amount = dicParas.ContainsKey("amount") ? dicParas["amount"].ToString() : string.Empty; string subject = dicParas.ContainsKey("subject") ? dicParas["subject"].ToString() : string.Empty; string openid = dicParas.ContainsKey("openid") ? dicParas["openid"].ToString() : string.Empty; if (string.IsNullOrWhiteSpace(orderId)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "订单号无效")); } //Flw_Order order = Flw_OrderBusiness.GetOrderModel(orderId); //if (order == null) //{ // return ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "订单号无效"); //} #region 新大陆微信公众号支付 string error = ""; PPosPayData.WeiXinPubPay pay = new PPosPayData.WeiXinPubPay(); pay.openid = openid; //在授权回调页面中获取到的授权code或者openid pay.amount = amount; //实际付款 pay.total_amount = amount; //订单总金额 pay.subject = subject; pay.selOrderNo = orderId; pay.goods_tag = ""; PPosPayApi ppos = new PPosPayApi(); PPosPayData.WeiXinPubPayACK ack = new PPosPayData.WeiXinPubPayACK(); PPosPayData.WeiXinPubPayACK result = ppos.PubPay(pay, ref ack, out error); if (result == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "支付失败," + error)); } #endregion PposPubSigPay model = new PposPubSigPay(); model.appId = result.apiAppid; model.timeStamp = result.apiTimestamp; model.nonceStr = result.apiNoncestr; model.package = result.apiPackage; model.paySign = result.apiPaysign; return(ResponseModelFactory <PposPubSigPay> .CreateModel(isSignKeyReturn, model)); } catch (Exception e) { throw e; } }
protected void Button2_Click(object sender, EventArgs e) { PPosPayData.WeiXinPubPay pay = new PPosPayData.WeiXinPubPay(); PPosPayData.WeiXinPubPayACK ack = new PPosPayData.WeiXinPubPayACK(); string error = string.Empty; PPosPayApi ppos = new PPosPayApi(); PPosPayData.WeiXinPubPayACK result = ppos.PubPay(pay, ref ack, out error); Response.Write(error); }