/// <summary>
        ///
        /// </summary>
        /// <param name="orderNum"></param>
        /// <param name="totalFee"></param>
        /// <param name="body"></param>
        /// <param name="ip"></param>
        /// <param name="attach">附加数据,原样返回</param>
        public WxPayWorker(string orderNum, decimal totalFee, string body, string ip, string attach)
        {
            wxPayHelper.SetAppId(wxPayConfig.AppId);                     ////""
            wxPayHelper.SetAppKey(wxPayConfig.AppKey);                   ////""
            wxPayHelper.SetPartnerKey(wxPayConfig.PartnerKey);           ////""
            wxPayHelper.SetSignType(wxPayConfig.SignType);               ////"sha1"

            wxPayHelper.SetParameter("bank_type", wxPayConfig.BankType); ////"WX"
            ////wxPayHelper.SetParameter("body", "test");
            wxPayHelper.SetParameter("body", body);
            if (!string.IsNullOrEmpty(attach))
            {
                wxPayHelper.SetParameter("attach", attach);
            }

            wxPayHelper.SetParameter("partner", wxPayConfig.Partner);////""
            ////wxPayHelper.SetParameter("out_trade_no", CommonUtil.CreateNoncestr());
            wxPayHelper.SetParameter("out_trade_no", orderNum);
            ////wxPayHelper.SetParameter("total_fee", "1");
            wxPayHelper.SetParameter("total_fee", WebUtil.Feng4Decimal(totalFee).ToString());
            wxPayHelper.SetParameter("fee_type", wxPayConfig.FeeType);     ////"1"
            wxPayHelper.SetParameter("notify_url", wxPayConfig.NotifyUrl); ////"htttp://www.baidu.com"
            ////wxPayHelper.SetParameter("spbill_create_ip", "127.0.0.1");
            wxPayHelper.SetParameter("spbill_create_ip", ip);
            wxPayHelper.SetParameter("input_charset", "UTF-8"); //wxPayConfig.InputCharset);////"GBK"
        }
        public DeliverNotifyWorker(DeliverNotifyRequest deliverNotifyRequest)
        {
            wxPayHelper.SetAppId(wxPayConfig.AppId);           ////""
            wxPayHelper.SetAppKey(wxPayConfig.AppKey);         ////""
            wxPayHelper.SetPartnerKey(wxPayConfig.PartnerKey); ////""

            this._deliverNotifyRequest            = deliverNotifyRequest;
            this._deliverNotifyRequest.AppId      = wxPayConfig.AppId;
            this._deliverNotifyRequest.SignMethod = "sha1";
        }
        public AddressWorker(AddressRequest addressRequest)
        {
            wxPayHelper.SetAppId(wxPayConfig.AppId);           ////""
            wxPayHelper.SetAppKey(wxPayConfig.AppKey);         ////""
            wxPayHelper.SetPartnerKey(wxPayConfig.PartnerKey); ////""

            this._addressRequest          = addressRequest;
            this._addressRequest.SignType = "sha1";
            this._addressRequest.AppId    = wxPayConfig.AppId;
        }
Exemple #4
0
        public OrderQueryWorker(OrderQueryRequest orderQueryRequest)
        {
            wxPayHelper.SetAppId(wxPayConfig.AppId);           ////""
            wxPayHelper.SetAppKey(wxPayConfig.AppKey);         ////""
            wxPayHelper.SetPartnerKey(wxPayConfig.PartnerKey); ////""

            this._orderQueryRequest                 = orderQueryRequest;
            this._orderQueryRequest.AppId           = wxPayConfig.AppId;
            this._orderQueryRequest.Package.Partner = wxPayConfig.Partner;
            this._orderQueryRequest.SignMethod      = "sha1";
            SetPackageSign();
        }
