示例#1
0
        /// <summary>
        /// 支付宝入口请求
        /// </summary>
        /// <param name="zfb"></param>
        /// <returns></returns>
        public string ZFBSendRequestWriter(ZFBPara_Model zfb)
        {

            //把请求参数打包成数组
            SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>();
            #region

            sParaTemp.Add("payment_type", "1");
            sParaTemp.Add("out_trade_no", zfb.out_trade_no);
            sParaTemp.Add("subject", zfb.subject);
            sParaTemp.Add("body", zfb.body);
            sParaTemp.Add("total_fee", zfb.total_fee);
            //默认支付方式,代码见“即时到帐接口”技术文档
            sParaTemp.Add("paymethod", "");
            //默认网银代号,代号列表见“即时到帐接口”技术文档“附录”→“银行列表”            
            sParaTemp.Add("defaultbank", "");
            //防钓鱼时间戳            
            sParaTemp.Add("anti_phishing_key", "");
            //获取客户端的IP地址,建议:编写获取客户端IP地址的程序            
            sParaTemp.Add("exter_invoke_ip", "");
            //自定义参数,可存放任何内容(除=、&等特殊字符外),不会显示在页面上            
            sParaTemp.Add("extra_common_param", "");
            //默认买家支付宝账号            
            sParaTemp.Add("buyer_email", "");
            //提成类型,该值为固定值:10,不需要修改            
            sParaTemp.Add("royalty_type", "");
            //提成信息集            
            sParaTemp.Add("royalty_parameters", "");
            #endregion
            //构造即时到帐接口表单提交HTML数据,无需修改
            Service ali = new Service();
            string sHtmlText = ali.Create_direct_pay_by_user(sParaTemp);
            return sHtmlText;
        }
示例#2
0
        /// <summary>
        /// 支付宝入口请求
        /// </summary>
        /// <param name="zfb"></param>
        /// <returns></returns>
        public string ZFBSendRequestWriter(ZFBPara_Model zfb)
        {
            //把请求参数打包成数组
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            #region

            sParaTemp.Add("payment_type", "1");
            sParaTemp.Add("out_trade_no", zfb.out_trade_no);
            sParaTemp.Add("subject", zfb.subject);
            sParaTemp.Add("body", zfb.body);
            sParaTemp.Add("total_fee", zfb.total_fee);
            //默认支付方式,代码见“即时到帐接口”技术文档
            sParaTemp.Add("paymethod", "");
            //默认网银代号,代号列表见“即时到帐接口”技术文档“附录”→“银行列表”
            sParaTemp.Add("defaultbank", "");
            //防钓鱼时间戳
            sParaTemp.Add("anti_phishing_key", "");
            //获取客户端的IP地址,建议:编写获取客户端IP地址的程序
            sParaTemp.Add("exter_invoke_ip", "");
            //自定义参数,可存放任何内容(除=、&等特殊字符外),不会显示在页面上
            sParaTemp.Add("extra_common_param", "");
            //默认买家支付宝账号
            sParaTemp.Add("buyer_email", "");
            //提成类型,该值为固定值:10,不需要修改
            sParaTemp.Add("royalty_type", "");
            //提成信息集
            sParaTemp.Add("royalty_parameters", "");
            #endregion
            //构造即时到帐接口表单提交HTML数据,无需修改
            Service ali       = new Service();
            string  sHtmlText = ali.Create_direct_pay_by_user(sParaTemp);
            return(sHtmlText);
        }
示例#3
0
        /// <summary>
        /// 支付宝入口请求
        /// </summary>
        /// <param name="zfb"></param>
        /// <returns></returns>
        public string ZFBSendRequestWriter(ZFBPara_Model zfb, bool isTouch)
        {

            //返回格式
            string format = "xml";
            //必填,不需要修改

            //返回格式
            string v = "2.0";
            //必填,不需要修改

            //请求号
            string req_id = DateTime.Now.ToString("yyyyMMddHHmmss");
            //必填,须保证每次请求都是唯一

            //req_data详细信息


            //商户订单号
            string out_trade_no = zfb.out_trade_no;
            //商户网站订单系统中唯一订单号,必填

            //订单名称
            string subject = zfb.subject;
            //必填

            //付款金额
            string total_fee = zfb.total_fee;
            //必填

            //请求业务参数详细
            string req_dataToken = "<direct_trade_create_req><notify_url>" + Com.Alipay.Touch.Config.notify_url + "</notify_url><call_back_url>" + Com.Alipay.Touch.Config.call_back_url + "</call_back_url><seller_account_name>" + Com.Alipay.Touch.Config.Seller_email + "</seller_account_name><out_trade_no>" + out_trade_no + "</out_trade_no><subject>" + subject + "</subject><total_fee>" + total_fee + "</total_fee><merchant_url>" + Com.Alipay.Touch.Config.merchant_url + "</merchant_url></direct_trade_create_req>";
            //必填

            //把请求参数打包成数组
            Dictionary<string, string> sParaTempToken = new Dictionary<string, string>();
            sParaTempToken.Add("partner", Com.Alipay.Touch.Config.Partner);
            sParaTempToken.Add("_input_charset", Com.Alipay.Touch.Config.Input_charset.ToLower());
            sParaTempToken.Add("sec_id", Com.Alipay.Touch.Config.Sign_type.ToUpper());
            sParaTempToken.Add("service", "alipay.wap.trade.create.direct");
            sParaTempToken.Add("format", format);
            sParaTempToken.Add("v", v);
            sParaTempToken.Add("req_id", req_id);
            sParaTempToken.Add("req_data", req_dataToken);

            //建立请求
            string sHtmlTextToken = Com.Alipay.Touch.Submit.BuildRequest(Com.Alipay.Touch.Config.gateway_new, sParaTempToken);
            //URLDECODE返回的信息
            Encoding code = Encoding.GetEncoding(Com.Alipay.Touch.Config.Input_charset);
            sHtmlTextToken = HttpUtility.UrlDecode(sHtmlTextToken, code);

            //解析远程模拟提交后返回的信息
            Dictionary<string, string> dicHtmlTextToken = Com.Alipay.Touch.Submit.ParseResponse(sHtmlTextToken);

            //获取token
            string request_token = dicHtmlTextToken["request_token"];

            ////////////////////////////////////////////根据授权码token调用交易接口alipay.wap.auth.authAndExecute////////////////////////////////////////////


            //业务详细
            string req_data = "<auth_and_execute_req><request_token>" + request_token + "</request_token></auth_and_execute_req>";
            //必填

            //把请求参数打包成数组
            Dictionary<string, string> sParaTemp = new Dictionary<string, string>();
            sParaTemp.Add("partner", Com.Alipay.Touch.Config.Partner);
            sParaTemp.Add("_input_charset", Com.Alipay.Touch.Config.Input_charset.ToLower());
            sParaTemp.Add("sec_id", Com.Alipay.Touch.Config.Sign_type.ToUpper());
            sParaTemp.Add("service", "alipay.wap.auth.authAndExecute");
            sParaTemp.Add("format", format);
            sParaTemp.Add("v", v);
            sParaTemp.Add("req_data", req_data);

            //建立请求
            string sHtmlText = Com.Alipay.Touch.Submit.BuildRequest(Com.Alipay.Touch.Config.gateway_new, sParaTemp, "get", "确认");
            return sHtmlText;
        }
