Ejemplo n.º 1
0
        public ActionResult <string> GetRefundQuery(string refund_id, string out_refund_no, string transaction_id, string out_trade_no)
        {
            if (string.IsNullOrEmpty(refund_id) && string.IsNullOrEmpty(out_refund_no) &&
                string.IsNullOrEmpty(transaction_id) && string.IsNullOrEmpty(out_trade_no))
            {
                return("微信订单号、商户订单号、商户退款单号、微信退款单号选填至少一个,微信退款单号优先!");
            }

            //调用退款查询接口,如果内部出现异常则在页面上显示异常原因
            try
            {
                string result = RefundQuery.Run(refund_id, out_refund_no, transaction_id, out_trade_no);
                return(result);
            }
            catch (WxPayException ex)
            {
                return(ex.ToString());
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        protected void submit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(refund_id.Text) && string.IsNullOrEmpty(out_refund_no.Text) &&
                string.IsNullOrEmpty(transaction_id.Text) && string.IsNullOrEmpty(out_trade_no.Text))
            {
                Response.Write("<script LANGUAGE='javascript'>alert('微信订单号、商户订单号、商户退款单号、微信退款单号选填至少一个,微信退款单号优先!');</script>");
                return;
            }

            //调用退款查询接口,如果内部出现异常则在页面上显示异常原因
            try
            {
                string result = RefundQuery.Run(refund_id.Text, out_refund_no.Text, transaction_id.Text, out_trade_no.Text);
                Response.Write("<span style='color:#00CD00;font-size:20px'>" + result + "</span>");
            }
            catch (WxPayException ex)
            {
                Response.Write("<span style='color:#FF0000;font-size:20px'>" + ex.ToString() + "</span>");
            }
            catch (Exception ex)
            {
                Response.Write("<span style='color:#FF0000;font-size:20px'>" + ex.ToString() + "</span>");
            }
        }