Ejemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string errorUrl = "/Manage/Pay/Yeepay/NotePay.aspx"; //������ת��ַ
            //��Ʒ���ƣ��̻���
            string companyName = UiCommon.StringConfig.CompanyNameOfPay;

            //֧����
            string userName = txtUserName.Text.Trim();

            //֧�����
            string payMoney = PayMoney.SelectedItem.Value; //PayMoney.Text.Trim();

            //֧������ Web_RMBCost.PayType
            int payTypeLog = 3;

            //������Ϣ Web_RMBCost.Typeinfo
            string typeInfoLog = "�ױ�һ��֧ͨ��";

            //���ױ��Ľ��׶�����
            string out_trade_no = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");

            BLL.Member mem = new BLL.Member();
            int otherPayMoney = mem.UserTodayOtherPayMoney(userName);
            //�Ƿ񳬳������ֵ���ƶ�
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {
                Response.Write("<script>alert('�������ܳ�ֵ��������ܴ���" + otherPayMoney + "��');location.href='" + errorUrl + "';</script>");
                Response.End();
            }

            //����֧��������־
            new BLL.Member().Add3PayOrder(userName, Convert.ToInt32(payMoney), payTypeLog, typeInfoLog, out_trade_no);

            //��ʼ����֧������

            //����
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");

            //#if !debug
            #region ��ʽ����
            p1_MerId = StringConfig.YeepayMerID;                                     // �̼�ID
            keyValue = StringConfig.YeepayKey;  // �̼���Կ
            Buy.NodeAuthorizationURL = StringConfig.YeepayNodeAuthorizationURL;
            #endregion
            //#endif

            //#region ���Դ���
            //p1_MerId = "10000432521";                                     // �̼�ID
            //keyValue = "8UPp0KE8sq73zVP370vko7C39403rtK1YwX40Td6irH216036H27Eb12792t";  // �̼���Կ
            //// ���������ַ
            //Buy.NodeAuthorizationURL = @"http://tech.yeepay.com:8080/robot/debug.action"; //test
            //#endregion

            p2_Order = out_trade_no;

            p3_Amt = payMoney;

            //���ױ���,�̶�ֵ"CNY".
            p4_Cur = "CNY";

            //��Ʒ����
            //����֧��ʱ��ʾ���ױ�֧���������Ķ�����Ʒ��Ϣ.
            p5_Pid = "";

            //��Ʒ����
            p6_Pcat = "";

            //��Ʒ����
            p7_Pdesc = "";

            //�̻�����֧���ɹ����ݵĵ�ַ,֧���ɹ����ױ�֧������õ�ַ�������γɹ�֪ͨ.
            //p8_Url = "http://localhost:102/user/yeepay/Callback.aspx";//���ز���URLuser/yeepay/Default.aspx

            //p8_Url = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/Yeepay/Callback.aspx";

            p8_Url = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/Yeepay/Callback.aspx";

            //�ͻ���ַ
            //Ϊ��1��: ��Ҫ�û����ͻ���ַ�����ױ�֧��ϵͳ;Ϊ��0��: ����Ҫ��Ĭ��Ϊ ��0��.
            p9_SAF = "0";

            //�̻���չ��Ϣ
            //�̻�����������д1K ���ַ���,֧���ɹ�ʱ��ԭ������.
            pa_MP = "";

            //�����
            //Ĭ��Ϊ""�����ױ�֧������.�������ʾ�ױ�֧����ҳ�棬ֱ����ת�������С�������֧��������һ��ͨ��֧��ҳ�棬���ֶο����ո�¼:�����б����ò���ֵ.
            pd_FrpId = "YPCARD";

            //Ӧ�����
            //Ϊ"1": ��ҪӦ�����;Ϊ"0": ����ҪӦ�����.
            pr_NeedResponse = "1";

            Response.Redirect(Buy.CreateBuyUrl(p1_MerId, keyValue, p2_Order, p3_Amt, p4_Cur, p5_Pid, p6_Pcat, p7_Pdesc, p8_Url, p9_SAF, pa_MP, pd_FrpId, pr_NeedResponse));
        }
Ejemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string errorUrl = "/Manage/Pay/Yeepay/Default.aspx"; //出错跳转地址
            //商品名称(商户)
            string companyName = UiCommon.StringConfig.CompanyNameOfPay;

            //支付人
            string userName = txtUserName.Text.Trim();

            //支付金额
            string payMoney = PayMoney.Text.Trim();

            //支付类型 Web_RMBCost.PayType
            int payTypeLog = 1;

            //类型信息 Web_RMBCost.Typeinfo
            string typeInfoLog = "易宝支付网关支付";

            //与易宝的交易订单号
            string out_trade_no = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");

            BLL.Member mem           = new BLL.Member();
            int        otherPayMoney = mem.UserTodayOtherPayMoney(userName);

            //是否超出今天充值限制额
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {
                Response.Write("<script>alert('您今天能充值金额数不能大于" + otherPayMoney + "。');location.href='" + errorUrl + "';</script>");
                Response.End();
            }

            //插入支付订单日志
            new BLL.Member().Add3PayOrder(userName, Convert.ToInt32(payMoney), payTypeLog, typeInfoLog, out_trade_no);


            //开始调用支付网关

            //设置编码
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");

            //#if !debug
            #region 正式代码
            p1_MerId = StringConfig.YeepayMerID; // 商家ID
            keyValue = StringConfig.YeepayKey;   // 商家密钥
            Buy.NodeAuthorizationURL = StringConfig.YeepayNodeAuthorizationURL;
            #endregion
            //#endif


            //#region 测试代码
            //p1_MerId = "10000432521";                                     // 商家ID
            //keyValue = "8UPp0KE8sq73zVP370vko7C39403rtK1YwX40Td6irH216036H27Eb12792t";  // 商家密钥
            // 设置请求地址
            //Buy.NodeAuthorizationURL = @"http://tech.yeepay.com:8080/robot/debug.action"; //test
            //#endregion


            p2_Order = out_trade_no;

            p3_Amt = payMoney;

            //交易币种,固定值"CNY".
            p4_Cur = "CNY";

            //商品名称
            //用于支付时显示在易宝支付网关左侧的订单产品信息.
            p5_Pid = "";

            //商品种类
            p6_Pcat = "";

            //商品描述
            p7_Pdesc = "";

            //商户接收支付成功数据的地址,支付成功后易宝支付会向该地址发送两次成功通知.
            //p8_Url = "http://*****:*****@#" + Convert.ToInt32(poupon).ToString();
            // ---end

            //银行编码
            //默认为"",到易宝支付网关.若不需显示易宝支付的页面,直接跳转到各银行、神州行支付、骏网一卡通等支付页面,该字段可依照附录:银行列表设置参数值.
            pd_FrpId = "";


            //应答机制
            //为"1": 需要应答机制;为"0": 不需要应答机制.
            pr_NeedResponse = "1";

            Response.Redirect(Buy.CreateBuyUrl(p1_MerId, keyValue, p2_Order, p3_Amt, p4_Cur, p5_Pid, p6_Pcat, p7_Pdesc, p8_Url, p9_SAF, pa_MP, pd_FrpId, pr_NeedResponse));
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //�Ƿ�����ʱ�ض����URL��ַ
            string toUrl = "/Manage/Pay/99bill/PhonePay/Default.aspx";

            //���յ�����֧��ƽ̨����֧�������ҳ���ַ��Ϊ���Ե�ַ
            string receivePageUrl = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/99bill/PhonePay/Receive.aspx";

            //��Ʒ���ƣ��̻���
            string companyName = UiCommon.StringConfig.CompanyNameOfPay;

            //֧����
            if (Request.Form["txtUserName"] == null)
            {
                Response.Redirect(toUrl);
            }
            string userName = Request.Form["txtUserName"].ToString();

            //֧�����
            if (Request.Form["PayMoney"] == null)
            {
                Response.Redirect(toUrl);
            }
            string payMoney = Request.Form["PayMoney"].ToString().Trim();
            BLL.Member mem = new BLL.Member();
            int otherPayMoney = mem.UserTodayOtherPayMoney(userName.Trim());
            //�Ƿ񳬳������ֵ���ƶ�
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {
                Response.Write("<script>alert('�������ܳ�ֵ��������ܴ���" + otherPayMoney + "��');location.href='" + toUrl + "';</script>");
                Response.End();
            }
            //֧������ Web_RMBCost.PayType
            int payTypeLog = 1;

            //������Ϣ Web_RMBCost.Typeinfo
            string typeInfoLog = "��Ǯ�����п���֧��";

            /**
             * @Description: ��Ǯ������֧�����ؽӿڷ���
             * @Copyright (c) �Ϻ���Ǯ��Ϣ�������޹�˾
             * @version 2.0
             */

            //�����������˻���
            ///�����Ǯ������ϵ��ȡ
            merchantAcctId.Value = UiCommon.StringConfig.JJbill_SZX_Account;// "1001622591104";

            //����������������Կ
            ///���ִ�Сд
            String key = UiCommon.StringConfig.JJbill_SZX_Key;// "84YB4FXGFKZ85975";

            //�ַ���.�̶�ѡ��ֵ����Ϊ�ա�
            ///ֻ��ѡ��1��2��3��5
            ///1����UTF-8; 2����GBK; 3����gb2312; 5 ����big5
            ///Ĭ��ֵΪ1
            inputCharset.Value = "1";

            //����������֧������ĺ�̨��ַ.��[pageUrl]����ͬʱΪ�ա������Ǿ��Ե�ַ��
            ///��Ǯͨ�����������ӵķ�ʽ�����׽�����͵�[bgUrl]��Ӧ��ҳ���ַ�����̻�������ɺ������<result>���Ϊ1��ҳ���ת��<redirecturl>��Ӧ�ĵ�ַ��
            ///�����Ǯδ���յ�<redirecturl>��Ӧ�ĵ�ַ����Ǯ����֧�����GET��[pageUrl]��Ӧ��ҳ�档
            bgUrl.Value = receivePageUrl;

            //����֧�������ҳ���ַ.��[bgUrl]����ͬʱΪ�ա������Ǿ��Ե�ַ��
            ///���[bgUrl]Ϊ�գ���Ǯ��֧�����GET��[pageUrl]��Ӧ�ĵ�ַ��
            ///���[bgUrl]��Ϊ�գ�����[bgUrl]ҳ��ָ����<redirecturl>��ַ��Ϊ�գ���ת��<redirecturl>��Ӧ�ĵ�ַ.
            pageUrl.Value = "";

            //���ذ汾.�̶�ֵ
            ///��Ǯ����ݰ汾�������ö�Ӧ�Ľӿڴ������
            ///������汾�Ź̶�Ϊv2.0
            version.Value = "v2.0";

            //��������.�̶�ѡ��ֵ��
            ///ֻ��ѡ��1��2��3
            ///1�������ģ�2����Ӣ��
            ///Ĭ��ֵΪ1
            language.Value = "1";

            //ǩ������.�̶�ֵ
            ///1����MD5ǩ��
            ///��ǰ�汾�̶�Ϊ1
            signType.Value = "1";

            //֧��������
            ///��Ϊ���Ļ�Ӣ���ַ�
            //payerName.Value="֧����";
            payerName.Value = userName;

            //֧������ϵ��ʽ����.�̶�ѡ��ֵ
            ///ֻ��ѡ��1
            ///1����Email
            payerContactType.Value = "1";

            //֧������ϵ��ʽ
            ///ֻ��ѡ��Email���ֻ���
            payerContact.Value = "";

            //�̻�������
            ///����ĸ�����֡���[-][_]���
            orderId.Value = DateTime.Now.ToString("yyyyMMddHHmmssfffffff"); //DateTime.Now.ToString("yyyyMMddHHmmss");

            //�������
            ///�Է�Ϊ��λ����������������
            ///�ȷ�2������0.02Ԫ
            ///orderAmount.Value="100";
            double dblTemp = Double.Parse(payMoney);
            orderAmount.Value = Convert.ToString(dblTemp * 100);//Ԫת��Ϊ��

            //�����ύʱ��
            ///14λ���֡���[4λ]��[2λ]��[2λ]ʱ[2λ]��[2λ]��[2λ]
            ///�磻20080101010101
            orderTime.Value = DateTime.Now.ToString("yyyyMMddHHmmss");

            //��Ʒ����
            ///��Ϊ���Ļ�Ӣ���ַ�
            //productName.Value="��Ʒ����";
            productName.Value = companyName;

            //��Ʒ����
            ///��Ϊ�գ��ǿ�ʱ����Ϊ����
            productNum.Value = "1";

            //��Ʒ����
            ///��Ϊ�ַ���������
            productId.Value = "";

            //��Ʒ����
            productDesc.Value = "";

            //��չ�ֶ�1
            ///��֧��������ԭ�����ظ��̻�
            ext1.Value = userName;

            //��չ�ֶ�2
            ///��֧��������ԭ�����ظ��̻�
            ext2.Value = "";

            //֧����ʽ.�̶�ѡ��ֵ
            ///��ѡ��00��41��42��52
            ///00 �����ǮĬ��֧����ʽ��ĿǰΪ�����п���֧���Ϳ�Ǯ�˻�֧����41 �����Ǯ�˻�֧����42 ���������п���֧���Ϳ�Ǯ�˻�֧����52 ���������п���֧��
            payType.Value = "52";

            //ȫ��֧����־
            ///ֻ��ѡ������ 0 �� 1
            ///0 �����ȫ��֧����ʽ��֧����ɺ󷵻ض������Ϊ�̻��ύ�Ķ��������Ԥ���ѿ����С�ڶ������ʱ������֧�����Ϊʧ�ܣ�Ԥ���ѿ������ڻ���ڶ������ʱ������֧�����Ϊ�ɹ���
            ///1 ����ȫ��֧����ʽ��֧����ɺ󷵻ض������Ϊ�û�Ԥ���ѿ�����ֻҪԤ���ѿ������ɹ�������֧�������Ϊ�ɹ���
            fullAmountFlag.Value = "0";

            //�����к��������ַ��IJ������б���urlencode���룬���������Ľ��ȫ��ת���ɴ�д��ĸ
            ///��ע�⣺�������µ��������������������ַ��IJ���������ת���ɴ�д��ĸ����������á�.ToUpper()������
            ///        �����ڷ���ҳ����յ��ķ��ز�����ȫ����Ϊ��д��ĸ���⽫���ܵ������ݿⶩ�����ݸ���ʧ�ܣ���
            payerName.Value = System.Web.HttpUtility.UrlEncode(payerName.Value, Encoding.GetEncoding("UTF-8")).ToUpper();
            productName.Value = System.Web.HttpUtility.UrlEncode(productName.Value, Encoding.GetEncoding("UTF-8")).ToUpper();
            productDesc.Value = System.Web.HttpUtility.UrlEncode(productDesc.Value, Encoding.GetEncoding("UTF-8")).ToUpper();
            ext1.Value = System.Web.HttpUtility.UrlEncode(ext1.Value, Encoding.GetEncoding("UTF-8")).ToUpper();
            ext2.Value = System.Web.HttpUtility.UrlEncode(ext2.Value, Encoding.GetEncoding("UTF-8")).ToUpper();

            //���ɼ���ǩ����
            ///����ذ�������˳��͹�����ɼ��ܴ���
            String signMsgVal = "";
            signMsgVal = appendParam(signMsgVal, "inputCharset", inputCharset.Value);
            signMsgVal = appendParam(signMsgVal, "bgUrl", bgUrl.Value);
            signMsgVal = appendParam(signMsgVal, "pageUrl", pageUrl.Value);
            signMsgVal = appendParam(signMsgVal, "version", version.Value);
            signMsgVal = appendParam(signMsgVal, "language", language.Value);
            signMsgVal = appendParam(signMsgVal, "signType", signType.Value);
            signMsgVal = appendParam(signMsgVal, "merchantAcctId", merchantAcctId.Value);
            signMsgVal = appendParam(signMsgVal, "payerName", payerName.Value);
            signMsgVal = appendParam(signMsgVal, "payerContactType", payerContactType.Value);
            signMsgVal = appendParam(signMsgVal, "payerContact", payerContact.Value);
            signMsgVal = appendParam(signMsgVal, "orderId", orderId.Value);
            signMsgVal = appendParam(signMsgVal, "orderAmount", orderAmount.Value);
            signMsgVal = appendParam(signMsgVal, "payType", payType.Value);
            signMsgVal = appendParam(signMsgVal, "fullAmountFlag", fullAmountFlag.Value);
            signMsgVal = appendParam(signMsgVal, "orderTime", orderTime.Value);
            signMsgVal = appendParam(signMsgVal, "productName", productName.Value);
            signMsgVal = appendParam(signMsgVal, "productNum", productNum.Value);
            signMsgVal = appendParam(signMsgVal, "productId", productId.Value);
            signMsgVal = appendParam(signMsgVal, "productDesc", productDesc.Value);
            signMsgVal = appendParam(signMsgVal, "ext1", ext1.Value);
            signMsgVal = appendParam(signMsgVal, "ext2", ext2.Value);
            signMsgVal = appendParam(signMsgVal, "key", key);

            signMsg.Value = GetMD5(signMsgVal, "utf-8").ToUpper();

            //��ӡ������Ϣ
            Lab_orderId.Text = orderId.Value;
            Lab_orderAmount.Text = payMoney;
            Lab_payerName.Text = userName;
            Lab_productName.Text = companyName;

            /*
            Response.Write("userName:"******"<br>");
            Response.Write("payMoney:" + payMoney + "<br>");
            Response.Write("payTypeLog:" + payTypeLog + "<br>");
            Response.Write("typeInfoLog:" + typeInfoLog + "<br>");
            Response.Write("orderId:" + orderId.Value + "<br>");
            Response.End();
            */

            //֧���ɹ�ǰ�� ����֧���Ķ�����־
            new BLL.Member().Add3PayOrder(userName, Convert.ToInt32(payMoney), payTypeLog, typeInfoLog, orderId.Value);
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //string toServerURL = "https://pay.ips.com.cn/ipayment.aspx";//IPS支付接口路径

               //string toServerURLTest = "https://pay.ips.net.cn/ipayment.aspx"; //IPS支付接口测试路径

               //frmPay.Action = toServerURLTest;

               string errorUrl = "/Manage/Pay/IPS/Default.aspx"; //出错跳转地址

               BLL.Member mem = new BLL.Member();

               string txtUserName = Utility.Common.GetStringOfForm("txtUserName"); //用户名

               if (!mem.ExistName(txtUserName.Trim()))
               {
               Response.Write("<script>alert('找不到您要充值的用户帐号,请检查输入是否有误');location.href='" + errorUrl + "';</script>");
               Response.End();
               }

               // [add] jeffery
               //string strCouponNum = Utility.Common.GetStringOfForm("CouponNum"); //获取应赠送奖劵数量
               //Attach.Value = txtUserName + "!@#" + strCouponNum;
               // --- end

             //支付金额
            string payMoney = Utility.Common.GetStringOfForm("PayMoney");

            if (string.IsNullOrEmpty(payMoney) || !CommonManager.String.IsInteger(payMoney) || int.Parse(payMoney) <= 0)
            {
                CommonManager.Web.RegJs(this, "alert('金额只能输入大于0的整数。');history.back();", false);
                return;
            }
            int otherPayMoney = mem.UserTodayOtherPayMoney(txtUserName.Trim());
            //是否超出今天充值限制额
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {
                Response.Write("<script>alert('您今天能充值金额数不能大于"+otherPayMoney+"。');location.href='" + errorUrl + "';</script>");
                Response.End();
            }
            int payTypeLog = 6;

               Currency_Type.Value = "RMB";  //支付币种

               Amount.Value = payMoney + ".00";  //订单金额

               Mer_code.Value = UiCommon.StringConfig.IPS_Mer_code; //商户编号

               Billno.Value = DateTime.Now.ToString("yyyyMMddHHmmssfffffff"); //商户定单编号

               Date.Value = DateTime.Now.ToString("yyyyMMdd");  //订单日期

               MerchantUrl.Value = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/IPS/OrderReturn.aspx"; //支付成功通知的URL

               failUrl.Value = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/IPS/OrderReturn.aspx"; //支付失败通知的URL

               signMD5.Value = Utility.Common.md5("billno" + Billno.Value + "currencytype" + Currency_Type.Value + "amount" + Amount.Value + "date" + Date.Value + "orderencodetype" + OrderEncodeType.Value + UiCommon.StringConfig.IPS_Letter);   //MD5加密签名

              //如果是神舟卡
               if (Utility.Common.GetStringOfForm("Type") == "phone")
               {
               DoCredit.Value = "1";//直连神舟行
               Bankco.Value = "00077";//神州行代码
               Rettype.Value = "1";
               ServerUrl.Value = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/IPS/IPS_Server.aspx";
               //支付成功前, 插入支付的订单日志
               mem.Add3PayOrder(txtUserName, Convert.ToInt32(payMoney), payTypeLog, "环迅-神州行充值", Billno.Value);
               }
               else
               {
               //支付成功前, 插入支付的订单日志
               mem.Add3PayOrder(txtUserName, Convert.ToInt32(payMoney), payTypeLog, "环迅充值", Billno.Value);
               }
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string errorUrl = "/Manage/Pay/KF/Default.aspx"; //出错跳转地址
              BLL.Member mem = new BLL.Member();

              string txtUserName = Utility.Common.GetStringOfForm("txtUserName"); //用户名

              if (!mem.ExistName(txtUserName.Trim()))
              {
                  Response.Write("<script>alert('找不到您要充值的用户帐号,请检查输入是否有误');location.href='" + errorUrl + "';</script>");
                  Response.End();
              }

              //支付金额
              string payMoney = Utility.Common.GetStringOfForm("PayMoney");
              if (string.IsNullOrEmpty(payMoney) || !CommonManager.String.IsInteger(payMoney) || int.Parse(payMoney) <= 0)
              {
                  CommonManager.Web.RegJs(this, "alert('金额只能输入大于0的整数。');history.back();", false);
                  return;
              }
              int otherPayMoney = mem.UserTodayOtherPayMoney(txtUserName.Trim());
              //是否超出今天充值限制额
              if (Convert.ToInt32(payMoney) > otherPayMoney)
              {
                  Response.Write("<script>alert('您今天能充值金额数不能大于" + otherPayMoney + "。');location.href='" + errorUrl + "';</script>");
                  Response.End();
              }
              //充值类型
              string payType = Utility.Common.GetStringOfForm("channelId");
              string P_CardId = string.Empty;
              string P_CardPass = string.Empty;
              if (payType != "1" && payType != "2" && payType != "3")
              {
                  P_CardId = Utility.Common.GetStringOfForm("CardNo");
                  P_CardPass = Utility.Common.GetStringOfForm("CardPwd");
              }
              else
              {

              }
              int payTypeLog = 8;
              //商户定单编号
              string P_OrderId = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");
              //支付成功前, 插入支付的订单日志
              mem.Add3PayOrder(txtUserName, Convert.ToInt32(payMoney), payTypeLog, "花旗充值", P_OrderId);
              //商户编号
              string P_UserId = UiCommon.StringConfig.KFPayID;
              //面值
              string P_FaceValue = payMoney + ".00";
              //充值类型
              string P_ChannelId = payType;
              //产品名称
              string P_Subject = "";
              //产品价格
              string P_Price = payMoney + ".00";

               //产品数量
              string P_Quantity ="1";
              //产品描述
              string P_Description = "";
              //用户附加信息
              string P_Notic = "";
              //充值状态通知地址
              string P_Result_URL = UiCommon.StringConfig.WebSiteName+"/Manage/Pay/KF/Result.aspx";
              //充值后网页跳转地址
              string P_Notify_URL = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/KF/Return.aspx";
              //密钥
              string SalfStr = UiCommon.StringConfig.KFPayKey;
              //签名认证
              string preEncodeStr = P_UserId + "|" + P_OrderId + "|" + P_CardId + "|" + P_CardPass + "|" + P_FaceValue + "|" + P_ChannelId + "|" + SalfStr;
              string P_PostKey = Utility.Common.md5(preEncodeStr);
              //Response.Write(P_PostKey+"</br>"+Utility.Common.md5(preEncodeStr).ToUpper());
              //Response.End();
              //接口url
              string url = UiCommon.StringConfig.KFNotifyURL+"P_UserId="+P_UserId+"&P_OrderId="+P_OrderId+"&P_CardId="+P_CardId+"&P_CardPass="******"&P_FaceValue="+P_FaceValue+"&P_ChannelId="+P_ChannelId+"&P_Subject="+P_Subject+"&P_Price="
                  +P_Price+"&P_Quantity="+P_Quantity+"&P_Description="+P_Description+"&P_Notic="+P_Notic+"&P_PostKey="+P_PostKey
                  +"&P_Result_url="+P_Result_URL+"&P_Notify_URL="+P_Notify_URL;

             Response.Redirect(url);
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string errorUrl = "/Manage/Pay/KF/Default.aspx";   //出错跳转地址

            BLL.Member mem = new BLL.Member();

            string txtUserName = Utility.Common.GetStringOfForm("txtUserName");   //用户名

            if (!mem.ExistName(txtUserName.Trim()))
            {
                Response.Write("<script>alert('找不到您要充值的用户帐号,请检查输入是否有误');location.href='" + errorUrl + "';</script>");
                Response.End();
            }

            //支付金额
            string payMoney = Utility.Common.GetStringOfForm("PayMoney");

            if (string.IsNullOrEmpty(payMoney) || !CommonManager.String.IsInteger(payMoney) || int.Parse(payMoney) <= 0)
            {
                CommonManager.Web.RegJs(this, "alert('金额只能输入大于0的整数。');history.back();", false);
                return;
            }
            int otherPayMoney = mem.UserTodayOtherPayMoney(txtUserName.Trim());

            //是否超出今天充值限制额
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {
                Response.Write("<script>alert('您今天能充值金额数不能大于" + otherPayMoney + "。');location.href='" + errorUrl + "';</script>");
                Response.End();
            }
            //充值类型
            string payType    = Utility.Common.GetStringOfForm("channelId");
            string P_CardId   = string.Empty;
            string P_CardPass = string.Empty;

            if (payType != "1" && payType != "2" && payType != "3")
            {
                P_CardId   = Utility.Common.GetStringOfForm("CardNo");
                P_CardPass = Utility.Common.GetStringOfForm("CardPwd");
            }
            else
            {
            }
            int payTypeLog = 8;
            //商户定单编号
            string P_OrderId = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");

            //支付成功前, 插入支付的订单日志
            mem.Add3PayOrder(txtUserName, Convert.ToInt32(payMoney), payTypeLog, "花旗充值", P_OrderId);
            //商户编号
            string P_UserId = UiCommon.StringConfig.KFPayID;
            //面值
            string P_FaceValue = payMoney + ".00";
            //充值类型
            string P_ChannelId = payType;
            //产品名称
            string P_Subject = "";
            //产品价格
            string P_Price = payMoney + ".00";

            //产品数量
            string P_Quantity = "1";
            //产品描述
            string P_Description = "";
            //用户附加信息
            string P_Notic = "";
            //充值状态通知地址
            string P_Result_URL = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/KF/Result.aspx";
            //充值后网页跳转地址
            string P_Notify_URL = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/KF/Return.aspx";
            //密钥
            string SalfStr = UiCommon.StringConfig.KFPayKey;
            //签名认证
            string preEncodeStr = P_UserId + "|" + P_OrderId + "|" + P_CardId + "|" + P_CardPass + "|" + P_FaceValue + "|" + P_ChannelId + "|" + SalfStr;
            string P_PostKey    = Utility.Common.md5(preEncodeStr);
            //Response.Write(P_PostKey+"</br>"+Utility.Common.md5(preEncodeStr).ToUpper());
            //Response.End();
            //接口url
            string url = UiCommon.StringConfig.KFNotifyURL + "P_UserId=" + P_UserId + "&P_OrderId=" + P_OrderId + "&P_CardId=" + P_CardId + "&P_CardPass="******"&P_FaceValue=" + P_FaceValue + "&P_ChannelId=" + P_ChannelId + "&P_Subject=" + P_Subject + "&P_Price="
                         + P_Price + "&P_Quantity=" + P_Quantity + "&P_Description=" + P_Description + "&P_Notic=" + P_Notic + "&P_PostKey=" + P_PostKey
                         + "&P_Result_url=" + P_Result_URL + "&P_Notify_URL=" + P_Notify_URL;

            Response.Redirect(url);
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string toUrl = "/Manage/Pay/15173pay/Default.aspx";
            //支付人
            string userName = Utility.Common.GetStringOfForm("txtUserName");
            BLL.Member mem = new BLL.Member();
            if (!mem.ExistName(userName))
            {
                CommonManager.Web.RegJs(this, "alert('找不到您输入的用户,请重新核对。');history.back();", false);
                return;
            }

            //支付金额
            string payMoney = Utility.Common.GetStringOfForm("PayMoney");
            if (string.IsNullOrEmpty(payMoney) || !CommonManager.String.IsInteger(payMoney) || int.Parse(payMoney) <= 0)
            {
                CommonManager.Web.RegJs(this, "alert('金额只能输入大于0的整数。');history.back();", false);
                return;
            }
            int otherPayMoney = mem.UserTodayOtherPayMoney(userName.Trim());
            //是否超出今天充值限制额
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {
                Response.Write("<script>alert('您今天能充值金额数不能大于" + otherPayMoney + "。');location.href='" + toUrl + "';</script>");
                Response.End();
            }
            Pay15173 pays = new Pay15173();
            //商户ID
            pays.Bargainor_id = UiCommon.StringConfig.Pay15173ID;

            //商户密钥
            pays.Key = UiCommon.StringConfig.Pay15173Key;

            //商户订单号
            string out_trade_no = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");

            pays.Sp_billno = out_trade_no;

            pays.Total_fee = Convert.ToDecimal(payMoney);
            //充值类型
            string payType = System.Web.HttpContext.Current.Request.Form["rdPayType"].ToString().Trim();

            pays.Pay_type = payType;

            //返回页面
            pays.Return_url = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/15173pay/Return.aspx";

            //交易单备注,留空
            pays.Attach = "CC";

            string typeInfoLog = string.Empty;

            switch (payType)
            {
                case "a":
                    typeInfoLog = "15173神州行卡支付";
                    break;
                case "b":
                    typeInfoLog = "15173俊网一卡通支付";
                    break;
                case "c":
                    typeInfoLog = "15173盛大卡支付";
                    break;
                case "d":
                    typeInfoLog = "15173征途游戏卡支付";
                    break;
                case "m":
                    typeInfoLog = "15173网易一卡通支付";
                    break;
                case "n":
                    typeInfoLog = "15173搜狐一卡通支付";
                    break;
                case "q":
                    typeInfoLog = "15173久游一卡通支付";
                    break;
                case "u":
                    typeInfoLog = "15173完美一卡通支付";
                    break;
                case "x":
                    typeInfoLog = "15173联通全国充值卡支付";
                    break;
                case "y":
                    typeInfoLog = "15173中国电信付费充值卡支付";
                    break;
                case "f":
                    typeInfoLog = "15173金山一卡通支付";
                    break;
                case "g":
                    typeInfoLog = "15173光宇一卡通支付";
                    break;
                case "e":
                    typeInfoLog = "15173纵游一卡通支付";
                    break;

            }
            int payTypeLog = 5;
            mem.Add3PayOrder(userName, Convert.ToInt32(payMoney), payTypeLog, typeInfoLog, out_trade_no);
            string url = "";
            if (!pays.GetPayUrl(out url))
            {
                Utility.Common.OutMsgBox(url, toUrl);
            }
            else
            {
                Response.Redirect(url);
            }
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //非法操作时重定向的URL地址
            string toUrl = "/Manage/Pay/99bill/NetBank/Default.aspx";

            //接收第三方支付平台返回支付结果的页面地址,为绝对地址
            string receivePageUrl = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/99bill/NetBank/Receive.aspx";

            //商品名称(商户)
            string companyName = UiCommon.StringConfig.CompanyNameOfPay;

            //支付人
            if (Request.Form["txtUserName"] == null)
            {
                Response.Redirect(toUrl);
            }
            string userName = Request.Form["txtUserName"].ToString();

            //支付金额
            if (Request.Form["PayMoney"] == null)
            {
                Response.Redirect(toUrl);
            }
            string payMoney = Request.Form["PayMoney"].ToString().Trim();

            BLL.Member mem           = new BLL.Member();
            int        otherPayMoney = mem.UserTodayOtherPayMoney(userName.Trim());

            //是否超出今天充值限制额
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {
                Response.Write("<script>alert('您今天能充值金额数不能大于" + otherPayMoney + "。');location.href='" + toUrl + "';</script>");
                Response.End();
            }
            //支付类型 Web_RMBCost.PayType
            int payTypeLog = 2;

            //类型信息 Web_RMBCost.Typeinfo
            string typeInfoLog = "快钱网上银行转帐支付";


            /**
             * @Description: 快钱人民币支付网关接口范例
             * @Copyright (c) 上海快钱信息服务有限公司
             * @version 2.0
             */

            //人民币网关账户号
            ///请登录快钱系统获取用户编号,用户编号后加01即为人民币网关账户号。
            merchantAcctId.Value = UiCommon.StringConfig.JJbill_NetBank_Account;//"1001622591101";

            //人民币网关密钥
            ///区分大小写.请与快钱联系索取
            String key = UiCommon.StringConfig.JJbill_NetBank_Key;// "K65XTCHC2N72M4MS";


            //字符集.固定选择值。可为空。
            ///只能选择1、2、3、5
            ///1代表UTF-8; 2代表GBK; 3代表gb2312; 5 代表big5
            ///默认值为1
            inputCharset.Value = "1";

            //服务器接受支付结果的后台地址.与[pageUrl]不能同时为空。必须是绝对地址。
            ///快钱通过服务器连接的方式将交易结果发送到[bgUrl]对应的页面地址,在商户处理完成后输出的<result>如果为1,页面会转向到<redirecturl>对应的地址。
            ///如果快钱未接收到<redirecturl>对应的地址,快钱将把支付结果GET到[pageUrl]对应的页面。
            bgUrl.Value = receivePageUrl;

            //接受支付结果的页面地址.与[bgUrl]不能同时为空。必须是绝对地址。
            ///如果[bgUrl]为空,快钱将支付结果GET到[pageUrl]对应的地址。
            ///如果[bgUrl]不为空,并且[bgUrl]页面指定的<redirecturl>地址不为空,则转向到<redirecturl>对应的地址.
            pageUrl.Value = "";

            //网关版本.固定值
            ///快钱会根据版本号来调用对应的接口处理程序。
            ///本代码版本号固定为v2.0
            version.Value = "v2.0";

            //语言种类.固定选择值。
            ///只能选择1、2、3
            ///1代表中文;2代表英文
            ///默认值为1
            language.Value = "1";

            //签名类型.固定值
            ///1代表MD5签名
            ///当前版本固定为1
            signType.Value = "1";


            //支付人姓名
            ///可为中文或英文字符
            //payerName.Value="支付人";
            payerName.Value = userName;


            //支付人联系方式类型.固定选择值
            ///只能选择1
            ///1代表Email
            payerContactType.Value = "1";

            //支付人联系方式
            ///只能选择Email或手机号
            payerContact.Value = "";

            //商户订单号
            ///由字母、数字、或[-][_]组成
            orderId.Value = DateTime.Now.ToString("yyyyMMddHHmmssfffffff"); //DateTime.Now.ToString("yyyyMMddHHmmss");


            //订单金额
            ///以分为单位,必须是整型数字
            ///比方2,代表0.02元
            ///orderAmount.Value="100";
            double dblTemp = Double.Parse(payMoney);

            orderAmount.Value = Convert.ToString(dblTemp * 100);//元转换为分


            //订单提交时间
            ///14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
            ///如;20080101010101
            orderTime.Value = DateTime.Now.ToString("yyyyMMddHHmmss");

            //商品名称
            ///可为中文或英文字符
            //productName.Value="商品名称";
            productName.Value = companyName;

            //商品数量
            ///可为空,非空时必须为数字
            productNum.Value = "1";

            //商品代码
            ///可为字符或者数字
            productId.Value = "";

            //商品描述
            productDesc.Value = "";

            //扩展字段1
            ///在支付结束后原样返回给商户
            ext1.Value = userName;

            //扩展字段2
            ///在支付结束后原样返回给商户
            ext2.Value = "";


            //支付方式.固定选择值
            ///只能选择00、10、11、12、13、14
            ///00:组合支付(网关支付页面显示快钱支持的各种支付方式,推荐使用)10:银行卡支付(网关支付页面只显示银行卡支付).11:电话银行支付(网关支付页面只显示电话支付).12:快钱账户支付(网关支付页面只显示快钱账户支付).13:线下支付(网关支付页面只显示线下支付方式).14:B2B支付(网关支付页面只显示B2B支付,但需要向快钱申请开通才能使用)
            payType.Value = "00";

            //银行代码
            ///实现直接跳转到银行页面去支付,只在payType=10时才需设置参数
            ///具体代码参见 接口文档银行代码列表
            bankId.Value = "";

            //同一订单禁止重复提交标志
            ///固定选择值: 1、0
            ///1代表同一订单号只允许提交1次;0表示同一订单号在没有支付成功的前提下可重复提交多次。默认为0建议实物购物车结算类商户采用0;虚拟产品类商户采用1
            redoFlag.Value = "1";

            //快钱的合作伙伴的账户号
            ///如未和快钱签订代理合作协议,不需要填写本参数
            pid.Value = "";


            //生成加密签名串
            ///请务必按照如下顺序和规则组成加密串!
            String signMsgVal = "";

            signMsgVal    = appendParam(signMsgVal, "inputCharset", inputCharset.Value);
            signMsgVal    = appendParam(signMsgVal, "pageUrl", pageUrl.Value);
            signMsgVal    = appendParam(signMsgVal, "bgUrl", bgUrl.Value);
            signMsgVal    = appendParam(signMsgVal, "version", version.Value);
            signMsgVal    = appendParam(signMsgVal, "language", language.Value);
            signMsgVal    = appendParam(signMsgVal, "signType", signType.Value);
            signMsgVal    = appendParam(signMsgVal, "merchantAcctId", merchantAcctId.Value);
            signMsgVal    = appendParam(signMsgVal, "payerName", payerName.Value);
            signMsgVal    = appendParam(signMsgVal, "payerContactType", payerContactType.Value);
            signMsgVal    = appendParam(signMsgVal, "payerContact", payerContact.Value);
            signMsgVal    = appendParam(signMsgVal, "orderId", orderId.Value);
            signMsgVal    = appendParam(signMsgVal, "orderAmount", orderAmount.Value);
            signMsgVal    = appendParam(signMsgVal, "orderTime", orderTime.Value);
            signMsgVal    = appendParam(signMsgVal, "productName", productName.Value);
            signMsgVal    = appendParam(signMsgVal, "productNum", productNum.Value);
            signMsgVal    = appendParam(signMsgVal, "productId", productId.Value);
            signMsgVal    = appendParam(signMsgVal, "productDesc", productDesc.Value);
            signMsgVal    = appendParam(signMsgVal, "ext1", ext1.Value);
            signMsgVal    = appendParam(signMsgVal, "ext2", ext2.Value);
            signMsgVal    = appendParam(signMsgVal, "payType", payType.Value);
            signMsgVal    = appendParam(signMsgVal, "bankId", bankId.Value);
            signMsgVal    = appendParam(signMsgVal, "redoFlag", redoFlag.Value);
            signMsgVal    = appendParam(signMsgVal, "pid", pid.Value);
            signMsgVal    = appendParam(signMsgVal, "key", key);
            signMsg.Value = FormsAuthentication.HashPasswordForStoringInConfigFile(signMsgVal, "MD5").ToUpper();


            //打印订单信息
            Lab_orderId.Text     = orderId.Value;
            Lab_orderAmount.Text = payMoney;
            Lab_payerName.Text   = payerName.Value;
            Lab_productName.Text = productName.Value;

            /*
             * Response.Write("userName:"******"<br>");
             * Response.Write("payMoney:" + payMoney + "<br>");
             * Response.Write("payTypeLog:" + payTypeLog + "<br>");
             * Response.Write("typeInfoLog:" + typeInfoLog + "<br>");
             * Response.Write("orderId:" + orderId.Value + "<br>");
             * Response.End();
             */

            //支付成功前, 插入支付的订单日志
            new BLL.Member().Add3PayOrder(userName, Convert.ToInt32(payMoney), payTypeLog, typeInfoLog, orderId.Value);
        }
