Example #1
0
        private void _init(Song.Entities.PayInterface payInterface)
        {
            //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

            //合作身份者ID,以2088开头由16位纯数字组成的字符串
            partner = payInterface.Pai_ParterID;

            //收款支付宝账号,以2088开头由16位纯数字组成的字符串
            seller_id = partner;

            //商户的私钥
            WeiSha.Common.CustomConfig config = CustomConfig.Load(payInterface.Pai_Config);
            private_key = config["Privatekey"].Value.String;
            private_key = Regex.Replace(private_key, @"\r|\n|\s", "", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);

            //支付宝的公钥,无需修改该值
            public_key = @"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRAFljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQEB/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5KsiNG9zpgmLCUYuLkxpLQIDAQAB";

            //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

            //字符编码格式 目前支持 gbk 或 utf-8
            input_charset = "utf-8";
            //签名方式,选择项:RSA、DSA、MD5
            sign_type = "RSA";
        }
Example #2
0
        /// <summary>
        /// 支付宝手机支付
        /// </summary>
        private void Alipaywap(Song.Entities.PayInterface pi, Song.Entities.MoneyAccount ma)
        {
            ////////////////////////////////////////////请求参数////////////////////////////////////////////
            string domain = "http://" + WeiSha.Common.Server.Domain + ":" + WeiSha.Common.Server.Port + "/";
            //支付类型
            string payment_type = "1";
            //商户订单号
            string out_trade_no = ma.Ma_Serial;
            //商户网站订单系统中唯一订单号,必填
            //必填,不能修改
            //服务器异步通知页面路径
            string notify_url = domain + "Pay/Alipaywap/notify_url.aspx";
            //需http://格式的完整路径,不能加?id=123这类自定义参数
            //页面跳转同步通知页面路径
            string return_url = domain + "Pay/Alipaywap/return_url.aspx";
            //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/
            //订单名称
            string name    = string.IsNullOrWhiteSpace(Extend.LoginState.Accounts.CurrentUser.Ac_Name) ? "" : Extend.LoginState.Accounts.CurrentUser.Ac_Name;
            string subject = name + "(" + Extend.LoginState.Accounts.CurrentUser.Ac_AccName + ")充值";
            //必填
            //付款金额
            string total_fee = money.ToString();
            //必填
            //商品展示地址
            string show_url = domain + "Mobile/Recharge.ashx";
            //必填,需以http://开头的完整路径,例如:http://www.商户网址.com/myorder.html
            //订单描述
            string body = subject;
            //选填
            //超时时间
            string it_b_pay = "10";
            //选填
            //钱包token
            string extern_token = "";

            ////////////////////////////////////////////////////////////////////////////////////////////////
            //把请求参数打包成数组
            Com.Alipaywap.Config config = new Com.Alipaywap.Config(pi);
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("partner", config.Partner);
            sParaTemp.Add("seller_id", config.Seller_id);
            sParaTemp.Add("_input_charset", config.Input_charset.ToLower());
            sParaTemp.Add("service", "alipay.wap.create.direct.pay.by.user");
            sParaTemp.Add("payment_type", payment_type);
            sParaTemp.Add("notify_url", notify_url);
            sParaTemp.Add("return_url", return_url);
            sParaTemp.Add("out_trade_no", out_trade_no);
            sParaTemp.Add("subject", subject);  //不要用Url编码处理中文
            sParaTemp.Add("total_fee", total_fee);
            sParaTemp.Add("show_url", show_url);
            sParaTemp.Add("body", body);    //不要用Url编码处理中文
            sParaTemp.Add("it_b_pay", it_b_pay);
            sParaTemp.Add("extern_token", extern_token);
            //建立请求
            Com.Alipaywap.Submit submit = new Com.Alipaywap.Submit(config);
            string sHtmlText            = submit.BuildRequest(sParaTemp, "get", "确认");

            Response.Write(sHtmlText);
        }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         Song.Entities.PayInterface pi = Business.Do <IPayInterface>().PaySingle(id);
         if (pi != null)
         {
             ListItem li = ddlInterFace.Items.FindByText(pi.Pai_Pattern);
             if (li != null)
             {
                 ddlInterFace.SelectedIndex = -1;
                 li.Selected = true;
             }
         }
         else
         {
             string   pagename = WeiSha.Common.Request.Page.FileName;
             ListItem li       = null;
             foreach (ListItem item in ddlInterFace.Items)
             {
                 string page = item.Value;
                 if (item.Value.Equals(pagename, StringComparison.CurrentCultureIgnoreCase))
                 {
                     li = item;
                     break;
                 }
             }
             if (li != null)
             {
                 ddlInterFace.SelectedIndex = -1;
                 li.Selected = true;
             }
         }
     }
 }
        /// <summary>
        /// 初始化数据
        /// </summary>
        private void initData()
        {
            this.payInterface = Business.Do <IPayInterface>().PaySingle(piid);
            if (this.payInterface == null)
            {
                return;
            }
            appid  = payInterface.Pai_ParterID;     //绑定支付的APPID(必须配置)
            secret = payInterface.Pai_Key;          //公众帐号secert(仅JSAPI支付的时候需要配置)
            WeiSha.Common.CustomConfig config = CustomConfig.Load(payInterface.Pai_Config);
            mchid  = config["MCHID"].Value.String;  //商户id
            paykey = config["Paykey"].Value.String; //商户支付密钥
            //回调地址
            this.payInterface = Business.Do <IPayInterface>().PaySingle(piid);
            string retdomain = this.payInterface.Pai_Returl;

            if (string.IsNullOrWhiteSpace(retdomain))
            {
                retdomain = "http://" + WeiSha.Common.Server.Domain + "/";
            }
            if (!retdomain.EndsWith("/"))
            {
                retdomain += "/";
            }
            notify_url = retdomain + "Pay/Weixin/miniProgramResult.aspx";
            notify_url = notify_url.ToLower();
        }
