Exemple #1
0
        public void TestNativeOrderHelper()
        {
            WeiXinPayChannel channel = new WeiXinPayChannel();

            channel.AppID                  = "wx8f74386d57405ec5";
            channel.AppSecret              = "2af3c935fc66e2087bff1064cde3a708";
            channel.PaySignKey             = "tFVyMIdj1DGCUMbahNzxTUxESkE6heBRtD2RWOfyzyh4WziirurWvBHt3WFVfQRlysh7T0MxMFHikBcScLUNrInygE4972yLyrZyFlay8tV4aKwtA3lBPNgI4qqJw46b";
            channel.ParnterID              = "1218285701";
            channel.ParnterKey             = "b158ca37b5fac76293e402e3144869fc";
            channel.NotifyToTradeCenterURL = "http://www.qq.com";

            Package package = new Package()
            {
                Body           = "测试订单",
                NotifyUrl      = "http://www.qq.com",
                OutTradeNo     = "kODvVBBJ3THJ1jMB",
                Partner        = channel.ParnterID,
                SpbillCreateIp = "192.168.0.1",
                TotalFee       = "1"
            };

            NativePayHelper req = new NativePayHelper(channel);

            req.SetPackage(package);
            Console.WriteLine(req.GenerateNativeUrl("12343252"));
            Console.WriteLine(req.GetParametersXMLStr());
        }
Exemple #2
0
        /// <summary>
        /// 创建微信支付NativePay连接
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        internal static object CreateWXNativePayUrl(TradeRequest request)
        {
            CreateWXNativePayUrlReqPara para = request.GetParameter <CreateWXNativePayUrlReqPara>();
            var             channelBll       = new PayChannelBLL(new Utility.BasicUserInfo());
            var             channel          = channelBll.GetByID(para.PayChannelID);
            var             WXChannel        = channel.ChannelParameters.DeserializeJSONTo <WeiXinPayChannel>();
            NativePayHelper req = new NativePayHelper(WXChannel);

            return(new { NativePayUrl = req.GenerateNativeUrl(para.ProductID) });
        }