Exemplo n.º 1
0
        public static string Query(AopDictionary bizContent, AlipayFormSetting setting)
        {
            try
            {
                QueryValidation(bizContent);
                var data    = new AlipayData();
                var request = RequestBase(setting, ALIPAY_QUERY);
                request.Add("biz_content", data.ToJson(bizContent));

                request.Add("sign", data.RSASign(request, setting.PrivateKey, setting.Charset, setting.SignType));

                var body = HttpService.DoPost(setting.ServerUrl + "?" + CHARSET + "=" + setting.Charset, request, setting.Charset);

                return(body);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(null);
            }
        }
Exemplo n.º 2
0
        /**
         * 跳转支付宝页面直接进行支付
         */
        public static string Pay(AopDictionary bizContent, AlipayFormSetting setting, string returnUrl, string noticeUrl)
        {
            try
            {
                PayValidation(bizContent);
                var data    = new AlipayData();
                var request = RequestBase(setting, PayMethod);
                request.Add("biz_content", data.ToJson(bizContent));
                request.Add("notify_url", noticeUrl);
                request.Add("return_url", returnUrl);
                request.Add("sign", data.RSASign(request, setting.PrivateKey, setting.Charset, setting.SignType));

                var body = BuildHtmlRequest(request, "POST", setting);

                return(body);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(null);
            }
        }