Example #5
0
        /// <summary>
        /// 微信html5支付,即手机网页支付
        /// </summary>
        /// <param name="pi"></param>
        /// <param name="ma"></param>
        private void WeixinH5Pay(Song.Entities.PayInterface pi, Song.Entities.MoneyAccount ma)
        {
            string url = "Weixin/Html5Pay.aspx?piid={0}&serial={1}&money={2}";

            url = string.Format(url, pi.Pai_ID, ma.Ma_Serial, money * 100);
            System.Web.HttpContext.Current.Response.Redirect(url);
        }
Example #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         Song.Entities.PayInterface pi = Business.Do <IPayInterface>().PaySingle(id);
         if (pi != null)
         {
             ListItem li = ddlInterFace.Items.FindByText(pi.Pai_Pattern);
             if (li != null)
             {
                 ddlInterFace.SelectedIndex = -1;
                 li.Selected = true;
             }
         }
         else
         {
             string   pagename = WeiSha.Common.Request.Page.FileName;
             ListItem li       = ddlInterFace.Items.FindByValue(pagename.ToLower());
             if (li != null)
             {
                 ddlInterFace.SelectedIndex = -1;
                 li.Selected = true;
             }
         }
     }
 }
        /// <summary>
        /// 初始化数据
        /// </summary>
        private void initData()
        {
            this.payInterface = Business.Do <IPayInterface>().PaySingle(piid);
            if (this.payInterface == null)
            {
                return;
            }
            appid  = payInterface.Pai_ParterID;     //绑定支付的APPID(必须配置)
            secret = payInterface.Pai_Key;          //公众帐号secert(仅JSAPI支付的时候需要配置)
            WeiSha.Common.CustomConfig config = CustomConfig.Load(payInterface.Pai_Config);
            mchid  = config["MCHID"].Value.String;  //商户id
            paykey = config["Paykey"].Value.String; //商户支付密钥
            //回调地址
            this.payInterface = Business.Do <IPayInterface>().PaySingle(piid);
            string retdomain = this.payInterface.Pai_Returl;

            if (string.IsNullOrWhiteSpace(retdomain))
            {
                retdomain = "http://" + WeiSha.Common.Server.Domain + "/";
            }
            if (!retdomain.EndsWith("/"))
            {
                retdomain += "/";
            }
            notify_url = retdomain + "Pay/Weixin/miniProgramResult.aspx";
            notify_url = notify_url.ToLower();

            //调试
            string msg = string.Format("小程序支付,第二步(调用小程序):\r\n商户ID:{0},商户密钥:{1},商户订单号:{2},回调:{3}", mchid, paykey, serial, notify_url);

            WxPayAPI.Log.Info(this.GetType().FullName, msg);
        }
