Exemplo n.º 1
0
        /// <summary>
        /// 回调处理
        /// </summary>
        /// <param name="wxKey">微信支付授权KEY</param>
        /// <param name="success"></param>
        /// <param name="fail"></param>
        /// <returns></returns>
        public static string ProcessNotify(string wxKey, NotifySuccess success, NotifyFail fail)
        {
            NotyfyResult    result     = new NotyfyResult();
            ResponseHandler resHandler = new ResponseHandler(null);

            try
            {
                result.Content = resHandler.ParseXML();
                string openid         = resHandler.GetParameter("openid");
                string out_trade_no   = resHandler.GetParameter("out_trade_no");
                string transaction_id = resHandler.GetParameter("transaction_id");
                string total_fee      = resHandler.GetParameter("total_fee");
                result = new NotyfyResult()
                {
                    Content        = resHandler.ParseXML(),
                    out_trade_no   = out_trade_no,
                    openid         = openid,
                    transaction_id = transaction_id,
                    total_fee      = total_fee,
                    appid          = resHandler.GetParameter("appid"),
                    fee_type       = resHandler.GetParameter("fee_type"),
                    is_subscribe   = resHandler.GetParameter("is_subscribe"),
                    mch_id         = resHandler.GetParameter("mch_id"),
                    result_code    = resHandler.GetParameter("result_code"),
                    time_end       = resHandler.GetParameter("time_end"),
                };
                resHandler.SetKey(wxKey);
                bool signResult = resHandler.IsTenpaySign();
                if (signResult)
                {
                    success(result);
                    return("success");
                }
                else
                {
                    fail(result);
                    return("error");
                }
            }
            catch (Exception ex)
            {
                result.Content = ex.Message;
                fail(result);
                return("error");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 回调处理
        /// </summary>
        /// <param name="wxKey">微信支付授权KEY</param>
        /// <param name="success"></param>
        /// <param name="fail"></param>
        /// <returns></returns>
        public static string ProcessNotify(string wxKey, NotifySuccess success, NotifyFail fail)
        {
            NotyfyResult result = new NotyfyResult();
            ResponseHandler resHandler = new ResponseHandler(null);
            try
            {
                result.Content = resHandler.ParseXML();
                string openid = resHandler.GetParameter("openid");
                string out_trade_no = resHandler.GetParameter("out_trade_no");
                string transaction_id = resHandler.GetParameter("transaction_id");
                string total_fee = resHandler.GetParameter("total_fee");
                result = new NotyfyResult()
                {
                    Content = resHandler.ParseXML(),
                    out_trade_no = out_trade_no,
                    openid = openid,
                    transaction_id = transaction_id,
                    total_fee = total_fee,
                    appid = resHandler.GetParameter("appid"),
                    fee_type = resHandler.GetParameter("fee_type"),
                    is_subscribe = resHandler.GetParameter("is_subscribe"),
                    mch_id = resHandler.GetParameter("mch_id"),
                    result_code = resHandler.GetParameter("result_code"),
                    time_end = resHandler.GetParameter("time_end"),
                };
                resHandler.SetKey(wxKey);
                bool signResult = resHandler.IsTenpaySign();
                if (signResult)
                {
                    success(result);
                    return "success";
                }
                else
                {
                    fail(result);
                    return "error";
                }
            }
            catch (Exception ex)
            {
                result.Content = ex.Message;
                fail(result);
                return "error";
            }

        }