示例#1
0
 /// <summary>
 /// 开联通签约查询
 /// </summary>
 /// <param name="result"></param>
 /// <param name="model"></param>
 /// <param name="order"></param>
 /// <param name="paywayMer"></param>
 public static void KJSignPay(ReturnModel result, RequestParamsM model, PayOrder order, View_PayMerSignWay paywayMer)
 {
     string        billno    = Common.GetBillNo(32);
     string        amount    = order.Account.ToString();//单位分
     string        returnUrl = order.MediaType == 1 ? paywayMer.ReturnUrl : paywayMer.ReturnUrlM;
     BindCardModel bindModel = new BindCardModel()
     {
         IDCard   = model.IDCard,
         BankCard = model.BankCard,
         Mobile   = model.Mobile,
         UserName = model.UserName
     };
     DinPayResultMsg r = IKJSign_query(paywayMer, model.BankValue, bindModel);
 }
示例#2
0
        /// <summary>
        /// 智付快捷支付-输入短信验证码确认支付
        /// </summary>
        /// <param name="order_money"></param>
        /// <param name="order_num"></param>
        /// <param name="ordertime"></param>
        /// <param name="bankCode"></param>
        /// <param name="strNotifyUrl"></param>
        /// <param name="sms_tradeno"></param>
        /// <param name="smscode"></param>
        /// <param name="userinfo"></param>
        /// <returns></returns>
        public static DinPayResultMsg GetKJPayConfirm(string signno, string order_money, string order_num, string ordertime, string bankCode, string strNotifyUrl, string sms_tradeno, string smscode, BindCardModel bindModel, View_PayMerSignWay paywayMer)
        {
            DinPayResultMsg result = new DinPayResultMsg()
            {
                is_success = false
            };

            try
            {
                string interface_version = "V3.0";
                string input_charset     = "UTF-8";
                string service_type      = "express_sign_pay";
                string sign_type         = "RSA-S";
                string merchant_code     = paywayMer.MerNo;//商户号;
                string order_no          = order_num;
                string order_amount      = order_money;
                string order_time        = ordertime;
                string notify_url        = strNotifyUrl;
                string merchant_sign_id  = signno;
                string mobile            = bindModel.Mobile;
                string sms_trade_no      = sms_tradeno;
                string sms_code          = smscode;
                string product_name      = "hk00a";

                string card_no       = bindModel.BankCard;
                string card_name     = bindModel.UserName;
                string id_no         = bindModel.IDCard;
                string card_cvv2     = "";
                string card_exp_date = "";
                string encrypt_info  = card_no + "|" + card_name + "|" + id_no; //组装敏感数据,信用卡用户需加入信用卡信息
                ////使用智付公钥对卡号和卡密加密【智付公钥需从商家后台-公钥管理中取出】//////////
                string dinpayPubKey = paywayMer.MerVerifyPublicKey;
                //////////将公钥转换成C#专用格式///////////
                dinpayPubKey = RSASignUtils.RSAPublicKeyJava2DotNet(dinpayPubKey);
                //加密后的卡号密码
                string encrypt_info_result = RSASignUtils.RSAEncrypt(encrypt_info, dinpayPubKey);
                ////////////////组装签名/////////////////
                string signStr = "";

                signStr = "encrypt_info=" + encrypt_info_result + "&input_charset=" + input_charset + "&interface_version=" + interface_version + "&merchant_code=" + merchant_code + "&merchant_sign_id=" + merchant_sign_id + "&mobile=" + mobile + "&notify_url=" + notify_url + "&order_amount=" + order_amount + "&order_no=" + order_no + "&order_time=" + order_time + "&product_name=" + product_name + "&service_type=" + service_type + "&sms_code=" + sms_code + "&sms_trade_no=" + sms_trade_no;

                if (sign_type == "RSA-S")//RSA-S签名方法
                {
                    //商家私钥
                    string merPriKey = paywayMer.MerPrivateKey;
                    //私钥转换成C#专用私钥
                    merPriKey = RSASignUtils.RSAPrivateKeyJava2DotNet(merPriKey);
                    //签名
                    string signData = RSASignUtils.RSASign(signStr, merPriKey);
                    //将signData进行UrlEncode编码
                    signData = HttpUtility.UrlEncode(signData);
                    //将加密后的卡号卡密进行UrlEncode编码
                    encrypt_info_result = HttpUtility.UrlEncode(encrypt_info_result);

                    //组装字符串
                    string para = "encrypt_info=" + encrypt_info_result + "&input_charset=" + input_charset + "&interface_version=" + interface_version + "&merchant_code=" + merchant_code + "&merchant_sign_id=" + merchant_sign_id + "&mobile=" + mobile + "&notify_url=" + notify_url + "&order_amount=" + order_amount + "&order_no=" + order_no + "&order_time=" + order_time + "&product_name=" + product_name + "&service_type=" + service_type + "&sms_code=" + sms_code + "&sms_trade_no=" + sms_trade_no + "&sign_type=" + sign_type + "&sign=" + signData;
                    //将字符串发送到Dinpay网关
                    string _xml = HttpUtils.HttpPost(paywayMer.MerKJApiUrl, para);
                    GetResultResp(_xml, result);

                    if (result.is_success)
                    {
                        ////组装验签字符串
                        //string signsrc = "is_success=" + (result.is_success?"T":"F") + "&merchant_code=" + result.merchant_code + "&merchant_sign_id=" + result.merchant_sign_id + "&order_no=" + result.order_no + "&trade_no=" + result.trade_no + "&trade_status=" + result.trade_status + "&trade_time=" + result.trade_time;
                        ////使用智付公钥对返回的数据验签
                        //bool validateResult = HttpHelp.ValidateRsaSign(signsrc, dinpayPubKey, result.sign);

                        //if (validateResult == false)
                        //{
                        //    result.is_success = false;
                        //    result.error_msg = "验签失败";
                        //}
                    }
                }
            }
            catch (Exception ex)
            {
                result.error_msg = ex.Message;
            }
            return(result);
        }