Example #8
0
        private void _init(Song.Entities.PayInterface payInterface)
        {
            //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

            // 合作身份者ID,签约账号,以2088开头由16位纯数字组成的字符串,查看地址:https://b.alipay.com/order/pidAndKey.htm
            partner = payInterface.Pai_ParterID;

            // 收款支付宝账号,以2088开头由16位纯数字组成的字符串,一般情况下收款账号就是签约账号
            seller_id = partner;

            //商户的私钥,原始格式,RSA公私钥生成:https://doc.open.alipay.com/doc2/detail.htm?spm=a219a.7629140.0.0.nBDxfy&treeId=58&articleId=103242&docType=1
            WeiSha.Common.CustomConfig config = CustomConfig.Load(payInterface.Pai_Config);
            private_key = config["Privatekey"].Value.String;
            private_key = Regex.Replace(private_key, @"\r|\n|\s", "", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);

            //支付宝的公钥,查看地址:https://b.alipay.com/order/pidAndKey.htm
            public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRAFljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQEB/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5KsiNG9zpgmLCUYuLkxpLQIDAQAB";

            //// 服务器异步通知页面路径,需http://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问
            //notify_url = "http://商户网关地址/create_direct_pay_by_user-CSHARP-UTF-8/notify_url.aspx";

            //// 页面跳转同步通知页面路径,需http://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问
            //return_url = "http://商户网关地址/create_direct_pay_by_user-CSHARP-UTF-8/return_url.aspx";

            // 签名方式
            sign_type = "RSA";

            // 字符编码格式 目前支持 gbk 或 utf-8
            input_charset = "utf-8";
        }
Example #9
0
        /// <summary>
        /// 微信公众号支付
        /// </summary>
        /// <param name="pi"></param>
        /// <param name="ma"></param>
        private void Weixinpubpay(Song.Entities.PayInterface pi, Song.Entities.MoneyAccount ma)
        {
            string host = System.Web.HttpContext.Current.Request.Url.Host + ":" + WeiSha.Common.Server.Port + "/";

            if (!string.IsNullOrWhiteSpace(pi.Pai_Returl))
            {
                host = pi.Pai_Returl;
            }
            if (!host.EndsWith("/"))
            {
                host += "/";
            }
            //构造网页授权获取code的URL
            string path = "Pay/Weixin/PublicPay.aspx";
            //System.Web.HttpContext.Current.Response.Write(host + path);
            string redirect_uri = HttpUtility.UrlEncode(host + path.ToLower());

            WxPayAPI.WxPayData data = new WxPayAPI.WxPayData();
            data.SetValue("appid", pi.Pai_ParterID);
            data.SetValue("redirect_uri", redirect_uri);
            data.SetValue("response_type", "code");
            data.SetValue("scope", "snsapi_base");
            //返回的状态值,接口id、流水号
            string state = "pi:{0},serial:{1}";

            state = string.Format(state, pi.Pai_ID, ma.Ma_Serial);
            data.SetValue("state", state + "#wechat_redirect");
            string url = "https://open.weixin.qq.com/connect/oauth2/authorize?" + data.ToUrl();

            System.Web.HttpContext.Current.Response.Redirect(url);
        }
