Esempio n. 1
0
        public void PrepaymentSubmit()
        {
            Guid   projectId = WEBRequest.GetFormGuid("ProjectId");
            string payPwd    = WEBRequest.GetFormString("TranPwd");
            Guid   userId    = WebUserAuth.UserId.Value;

            if (userId == null || userId == Guid.Empty)
            {
                this.PrintJson("-3", "对不起,您还未登录!");
                return;
            }

            if (GlobalUtils.IsOpenCGT)
            {
                TuanDai.CgtCallbackUrl.Model.ModelRequest.PreReturnMoney reqMode = new TuanDai.CgtCallbackUrl.Model.ModelRequest.PreReturnMoney();
                reqMode.UserId = userId.ToString();
                List <Guid> listProject = new List <Guid>();
                listProject.Add(projectId);
                reqMode.ProjectIds = listProject;
                string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.Prepayment);
                PrintJson("8888", url);
            }
            else
            {
                ProjectBLL bll      = new ProjectBLL();
                string     errorMsg = bll.PrepaymentSubmit(projectId, userId, payPwd);
                if (errorMsg != "")
                {
                    this.PrintJson("-2", errorMsg);
                    return;
                }

                //TuanDai.WXApiWeb.Common.SubscribeMsgHelper msghelper = new Common.SubscribeMsgHelper();
                //推送提前还款信息到App
                //msghelper.AsyncSubscribeUserToMsg(projectId);

                //向所有投资者发送短信通知用户提前还款
                //msghelper.SyncSendPhoneMsgToSubcribeUsers(projectId);
                SyncSendPhoneMsgToSubcribeUsers(projectId);

                SysLogHelper.WriteTraceLog("提前还款", "用户Id:" + userId.ToText() + " ProjectId:" + projectId.ToText());

                this.PrintJson("1", "");
                return;
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WebSettingInfo webSetting = new WebSettingBLL().GetWebSettingInfo("fe5e5a30-b12c-4888-9858-12cbe80e1018");

            // 商户唯一订单号
            string no_order = "" + Request.QueryString["orderno"];

            //LogHelper.WriteLog("宝付支付我方订单号", "", no_order);
            SysLogHelper.WriteTraceLog("宝付支付我方订单号", no_order);

            AccountRechareInfo rechargemodel = getAccountRechare(no_order);

            if (null == rechargemodel)
            {
                Response.Write("您好,获取充值记录为null!");
                return;
            }

            string strMd5Key;

            strMemberID = "100000178";                                                                 //webSetting.Param1Value.ToString().Trim();//商户号

            strPayID            = "";                                                                  //Request.Params["PayID"];//招商银行是1001
            strTradeDate        = DateTime.Now.ToString("yyyyMMddHHmmss");
            strTransID          = rechargemodel.TranOrder.Trim();                                      //strMemberID + DateTime.Now.ToString("MMddHHmmss");//商户订单号(交易流水号)(建议使用商户订单号加上贵方的唯一标识号)
            strOrderMoney       = (float.Parse(rechargemodel.Amount.ToString("f2")) * 100).ToString(); //订单金额,需要和卡面额一致(此处以分为单位)
            strProductName      = "宝付在线充值";                                                            //商品名称
            strAmount           = "1";                                                                 //商品数量,为1
            strUsername         = "";
            strAdditionalInfo   = "";
            strPageUrl          = GlobalUtils.WebURL + "/PaymentPlatform/Baofu/page_url.aspx";   //客户端跳转地址
            strReturnUrl        = GlobalUtils.WebURL + "/PaymentPlatform/Baofu/return_url.aspx"; //ConfigurationManager.AppSettings["BaofuNotifyUrl"];//ConfigurationManager.AppSettings["ReturnUrl"];//服务器端返回地址
            strNoticeType       = "1";                                                           //0 不跳转 1 会跳转
            strMd5Key           = "abcdefg";                                                     //webSetting.Param2Value.Trim();//ConfigurationManager.AppSettings["Md5key"];//密钥 双方约定
            strTerminalID       = "10000001";                                                    //webSetting.Param3Value.Trim();//ConfigurationManager.AppSettings["TerminalID"];//终端
            strInterfaceVersion = "4.0";                                                         // webSetting.Param4Value.Trim();//ConfigurationManager.AppSettings["InterfaceVersion"];//版本 当前为4.0请勿修改
            strKeyType          = webSetting.Param5Value.Trim();                                 //ConfigurationManager.AppSettings["KeyType"]; //加密方式默认1 MD5


            strSignature = GetMd5Sign(strMemberID, strPayID, strTradeDate,
                                      strTransID, strOrderMoney, strPageUrl, strReturnUrl, strNoticeType, strMd5Key);

            //LogHelper.WriteLog("支付请求签名", "", strSignature);
            SysLogHelper.WriteTraceLog("支付请求签名", no_order);
        }
