Пример #1
0
        public void LianTuo_WeixinJSApi()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.LianTuoWeixinJSApi);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                AuthCode    = "oLNmRjrZe5hqTd0eXMvZQTUBjR94",//open id
                Timeout     = 15,
            };

            try
            {
                pay.BeginPay(parameter);
                Thread.Sleep(10000);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #2
0
        public void IPaysoon_WeiXinJSApi_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.IPaysoonWeiXinJSApi);
            var parameter = new PayParameter()
            {
                Amount       = 0.01,
                Description  = "测试交易",
                TradeID      = Guid.NewGuid().ToString("N"),
                TradeName    = "myTradeName",
                AuthCode     = "oysxe0Y95B27OyL1b1OLOuRAXyks",//openid
                NotifyDomain = "http://tan.xododo.com",
                ReturnUrl    = "http://test"
            };

            try
            {
                var url = pay.BeginPay(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #3
0
        public void LianTuo_WeixinBarcode()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.LianTuoWeixinBarcode);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                AuthCode    = "134731850825699894",//客户出示的二维码
                Timeout     = 15,
            };

            try
            {
                pay.BeginPay(parameter);
                Thread.Sleep(10000);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #4
0
        public void IPaysoon_WeiXinScanQRCode_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.IPaysoonWeiXinScanQRCode);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                Timeout     = 30,
            };

            try
            {
                var url = pay.BeginPay(parameter);
                //pay.CheckPayState(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #5
0
        public void AlipayWeb_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.AlipayWeb);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                Timeout     = 30,
            };

            try
            {
                var code = pay.BeginPay(parameter);
                pay.CheckPayState(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #6
0
        public void IPaysoon_WeiXinBarcode_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.IPaysoonWeiXinBarcode);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                AuthCode    = "134548413943541106",//客户出示的二维码
                Timeout     = 30,
            };

            try
            {
                pay.BeginPay(parameter);
                //pay.CheckPayState(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #7
0
        public void Bboqi_WeixinBarcode()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.BboqiWeiXinBarcode);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                AuthCode    = "135138355822429035",//客户出示的二维码
                Timeout     = 30,
            };

            try
            {
                pay.BeginPay(parameter);
                Thread.Sleep(10000);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #8
0
        public void WeiXinH5_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.WeiXinH5);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                Timeout     = 30,
                AuthCode    = "20.168.3.8",//客户端ip
            };

            try
            {
                var url = pay.BeginPay(parameter);
                pay.CheckPayState(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #9
0
        public void Bboqi_CheckPayState()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.BboqiWeiXinBarcode);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = "4fbc6cbcb0be4600802d566564ebc443",
                TradeName   = "myTradeName",
                AuthCode    = "134580297422568560",//客户出示的二维码
                Timeout     = 30,
            };

            try
            {
                pay.CheckPayState(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #10
0
        public void IPaysoon_AlipayBarcode_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.IPaysoonAlipayBarcode);
            var parameter = new PayParameter()
            {
                Amount      = 0.03,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                AuthCode    = "283829134783524951" +
                              "",//客户出示的二维码
                Timeout = 30,
            };

            parameter.GoodsDetails.Add(new GoodsDetail()
            {
                GoodsId   = "P002",
                GoodsName = "测试商品A1",
                Price     = 0.03,
                Quantity  = 1
            });
            try
            {
                pay.BeginPay(parameter);
                //pay.CheckPayState(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #11
0
        public void AlipayBarcode_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.AlipayBarcode);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                AuthCode    = "283996484850531686",//客户出示的二维码
                Timeout     = 30,
                StoreId     = "897",
            };

            parameter.GoodsDetails.Add(new GoodsDetail()
            {
                GoodsId   = "P001",
                GoodsName = "测试商品01",
                Quantity  = 1,
                Price     = 0.01
            });
            try
            {
                pay.BeginPay(parameter);
                pay.CheckPayState(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #12
0
 public void AlipayRefund_Test()
 {
     var pay    = PayFactory.CreatePay(PayInterfaceType.AlipayBarcode);
     var result = pay.Refund(new RefundParameter()
     {
         Amount  = 0.01,
         TradeID = "5a0d7698e94f475c9e4113fc9dea9b4b",
     });
 }
Пример #13
0
        public void test()
        {
            var request   = Request;
            var pay       = PayFactory.CreatePay(PayInterfaceType.LianTuoWeixinJSApi);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                AuthCode    = "oXenWt_-ULS1e5Mafl8pYpw1Y5j8",
                ReturnUrl   = "http://caiyun.xododo.net/home/weixinBack"
            };

            Response.Redirect(pay.BeginPay(parameter));
        }
Пример #14
0
        public void alipayWeb()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.AlipayWeb);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                ReturnUrl   = "http://caiyun.xododo.net/home/weixinBack",
            };

            var url = pay.BeginPay(parameter);

            Response.Redirect(url);
        }
Пример #15
0
        public void weixinTest()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.WeiXinJSApi);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                AuthCode    = "oZX1SwBVE3Ee8KOrQRPfYlhk2OFc",//openid
                ReturnUrl   = "http://caiyun.xododo.net/home/weixinBack",
            };

            var url = pay.BeginPay(parameter);

            Response.Redirect(url);
        }
Пример #16
0
        public void bboqi_weixinTest()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.BboqiWeiXinJSApi);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                AuthCode    = "oysxe0Y95B27OyL1b1OLOuRAXyks",//openid
                ReturnUrl   = "http://caiyun.xododo.net/home/weixinBack",
            };

            var url = pay.BeginPay(parameter);

            Response.Redirect(url);
        }