Exemple #5
0
        public AlarmWorker(AlarmResponse alarmResponse)
        {
            wxPayHelper.SetAppId(wxPayConfig.AppId);           ////""
            wxPayHelper.SetAppKey(wxPayConfig.AppKey);         ////""
            wxPayHelper.SetPartnerKey(wxPayConfig.PartnerKey); ////""
            ////wxPayHelper.SetSignType(wxPayConfig.SignType);////"sha1"

            ////wxPayHelper.SetParameter("bank_type", wxPayConfig.BankType);
            ////wxPayHelper.SetParameter("partner", wxPayConfig.Partner);
            ////wxPayHelper.SetParameter("fee_type", wxPayConfig.FeeType);
            ////wxPayHelper.SetParameter("notify_url", wxPayConfig.NotifyUrl);
            ////wxPayHelper.SetParameter("input_charset", wxPayConfig.InputCharset);

            this._alarmResponse = alarmResponse;
        }
        /// <summary>
        /// 发货
        /// </summary>
        /// <param name="paymentInfo"></param>
        /// <param name="orderEntity"></param>
        /// <returns></returns>
        public Dictionary<string, object> fahuomgr(Model.wx_payment_wxpay paymentInfo, Model.orders orderEntity)
        {
            BLL.wx_logs logBll = new BLL.wx_logs();
            string funName = "发货";
            logBll.AddLog(paymentInfo.wid.Value, "微支付", funName, "开始执行fahuomgr方法[otid:" + orderEntity.id + "]");

            WxPayHelper wxPayHelper = new WxPayHelper();
            wx_payment_wxpay payBll = new wx_payment_wxpay();
           
            //先设置基本信息
            string partnerId = paymentInfo.partnerId; //"1218574001";
            string appId = paymentInfo.appId;// "wxa9b8e33e48ac5e0f";
            string partnerKey = paymentInfo.partnerKey;// "huyuxianghuyuxianghuyuxiang12345";
            //paysignkey(非appkey) 
            string appKey = paymentInfo.paySignKey;// "nwRmqgvSG08pe3vU5qzBLb7Bvih0WOABGzUPvqgFqE0iSkJlJ8wh7JlLYy2cXFgFA3v1bM8eTDm1y1UcyeW9IGq2py2qei7J5xDoVR9lfO3cS6fMjFbMQeeqBRit0bKp";

            wxPayHelper.SetAppId(appId);
            wxPayHelper.SetAppKey(appKey);
            wxPayHelper.SetPartnerKey(partnerKey);
            wxPayHelper.SetSignType("sha1");
            //设置请求package信息

            WeiXinCRMComm wxComm = new WeiXinCRMComm();
            string err="";
            string access_token = wxComm.getAccessToken(paymentInfo.wid.Value, out err);

            string param = wxPayHelper.CreateFaHuoPackage(orderEntity.openid, orderEntity.trade_no, orderEntity.order_no);

            string url = "https://api.weixin.qq.com/pay/delivernotify?access_token=" + access_token;
            string ret = Utils.HttpPost(url, param);
            logBll.AddLog(paymentInfo.wid.Value, "微支付", funName, "ret=" + ret);
            Dictionary<string, object> dict = JsonToDictionary(ret);
            logBll.AddLog(paymentInfo.wid.Value, "微支付", funName, "[otid:" + orderEntity.id + "]发货成功");
            //string errcode = dict["errcode"].ToString();
            //string errmsg = dict["errmsg"].ToString();

            //mxAuthFrame.BLL.wxOrderTmpBLL wot = new mxAuthFrame.BLL.wxOrderTmpBLL();
            //ordertmp.fahuoCode = errcode;
            //ordertmp.fahuoMsg = errmsg;
            //wot.Update(ordertmp);

            //Dictionary<string, string> ret_d = new Dictionary<string, string>();
            //ret_d.Add(errcode, errmsg);
            return dict;
        }
        public WxPayNotifyWorker(Dictionary <string, string> webParams, PostData postData)
        {
            wxPayHelper.SetAppId(wxPayConfig.AppId);           ////""
            wxPayHelper.SetAppKey(wxPayConfig.AppKey);         ////""
            wxPayHelper.SetPartnerKey(wxPayConfig.PartnerKey); ////""
            ////wxPayHelper.SetSignType(wxPayConfig.SignType);////"sha1"

            ////wxPayHelper.SetParameter("bank_type", wxPayConfig.BankType);
            ////wxPayHelper.SetParameter("partner", wxPayConfig.Partner);
            ////wxPayHelper.SetParameter("fee_type", wxPayConfig.FeeType);
            ////wxPayHelper.SetParameter("notify_url", wxPayConfig.NotifyUrl);
            ////wxPayHelper.SetParameter("input_charset", wxPayConfig.InputCharset);
            foreach (var webParam in webParams)
            {
                wxPayHelper.SetParameter(webParam.Key, webParam.Value);
            }

            this.webParams = webParams;
            this.postData  = postData;
        }
        /// <summary>
        /// 微信支付:生成请求数据
        /// </summary>
        /// <param name="openid">微信用户id</openid>
        /// <param name="ttFee">商品总价格</param>
        /// <param name="busiBody"></param>
        /// <returns></returns>
        protected void WxPayData(decimal ttFee, string busiBody, string out_trade_no)
        {
            WxPayHelper wxPayHelper = new WxPayHelper();
            BLL.wx_payment_wxpay wxPayBll = new BLL.wx_payment_wxpay();
            Model.wx_payment_wxpay paymentInfo = wxPayBll.GetModelByWid(wid);

            //先设置基本信息
            string partnerId = paymentInfo.partnerId;// "1218574001";//  
            string appId = paymentInfo.appId;// "wxa9b8e33e48ac5e0f";// 
            string partnerKey = paymentInfo.partnerKey;// "huyuxianghuyuxianghuyuxiang12345";//  
            //paysignkey(非appkey) 
            string appKey = paymentInfo.paySignKey; //"nwRmqgvSG08pe3vU5qzBLb7Bvih0WOABGzUPvqgFqE0iSkJlJ8wh7JlLYy2cXFgFA3v1bM8eTDm1y1UcyeW9IGq2py2qei7J5xDoVR9lfO3cS6fMjFbMQeeqBRit0bKp";// 

            wxPayHelper.SetAppId(appId);
            wxPayHelper.SetAppKey(appKey);
            wxPayHelper.SetPartnerKey(partnerKey);
            wxPayHelper.SetSignType("SHA1");
            //设置请求package信息
            wxPayHelper.SetParameter("bank_type", "WX");
            wxPayHelper.SetParameter("body", busiBody);
            wxPayHelper.SetParameter("attach",wid+"|"+busiBody);
            wxPayHelper.SetParameter("partner", partnerId);
            wxPayHelper.SetParameter("out_trade_no", out_trade_no);
            wxPayHelper.SetParameter("total_fee", ((int)(ttFee * 100)).ToString());
            wxPayHelper.SetParameter("fee_type", "1");
           // wxPayHelper.SetParameter("notify_url", "http://" + HttpContext.Current.Request.Url.Authority + "/api/payment/wxpay/notify_url.aspx?wid="+wid);

            wxPayHelper.SetParameter("notify_url", "http://" + HttpContext.Current.Request.Url.Authority + "/api/payment/wxpay/notify_url.aspx");//不能带参数
            wxPayHelper.SetParameter("spbill_create_ip", MXRequest.GetIP());
            wxPayHelper.SetParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
            //---------有效期截至日期------
          
            wxPayHelper.SetParameter("time_expire", DateTime.Now.AddMinutes(expireMinute).ToString("yyyyMMddHHmmss"));

            wxPayHelper.SetParameter("input_charset", "UTF-8");
            packageValue = wxPayHelper.CreateBizPackage();


        }
