Exemplo n.º 1
0
        public IActionResult WebPay(string order_id, int total_amount)
        {
            var request = new WebPayRequest();

            request.AddGatewayData(new WebPayModel()
            {
                TotalAmount = total_amount,
                OrderId     = order_id
            });

            var response = _gateway.Execute(request);

            return(Content(response.Html, "text/html", Encoding.UTF8));
        }
Exemplo n.º 2
0
        public async Task WebPayTest()
        {
            var gateway = GetService <IGateway>();
            var request = new WebPayRequest(new WebPayModel
            {
                OutTradeNo  = "abc001",
                TotalAmount = 0.01,
                Subject     = "spear_pay",
                Body        = "test"
            });
            var resp = await gateway.Execute(request);

            Print(resp);
        }
Exemplo n.º 3
0
 public HttpResponseMessage Pay([FromBody] WebPayModel payModel)
 {
     if (ModelState.IsValid)
     {
         var request = new WebPayRequest();
         request.AddGatewayData(payModel);
         var response = _gateway.Execute(request);
         var result   = new HttpResponseMessage(HttpStatusCode.OK)
         {
             Content = new StringContent(response.Html, Encoding.UTF8, "text/html")
         };
         return(result);
     }
     return(new HttpResponseMessage(HttpStatusCode.MethodNotAllowed));
 }
Exemplo n.º 4
0
        public async Task WebPayTest()
        {
            var gateway = GetService <IGateway>();
            var request = new WebPayRequest(new WebPayModel
            {
                Amount    = 100,
                OrderId   = "D001",
                ReturnUrl = "http://www.baidu.com",
                GoodsId   = "10001",
                GoodsInfo = "招投标承保系统保费"
            });
            var resp = await gateway.Execute(request);

            Print(resp);
        }
Exemplo n.º 5
0
        public IActionResult WebPay(string out_trade_no, string subject, double total_amount, string body)
        {
            var request = new WebPayRequest();

            request.AddGatewayData(new WebPayModel()
            {
                Body        = body,
                TotalAmount = total_amount,
                Subject     = subject,
                OutTradeNo  = out_trade_no
            });

            var response = _gateway.Execute(request);

            return(Content(response.Html, "text/html", Encoding.UTF8));
        }
Exemplo n.º 6
0
        public void TestWebPay()
        {
            var request = new WebPayRequest();

            request.AddGatewayData(new WebPayModel()
            {
                TotalAmount = 1,
                Subject     = "支付宝电脑网站支付测试",
                OutTradeNo  = _outTradeNo
            });

            var response = _alipayGateway.Execute(request);

            _output.WriteLine(response.Html);
            Assert.NotNull(response.Html);
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Web(string orderNo, int amount, string bank = "")
        {
            var request = new WebPayRequest(new WebPayModel
            {
                Amount    = amount,
                OrderId   = orderNo,
                ReturnUrl = "http://www.baidu.com",
                GateId    = bank,
                GoodsId   = "10001",
                GoodsInfo = "招投标承保系统保费",
                PayType   = "B2B"
            });
            var result = await _gateway.Execute(request);

            return(Content(result.Html, "text/html", Encoding.UTF8));
        }
Exemplo n.º 8
0
 public WapPayResponse(WebPayRequest request)
 {
     Html = request.GatewayData.ToForm(request.RequestUrl);
 }
Exemplo n.º 9
0
 public WebPayResponse(WebPayRequest request)
 {
     Html = request.Data.ToForm(request.Url);
     Raw  = request.Data.Raw;
 }