Exemplo n.º 1
0
        public static HttpResponseMessage ApiPayWeixinNotify(IRequest context, string orderNo)
        {
            var response = new HttpResponseMessage();

            var paymentApi = new PaymentApi(context.GetQueryInt("siteId"));

            bool   isPaied;
            string responseXml;

            paymentApi.NotifyByWeixin(HttpContext.Current.Request, out isPaied, out responseXml);
            if (isPaied)
            {
                OrderDao.UpdateIsPaied(orderNo);
            }

            response.Content = new StringContent(responseXml);
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml");
            response.StatusCode = HttpStatusCode.OK;

            return(response);
        }
Exemplo n.º 2
0
        public static HttpResponseMessage ApiWeixinNotify(IRequest request, string orderNo)
        {
            var response = new HttpResponseMessage();

            var siteId     = request.GetQueryInt("siteId");
            var paymentApi = new PaymentApi(siteId);

            bool   isPaied;
            string responseXml;

            paymentApi.NotifyByWeixin(HttpContext.Current.Request, out isPaied, out responseXml);
            //var filePath = Path.Combine(Main.PhysicalApplicationPath, "log.txt");
            //File.WriteAllText(filePath, responseXml);
            if (isPaied)
            {
                RecordDao.UpdateIsPaied(orderNo);
            }

            response.Content = new StringContent(responseXml);
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml");
            response.StatusCode = HttpStatusCode.OK;

            return(response);
        }