Exemple #9
0
        public static void Main(String[] args)
        {
            try
            {
                WxPayHelper wxPayHelper = new WxPayHelper();
                //先设置基本信息
                wxPayHelper.SetAppId("wxf8b4f85f3a794e77");
                wxPayHelper.SetAppKey("2Wozy2aksie1puXUBpWD8oZxiD1DfQuEaiC7KcRATv1Ino3mdopKaPGQQ7TtkNySuAmCaDCrw4xhPY5qKTBl7Fzm0RgR3c0WaVYIXZARsxzHV2x7iwPPzOz94dnwPWSn");
                wxPayHelper.SetPartnerKey("8934e7d15453e97507ef794cf7b0519d");
                wxPayHelper.SetSignType("sha1");
                //设置请求package信息
                wxPayHelper.SetParameter("bank_type", "WX");
                wxPayHelper.SetParameter("body", "test");
                wxPayHelper.SetParameter("partner", "1900000109");
                wxPayHelper.SetParameter("out_trade_no", CommonUtil.CreateNoncestr());
                wxPayHelper.SetParameter("total_fee", "1");
                wxPayHelper.SetParameter("fee_type", "1");
                wxPayHelper.SetParameter("notify_url", "htttp://www.baidu.com");
                wxPayHelper.SetParameter("spbill_create_ip", "127.0.0.1");
                wxPayHelper.SetParameter("input_charset", "GBK");

                System.Console.Out.WriteLine("生成app支付package:");
                System.Console.Out.WriteLine(wxPayHelper.CreateAppPackage("test"));
                System.Console.Out.WriteLine("生成jsapi支付package:");
                System.Console.Out.WriteLine(wxPayHelper.CreateBizPackage());
                System.Console.Out.WriteLine("生成原生支付url:");
                System.Console.Out.WriteLine(wxPayHelper.CreateNativeUrl("abc"));
                System.Console.Out.WriteLine("生成原生支付package:");
                System.Console.Out.WriteLine(wxPayHelper.CreateNativePackage("0", "ok"));


            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine(e.Message);
            }

        }