Example #10
0
        /// <summary>
        /// 支付宝网页直付
        /// </summary>
        /// <param name="pi"></param>
        private void Alipayweb(Song.Entities.PayInterface pi, Song.Entities.MoneyAccount ma)
        {
            ////////////////////////////////////////////请求参数////////////////////////////////////////////

            //商户订单号,商户网站订单系统中唯一订单号,必填
            string out_trade_no = ma.Ma_Serial;
            //订单名称,必填
            string name    = string.IsNullOrWhiteSpace(Extend.LoginState.Accounts.CurrentUser.Ac_Name) ? "" : Extend.LoginState.Accounts.CurrentUser.Ac_Name;
            string subject = name + "(" + Extend.LoginState.Accounts.CurrentUser.Ac_AccName + ")充值";
            //付款金额,必填
            string total_fee = money.ToString();
            //商品描述,可空
            string body = subject;
            ////////////////////////////////////////////////////////////////////////////////////////////////
            //服务器异步通知页面路径
            string domain = "http://" + WeiSha.Common.Server.Domain + ":" + WeiSha.Common.Server.Port + "/";

            domain = string.IsNullOrWhiteSpace(pi.Pai_Returl) ? domain : pi.Pai_Returl;
            if (!domain.EndsWith("/"))
            {
                domain += "/";
            }
            string notify_url = domain + "Pay/Alipayweb/notify_url.aspx";
            //需http://格式的完整路径,不能加?id=123这类自定义参数
            //页面跳转同步通知页面路径
            string return_url = domain + "Pay/Alipayweb/return_url.aspx";

            ////////////////////////////////////////////////////////////////////////////////////////////////

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

            Com.Alipayweb.Config config = new Com.Alipayweb.Config(pi);
            sParaTemp.Add("service", Config.service);
            sParaTemp.Add("partner", config.Partner);
            sParaTemp.Add("seller_id", config.Seller_id);
            sParaTemp.Add("_input_charset", config.Input_charset.ToLower());
            sParaTemp.Add("payment_type", Config.payment_type);
            sParaTemp.Add("notify_url", notify_url);
            sParaTemp.Add("return_url", return_url);
            sParaTemp.Add("anti_phishing_key", Config.anti_phishing_key);
            sParaTemp.Add("exter_invoke_ip", Config.exter_invoke_ip);
            sParaTemp.Add("out_trade_no", out_trade_no);
            sParaTemp.Add("subject", subject); //不要用Url编码处理中文
            sParaTemp.Add("total_fee", total_fee);
            sParaTemp.Add("body", body);       //不要用Url编码处理中文
            //其他业务参数根据在线开发文档,添加参数.文档地址:https://doc.open.alipay.com/doc2/detail.htm?spm=a219a.7629140.0.0.O9yorI&treeId=62&articleId=103740&docType=1
            //如sParaTemp.Add("参数名","参数值");

            //建立请求
            Submit submit    = new Submit(config);
            string sHtmlText = submit.BuildRequest(sParaTemp, "get", "确认");

            Response.Write(sHtmlText);
        }
Example #11
0
        /// <summary>
        /// 微信小程序支付
        /// </summary>
        /// <param name="pi"></param>
        /// <param name="ma"></param>
        private void WeixinMiniProgramPay(Song.Entities.PayInterface pi, Song.Entities.MoneyAccount ma)
        {
            string url = "Weixin/miniProgramPay.aspx?piid={0}&serial={1}&money={2}&org={3}";

            url = string.Format(url, pi.Pai_ID, ma.Ma_Serial, money * 100, ma.Org_ID);
            //调试
            string msg = string.Format("小程序支付,第一步(启动):\r\n接口ID:{0},流水号:{1},金额:{2}元", pi.Pai_ID, ma.Ma_Serial, money);

            WxPayAPI.Log.Info(this.GetType().FullName, msg);

            System.Web.HttpContext.Current.Response.Redirect(url);
        }
 private void fill()
 {
     Song.Entities.PayInterface pi = id <= 0 ? null : Business.Do <IPayInterface>().PaySingle(id);
     if (pi == null)
     {
         return;
     }
     this.EntityBind(pi);
     //自定义配置项
     WeiSha.Common.CustomConfig config = CustomConfig.Load(pi.Pai_Config);
     tbPrivatekey.Text = config["Privatekey"].Value.String;
 }