Ejemplo n.º 9
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            /*
            show_url          ="www.xiaohhgame.com"                   '��վ����ַ
            seller_email		= "*****@*****.**"				'�����ó����Լ���֧�����ʻ�
            partner			= "2088102335433231"					'֧�������˻��ĺ��������ID
            key			    = "7a7kaee4ogm8lwywepjgpgkcek9pcnl3"	'֧�����İ�ȫУ����

            notify_url			= "http://www.xiaohhgame.com/alipay/Alipay_Notify.asp"	'�����������֪ͨ��ҳ�� Ҫ�� http://��ʽ������·��
            return_url			= "http://www.xiaohhgame.com/alipay/return_Alipay_Notify.asp"	'��������ת��ҳ�� Ҫ�� http://��ʽ������·��
            */

            //��Ʒ���ƣ��̻���
            string companyName = UiCommon.StringConfig.CompanyNameOfPay;

            //֧����
            string userName = txtUserName.Text.Trim();
            BLL.Member mem = new BLL.Member();
            if (!mem.ExistName(userName))
            {
                CommonManager.Web.RegJs(this, "alert('�Ҳ�����������û��������º˶ԡ�');history.back();", false);
                return;
            }

            //֧�����
            string payMoney = PayMoney.Text.Trim();
            if (string.IsNullOrEmpty(payMoney) || !CommonManager.String.IsInteger(payMoney) || int.Parse(payMoney) <= 0)
            {
                CommonManager.Web.RegJs(this, "alert('���ֻ���������0��������');history.back();", false);
                return;
            }
            int otherPayMoney = mem.UserTodayOtherPayMoney(userName.Trim());
            //�Ƿ񳬳������ֵ���ƶ�
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {

                CommonManager.Web.RegJs(this, "alert(''�������ܳ�ֵ��������ܴ���" + otherPayMoney + "��');history.back();", false);
                return;
            }
            //֧������ Web_RMBCost.PayType
            int payTypeLog = 4;

            //������Ϣ Web_RMBCost.Typeinfo
            string typeInfoLog = "֧��������֧��";

            //*****************ҵ�������ֵ*****************************************************************
            //������(��ʱ����)
            /*System.DateTime currentTime = new System.DateTime();
            currentTime = System.DateTime.Now;
            string out_trade_no = currentTime.ToString("g");
            out_trade_no = out_trade_no.Replace("-", "");
            out_trade_no = out_trade_no.Replace(":", "");
            out_trade_no = out_trade_no.Replace(" ", "");*/
            string out_trade_no = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");

            //֧���ӿڡ�https://www.alipay.com/cooperate/gateway.do?
            string gateway = UiCommon.StringConfig.AlipayNotifyURL;

            //�������
            string service = "create_direct_pay_by_user";

            //partner �������ID(�����ֶ�)
            string partner = UiCommon.StringConfig.AlipayPartnerID;// "2088102335433231";

            //��������
            string sign_type = "MD5";

            //subject ��Ʒ����
            string subject = companyName;

            //body ��Ʒ����

            // [modify] jeffery
            string body = "��Ϸ" + UiCommon.StringConfig.MoneyName;

            //double poupon = Convert.ToDouble(CouponRate) * Convert.ToDouble(PayMoney.Text);
            //if (poupon < 0)
            //    poupon = 0;

            //string body = "��Ϸ" + UiCommon.StringConfig.MoneyName +
            //    "!@#" + userName + "!@#" + Convert.ToInt32(poupon).ToString();
            // ---end

            //֧������
            string payment_type = "1";

            //�ܽ�� 0.01��50000.00
            string total_fee = payMoney;

            //��վ����ַ
            string show_url = UiCommon.StringConfig.WebSiteName;// ֧����ҳ����ʾ<a href="www.xiaohhgame.com" target="_blank">��Ʒ����</a> ;

            //����˺�
            string seller_email = UiCommon.StringConfig.AlipayAccount; //"*****@*****.**";

            //partner�˻���֧������ȫУ����
            string key = UiCommon.StringConfig.AlipayKey; //"7a7kaee4ogm8lwywepjgpgkcek9pcnl3";

            //������֪ͨ���ؽӿڣ����ҳ�����չʾ���ͻ���,ֻ�и���ɹ��Ż���ת�����ҳ��
            string return_url = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/Alipay/Alipay_Return.aspx";

            //������֪ͨ���ؽӿ�
            string notify_url = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/Alipay/Alipay_Notify.aspx";

            string _input_charset = "utf-8";

            //֧���ɹ�ǰ�� ����֧���Ķ�����־
            mem.Add3PayOrder(userName, Convert.ToInt32(payMoney), payTypeLog, typeInfoLog, out_trade_no);

            //��֧�������ύ��֧����������
            AliPay ap = new AliPay();
            string aliay_url = ap.CreatUrl(
                gateway,
                service,
                partner,
                sign_type,
                out_trade_no,
                subject,
                body,
                payment_type,
                total_fee,
                show_url,
                seller_email,
                key,
                return_url,
                _input_charset,
                notify_url
                );

            Response.Redirect(aliay_url);
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string toUrl = "/Manage/Pay/15173pay/Default.aspx";
            //支付人
            string userName = Utility.Common.GetStringOfForm("txtUserName");

            BLL.Member mem = new BLL.Member();
            if (!mem.ExistName(userName))
            {
                CommonManager.Web.RegJs(this, "alert('找不到您输入的用户,请重新核对。');history.back();", false);
                return;
            }

            //支付金额
            string payMoney = Utility.Common.GetStringOfForm("PayMoney");

            if (string.IsNullOrEmpty(payMoney) || !CommonManager.String.IsInteger(payMoney) || int.Parse(payMoney) <= 0)
            {
                CommonManager.Web.RegJs(this, "alert('金额只能输入大于0的整数。');history.back();", false);
                return;
            }
            int otherPayMoney = mem.UserTodayOtherPayMoney(userName.Trim());

            //是否超出今天充值限制额
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {
                Response.Write("<script>alert('您今天能充值金额数不能大于" + otherPayMoney + "。');location.href='" + toUrl + "';</script>");
                Response.End();
            }
            Pay15173 pays = new Pay15173();

            //商户ID
            pays.Bargainor_id = UiCommon.StringConfig.Pay15173ID;

            //商户密钥
            pays.Key = UiCommon.StringConfig.Pay15173Key;

            //商户订单号
            string out_trade_no = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");

            pays.Sp_billno = out_trade_no;

            pays.Total_fee = Convert.ToDecimal(payMoney);
            //充值类型
            string payType = System.Web.HttpContext.Current.Request.Form["rdPayType"].ToString().Trim();

            pays.Pay_type = payType;

            //返回页面
            pays.Return_url = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/15173pay/Return.aspx";

            //交易单备注,留空
            pays.Attach = "CC";

            string typeInfoLog = string.Empty;

            switch (payType)
            {
            case "a":
                typeInfoLog = "15173神州行卡支付";
                break;

            case "b":
                typeInfoLog = "15173俊网一卡通支付";
                break;

            case "c":
                typeInfoLog = "15173盛大卡支付";
                break;

            case "d":
                typeInfoLog = "15173征途游戏卡支付";
                break;

            case "m":
                typeInfoLog = "15173网易一卡通支付";
                break;

            case "n":
                typeInfoLog = "15173搜狐一卡通支付";
                break;

            case "q":
                typeInfoLog = "15173久游一卡通支付";
                break;

            case "u":
                typeInfoLog = "15173完美一卡通支付";
                break;

            case "x":
                typeInfoLog = "15173联通全国充值卡支付";
                break;

            case "y":
                typeInfoLog = "15173中国电信付费充值卡支付";
                break;

            case "f":
                typeInfoLog = "15173金山一卡通支付";
                break;

            case "g":
                typeInfoLog = "15173光宇一卡通支付";
                break;

            case "e":
                typeInfoLog = "15173纵游一卡通支付";
                break;
            }
            int payTypeLog = 5;

            mem.Add3PayOrder(userName, Convert.ToInt32(payMoney), payTypeLog, typeInfoLog, out_trade_no);
            string url = "";

            if (!pays.GetPayUrl(out url))
            {
                Utility.Common.OutMsgBox(url, toUrl);
            }
            else
            {
                Response.Redirect(url);
            }
        }
Ejemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //非法操作时重定向的URL地址
            string toUrl = "/Manage/Pay/99bill/PhonePay/Default.aspx";

            //接收第三方支付平台返回支付结果的页面地址,为绝对地址
            string receivePageUrl = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/99bill/PhonePay/Receive.aspx";

            //商品名称(商户)
            string companyName = UiCommon.StringConfig.CompanyNameOfPay;

            //支付人
            if (Request.Form["txtUserName"] == null)
            {
                Response.Redirect(toUrl);
            }
            string userName = Request.Form["txtUserName"].ToString();

            //支付金额
            if (Request.Form["PayMoney"] == null)
            {
                Response.Redirect(toUrl);
            }
            string payMoney = Request.Form["PayMoney"].ToString().Trim();

            BLL.Member mem           = new BLL.Member();
            int        otherPayMoney = mem.UserTodayOtherPayMoney(userName.Trim());

            //是否超出今天充值限制额
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {
                Response.Write("<script>alert('您今天能充值金额数不能大于" + otherPayMoney + "。');location.href='" + toUrl + "';</script>");
                Response.End();
            }
            //支付类型 Web_RMBCost.PayType
            int payTypeLog = 1;

            //类型信息 Web_RMBCost.Typeinfo
            string typeInfoLog = "快钱神州行卡密支付";


            /**
             * @Description: 快钱神州行支付网关接口范例
             * @Copyright (c) 上海快钱信息服务有限公司
             * @version 2.0
             */

            //神州行网关账户号
            ///请与快钱技术联系索取
            merchantAcctId.Value = UiCommon.StringConfig.JJbill_SZX_Account;// "1001622591104";

            //设置神州行网关密钥
            ///区分大小写
            String key = UiCommon.StringConfig.JJbill_SZX_Key;// "84YB4FXGFKZ85975";


            //字符集.固定选择值。可为空。
            ///只能选择1、2、3、5
            ///1代表UTF-8; 2代表GBK; 3代表gb2312; 5 代表big5
            ///默认值为1
            inputCharset.Value = "1";

            //服务器接受支付结果的后台地址.与[pageUrl]不能同时为空。必须是绝对地址。
            ///快钱通过服务器连接的方式将交易结果发送到[bgUrl]对应的页面地址,在商户处理完成后输出的<result>如果为1,页面会转向到<redirecturl>对应的地址。
            ///如果快钱未接收到<redirecturl>对应的地址,快钱将把支付结果GET到[pageUrl]对应的页面。
            bgUrl.Value = receivePageUrl;

            //接受支付结果的页面地址.与[bgUrl]不能同时为空。必须是绝对地址。
            ///如果[bgUrl]为空,快钱将支付结果GET到[pageUrl]对应的地址。
            ///如果[bgUrl]不为空,并且[bgUrl]页面指定的<redirecturl>地址不为空,则转向到<redirecturl>对应的地址.
            pageUrl.Value = "";

            //网关版本.固定值
            ///快钱会根据版本号来调用对应的接口处理程序。
            ///本代码版本号固定为v2.0
            version.Value = "v2.0";

            //语言种类.固定选择值。
            ///只能选择1、2、3
            ///1代表中文;2代表英文
            ///默认值为1
            language.Value = "1";

            //签名类型.固定值
            ///1代表MD5签名
            ///当前版本固定为1
            signType.Value = "1";


            //支付人姓名
            ///可为中文或英文字符
            //payerName.Value="支付人";
            payerName.Value = userName;


            //支付人联系方式类型.固定选择值
            ///只能选择1
            ///1代表Email
            payerContactType.Value = "1";

            //支付人联系方式
            ///只能选择Email或手机号
            payerContact.Value = "";

            //商户订单号
            ///由字母、数字、或[-][_]组成
            orderId.Value = DateTime.Now.ToString("yyyyMMddHHmmssfffffff"); //DateTime.Now.ToString("yyyyMMddHHmmss");


            //订单金额
            ///以分为单位,必须是整型数字
            ///比方2,代表0.02元
            ///orderAmount.Value="100";
            double dblTemp = Double.Parse(payMoney);

            orderAmount.Value = Convert.ToString(dblTemp * 100);//元转换为分


            //订单提交时间
            ///14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
            ///如;20080101010101
            orderTime.Value = DateTime.Now.ToString("yyyyMMddHHmmss");

            //商品名称
            ///可为中文或英文字符
            //productName.Value="商品名称";
            productName.Value = companyName;

            //商品数量
            ///可为空,非空时必须为数字
            productNum.Value = "1";

            //商品代码
            ///可为字符或者数字
            productId.Value = "";

            //商品描述
            productDesc.Value = "";

            //扩展字段1
            ///在支付结束后原样返回给商户
            ext1.Value = userName;

            //扩展字段2
            ///在支付结束后原样返回给商户
            ext2.Value = "";


            //支付方式.固定选择值
            ///可选择00、41、42、52
            ///00 代表快钱默认支付方式,目前为神州行卡密支付和快钱账户支付;41 代表快钱账户支付;42 代表神州行卡密支付和快钱账户支付;52 代表神州行卡密支付
            payType.Value = "52";

            //全额支付标志
            ///只能选择数字 0 或 1
            ///0 代表非全额支付方式,支付完成后返回订单金额为商户提交的订单金额。如果预付费卡面额小于订单金额时,返回支付结果为失败;预付费卡面额大于或等于订单金额时,返回支付结果为成功;
            ///1 代表全额支付方式,支付完成后返回订单金额为用户预付费卡的面额。只要预付费卡销卡成功,返回支付结果都为成功。
            fullAmountFlag.Value = "0";



            //对所有含有中文字符的参数进行编码urlencode编码,并将编码后的结果全部转换成大写字母
            ///!注意:对于以下的五个参数,若不含中文字符的参数,请勿转换成大写字母(即无需调用“.ToUpper()”)。
            ///        否则,在返回页面接收到的返回参数将全部变为大写字母,这将可能导致数据库订单数据更新失败!!
            payerName.Value   = System.Web.HttpUtility.UrlEncode(payerName.Value, Encoding.GetEncoding("UTF-8")).ToUpper();
            productName.Value = System.Web.HttpUtility.UrlEncode(productName.Value, Encoding.GetEncoding("UTF-8")).ToUpper();
            productDesc.Value = System.Web.HttpUtility.UrlEncode(productDesc.Value, Encoding.GetEncoding("UTF-8")).ToUpper();
            ext1.Value        = System.Web.HttpUtility.UrlEncode(ext1.Value, Encoding.GetEncoding("UTF-8")).ToUpper();
            ext2.Value        = System.Web.HttpUtility.UrlEncode(ext2.Value, Encoding.GetEncoding("UTF-8")).ToUpper();



            //生成加密签名串
            ///请务必按照如下顺序和规则组成加密串!
            String signMsgVal = "";

            signMsgVal = appendParam(signMsgVal, "inputCharset", inputCharset.Value);
            signMsgVal = appendParam(signMsgVal, "bgUrl", bgUrl.Value);
            signMsgVal = appendParam(signMsgVal, "pageUrl", pageUrl.Value);
            signMsgVal = appendParam(signMsgVal, "version", version.Value);
            signMsgVal = appendParam(signMsgVal, "language", language.Value);
            signMsgVal = appendParam(signMsgVal, "signType", signType.Value);
            signMsgVal = appendParam(signMsgVal, "merchantAcctId", merchantAcctId.Value);
            signMsgVal = appendParam(signMsgVal, "payerName", payerName.Value);
            signMsgVal = appendParam(signMsgVal, "payerContactType", payerContactType.Value);
            signMsgVal = appendParam(signMsgVal, "payerContact", payerContact.Value);
            signMsgVal = appendParam(signMsgVal, "orderId", orderId.Value);
            signMsgVal = appendParam(signMsgVal, "orderAmount", orderAmount.Value);
            signMsgVal = appendParam(signMsgVal, "payType", payType.Value);
            signMsgVal = appendParam(signMsgVal, "fullAmountFlag", fullAmountFlag.Value);
            signMsgVal = appendParam(signMsgVal, "orderTime", orderTime.Value);
            signMsgVal = appendParam(signMsgVal, "productName", productName.Value);
            signMsgVal = appendParam(signMsgVal, "productNum", productNum.Value);
            signMsgVal = appendParam(signMsgVal, "productId", productId.Value);
            signMsgVal = appendParam(signMsgVal, "productDesc", productDesc.Value);
            signMsgVal = appendParam(signMsgVal, "ext1", ext1.Value);
            signMsgVal = appendParam(signMsgVal, "ext2", ext2.Value);
            signMsgVal = appendParam(signMsgVal, "key", key);

            signMsg.Value = GetMD5(signMsgVal, "utf-8").ToUpper();


            //打印订单信息
            Lab_orderId.Text     = orderId.Value;
            Lab_orderAmount.Text = payMoney;
            Lab_payerName.Text   = userName;
            Lab_productName.Text = companyName;

            /*
             * Response.Write("userName:"******"<br>");
             * Response.Write("payMoney:" + payMoney + "<br>");
             * Response.Write("payTypeLog:" + payTypeLog + "<br>");
             * Response.Write("typeInfoLog:" + typeInfoLog + "<br>");
             * Response.Write("orderId:" + orderId.Value + "<br>");
             * Response.End();
             */

            //支付成功前, 插入支付的订单日志
            new BLL.Member().Add3PayOrder(userName, Convert.ToInt32(payMoney), payTypeLog, typeInfoLog, orderId.Value);
        }