Exemple #10
0
        /// <summary>
        /// 微信支付:生成请求数据
        /// </summary>
        /// <param name="openid">微信用户id</openid>
        /// <param name="ttFee">商品总价格</param>
        /// <param name="busiBody"></param>
        /// <returns></returns>
        protected void WxPayData(decimal ttFee, string busiBody, string out_trade_no)
        {
            WxPayHelper wxPayHelper = new WxPayHelper();

            BLL.wx_payment_wxpay   wxPayBll    = new BLL.wx_payment_wxpay();
            Model.wx_payment_wxpay paymentInfo = wxPayBll.GetModelByWid(wid);

            //先设置基本信息
            string partnerId  = paymentInfo.partnerId;  // "1218574001";//
            string appId      = paymentInfo.appId;      // "wxa9b8e33e48ac5e0f";//
            string partnerKey = paymentInfo.partnerKey; // "huyuxianghuyuxianghuyuxiang12345";//
            //paysignkey(非appkey)
            string appKey = paymentInfo.paySignKey;     //"nwRmqgvSG08pe3vU5qzBLb7Bvih0WOABGzUPvqgFqE0iSkJlJ8wh7JlLYy2cXFgFA3v1bM8eTDm1y1UcyeW9IGq2py2qei7J5xDoVR9lfO3cS6fMjFbMQeeqBRit0bKp";//

            wxPayHelper.SetAppId(appId);
            wxPayHelper.SetAppKey(appKey);
            wxPayHelper.SetPartnerKey(partnerKey);
            wxPayHelper.SetSignType("SHA1");
            //设置请求package信息
            wxPayHelper.SetParameter("bank_type", "WX");
            wxPayHelper.SetParameter("body", busiBody);
            wxPayHelper.SetParameter("attach", wid + "|" + busiBody);
            wxPayHelper.SetParameter("partner", partnerId);
            wxPayHelper.SetParameter("out_trade_no", out_trade_no);
            wxPayHelper.SetParameter("total_fee", ((int)(ttFee * 100)).ToString());
            wxPayHelper.SetParameter("fee_type", "1");
            // wxPayHelper.SetParameter("notify_url", "http://" + HttpContext.Current.Request.Url.Authority + "/api/payment/wxpay/notify_url.aspx?wid="+wid);

            wxPayHelper.SetParameter("notify_url", "http://" + HttpContext.Current.Request.Url.Authority + "/api/payment/wxpay/notify_url.aspx");//不能带参数
            wxPayHelper.SetParameter("spbill_create_ip", MXRequest.GetIP());
            wxPayHelper.SetParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
            //---------有效期截至日期------

            wxPayHelper.SetParameter("time_expire", DateTime.Now.AddMinutes(expireMinute).ToString("yyyyMMddHHmmss"));

            wxPayHelper.SetParameter("input_charset", "UTF-8");
            packageValue = wxPayHelper.CreateBizPackage();
        }