示例#4
0
        /// <summary>
        /// 支付宝入口请求
        /// </summary>
        /// <param name="zfb"></param>
        /// <returns></returns>
        public string ZFBSendRequestWriter(ZFBPara_Model zfb, bool isTouch)
        {
            //返回格式
            string format = "xml";
            //必填,不需要修改

            //返回格式
            string v = "2.0";
            //必填,不需要修改

            //请求号
            string req_id = DateTime.Now.ToString("yyyyMMddHHmmss");
            //必填,须保证每次请求都是唯一

            //req_data详细信息


            //商户订单号
            string out_trade_no = zfb.out_trade_no;
            //商户网站订单系统中唯一订单号,必填

            //订单名称
            string subject = zfb.subject;
            //必填

            //付款金额
            string total_fee = zfb.total_fee;
            //必填

            //请求业务参数详细
            string req_dataToken = "<direct_trade_create_req><notify_url>" + Com.Alipay.Touch.Config.notify_url + "</notify_url><call_back_url>" + Com.Alipay.Touch.Config.call_back_url + "</call_back_url><seller_account_name>" + Com.Alipay.Touch.Config.Seller_email + "</seller_account_name><out_trade_no>" + out_trade_no + "</out_trade_no><subject>" + subject + "</subject><total_fee>" + total_fee + "</total_fee><merchant_url>" + Com.Alipay.Touch.Config.merchant_url + "</merchant_url></direct_trade_create_req>";
            //必填

            //把请求参数打包成数组
            Dictionary <string, string> sParaTempToken = new Dictionary <string, string>();

            sParaTempToken.Add("partner", Com.Alipay.Touch.Config.Partner);
            sParaTempToken.Add("_input_charset", Com.Alipay.Touch.Config.Input_charset.ToLower());
            sParaTempToken.Add("sec_id", Com.Alipay.Touch.Config.Sign_type.ToUpper());
            sParaTempToken.Add("service", "alipay.wap.trade.create.direct");
            sParaTempToken.Add("format", format);
            sParaTempToken.Add("v", v);
            sParaTempToken.Add("req_id", req_id);
            sParaTempToken.Add("req_data", req_dataToken);

            //建立请求
            string sHtmlTextToken = Com.Alipay.Touch.Submit.BuildRequest(Com.Alipay.Touch.Config.gateway_new, sParaTempToken);
            //URLDECODE返回的信息
            Encoding code = Encoding.GetEncoding(Com.Alipay.Touch.Config.Input_charset);

            sHtmlTextToken = HttpUtility.UrlDecode(sHtmlTextToken, code);

            //解析远程模拟提交后返回的信息
            Dictionary <string, string> dicHtmlTextToken = Com.Alipay.Touch.Submit.ParseResponse(sHtmlTextToken);

            //获取token
            string request_token = dicHtmlTextToken["request_token"];

            ////////////////////////////////////////////根据授权码token调用交易接口alipay.wap.auth.authAndExecute////////////////////////////////////////////


            //业务详细
            string req_data = "<auth_and_execute_req><request_token>" + request_token + "</request_token></auth_and_execute_req>";
            //必填

            //把请求参数打包成数组
            Dictionary <string, string> sParaTemp = new Dictionary <string, string>();

            sParaTemp.Add("partner", Com.Alipay.Touch.Config.Partner);
            sParaTemp.Add("_input_charset", Com.Alipay.Touch.Config.Input_charset.ToLower());
            sParaTemp.Add("sec_id", Com.Alipay.Touch.Config.Sign_type.ToUpper());
            sParaTemp.Add("service", "alipay.wap.auth.authAndExecute");
            sParaTemp.Add("format", format);
            sParaTemp.Add("v", v);
            sParaTemp.Add("req_data", req_data);

            //建立请求
            string sHtmlText = Com.Alipay.Touch.Submit.BuildRequest(Com.Alipay.Touch.Config.gateway_new, sParaTemp, "get", "确认");

            return(sHtmlText);
        }