Example #13
0
 /// <summary>
 /// 初始化数据
 /// </summary>
 private void initData()
 {
     this.payInterface = Business.Do <IPayInterface>().PaySingle(piid);
     this.moneyAccount = Business.Do <IAccounts>().MoneySingle(serial);
     total_fee         = (int)(moneyAccount.Ma_Money * 100);
     orgid             = moneyAccount.Org_ID;
     appid             = payInterface.Pai_ParterID; //绑定支付的APPID(必须配置)
     secret            = payInterface.Pai_Key;      //公众帐号secert(仅JSAPI支付的时候需要配置)
     WeiSha.Common.CustomConfig config = CustomConfig.Load(payInterface.Pai_Config);
     mchid  = config["MCHID"].Value.String;         //商户id
     paykey = config["Paykey"].Value.String;        //支付密钥
 }
Example #14
0
        /// <summary>
        /// 修改是否使用的状态
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void sbEnable_Click(object sender, EventArgs e)
        {
            StateButton ub    = (StateButton)sender;
            int         index = ((GridViewRow)(ub.Parent.Parent)).RowIndex;
            int         id    = int.Parse(this.GridView1.DataKeys[index].Value.ToString());

            //
            Song.Entities.PayInterface entity = Business.Do <IPayInterface>().PaySingle(id);
            entity.Pai_IsEnable = !entity.Pai_IsEnable;
            Business.Do <IPayInterface>().PaySave(entity);
            BindData(null, null);
        }
Example #15
0
        public void ProcessRequest(HttpContext context)
        {
            this.Response = context.Response;
            //来源
            string from = "Recharge.ashx";

            if (context.Request.UrlReferrer != null)
            {
                from = context.Request.UrlReferrer.ToString();
            }
            if (!Extend.LoginState.Accounts.IsLogin)
            {
                context.Response.Redirect(addPara(from, "err=1", "money=" + money, "paiid=" + paiid));
                return;
            }
            ////验证码不正确
            //if (isVerify && !isCodeImg())
            //{
            //    this.Response.Redirect(addPara(from, "err=3"));
            //    return;
            //}
            //支付接口的设置项
            Song.Entities.PayInterface pi = Business.Do <IPayInterface>().PaySingle(paiid);
            if (pi == null)
            {
                //设置项不存在
                context.Response.Redirect(addPara(from, "err=2", "money=" + money, "paiid=" + paiid));
                return;
            }
            else
            {
                //产生流水号
                MoneyAccount ma = new MoneyAccount();
                ma.Ma_Money     = money;
                ma.Ac_ID        = Extend.LoginState.Accounts.CurrentUser.Ac_ID;
                ma.Ma_Source    = pi.Pai_Pattern;
                ma.Pai_ID       = pi.Pai_ID;
                ma.Ma_From      = 3;
                ma.Ma_IsSuccess = false;
                ma = Business.Do <IAccounts>().MoneyIncome(ma);
                //调用指定的支付接口
                if (pi.Pai_Pattern == "支付宝手机支付")
                {
                    Alipaywap(pi, ma);
                }
                if (pi.Pai_Pattern == "支付宝网页直付")
                {
                    Alipayweb(pi, ma);
                }
            }
        }