Esempio n. 3
0
        //md5签名
        private string GetMd5Sign(string _MerchantID, string _PayID, string _TradeDate, string _TransID,
                                  string _OrderMoney, string _Page_url, string _Return_url, string _NoticeType, string _Md5Key)
        {
            string mark = "|";
            string str  = _MerchantID + mark
                          + _PayID + mark
                          + _TradeDate + mark
                          + _TransID + mark
                          + _OrderMoney + mark
                          + _Page_url + mark
                          + _Return_url + mark
                          + _NoticeType + mark
                          + _Md5Key;

            //LogHelper.WriteLog("支付请求报文", "", str);
            SysLogHelper.WriteTraceLog("支付请求报文", str);
            return(Md5Encrypt(str));
        }
Esempio n. 4
0
        private BankCardBin GetBankCardBin_Old()
        {
            WebSettingInfo webSetting = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("E27798C9-9301-4176-AC0B-6F3916F389EA");

            PartnerConfig partnerConfig = new PartnerConfig(webSetting.Param1Value, webSetting.Param2Value, webSetting.Param3Value, webSetting.Param5Value);

            string url = "https://yintong.com.cn/traderapi/bankcardquery.htm";

            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("oid_partner", partnerConfig.OidPartner);
            sParaTemp.Add("sign_type", "RSA");
            sParaTemp.Add("card_no", userModel.BankAccountNo);
            sParaTemp.Add("pay_type", "D");
            sParaTemp.Add("flag_amt_limit", "1");

            string strb = "";

            foreach (var item in sParaTemp)
            {
                if (strb == "")
                {
                    strb = item.Key + "=" + item.Value;
                }
                else
                {
                    strb += "&" + item.Key + "=" + item.Value;
                }
            }
            string       req_data = strb;
            String       sign     = LLPay.RSAFromPkcs8.sign(req_data, partnerConfig.TraderPriKey, "utf-8");
            BankCardInfo info     = new BankCardInfo();

            info.oid_partner    = partnerConfig.OidPartner;
            info.sign_type      = "RSA";
            info.sign           = sign;
            info.card_no        = userModel.BankAccountNo;
            info.pay_type       = "D";
            info.flag_amt_limit = "1";

            SysLogHelper.WriteTraceLog("连连查询银行卡BIN报文", strb);

            string      json     = Tool.HttpUtils.HttpPost(url, Newtonsoft.Json.JsonConvert.SerializeObject(info));
            BankCardBin bankcard = new BankCardBin();

            bankcard = Newtonsoft.Json.JsonConvert.DeserializeObject <BankCardBin>(json);

            if (bankcard == null)
            {
                bankcard = new BankCardBin();
            }
            if (bankcard.single_amt.ToText().IsEmpty())
            {
                bankcard.single_amt = "0";
            }
            if (bankcard.day_amt.ToText().IsEmpty())
            {
                bankcard.day_amt = "0";
            }
            return(bankcard);
        }