示例#3
0
        /// <summary>
        /// 智付快捷支付--网页签约支付页面
        /// </summary>
        /// <param name="order_money"></param>
        /// <param name="order_num"></param>
        /// <param name="bankCode"></param>
        /// <param name="userinfo"></param>
        /// <returns></returns>
        public static string GetKJWeb_Pay(View_PayMerSignWay paywayMer, string order_money, string order_num, string strNotifyUrl, string ordertime, string bankCode, BindCardModel bindModel)
        {
            string interface_version = "V3.0";
            string input_charset     = "UTF-8";
            string service_type      = "express_web_sign_pay";
            string sign_type         = "RSA-S";
            string merchant_code     = paywayMer.MerNo;// SettingHelper.strDinPayMemberID;//商户号;
            string order_no          = order_num;
            string order_amount      = order_money;
            string order_time        = ordertime;
            string notify_url        = strNotifyUrl;
            string card_type         = "0";
            string mobile            = bindModel.Mobile;
            string bank_code         = bankCode;//支付通道银行编码
            string product_name      = "货款";

            string card_no      = bindModel.BankCard;
            string card_name    = bindModel.UserName;
            string id_no        = bindModel.IDCard;
            string encrypt_info = card_no + "|" + card_name + "|" + id_no; //组装敏感数据,信用卡需将信用卡信息加入
            ////使用加密密钥对卡号和卡密加密【加密密钥需从商家后台-公钥管理中取出】//////////
            string dinpayPubKey = paywayMer.MerVerifyPublicKey;            // SettingHelper.strDinPayPublicKey;

            //////////将公钥转换成C#专用格式///////////
            dinpayPubKey = RSASignUtils.RSAPublicKeyJava2DotNet(dinpayPubKey);
            //加密后的卡号密码
            string encrypt_info2 = RSASignUtils.RSAEncrypt(encrypt_info, dinpayPubKey);
            ////////////////组装签名/////////////////

            string signStr  = "bank_code=" + bank_code + "&card_type=" + card_type + "&encrypt_info=" + encrypt_info2 + "&input_charset=" + input_charset + "&interface_version=" + interface_version + "&merchant_code=" + merchant_code + "&mobile=" + mobile + "&notify_url=" + notify_url + "&order_amount=" + order_amount + "&order_no=" + order_no + "&order_time=" + order_time + "&product_name=" + product_name + "&service_type=" + service_type;
            string signData = "";

            if (sign_type == "RSA-S")//RSA-S签名方法
            {
                //商家私钥
                string merPriKey = paywayMer.MerPrivateKey;// SettingHelper.strDinPayMerchantPrivateKey;
                //私钥转换成C#专用私钥
                merPriKey = RSASignUtils.RSAPrivateKeyJava2DotNet(merPriKey);
                //签名
                signData = RSASignUtils.RSASign(signStr, merPriKey);
            }

            #region
            var strForm = new StringBuilder();

            strForm.AppendFormat("<form action=\"{0}\" id=\"dinpayForm\" name=\"dinpayForm\" method=\"POST\">", paywayMer.MerKJApiUrl);

            strForm.AppendFormat("<input type=\"hidden\" name=\"sign\" id=\"sign\" value=\"{0}\" />", signData);

            strForm.AppendFormat("<input type=\"hidden\" name=\"interface_version\" id=\"interface_version\" value=\"{0}\" />", interface_version);

            strForm.AppendFormat("<input type=\"hidden\" name=\"input_charset\" id=\"input_charset\" value=\"{0}\" />", input_charset);

            strForm.AppendFormat("<input type=\"hidden\" name=\"service_type\" id=\"service_type\" value=\"{0}\" />", service_type);

            strForm.AppendFormat("<input type=\"hidden\" name=\"sign_type\" id=\"sign_type\" value=\"{0}\" />", sign_type);

            strForm.AppendFormat("<input type=\"hidden\" name=\"merchant_code\" id=\"merchant_code\" value=\"{0}\" />", merchant_code);

            strForm.AppendFormat("<input type=\"hidden\" name=\"order_no\" id=\"order_no\" value=\"{0}\" />", order_no);

            strForm.AppendFormat("<input type=\"hidden\" name=\"order_amount\" id=\"order_amount\" value=\"{0}\" />", order_amount);

            strForm.AppendFormat("<input type=\"hidden\" name=\"order_time\" id=\"order_time\" value=\"{0}\" />", order_time);

            strForm.AppendFormat("<input type=\"hidden\" name=\"notify_url\" id=\"notify_url\" value=\"{0}\" />", notify_url);

            strForm.AppendFormat("<input type=\"hidden\" name=\"card_type\" id=\"card_type\" value=\"{0}\" />", card_type);

            strForm.AppendFormat("<input type=\"hidden\" name=\"mobile\" id=\"mobile\"  value=\"{0}\" />", mobile);

            strForm.AppendFormat("<input type=\"hidden\" name=\"bank_code\" id=\"bank_code\" value=\"{0}\"  />", bank_code);

            strForm.AppendFormat("<input type=\"hidden\" name=\"product_name\" id=\"product_name\" value=\"{0}\" />", product_name);

            strForm.AppendFormat("<input type=\"hidden\" name=\"encrypt_info\" id=\"encrypt_info\" value=\"{0}\" />", encrypt_info2);

            strForm.AppendFormat("</form >");

            strForm.AppendFormat("<script type=\"text/javascript\" language=\"javascript\">setTimeout(\"document.getElementById('dinpayForm').submit();\",10);</script>");
            #endregion

            return(strForm.ToString());
        }