Пример #17
0
        public IActionResult WeixinH5()
        {
            var pay = PayFactory.CreatePay(PayInterfaceType.WeiXinH5);

            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                Timeout     = 180,
                AuthCode    = GetUserIp(Request.HttpContext),
            };
            var url = pay.BeginPay(parameter);

            return(Content("<script>location.href='" + url + "';</script>", "text/html"));
        }
Пример #18
0
 public void WeixinRefund_Test()
 {
     try
     {
         var pay    = PayFactory.CreatePay(PayInterfaceType.WeiXinBarcode);
         var result = pay.Refund(new RefundParameter()
         {
             Amount  = 0.01,
             TradeID = "842040ed09434b36aeb4fc475ed636fd",
         });
     }
     catch (PayServerReportException)
     {
     }
     catch
     {
         throw;
     }
 }
Пример #19
0
        public void IPaysoon_AlipayQuery_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.IPaysoonAlipayBarcode);
            var parameter = new PayParameter()
            {
                TradeID = "657e4025b8de41f7974924cadc12740f",
            };

            try
            {
                pay.CheckPayState(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #20
0
        public void IPaysoon_WeiXinQuery_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.IPaysoonWeiXinBarcode);
            var parameter = new PayParameter()
            {
                TradeID = "37665d7fd41a4cb5b381922358495f91",
            };

            try
            {
                pay.CheckPayState(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #21
0
        public void WeiXinJSApi_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.WeiXinJSApi);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                AuthCode    = "olqA5wtuH62E8dgqSnudCCZlIc3g",//openid
                ReturnUrl   = "http://caiyun.xododo.net/home/weixinBack"
            };

            try
            {
                var url = pay.BeginPay(parameter);

                /*
                 * js调用:
                 * function jsApiCall()
                 * {
                 *     WeixinJSBridge.invoke(
                 *     'getBrandWCPayRequest',
                 *     <%=wxJsApiParam%>,//josn串
                 *      function (res)
                 *      {
                 *          WeixinJSBridge.log(res.err_msg);
                 *          alert(res.err_code + res.err_desc + res.err_msg);
                 *       }
                 *      );
                 * }
                 */
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #22
0
        public void Bboqi_WeiXinJSApi_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.BboqiWeiXinJSApi);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
                AuthCode    = "oysxe0Y95B27OyL1b1OLOuRAXyks",//openid
            };

            try
            {
                var wxJsApiParam = pay.BeginPay(parameter);
                Thread.Sleep(10000);

                /*
                 * js调用:
                 * function jsApiCall()
                 * {
                 *     WeixinJSBridge.invoke(
                 *     'getBrandWCPayRequest',
                 *     <%=wxJsApiParam%>,//josn串
                 *      function (res)
                 *      {
                 *          WeixinJSBridge.log(res.err_msg);
                 *          alert(res.err_code + res.err_desc + res.err_msg);
                 *       }
                 *      );
                 * }
                 */
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #23
0
        public void LianTuo_Refund()
        {
            var pay = PayFactory.CreatePay(PayInterfaceType.LianTuoAlipayBarcode);

            var parameter = new RefundParameter()
            {
                Amount  = 0.01,
                TradeID = "6f4066943146464eb7a8720d139bbfee",
                Reason  = "买错了",
            };

            try
            {
                var result = pay.Refund(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #24
0
        public IActionResult QRCode()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.IPaysoonAlipayScanQRCode);
            var parameter = new PayParameter()
            {
                Amount      = 0.02,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName"
            };
            //发起支付,得到二维码
            var qrCode = pay.BeginPay(parameter);

            BitMatrix byteMatrix = new MultiFormatWriter().encode(qrCode, BarcodeFormat.QR_CODE, 300, 300);

            System.Drawing.Bitmap bitmap = toBitmap(byteMatrix);

            MemoryStream ms = new MemoryStream();

            bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            bitmap.Dispose();
            return(File(ms.ToArray(), "image/png"));
        }
Пример #25
0
        public void WeiXinScanQRCode_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.WeiXinScanQRCode);
            var parameter = new PayParameter()
            {
                Amount      = 0.01,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName"
            };

            try
            {
                pay.BeginPay(parameter);
                pay.CheckPayState(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #26
0
        public void Cailutong_BTC()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.CailutongBTC);
            var parameter = new PayParameter()
            {
                Amount      = 0.0001,
                Description = "测试交易",
                TradeID     = Guid.NewGuid().ToString("N"),
                TradeName   = "myTradeName",
            };

            try
            {
                pay.BeginPay(parameter);
                pay.CheckPayState(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }
Пример #27
0
        public void WeiXinTransfers_Test()
        {
            var pay       = PayFactory.CreatePay(PayInterfaceType.WeiXinTransfers);
            var parameter = new PayParameter()
            {
                Description = "测试",
                Amount      = 1,                              //微信规定最低1元
                TradeID     = Guid.NewGuid().ToString("N"),
                AuthCode    = "olqA5wtuH62E8dgqSnudCCZlIc3g", //谭泳在小恒欢乐送的openid oZX1SwBVE3Ee8KOrQRPfYlhk2OFc
            };

            try
            {
                pay.BeginPay(parameter);
                pay.CheckPayState(parameter);
            }
            catch (PayServerReportException)
            {
            }
            catch
            {
                throw;
            }
        }