Esempio n. 1
0
        public async Task <IActionResult> PreCreate(string out_trade_no, string subject, string total_amount, string body, string notify_url)
        {
            var model = new AlipayTradePrecreateModel()
            {
                Body        = body,
                Subject     = subject,
                TotalAmount = total_amount,
                OutTradeNo  = out_trade_no,
            };
            var req = new AlipayTradePrecreateRequest();

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

            var response = await _client.ExecuteAsync(req);

            return(Ok(response.Body));
        }
Esempio n. 2
0
        public async Task <IActionResult> PreCreate(AlipayTradePreCreateViewModel viewModel)
        {
            var model = new AlipayTradePrecreateModel()
            {
                OutTradeNo  = viewModel.OutTradeNo,
                Subject     = viewModel.Subject,
                TotalAmount = viewModel.TotalAmount,
                Body        = viewModel.Body,
            };
            var req = new AlipayTradePrecreateRequest();

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

            var response = await _client.ExecuteAsync(req);

            ViewData["qrcode"]   = response.QrCode;
            ViewData["response"] = response.Body;
            return(View());
        }