Пример #1
0
        public void TestPreOrder()
        {
            //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";

            WeiXinPayChannel channel = new WeiXinPayChannel();

            channel.AppID                  = "wxd930ea5d5a258f4f";
            channel.AppSecret              = "db426a9829e4b49a0dcac7b4162da6b6";
            channel.PaySignKey             = "L8LrMqqeGRxST5reouB0K66CaYAWpqhAVsq7ggKkxHCOastWksvuX1uvmvQclxaHoYd3ElNBrNO2DHnnzgfVG9Qs473M3DTOZug5er46FhuGofumV8H2FVR9qkjSlC5K";
            channel.ParnterID              = "1900000109";
            channel.ParnterKey             = "8934e7d15453e97507ef794cf7b0519d";
            channel.NotifyToTradeCenterURL = "http://www.qq.com";
            var str = channel.ToJSON();

            PreOrderRequest req = new PreOrderRequest();

            req.ClientIP         = "192.168.0.1";
            req.GoodsDescription = "测试订单";
            req.OrderAmount      = 1;
            req.OrderNO          = CommonUtil.GenerateNoncestr();
            req.UserID           = "crestxu";

            var rsp = WeiXinPay4AppGateway.PreOrder(channel, req);

            Assert.IsTrue(rsp.IsSuccess);
        }