예제 #1
0
        public async Task <IActionResult> AppPay(string out_trade_no, string subject, string total_amount, string body, string product_code, string notify_url = "")
        {
            var model = new AlipayTradeAppPayModel
            {
                OutTradeNo  = out_trade_no,
                Subject     = subject,
                ProductCode = product_code,
                TotalAmount = total_amount,
                Body        = body
            };
            var req = new AlipayTradeAppPayRequest();

            req.SetBizModel(model);
            req.SetNotifyUrl(notify_url);

            var response = await _client.SdkExecuteAsync(req);

            //将response.Body给 ios/android端 由其去调起支付宝APP(https://docs.open.alipay.com/204/105296/ https://docs.open.alipay.com/204/105295/)
            ResponseModel responseModel = new ResponseModel()
            {
                code = HTTPResponseCode.PartialContent,
                data = response.Body
            };

            if (response.IsError)
            {
                responseModel.code    = HTTPResponseCode.BadRequest;
                responseModel.message = response.Msg;
            }
            else
            {
                responseModel.code = HTTPResponseCode.Successful;
            }
            return(Json(responseModel));
        }
예제 #2
0
        public async Task <IActionResult> AppPay(AlipayTradeAppPayViewModel viewModel)
        {
            var model = new AlipayTradeAppPayModel
            {
                OutTradeNo  = viewModel.OutTradeNo,
                Subject     = viewModel.Subject,
                ProductCode = viewModel.ProductCode,
                TotalAmount = viewModel.TotalAmount,
                Body        = viewModel.Body
            };
            var req = new AlipayTradeAppPayRequest();

            req.SetBizModel(model);
            req.SetNotifyUrl(viewModel.NotifyUrl);

            var response = await _client.SdkExecuteAsync(req, _optionsAccessor.Value);

            //将response.Body给 ios/android端 由其去调起支付宝APP(https://docs.open.alipay.com/204/105296/ https://docs.open.alipay.com/204/105295/)
            return(Ok(response.Body));
        }
예제 #3
0
        // APP支付(集成SDK)
        public async Task <AlipayTradeAppPayResponse> AppPay(PayRequest request)
        {
            var order = OrderService.Get(request.Id);
            var model = new AlipayTradeAppPayModel
            {
                OutTradeNo  = order.Order_SN,
                Subject     = order.Name,
                TotalAmount = order.Order_Money.ToString("n"),
                Body        = order.Remark,
                ProductCode = request.ProduceCode ?? "QUICK_MSECURITY_PAY"
            };

            var req = new AlipayTradeAppPayRequest();

            req.SetBizModel(model);
            req.SetNotifyUrl(request.NotifyUrl);

            // 将response.ResponseBody ios/android端 由其去调起支付宝APP
            // https://docs.open.alipay.com/204/105296/
            // https://docs.open.alipay.com/204/105295/
            return(await client.SdkExecuteAsync(req, options.Value));
        }
예제 #4
0
        public async Task <IActionResult> AppPay(AlipayTradeAppPayViewModel viewModel)
        {
            var model = new AlipayTradeAppPayModel
            {
                OutTradeNo  = viewModel.OutTradeNo,
                Subject     = viewModel.Subject,
                ProductCode = viewModel.ProductCode,
                TotalAmount = viewModel.TotalAmount,
                Body        = viewModel.Body
            };
            var req = new AlipayTradeAppPayRequest();

            req.SetBizModel(model);
            req.SetNotifyUrl(viewModel.NotifyUrl);

            var response = await _client.SdkExecuteAsync(req, _optionsAccessor.Value);

            // 将response.Body给 ios、android端,由其去完成调起支付宝APP。
            // 客户端 Android 集成流程: https://opendocs.alipay.com/open/204/105296/
            // 客户端 iOS 集成流程: https://opendocs.alipay.com/open/204/105295/
            ViewData["response"] = response.Body;
            return(View());
        }