Ejemplo n.º 12
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //非法操作时重定向的URL地址
            //     string toUrl = "/Manage/Pay/Yeepay2/Default.aspx";
            //银行支付通道编码
            //与易宝的交易订单号
            string out_trade_no = string.Empty;

            string bankCode = CommonManager.Web.Request("params", "").Trim();

            if (bankCode.ToUpper() == "BANK")   //网银充值
            {
                bankCode     = CommonManager.Web.RequestForm("rtypeBank", "").ToUpper();
                payType      = "银行卡充值";
                out_trade_no = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");
            }
            else  //点卡充值
            {
                bankCode     = CommonManager.Web.RequestForm("rtype", "").ToUpper();
                out_trade_no = "ka" + DateTime.Now.ToString("yyMMddHHmmssfffffff");
                switch (bankCode.ToLower())
                {
                case "szx-net":
                    payType = "神州行充值卡充值";
                    break;

                case "unicom-net":
                    payType = "联通卡充值";
                    break;

                case "ypcard-net":
                    payType = "易宝一卡通充值";
                    break;

                case "zhengtu-net":
                    payType = "征途游戏卡充值";
                    break;

                case "sndacard-net":
                    payType = "盛大游戏卡充值";
                    break;

                case "qqcard-net":
                    payType = "Q币支付";
                    break;

                case "junnet-net":
                    payType = "全国骏网一卡通充值";
                    break;
                }
            }


            BLL.Member mem      = new BLL.Member();
            string     userName = txtUserName.Text.Trim();

            //判断输入的用户是否存在
            if (!mem.ExistName(userName))
            {
                Response.Write("<script>alert('找不到您要充值的用户帐号,请检查输入是否有误');history.go(-1);</script>");
                Response.End();
            }
            //判断玩家充值时,不能在游戏中
            if (mem.IsInRoomOrGame(userName))
            {
                Response.Write("<script>alert('要充值的帐号正在游戏中,请先退出游戏再进行充值');history.go(-1);</script>");
                Response.End();
            }
            string money = PayMoney.Text.Trim();

            //判断面值是否正确
            if (string.IsNullOrEmpty(money) || !CommonManager.String.IsInteger(money) || int.Parse(money) <= 0)
            {
                CommonManager.Web.RegJs(this, "alert('金额只能输入大于0的整数。');history.back();", false);
                return;
            }

            int otherPayMoney = mem.UserTodayOtherPayMoney(userName);

            //是否超出今天充值限制额
            if (Convert.ToInt32(money) > otherPayMoney)
            {
                Response.Write("<script>alert('您今天能充值金额数不能大于" + otherPayMoney + "。');history.go(-1);</script>");
                Response.End();
            }


            //接收第三方支付平台返回支付结果的页面地址,为绝对地址
            string receivePageUrl = UiCommon.StringConfig.WebSiteName + "/Manage/pay/Yeepay2/Return.aspx";
            //商品名称(商户)
            string companyName = UiCommon.StringConfig.CompanyNameOfPay;
            //支付类型 Web_RMBCost.PayType
            int payTypeLog = 3;


            //类型信息 Web_RMBCost.Typeinfo
            string typeInfoLog = "易宝支付_" + payType;


            //插入支付订单日志
            //by YMH 2012-9-5  充值积分
            //积分充值存在
            if (ConfigurationManager.AppSettings["IsPayToPoint"] == "1" && rblPayType.SelectedValue == "point" && ddlGameList.SelectedValue != "")
            {
                pa_MP = "2"; //充积分
                new BLL.Member().Add3PayOrder(userName, Convert.ToInt32(money), typeInfoLog, out_trade_no, ddlGameList.SelectedValue);
            }
            else
            {
                pa_MP = "0"; //充金币
                new BLL.Member().Add3PayOrder(userName, Convert.ToInt32(money), payTypeLog, typeInfoLog, out_trade_no);
            }
            //开始调用支付网关



            //设置编码
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");


            //#if !debug
            #region 正式代码
            p1_MerId = StringConfig.YeepayMerID; // 商家ID
            keyValue = StringConfig.YeepayKey;   // 商家密钥
            Buy.NodeAuthorizationURL = StringConfig.YeepayNodeAuthorizationURL;
            #endregion
            //#endif


            p2_Order = out_trade_no;

            p3_Amt = money;

            //交易币种,固定值"CNY".
            p4_Cur = "CNY";

            //商品名称
            //用于支付时显示在易宝支付网关左侧的订单产品信息.
            p5_Pid = "";

            //商品种类
            p6_Pcat = "";

            //商品描述
            p7_Pdesc = "";
            //商户接收支付成功数据的地址,支付成功后易宝支付会向该地址发送两次成功通知.
            p8_Url = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/Yeepay2/Return.aspx";
            //送货地址
            //为“1”: 需要用户将送货地址留在易宝支付系统;为“0”: 不需要,默认为 ”0”.
            p9_SAF = "0";

            //商户扩展信息
            //商户可以任意填写1K 的字符串,支付成功时将原样返回.	用这个字段判断是否是点卡 点卡手续费20%
            //   pa_MP = "";

            //银行编码
            //默认为"",到易宝支付网关.若不需显示易宝支付的页面,直接跳转到各银行、神州行支付、骏网一卡通等支付页面,该字段可依照附录:银行列表设置参数值.
            pd_FrpId = bankCode;


            //应答机制
            //为"1": 需要应答机制;为"0": 不需要应答机制.
            pr_NeedResponse = "1";

            // Response.Write(p1_MerId.ToString() + " <br> " + keyValue.ToString() + " <br> " + p2_Order.ToString() + " <br> " + p3_Amt.ToString() + " <br> " + p4_Cur.ToString() + " <br> " + p5_Pid.ToString() + " <br> " + p6_Pcat.ToString() + " <br> " + p7_Pdesc.ToString() + " <br> " + p8_Url.ToString() + " <br> " + p9_SAF.ToString() + " <br> " + pa_MP.ToString() + " <br> " + pd_FrpId.ToString() + " <br> " + pr_NeedResponse);
            // Response.End();

            Response.Redirect(Buy.CreateBuyUrl(p1_MerId, keyValue, p2_Order, p3_Amt, p4_Cur, p5_Pid, p6_Pcat, p7_Pdesc, p8_Url, p9_SAF, pa_MP, pd_FrpId, pr_NeedResponse));
        }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //�Ƿ�����ʱ�ض����URL��ַ
            string toUrl = "/Manage/Pay/99bill/NetBank/Default.aspx";

            //���յ�����֧��ƽ̨����֧�������ҳ���ַ��Ϊ���Ե�ַ
            string receivePageUrl = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/99bill/NetBank/Receive.aspx";

            //��Ʒ���ƣ��̻���
            string companyName = UiCommon.StringConfig.CompanyNameOfPay;

            //֧����
            if (Request.Form["txtUserName"] == null)
            {
                Response.Redirect(toUrl);
            }
            string userName = Request.Form["txtUserName"].ToString();

            //֧�����
            if (Request.Form["PayMoney"] == null)
            {
                Response.Redirect(toUrl);
            }
            string payMoney = Request.Form["PayMoney"].ToString().Trim();

            BLL.Member mem = new BLL.Member();
            int otherPayMoney = mem.UserTodayOtherPayMoney(userName.Trim());
            //�Ƿ񳬳������ֵ���ƶ�
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {
                Response.Write("<script>alert('�������ܳ�ֵ��������ܴ���" + otherPayMoney + "��');location.href='" + toUrl + "';</script>");
                Response.End();
            }
            //֧������ Web_RMBCost.PayType
            int payTypeLog = 2;

            //������Ϣ Web_RMBCost.Typeinfo
            string typeInfoLog = "��Ǯ��������ת��֧��";

            /**
             * @Description: ��Ǯ�����֧�����ؽӿڷ���
             * @Copyright (c) �Ϻ���Ǯ��Ϣ�������޹�˾
             * @version 2.0
             */

            //����������˻���
            ///���¼��Ǯϵͳ��ȡ�û���ţ��û���ź��01��Ϊ����������˻��š�
            merchantAcctId.Value = UiCommon.StringConfig.JJbill_NetBank_Account;//"1001622591101";

            //�����������Կ
            ///���ִ�Сд.�����Ǯ��ϵ��ȡ
            String key = UiCommon.StringConfig.JJbill_NetBank_Key;// "K65XTCHC2N72M4MS";

            //�ַ���.�̶�ѡ��ֵ����Ϊ�ա�
            ///ֻ��ѡ��1��2��3��5
            ///1����UTF-8; 2����GBK; 3����gb2312; 5 ����big5
            ///Ĭ��ֵΪ1
            inputCharset.Value = "1";

            //����������֧������ĺ�̨��ַ.��[pageUrl]����ͬʱΪ�ա������Ǿ��Ե�ַ��
            ///��Ǯͨ�����������ӵķ�ʽ�����׽�����͵�[bgUrl]��Ӧ��ҳ���ַ�����̻�������ɺ������<result>���Ϊ1��ҳ���ת��<redirecturl>��Ӧ�ĵ�ַ��
            ///�����Ǯδ���յ�<redirecturl>��Ӧ�ĵ�ַ����Ǯ����֧�����GET��[pageUrl]��Ӧ��ҳ�档
            bgUrl.Value = receivePageUrl;

            //����֧�������ҳ���ַ.��[bgUrl]����ͬʱΪ�ա������Ǿ��Ե�ַ��
            ///���[bgUrl]Ϊ�գ���Ǯ��֧�����GET��[pageUrl]��Ӧ�ĵ�ַ��
            ///���[bgUrl]��Ϊ�գ�����[bgUrl]ҳ��ָ����<redirecturl>��ַ��Ϊ�գ���ת��<redirecturl>��Ӧ�ĵ�ַ.
            pageUrl.Value = "";

            //���ذ汾.�̶�ֵ
            ///��Ǯ����ݰ汾�������ö�Ӧ�Ľӿڴ������
            ///������汾�Ź̶�Ϊv2.0
            version.Value = "v2.0";

            //��������.�̶�ѡ��ֵ��
            ///ֻ��ѡ��1��2��3
            ///1�������ģ�2����Ӣ��
            ///Ĭ��ֵΪ1
            language.Value = "1";

            //ǩ������.�̶�ֵ
            ///1����MD5ǩ��
            ///��ǰ�汾�̶�Ϊ1
            signType.Value = "1";

            //֧��������
            ///��Ϊ���Ļ�Ӣ���ַ�
            //payerName.Value="֧����";
            payerName.Value = userName;

            //֧������ϵ��ʽ����.�̶�ѡ��ֵ
            ///ֻ��ѡ��1
            ///1����Email
            payerContactType.Value = "1";

            //֧������ϵ��ʽ
            ///ֻ��ѡ��Email���ֻ���
            payerContact.Value = "";

            //�̻�������
            ///����ĸ�����֡���[-][_]���
            orderId.Value = DateTime.Now.ToString("yyyyMMddHHmmssfffffff"); //DateTime.Now.ToString("yyyyMMddHHmmss");

            //�������
            ///�Է�Ϊ��λ����������������
            ///�ȷ�2������0.02Ԫ
            ///orderAmount.Value="100";
            double dblTemp = Double.Parse(payMoney);
            orderAmount.Value = Convert.ToString(dblTemp * 100);//Ԫת��Ϊ��

            //�����ύʱ��
            ///14λ���֡���[4λ]��[2λ]��[2λ]ʱ[2λ]��[2λ]��[2λ]
            ///�磻20080101010101
            orderTime.Value = DateTime.Now.ToString("yyyyMMddHHmmss");

            //��Ʒ����
            ///��Ϊ���Ļ�Ӣ���ַ�
            //productName.Value="��Ʒ����";
            productName.Value = companyName;

            //��Ʒ����
            ///��Ϊ�գ��ǿ�ʱ����Ϊ����
            productNum.Value = "1";

            //��Ʒ����
            ///��Ϊ�ַ���������
            productId.Value = "";

            //��Ʒ����
            productDesc.Value = "";

            //��չ�ֶ�1
            ///��֧��������ԭ�����ظ��̻�
            ext1.Value = userName;

            //��չ�ֶ�2
            ///��֧��������ԭ�����ظ��̻�
            ext2.Value = "";

            //֧����ʽ.�̶�ѡ��ֵ
            ///ֻ��ѡ��00��10��11��12��13��14
            ///00�����֧��������֧��ҳ����ʾ��Ǯ֧�ֵĸ���֧����ʽ���Ƽ�ʹ�ã�10�����п�֧��������֧��ҳ��ֻ��ʾ���п�֧����.11���绰����֧��������֧��ҳ��ֻ��ʾ�绰֧����.12����Ǯ�˻�֧��������֧��ҳ��ֻ��ʾ��Ǯ�˻�֧����.13������֧��������֧��ҳ��ֻ��ʾ����֧����ʽ��.14��B2B֧��������֧��ҳ��ֻ��ʾB2B֧��������Ҫ���Ǯ���뿪ͨ����ʹ�ã�
            payType.Value = "00";

            //�����
            ///ʵ��ֱ����ת������ҳ��ȥ֧��,ֻ��payType=10ʱ�������ò���
            ///�������μ� �ӿ��ĵ����д����б�
            bankId.Value = "";

            //ͬһ������ֹ�ظ��ύ��־
            ///�̶�ѡ��ֵ�� 1��0
            ///1����ͬһ������ֻ�����ύ1�Σ�0��ʾͬһ��������û��֧���ɹ���ǰ���¿��ظ��ύ��Ρ�Ĭ��Ϊ0����ʵ�ﹺ�ﳵ�������̻�����0�������Ʒ���̻�����1
            redoFlag.Value = "1";

            //��Ǯ�ĺ��������˻���
            ///��δ�Ϳ�Ǯǩ���������Э�飬����Ҫ��д������
            pid.Value = "";

            //���ɼ���ǩ����
            ///����ذ�������˳��͹�����ɼ��ܴ���
            String signMsgVal = "";
            signMsgVal = appendParam(signMsgVal, "inputCharset", inputCharset.Value);
            signMsgVal = appendParam(signMsgVal, "pageUrl", pageUrl.Value);
            signMsgVal = appendParam(signMsgVal, "bgUrl", bgUrl.Value);
            signMsgVal = appendParam(signMsgVal, "version", version.Value);
            signMsgVal = appendParam(signMsgVal, "language", language.Value);
            signMsgVal = appendParam(signMsgVal, "signType", signType.Value);
            signMsgVal = appendParam(signMsgVal, "merchantAcctId", merchantAcctId.Value);
            signMsgVal = appendParam(signMsgVal, "payerName", payerName.Value);
            signMsgVal = appendParam(signMsgVal, "payerContactType", payerContactType.Value);
            signMsgVal = appendParam(signMsgVal, "payerContact", payerContact.Value);
            signMsgVal = appendParam(signMsgVal, "orderId", orderId.Value);
            signMsgVal = appendParam(signMsgVal, "orderAmount", orderAmount.Value);
            signMsgVal = appendParam(signMsgVal, "orderTime", orderTime.Value);
            signMsgVal = appendParam(signMsgVal, "productName", productName.Value);
            signMsgVal = appendParam(signMsgVal, "productNum", productNum.Value);
            signMsgVal = appendParam(signMsgVal, "productId", productId.Value);
            signMsgVal = appendParam(signMsgVal, "productDesc", productDesc.Value);
            signMsgVal = appendParam(signMsgVal, "ext1", ext1.Value);
            signMsgVal = appendParam(signMsgVal, "ext2", ext2.Value);
            signMsgVal = appendParam(signMsgVal, "payType", payType.Value);
            signMsgVal = appendParam(signMsgVal, "bankId", bankId.Value);
            signMsgVal = appendParam(signMsgVal, "redoFlag", redoFlag.Value);
            signMsgVal = appendParam(signMsgVal, "pid", pid.Value);
            signMsgVal = appendParam(signMsgVal, "key", key);
            signMsg.Value = FormsAuthentication.HashPasswordForStoringInConfigFile(signMsgVal, "MD5").ToUpper();

            //��ӡ������Ϣ
            Lab_orderId.Text = orderId.Value;
            Lab_orderAmount.Text = payMoney;
            Lab_payerName.Text = payerName.Value;
            Lab_productName.Text = productName.Value;

            /*
            Response.Write("userName:"******"<br>");
            Response.Write("payMoney:" + payMoney + "<br>");
            Response.Write("payTypeLog:" + payTypeLog + "<br>");
            Response.Write("typeInfoLog:" + typeInfoLog + "<br>");
            Response.Write("orderId:" + orderId.Value + "<br>");
            Response.End();
            */

            //֧���ɹ�ǰ�� ����֧���Ķ�����־
            new BLL.Member().Add3PayOrder(userName, Convert.ToInt32(payMoney), payTypeLog, typeInfoLog, orderId.Value);
        }