示例#4
0
        /// <summary>
        /// 智付快捷下单获取短信验证码
        /// </summary>
        /// <param name="order_money"></param>
        /// <param name="order_num"></param>
        /// <param name="bankCode"></param>
        /// <param name="strNotifyUrl"></param>
        /// <param name="userinfo"></param>
        /// <returns></returns>
        public static DinPayResultMsg GetKJSignPaySmsCode(string signid, string order_money, string order_num, string bankCode, string strNotifyUrl, BindCardModel bindModel, View_PayMerSignWay paywayMer)
        {
            DinPayResultMsg result = new DinPayResultMsg()
            {
                is_success = false
            };

            try
            {
                string interface_version = "V3.0";
                string input_charset     = "UTF-8";
                string service_type      = "sign_pay_sms_code";
                string sign_type         = "RSA-S";
                string merchant_code     = paywayMer.MerNo;
                string order_no          = order_num;
                string order_amount      = order_money;
                string sms_type          = "1";              //0-签约+支付验证码 1-支付验证码
                string send_type         = "0";              //0-平台下发
                string merchant_sign_id  = signid;           //快捷支付签约号 已签约用户必输
                string card_type         = "0";              //0-借记卡 1-信用卡 未签约用户必输
                string mobile            = bindModel.Mobile; //待签约的手机号
                string bank_code         = bankCode;         //未签约用户必输

                string card_no      = bindModel.BankCard;
                string card_name    = bindModel.UserName;
                string id_no        = bindModel.IDCard;
                string encrypt_info = card_no + "|" + card_name + "|" + id_no; //组装敏感数据
                ////使用智付公钥对卡号和卡密加密【智付公钥需从商家后台-公钥管理中取出】//////////
                string dinpayPubKey = paywayMer.MerVerifyPublicKey;
                //////////将加密密钥转换成C#专用格式///////////
                dinpayPubKey = RSASignUtils.RSAPublicKeyJava2DotNet(dinpayPubKey);
                //加密后的卡号密码
                string encrypt_info_result = RSASignUtils.RSAEncrypt(encrypt_info, dinpayPubKey);
                ////////////////组装签名/////////////////

                string signStr = "bank_code=" + bank_code + "&card_type=" + card_type + "&encrypt_info=" + encrypt_info_result + "&input_charset=" + input_charset + "&interface_version=" + interface_version + "&merchant_code=" + merchant_code + "&merchant_sign_id=" + merchant_sign_id + "&mobile=" + mobile + "&order_amount=" + order_amount + "&order_no=" + order_no + "&send_type=" + send_type + "&service_type=" + service_type + "&sms_type=" + sms_type;

                if (sign_type == "RSA-S")//RSA-S签名方法
                {
                    //商家私钥
                    string merPriKey = paywayMer.MerPrivateKey;
                    //私钥转换成C#专用私钥
                    merPriKey = RSASignUtils.RSAPrivateKeyJava2DotNet(merPriKey);
                    //签名
                    string signData = RSASignUtils.RSASign(signStr, merPriKey);
                    //将signData进行UrlEncode编码
                    signData = HttpUtility.UrlEncode(signData);
                    //将加密后的卡号卡密进行UrlEncode编码
                    encrypt_info_result = HttpUtility.UrlEncode(encrypt_info_result);

                    //组装字符串
                    //string para = signStr + "&sign_type=" + sign_type + "&sign=" + signData;
                    string para = "bank_code=" + bank_code + "&card_type=" + card_type + "&encrypt_info=" + encrypt_info_result + "&input_charset=" + input_charset + "&interface_version=" + interface_version + "&merchant_code=" + merchant_code + "&merchant_sign_id=" + merchant_sign_id + "&mobile=" + mobile + "&order_amount=" + order_amount + "&order_no=" + order_no + "&send_type=" + send_type + "&service_type=" + service_type + "&sms_type=" + sms_type + "&sign_type=" + sign_type + "&sign=" + signData;
                    //将字符串发送到Dinpay网关
                    string _xml = HttpUtils.HttpPost(paywayMer.MerKJApiUrl, para);
                    GetResultResp(_xml, result);
                    if (result.is_success)
                    {
                        ////组装验签字符串
                        //string signsrc = "is_success=" + (result.is_success ? "T" : "F") + "&merchant_code=" + result.merchant_code + "&order_no=" + result.order_no + "&sms_trade_no=" + result.sms_trade_no;
                        ////使用智付公钥对返回的数据验签
                        //bool validateResult = HttpHelp.ValidateRsaSign(signsrc, dinpayPubKey, result.sign);

                        //if (validateResult == false)
                        //{
                        //    result.error_msg = "验签失败";
                        //}
                    }
                }
            }
            catch (Exception ex)
            {
                result.error_msg = ex.Message;
            }
            return(result);
        }
