Example #1
0
        public async Task TestRequestParam()
        {
            Time.SetTime("2017-10-31 08:59:26");
            Util.Helpers.String result = new Util.Helpers.String();
            result.Append("app_id=2016090800463464&");
            result.Append("biz_content={\"out_trade_no\":\"59f7caeeab89e009e4a4e1fb\",\"subject\":\"test\",\"total_amount\":\"10\",\"timeout_express\":\"90m\",\"scene\":\"bar_code\",\"auth_code\":\"281023564031402341\"}&");
            result.Append("charset=utf-8&");
            result.Append("format=json&");
            result.Append("method=alipay.trade.pay&");
            result.Append("notify_url=b&");
            result.Append("return_url=a&");
            result.Append("sign=aO+PHyeh0JRgOnfmor49aG8pIoP8SNhzmte9JFewFRURp1iSrVazHMdtTnf0wuiBOFKcUVDnoPuLIEKJRtopLk8cvXM0I6HScOVhim5ZtVw6Imkf7qGkjexpV749vlNAREV3k2FgYnrL6WGlsAmNOig/r/SIMaPjOQiLlJ7u5WS4I0SWeZNEf3LTi7nBhmJLw75suxJQJXd+4rDCwTdgH2NQVECxNhfGDBd9LEEqfhayAbi11SDMTWEi9q6uzgWeFNZQK3n19MY94neq4Kfet24WthRKnvKYOMDv9iLMOJ5LINz7omy6JYUxfpn015sGpJh13sO9KWwyUqo56iStvw==&");
            result.Append("sign_type=RSA2&");
            result.Append("timestamp=2017-10-31 08:59:26&");
            result.Append("version=1.0");
            _service = new AlipayBarcodePayService(new TestConfigProvider());
            var param = new PayParam {
                Money     = 10,
                OrderId   = "59f7caeeab89e009e4a4e1fb",
                Subject   = "test",
                AuthCode  = "281023564031402341",
                ReturnUrl = "a",
                NotifyUrl = "b"
            };
            var request = await _service.Debug(param);

            _output.WriteLine(request);
            Assert.Equal(result.ToString(), request);
        }
Example #2
0
        /// <summary>
        /// 支付
        /// </summary>
        private async Task <PayResult> PayAsync()
        {
            Time.SetTime(TestConst.Time);
            _service = new AlipayBarcodePayService(new TestConfigProvider());
            var param = new PayParam {
                Money     = 10,
                OrderId   = "59f7caeeab89e009e4a4e1fb",
                Subject   = "test",
                AuthCode  = "281023564031402341",
                ReturnUrl = "a",
                NotifyUrl = "b"
            };

            _service.IsSend = false;
            return(await _service.PayAsync(param));
        }
        public void TestPay_1()
        {
            var result = "app_id=2016090800463464&biz_content={\"out_trade_no\":\"59f7caeeab89e009e4a4e1fb\",\"subject\":\"test\",\"total_amount\":\"10\",\"timeout_express\":\"90m\",\"auth_code\":\"281023564031402341\",\"scene\":\"bar_code\"}&charset=utf-8&format=json&method=alipay.trade.pay&sign=TrzaFo0mYi5ECKxQqwVj8WeNivimDYdeZfRF9bGV4Hq2rAoaZLshvV6C/1oeGJq/jsfiFFvxi6RNSlJuo2+erZq81FYALKltt+8gL6XwgCf8KL64+nC3zpE1dAmkKJA3ft4xKoEG5uUSMQBKqx59E3DNApAeibrFboF5vP1MB/Dru1pfS7mijixWhPd1LSDMdH0tUCyWlkh1W1MiWnrzBCNNEaNn2slHvYQjyUHZyR577yuCdcst5/MjCwY+0l0Rt0QYaCPizQEU1n6h65gifq/sSyOlkLnaMeX2JZpRSD7yCVzSyMHqsYRAr5vzSBztfYIrMVdb74JkQQKa27QVng==&sign_type=RSA2&timestamp=2017-10-31 08:59:26&version=1.0";

            Time.SetTime("2017-10-31 08:59:26");
            _service = new AlipayBarcodePayService(new TestConfigProvider())
            {
                IsSendRequest = false
            };
            _service.Pay(new PayParam {
                Money    = 10,
                OrderId  = "59f7caeeab89e009e4a4e1fb",
                Subject  = "test",
                AuthCode = "281023564031402341"
            });
            _output.WriteLine(_service.ToString());
            Assert.Equal(result, _service.ToString());
        }
Example #4
0
 /// <summary>
 /// 测试初始化
 /// </summary>
 public AlipayBarcodePayServiceTest(ITestOutputHelper output)
 {
     _output  = output;
     _service = new AlipayBarcodePayService(new TestConfigProvider());
 }