Example #16
0
 void fill()
 {
     Song.Entities.MoneyAccount mm = Business.Do <IAccounts>().MoneySingle(id);
     this.EntityBind(mm);
     //学员
     Song.Entities.Accounts student = Business.Do <IAccounts>().AccountsSingle(mm.Ac_ID);
     if (student != null)
     {
         Ac_ID.Text = student.Ac_Name;
     }
     //支出或充值
     Ma_Type.Text = mm.Ma_Type == 1 ? "支出" : "充值";
     type         = mm.Ma_Type;
     //支付方式
     if (mm.Ma_From == 1)
     {
         Ma_From.Text = "管理员操作";
     }
     if (mm.Ma_From == 2)
     {
         Ma_From.Text = "充值码充值";
     }
     if (mm.Ma_From == 3)
     {
         Ma_From.Text = "在线支付";
     }
     if (mm.Ma_From == 4)
     {
         Ma_From.Text = "购买课程";
     }
     //支付账号,收款账号
     Ma_Buyer.Text  = mm.Ma_Buyer;
     Ma_Seller.Text = mm.Ma_Seller;
     //状态
     Ma_IsSuccess.Text = mm.Ma_IsSuccess ? "成功" : "失败";
     //充值码
     trCode.Visible = mm.Ma_From == 2;
     Rc_Code.Text   = mm.Rc_Code;
     //支付平台
     if (mm.Ma_From == 3)
     {
         trPayinterface.Visible = true;
         Song.Entities.PayInterface payi = Business.Do <IPayInterface>().PaySingle(mm.Pai_ID);
         if (payi != null)
         {
             Pai_ID.Text = payi.Pai_Name;
         }
     }
 }
Example #17
0
 private void fill()
 {
     Song.Entities.PayInterface pi = id <= 0 ? null : Business.Do <IPayInterface>().PaySingle(id);
     if (pi != null)
     {
         this.EntityBind(pi);
         //自定义配置项
         WeiSha.Common.CustomConfig config = CustomConfig.Load(pi.Pai_Config);
         tbPrivatekey.Text = config["Privatekey"].Value.String;
     }
     //回调域如果为空
     if (Pai_Returl.Text.Trim() == "")
     {
         Pai_Returl.Text = "http://" + WeiSha.Common.Server.Domain + ":" + WeiSha.Common.Server.Port + "/";
     }
 }
Example #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.ServerVariables["REQUEST_METHOD"] == "GET")
     {
         //当前登录账号
         if (acc == null)
         {
             Response.Redirect("/mobile/login.ashx");
         }
         piid   = WeiSha.Common.Request.QueryString["piid"].Int32 ?? 0;
         serial = WeiSha.Common.Request.QueryString["serial"].String;
         //回调地址
         this.payInterface = Business.Do <IPayInterface>().PaySingle(piid);
         retdomain         = this.payInterface.Pai_Returl;
         if (string.IsNullOrWhiteSpace(retdomain))
         {
             retdomain = "http://" + WeiSha.Common.Server.Domain + "/";
         }
         if (!retdomain.EndsWith("/"))
         {
             retdomain += "/";
         }
         notify_url = retdomain + "Pay/Weixin/Html5PayResultNotify.aspx";
         notify_url = notify_url.ToLower();
     }
     //接收ajax请求
     if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
     {
         //微信授权code,通过它获取access_token和openid
         string code = WeiSha.Common.Request.Form["code"].String;
         piid       = WeiSha.Common.Request.Form["piid"].Int32 ?? 0;
         serial     = WeiSha.Common.Request.Form["serial"].String;
         notify_url = WeiSha.Common.Request.Form["returl"].String;
         initData();
         //支付下单
         WxPayData result = JsApiPayPage();
         if (result != null)
         {
             Response.Write(result.ToJson());
         }
         if (result == null)
         {
             Response.Write("0");
         }
         Response.End();
     }
 }