示例#5
0
        /// <summary>
        /// 智付快捷支付--签约查询接口
        /// 根据用户卡信息,查询该卡是否签约快捷支付
        /// </summary>
        /// <returns></returns>
        public static DinPayResultMsg IKJSign_query(View_PayMerSignWay paywayMer, string bankCode, BindCardModel bindModel)
        {
            DinPayResultMsg result = new DinPayResultMsg()
            {
                is_success = false
            };

            try
            {
                string interface_version = "V3.0";
                string input_charset     = "UTF-8";
                string service_type      = "sign_query";
                string sign_type         = "RSA-S";
                string merchant_code     = paywayMer.MerNo;    //商户号;
                string bank_code         = bankCode;           //支付通道银行编码
                string card_type         = "0";                //0-借记卡,1-信用卡
                string card_no           = bindModel.BankCard; //银行卡号
                string mobile            = bindModel.Mobile;   //开卡手机
                string merchant_sign_id  = "";                 //签约号,可选,与card_no 二选一

                ////////////////组装签名/////////////////
                //银行卡和签约号选输其一
                string signStr = "";
                signStr = "bank_code=" + bank_code + "&card_no=" + card_no + "&card_type=" + card_type + "&input_charset=" + input_charset + "&interface_version=" + interface_version + "&merchant_code=" + merchant_code;
                if (merchant_sign_id != "")
                {
                    signStr = signStr + "&merchant_sign_id=" + merchant_sign_id + "&service_type=" + service_type;
                }
                else
                {
                    signStr = signStr + "&mobile=" + mobile + "&service_type=" + service_type;
                }

                if (sign_type == "RSA-S")//RSA-S签名方法
                {
                    //商家私钥
                    string merPriKey = paywayMer.MerPrivateKey;// SettingHelper.strDinPayMerchantPrivateKey;
                    //私钥转换成C#专用私钥
                    merPriKey = RSASignUtils.RSAPrivateKeyJava2DotNet(merPriKey);
                    //签名
                    string signData = RSASignUtils.RSASign(signStr, merPriKey);
                    //将signData进行UrlEncode编码
                    signData = HttpUtility.UrlEncode(signData);

                    //组装字符串
                    string para = signStr + "&sign_type=" + sign_type + "&sign=" + signData;
                    //将字符串发送到Dinpay网关
                    string _xml = HttpUtils.HttpPost(paywayMer.MerKJApiUrl, para);

                    //将同步返回的xml中的参数提取出来
                    var el = XElement.Load(new StringReader(_xml));
                    GetResultResp(_xml, result);
                }
            }
            catch (Exception ex)
            {
                result.error_msg = ex.Message;
            }
            return(result);
        }