Exemple #11
0
    /// <summary>
    /// 微信支付:生成请求数据
    /// </summary>
    /// <param name="openid">微信用户id</openid>
    /// <param name="ttFee">商品总价格</param>
    /// <param name="busiBody"></param>
    /// <returns></returns>
    protected void WxPayData(decimal ttFee, string busiBody, string out_trade_no)
    {
        WxPayHelper wxPayHelper = new WxPayHelper();
        //BLL.wx_payment_wxpay wxPayBll = new BLL.wx_payment_wxpay();
        //Model.wx_payment_wxpay paymentInfo = wxPayBll.GetModelByWid(wid);

        //先设置基本信息
        string partnerId  = "1220201501";                                                                                                                   // "1220201501";//
        string appId      = "wxe5d8d2c5589f5ffb";                                                                                                           // "wxe5d8d2c5589f5ffb";//
        string partnerKey = "19ace89a7acd6e14ac3c66b2852f14d6";                                                                                             // "19ace89a7acd6e14ac3c66b2852f14d6";//
        //paysignkey(非appkey)
        string appKey = "YOFbXGzn0i8ZH8UlfqH7D7LpHHCXd4CxNqZgLffI8v58GSpxntqnVOx5zJFrsM2efT6XH89Nr0WDpfZjcfYCHD05uteWUfHq6BG8zuyTAe4uQ39yKOKqwYwl6yhgKueb"; //"YOFbXGzn0i8ZH8UlfqH7D7LpHHCXd4CxNqZgLffI8v58GSpxntqnVOx5zJFrsM2efT6XH89Nr0WDpfZjcfYCHD05uteWUfHq6BG8zuyTAe4uQ39yKOKqwYwl6yhgKueb";//

        wxPayHelper.SetAppId(appId);
        wxPayHelper.SetAppKey(appKey);
        wxPayHelper.SetPartnerKey(partnerKey);
        wxPayHelper.SetSignType("SHA1");
        //设置请求package信息
        wxPayHelper.SetParameter("bank_type", "WX");
        wxPayHelper.SetParameter("body", busiBody);
        wxPayHelper.SetParameter("attach", wid + "|" + busiBody);
        wxPayHelper.SetParameter("partner", partnerId);
        wxPayHelper.SetParameter("out_trade_no", out_trade_no);
        wxPayHelper.SetParameter("total_fee", ((int)(ttFee * 100)).ToString());
        wxPayHelper.SetParameter("fee_type", "1");
        // wxPayHelper.SetParameter("notify_url", "http://" + HttpContext.Current.Request.Url.Authority + "/api/payment/wxpay/notify_url.aspx?wid="+wid);

        wxPayHelper.SetParameter("notify_url", "http://" + HttpContext.Current.Request.Url.Authority + "/api/payment/wxpay/notify_url.aspx");//不能带参数
        wxPayHelper.SetParameter("spbill_create_ip", DTRequest.GetIP());
        wxPayHelper.SetParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
        //---------有效期截至日期------

        wxPayHelper.SetParameter("time_expire", DateTime.Now.AddMinutes(expireMinute).ToString("yyyyMMddHHmmss"));

        wxPayHelper.SetParameter("input_charset", "UTF-8");
        packageValue = wxPayHelper.CreateBizPackage();
    }