Ejemplo n.º 14
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //非法操作时重定向的URL地址
            //     string toUrl = "/Manage/Pay/Yeepay2/Default.aspx";
            //银行支付通道编码
            //与易宝的交易订单号
            string out_trade_no = string.Empty;

            string bankCode = CommonManager.Web.Request("params", "").Trim();

            if (bankCode.ToUpper() == "BANK")   //网银充值
            {
                bankCode = CommonManager.Web.RequestForm("rtypeBank", "").ToUpper();
                payType = "银行卡充值";
                out_trade_no = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");
            }
            else  //点卡充值
            {
                bankCode = CommonManager.Web.RequestForm("rtype", "").ToUpper();
                out_trade_no ="ka" + DateTime.Now.ToString("yyMMddHHmmssfffffff");
                switch (bankCode.ToLower())
                {
                    case "szx-net":
                        payType = "神州行充值卡充值";
                        break;
                    case "unicom-net":
                        payType = "联通卡充值";
                        break;
                    case "ypcard-net":
                        payType = "易宝一卡通充值";
                        break;
                    case "zhengtu-net":
                        payType = "征途游戏卡充值";
                        break;
                    case "sndacard-net":
                        payType = "盛大游戏卡充值";
                        break;
                    case "qqcard-net":
                        payType = "Q币支付";
                        break;
                    case "junnet-net":
                        payType = "全国骏网一卡通充值";
                        break;

                }
            }

            BLL.Member mem = new BLL.Member();
            string userName = txtUserName.Text.Trim();
            //判断输入的用户是否存在
            if (!mem.ExistName(userName))
            {
                Response.Write("<script>alert('找不到您要充值的用户帐号,请检查输入是否有误');history.go(-1);</script>");
                Response.End();
            }
            //判断玩家充值时,不能在游戏中
            if (mem.IsInRoomOrGame(userName))
            {
                Response.Write("<script>alert('要充值的帐号正在游戏中,请先退出游戏再进行充值');history.go(-1);</script>");
                Response.End();

            }
            string money = PayMoney.Text.Trim();
            //判断面值是否正确
            if (string.IsNullOrEmpty(money) || !CommonManager.String.IsInteger(money) || int.Parse(money) <= 0)
            {
                CommonManager.Web.RegJs(this, "alert('金额只能输入大于0的整数。');history.back();", false);
                return;
            }

            int otherPayMoney = mem.UserTodayOtherPayMoney(userName);
            //是否超出今天充值限制额
            if (Convert.ToInt32(money) > otherPayMoney)
            {
                Response.Write("<script>alert('您今天能充值金额数不能大于" + otherPayMoney + "。');history.go(-1);</script>");
                Response.End();
            }

            //接收第三方支付平台返回支付结果的页面地址,为绝对地址
            string receivePageUrl = UiCommon.StringConfig.WebSiteName + "/Manage/pay/Yeepay2/Return.aspx";
            //商品名称(商户)
            string companyName = UiCommon.StringConfig.CompanyNameOfPay;
            //支付类型 Web_RMBCost.PayType
            int payTypeLog = 3;

            //类型信息 Web_RMBCost.Typeinfo
            string typeInfoLog = "易宝支付_" + payType;

            //插入支付订单日志
               //by YMH 2012-9-5  充值积分
               //积分充值存在
            if (ConfigurationManager.AppSettings["IsPayToPoint"] == "1" && rblPayType.SelectedValue == "point" && ddlGameList.SelectedValue != "")
            {
                pa_MP = "2"; //充积分
                new BLL.Member().Add3PayOrder(userName, Convert.ToInt32(money), typeInfoLog, out_trade_no,ddlGameList.SelectedValue);

            }
            else
            {
                pa_MP = "0"; //充金币
                new BLL.Member().Add3PayOrder(userName, Convert.ToInt32(money), payTypeLog, typeInfoLog, out_trade_no);
            }
            //开始调用支付网关

            //设置编码
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");

            //#if !debug
            #region 正式代码
            p1_MerId = StringConfig.YeepayMerID;                                     // 商家ID
            keyValue = StringConfig.YeepayKey;  // 商家密钥
            Buy.NodeAuthorizationURL = StringConfig.YeepayNodeAuthorizationURL;
            #endregion
            //#endif

            p2_Order = out_trade_no;

            p3_Amt = money;

            //交易币种,固定值"CNY".
            p4_Cur = "CNY";

            //商品名称
            //用于支付时显示在易宝支付网关左侧的订单产品信息.
            p5_Pid = "";

            //商品种类
            p6_Pcat = "";

            //商品描述
            p7_Pdesc = "";
            //商户接收支付成功数据的地址,支付成功后易宝支付会向该地址发送两次成功通知.
            p8_Url = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/Yeepay2/Return.aspx";
            //送货地址
            //为“1”: 需要用户将送货地址留在易宝支付系统;为“0”: 不需要,默认为 ”0”.
            p9_SAF = "0";

            //商户扩展信息
            //商户可以任意填写1K 的字符串,支付成功时将原样返回.	用这个字段判断是否是点卡 点卡手续费20%
            //   pa_MP = "";

            //银行编码
            //默认为"",到易宝支付网关.若不需显示易宝支付的页面,直接跳转到各银行、神州行支付、骏网一卡通等支付页面,该字段可依照附录:银行列表设置参数值.
            pd_FrpId = bankCode;

            //应答机制
            //为"1": 需要应答机制;为"0": 不需要应答机制.
            pr_NeedResponse = "1";

               // Response.Write(p1_MerId.ToString() + " <br> " + keyValue.ToString() + " <br> " + p2_Order.ToString() + " <br> " + p3_Amt.ToString() + " <br> " + p4_Cur.ToString() + " <br> " + p5_Pid.ToString() + " <br> " + p6_Pcat.ToString() + " <br> " + p7_Pdesc.ToString() + " <br> " + p8_Url.ToString() + " <br> " + p9_SAF.ToString() + " <br> " + pa_MP.ToString() + " <br> " + pd_FrpId.ToString() + " <br> " + pr_NeedResponse);
               // Response.End();

            Response.Redirect(Buy.CreateBuyUrl(p1_MerId, keyValue, p2_Order, p3_Amt, p4_Cur, p5_Pid, p6_Pcat, p7_Pdesc, p8_Url, p9_SAF, pa_MP, pd_FrpId, pr_NeedResponse));
        }
Ejemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //string toServerURL = "https://pay.ips.com.cn/ipayment.aspx";//IPS支付接口路径

            //string toServerURLTest = "https://pay.ips.net.cn/ipayment.aspx"; //IPS支付接口测试路径

            //frmPay.Action = toServerURLTest;

            string errorUrl = "/Manage/Pay/IPS/Default.aspx"; //出错跳转地址

            BLL.Member mem = new BLL.Member();

            string txtUserName = Utility.Common.GetStringOfForm("txtUserName"); //用户名

            if (!mem.ExistName(txtUserName.Trim()))
            {
                Response.Write("<script>alert('找不到您要充值的用户帐号,请检查输入是否有误');location.href='" + errorUrl + "';</script>");
                Response.End();
            }

            // [add] jeffery
            //string strCouponNum = Utility.Common.GetStringOfForm("CouponNum"); //获取应赠送奖劵数量
            //Attach.Value = txtUserName + "!@#" + strCouponNum;
            // --- end

            //支付金额
            string payMoney = Utility.Common.GetStringOfForm("PayMoney");

            if (string.IsNullOrEmpty(payMoney) || !CommonManager.String.IsInteger(payMoney) || int.Parse(payMoney) <= 0)
            {
                CommonManager.Web.RegJs(this, "alert('金额只能输入大于0的整数。');history.back();", false);
                return;
            }
            int otherPayMoney = mem.UserTodayOtherPayMoney(txtUserName.Trim());

            //是否超出今天充值限制额
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {
                Response.Write("<script>alert('您今天能充值金额数不能大于" + otherPayMoney + "。');location.href='" + errorUrl + "';</script>");
                Response.End();
            }
            int payTypeLog = 6;

            Currency_Type.Value = "RMB";     //支付币种

            Amount.Value = payMoney + ".00"; //订单金额


            Mer_code.Value = UiCommon.StringConfig.IPS_Mer_code; //商户编号


            Billno.Value = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");                              //商户定单编号

            Date.Value = DateTime.Now.ToString("yyyyMMdd");                                             //订单日期

            MerchantUrl.Value = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/IPS/OrderReturn.aspx"; //支付成功通知的URL

            failUrl.Value = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/IPS/OrderReturn.aspx";     //支付失败通知的URL


            signMD5.Value = Utility.Common.md5("billno" + Billno.Value + "currencytype" + Currency_Type.Value + "amount" + Amount.Value + "date" + Date.Value + "orderencodetype" + OrderEncodeType.Value + UiCommon.StringConfig.IPS_Letter);  //MD5加密签名

            //如果是神舟卡
            if (Utility.Common.GetStringOfForm("Type") == "phone")
            {
                DoCredit.Value  = "1";     //直连神舟行
                Bankco.Value    = "00077"; //神州行代码
                Rettype.Value   = "1";
                ServerUrl.Value = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/IPS/IPS_Server.aspx";
                //支付成功前, 插入支付的订单日志
                mem.Add3PayOrder(txtUserName, Convert.ToInt32(payMoney), payTypeLog, "环迅-神州行充值", Billno.Value);
            }
            else
            {
                //支付成功前, 插入支付的订单日志
                mem.Add3PayOrder(txtUserName, Convert.ToInt32(payMoney), payTypeLog, "环迅充值", Billno.Value);
            }
        }