Example #19
0
        /// <summary>
        /// 微信扫码支付
        /// </summary>
        /// <param name="pi"></param>
        /// <param name="ma"></param>
        private void WeixinNativepay(Song.Entities.PayInterface pi, Song.Entities.MoneyAccount ma)
        {
            string host = System.Web.HttpContext.Current.Request.Url.Host + ":" + WeiSha.Common.Server.Port + "/";

            if (!string.IsNullOrWhiteSpace(pi.Pai_Returl))
            {
                host = pi.Pai_Returl;
            }
            if (!host.EndsWith("/"))
            {
                host += "/";
            }
            //用于生成支付二维码的URL
            string url = "Pay/Weixin/NativePayPage.aspx?pi={0}&serial={1}";

            url = host + string.Format(url.ToString(), pi.Pai_ID, ma.Ma_Serial);
            System.Web.HttpContext.Current.Response.Redirect(url);
        }
Example #20
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEnter_Click(object sender, EventArgs e)
        {
            Song.Entities.PayInterface pi = id <= 0 ? new Song.Entities.PayInterface() : Business.Do <IPayInterface>().PaySingle(id);
            pi = this.EntityFill(pi) as Song.Entities.PayInterface;
            //支付方式
            pi.Pai_Pattern = Pai_Pattern.DdlInterFace.SelectedItem.Text;
            //自定义配置项
            WeiSha.Common.CustomConfig config = CustomConfig.Load(pi.Pai_Config);
            string privateKey = Regex.Replace(tbPrivatekey.Text.Trim(), @"\r|\n|\s", "", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);

            config["Privatekey"].Text = privateKey;
            pi.Pai_Config             = config.XmlString;
            //所用的平台
            pi.Pai_Platform = "web";
            //支付的应用场景
            pi.Pai_Scene = scene;
            //只能根机构才可以设置支付接口(也就是说,钱全到根机构账上)
            Song.Entities.Organization org = Business.Do <IOrganization>().OrganRoot();
            if (org != null)
            {
                pi.Org_ID = org.Org_ID;
            }
            try
            {
                if (id <= 0)
                {
                    Business.Do <IPayInterface>().PayAdd(pi);
                }
                else
                {
                    Business.Do <IPayInterface>().PaySave(pi);
                }

                Master.AlertCloseAndRefresh("操作成功!");
            }
            catch (Exception ex)
            {
                Master.Alert(ex.Message);
            }
        }
Example #21
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEnter_Click(object sender, EventArgs e)
        {
            Song.Entities.PayInterface pi = id <= 0 ? new Song.Entities.PayInterface() : Business.Do <IPayInterface>().PaySingle(id);
            pi = this.EntityFill(pi) as Song.Entities.PayInterface;
            //支付方式
            pi.Pai_Pattern = Pai_Pattern.DdlInterFace.SelectedItem.Text;
            //自定义配置项
            WeiSha.Common.CustomConfig config = CustomConfig.Load(pi.Pai_Config);
            config["MCHID"].Text  = tbMCHID.Text.Trim();    //商户id
            config["Paykey"].Text = tbPaykey.Text.Trim();   //支付密钥
            pi.Pai_Config         = config.XmlString;
            //所用的平台
            pi.Pai_Platform = "mobi";
            //支付的应用场景
            pi.Pai_Scene = scene;
            //只能根机构才可以设置支付接口(也就是说,钱全到根机构账上)
            Song.Entities.Organization org = Business.Do <IOrganization>().OrganRoot();
            if (org != null)
            {
                pi.Org_ID = org.Org_ID;
            }
            try
            {
                if (id <= 0)
                {
                    Business.Do <IPayInterface>().PayAdd(pi);
                }
                else
                {
                    Business.Do <IPayInterface>().PaySave(pi);
                }

                Master.AlertCloseAndRefresh("操作成功!");
            }
            catch (Exception ex)
            {
                Master.Alert(ex.Message);
            }
        }