Esempio n. 5
0
        private void InitData()
        {
            try
            {
                WebSettingInfo webSetting = new WebSettingBLL().GetWebSettingInfo("fe5e5a30-b12c-4888-9858-12cbe80e1018");

                string MemberID       = Request.Params["MemberID"];          //商户号
                string TerminalID     = Request.Params["TerminalID"];        //商户终端号
                string TransID        = Request.Params["TransID"];           //商户流水号
                string Result         = Request.Params["Result"];            //支付结果(1:成功,0:失败)
                string ResultDesc     = Request.Params["ResultDesc"];        //支付结果描述
                string FactMoney      = Request.Params["FactMoney"];         //实际成交金额
                string AdditionalInfo = Request.Params["AdditionalInfo"];    //订单附加消息
                string SuccTime       = Request.Params["SuccTime"];          //交易成功时间
                string Md5Sign        = Request.Params["Md5Sign"].ToLower(); //md5签名
                string Md5Key         = "abcdefg";                           //webSetting.Param2Value;//ConfigurationManager.AppSettings["Md5key"];//密钥 双方约定
                String mark           = "~|~";                               //分隔符

                //string _Md5Key = "100000178";//测试商户号//webSetting.Param1Value;//WebConfigurationManager.AppSettings["Md5key"];

                string _WaitSign = "MemberID=" + MemberID + mark + "TerminalID=" + TerminalID + mark + "TransID=" + TransID + mark + "Result=" + Result + mark + "ResultDesc=" + ResultDesc + mark
                                   + "FactMoney=" + FactMoney + mark + "AdditionalInfo=" + AdditionalInfo + mark + "SuccTime=" + SuccTime
                                   + mark + "Md5Sign=" + Md5Key;

                SysLogHelper.WriteTraceLog("等待验签参数", _WaitSign);
                //验证签名成功
                if (Md5Sign.ToLower() == Md5Encrypt(_WaitSign).ToLower())
                {
                    ///支付结果(1:成功,0:失败)
                    DynamicParameters dyParams = new DynamicParameters();
                    string            strSQL   = "";
                    if (Result == "1")
                    {
                        strSQL   = "p_OnLineRechargeHandler";
                        dyParams = new DynamicParameters();
                        dyParams.Add("@handlerStatus", 2);
                        dyParams.Add("@MediumMoney", decimal.Divide(decimal.Parse(FactMoney), 100));
                        dyParams.Add("@MediumOrderNo", (TransID + SuccTime).Trim());
                        dyParams.Add("@outStatus", 0, DbType.Int32, ParameterDirection.Output, 20);

                        PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, strSQL, ref dyParams, CommandType.StoredProcedure);

                        int presult = dyParams.Get <int>("@outStatus");

                        SysLogHelper.WriteTraceLog("宝付支付交易成功", string.Concat("签名:", Md5Sign.ToLower(), "签名方式:", "MD5", "我方处理状态:", presult.ToString().Trim(), "宝付处理状态:", Result, "支付单号:", TransID));

                        AccountRechareInfo accountRechare = getAccountRechare(TransID);
                        if (accountRechare != null)
                        {
                            strSQL   = "select count(1) from AccountRechare where UserId=@userId and Status=2 and  [type] in(2, 3, 4, 6, 8, 12)";
                            dyParams = new DynamicParameters();
                            dyParams.Add("@userId", accountRechare.UserId);
                            int iCount = PublicConn.QuerySingleWrite <int>(strSQL, ref dyParams);
                            if (iCount > 0)
                            {
                                TuanDai.PortalSystem.BLL.VipGetWorthBLL.AddGetWorth(accountRechare.UserId, (int)ConstString.UserGrowthType.FirstReCharge, null, 0);
                            }
                            UserBasicInfoInfo userBasicInfo = new UserBLL().GetUserBasicInfoModelById(accountRechare.UserId);
                            if (userBasicInfo != null)
                            {
                                var isNewSmsRequest = ConfigHelper.getConfigString("IsNewSmsRequest", "0");
                                if (isNewSmsRequest == "0")
                                {
                                    var parameters = new Dictionary <string, object>();
                                    parameters.Add("CurrentDate", DateTime.Now);
                                    //parameters.Add("RechargeMoney", FactMoney);
                                    parameters.Add("RechargeMoney", decimal.Divide(decimal.Parse(FactMoney), 100));//宝付充值以分为单位
                                    parameters.Add("User", userBasicInfo);
                                    parameters.Add("Host", GlobalUtils.WebURL);

                                    var msgSender = new BusinessDll.MessageSend();
                                    msgSender.SendMessage2(eventCode: MessageTemplates.RechargeSuccess, parameters: parameters,
                                                           mobile: userBasicInfo.TelNo, email: userBasicInfo.Email, userId: userBasicInfo.Id);
                                }
                                else
                                {
                                    SmsRequest rechargeSuccessSmsRequest = new SmsRequest();
                                    rechargeSuccessSmsRequest.EventCode      = MsgTemplatesType.RechargeSuccess;
                                    rechargeSuccessSmsRequest.PlatformSource = PlatformSource.Pc;
                                    rechargeSuccessSmsRequest.UserId         = userBasicInfo.Id;
                                    rechargeSuccessSmsRequest.EmailAddress   = userBasicInfo.Email;
                                    rechargeSuccessSmsRequest.Mobile         = userBasicInfo.TelNo;
                                    rechargeSuccessSmsRequest.Parameters     = new Dictionary <string, object>();
                                    rechargeSuccessSmsRequest.Parameters.Add("RechargeMoney", FactMoney);

                                    string errorMessage = string.Empty;
                                    SmsClient.SendMessage(rechargeSuccessSmsRequest, ref errorMessage);
                                }
                            }
                        }
                        Response.Write("OK");
                        Response.End();
                    }

                    //if (Result == "0")
                    //{
                    //    db.p_OnLineRechargeHandler(1, TransID.Trim(), decimal.Divide(decimal.Parse(FactMoney), 100), (TransID + SuccTime).Trim(), outStatus);
                    //    int presult = int.Parse(outStatus.Value.ToString());
                    //    NetLog.WriteLoginHandler("宝付支付交易失败", string.Concat("签名:", Md5Sign.ToLower(), "签名方式:", "MD5", "我方处理状态:", presult.ToString().Trim(), "宝付处理状态:", Result, "支付单号:", TransID));

                    //    Response.Write("Fail");
                    //}
                }
                else
                {
                    SysLogHelper.WriteTraceLog("宝付验签失败", string.Concat("宝付返回签名:", Md5Sign.ToLower(), "等待验签", Md5Encrypt(_WaitSign).ToLower(), "签名方式:", "MD5", "宝付处理状态:", Result));
                    Response.Write("校验失败");
                    Response.End();
                }
            }
            catch (Exception ex)
            {
                SysLogHelper.WriteErrorLog("宝付支付失败", "错误详细信息:" + ex.Message + "|" + ex.StackTrace);
                Response.Write("Fail");
                Response.End();
            }
        }