Ejemplo n.º 16
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            /*
             * show_url          ="www.xiaohhgame.com"                   '网站的网址
             * seller_email		= "*****@*****.**"				'请设置成您自己的支付宝帐户
             * partner			= "2088102335433231"					'支付宝的账户的合作者身份ID
             * key			    = "7a7kaee4ogm8lwywepjgpgkcek9pcnl3"	'支付宝的安全校验码
             *
             * notify_url			= "http://www.xiaohhgame.com/alipay/Alipay_Notify.asp"	'付完款后服务器通知的页面 要用 http://格式的完整路径
             * return_url			= "http://www.xiaohhgame.com/alipay/return_Alipay_Notify.asp"	'付完款后跳转的页面 要用 http://格式的完整路径
             */


            //商品名称(商户)
            string companyName = UiCommon.StringConfig.CompanyNameOfPay;

            //支付人
            string userName = txtUserName.Text.Trim();

            BLL.Member mem = new BLL.Member();
            if (!mem.ExistName(userName))
            {
                CommonManager.Web.RegJs(this, "alert('找不到您输入的用户,请重新核对。');history.back();", false);
                return;
            }

            //支付金额
            string payMoney = PayMoney.Text.Trim();

            if (string.IsNullOrEmpty(payMoney) || !CommonManager.String.IsInteger(payMoney) || int.Parse(payMoney) <= 0)
            {
                CommonManager.Web.RegJs(this, "alert('金额只能输入大于0的整数。');history.back();", false);
                return;
            }
            int otherPayMoney = mem.UserTodayOtherPayMoney(userName.Trim());

            //是否超出今天充值限制额
            if (Convert.ToInt32(payMoney) > otherPayMoney)
            {
                CommonManager.Web.RegJs(this, "alert(''您今天能充值金额数不能大于" + otherPayMoney + "。');history.back();", false);
                return;
            }
            //支付类型 Web_RMBCost.PayType
            int payTypeLog = 4;

            //类型信息 Web_RMBCost.Typeinfo
            string typeInfoLog = "支付宝在线支付";

            //*****************业务参数赋值*****************************************************************
            //订单号(按时构造)

            /*System.DateTime currentTime = new System.DateTime();
             * currentTime = System.DateTime.Now;
             * string out_trade_no = currentTime.ToString("g");
             * out_trade_no = out_trade_no.Replace("-", "");
             * out_trade_no = out_trade_no.Replace(":", "");
             * out_trade_no = out_trade_no.Replace(" ", "");*/
            string out_trade_no = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");

            //支付接口 https://www.alipay.com/cooperate/gateway.do?
            string gateway = UiCommon.StringConfig.AlipayNotifyURL;

            //服务参数
            string service = "create_direct_pay_by_user";

            //partner 合作伙伴ID(保留字段)
            string partner = UiCommon.StringConfig.AlipayPartnerID;// "2088102335433231";

            //加密类型
            string sign_type = "MD5";

            //subject 商品名称
            string subject = companyName;

            //body 商品描述

            // [modify] jeffery
            string body = "游戏" + UiCommon.StringConfig.MoneyName;

            //double poupon = Convert.ToDouble(CouponRate) * Convert.ToDouble(PayMoney.Text);
            //if (poupon < 0)
            //    poupon = 0;

            //string body = "游戏" + UiCommon.StringConfig.MoneyName +
            //    "!@#" + userName + "!@#" + Convert.ToInt32(poupon).ToString();
            // ---end

            //支付类型
            string payment_type = "1";

            //总金额 0.01~50000.00
            string total_fee = payMoney;

            //网站的网址
            string show_url = UiCommon.StringConfig.WebSiteName;// 支付宝页面显示<a href="www.xiaohhgame.com" target="_blank">商品名称</a> ;

            //卖家账号
            string seller_email = UiCommon.StringConfig.AlipayAccount; //"*****@*****.**";

            //partner账户的支付宝安全校验码
            string key = UiCommon.StringConfig.AlipayKey; //"7a7kaee4ogm8lwywepjgpgkcek9pcnl3";

            //服务器通知返回接口,这个页面可以展示给客户看,只有付款成功才会跳转到这个页面
            string return_url = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/Alipay/Alipay_Return.aspx";

            //服务器通知返回接口
            string notify_url = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/Alipay/Alipay_Notify.aspx";

            string _input_charset = "utf-8";


            //支付成功前, 插入支付的订单日志
            mem.Add3PayOrder(userName, Convert.ToInt32(payMoney), payTypeLog, typeInfoLog, out_trade_no);


            //把支付数据提交到支付宝服务器
            AliPay ap        = new AliPay();
            string aliay_url = ap.CreatUrl(
                gateway,
                service,
                partner,
                sign_type,
                out_trade_no,
                subject,
                body,
                payment_type,
                total_fee,
                show_url,
                seller_email,
                key,
                return_url,
                _input_charset,
                notify_url
                );

            Response.Redirect(aliay_url);
        }