Example #22
0
 /// <summary>
 /// 初始化数据
 /// </summary>
 private void initData()
 {
     this.payInterface = Business.Do <IPayInterface>().PaySingle(pi);
     this.moneyAccount = Business.Do <IAccounts>().MoneySingle(serial);
     total_fee         = (int)(moneyAccount.Ma_Money * 100);
     orgid             = moneyAccount.Org_ID;
     appid             = payInterface.Pai_ParterID; //绑定支付的APPID(必须配置)
     secret            = payInterface.Pai_Key;      //公众帐号secert(仅JSAPI支付的时候需要配置)
     WeiSha.Common.CustomConfig config = CustomConfig.Load(payInterface.Pai_Config);
     mchid  = config["MCHID"].Value.String;         //商户id
     paykey = config["Paykey"].Value.String;        //支付密钥
     //回调地址
     notify_url = this.payInterface.Pai_Returl;
     if (string.IsNullOrWhiteSpace(notify_url))
     {
         notify_url = "http://" + WeiSha.Common.Server.Domain + "/";
     }
     if (!notify_url.EndsWith("/"))
     {
         notify_url += "/";
     }
     notify_url += "Pay/Weixin/NativeNotifyPage.aspx";
 }
Example #23
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        private void initData(string state)
        {
            int pi = 0;

            foreach (string s in state.Split(','))
            {
                string[] arr = s.Split(':');
                if (arr[0] == "serial")
                {
                    serial = arr[1];
                }
                if (arr[0] == "pi")
                {
                    int.TryParse(arr[1], out pi);
                }
            }
            this.payInterface = Business.Do <IPayInterface>().PaySingle(pi);
            this.moneyAccount = Business.Do <IAccounts>().MoneySingle(serial);
            total_fee         = (int)(moneyAccount.Ma_Money * 100);
            orgid             = moneyAccount.Org_ID;
            appid             = payInterface.Pai_ParterID; //绑定支付的APPID(必须配置)
            secret            = payInterface.Pai_Key;      //公众帐号secert(仅JSAPI支付的时候需要配置)
            WeiSha.Common.CustomConfig config = CustomConfig.Load(payInterface.Pai_Config);
            mchid  = config["MCHID"].Value.String;         //商户id
            paykey = config["Paykey"].Value.String;        //支付密钥
            //回调地址
            notify_url = this.payInterface.Pai_Returl;
            if (string.IsNullOrWhiteSpace(notify_url))
            {
                notify_url = "http://" + WeiSha.Common.Server.Domain + "/";
            }
            if (!notify_url.EndsWith("/"))
            {
                notify_url += "/";
            }
            notify_url += "Pay/Weixin/ResultNotifyPage.aspx";
        }
Example #24
0
 /// <summary>
 /// 初始化接口
 /// </summary>
 private void initData()
 {
     Song.Entities.PayInterface[] pis = Business.Do <IPayInterface>().PayAll(-1, null, true);
     foreach (Song.Entities.PayInterface p in pis)
     {
         if (p.Pai_Pattern == "微信小程序支付")
         {
             this.payInterface = p;
             break;
         }
     }
     if (this.payInterface == null)
     {
         WxPayAPI.Log.Error(this, "小程序支付接口不存在!");
     }
     if (this.payInterface != null)
     {
         appid  = payInterface.Pai_ParterID;     //绑定支付的APPID(必须配置)
         secret = payInterface.Pai_Key;          //公众帐号secert(仅JSAPI支付的时候需要配置)
         WeiSha.Common.CustomConfig config = CustomConfig.Load(payInterface.Pai_Config);
         mchid  = config["MCHID"].Value.String;  //商户id
         paykey = config["Paykey"].Value.String; //支付密钥
     }
 }
Example #25
0
 /// <summary>
 /// 配置项
 /// </summary>
 /// <param name="paiid">系统中的接口ID</param>
 public Config(Song.Entities.PayInterface payInterface)
 {
     _init(payInterface);
 }
Example #26
0
 public Config(int paiid)
 {
     Song.Entities.PayInterface payInterface = Business.Do <IPayInterface>().PaySingle(paiid);
     _init(payInterface);
 }