コード例 #1
0
ファイル: MiShuaDepository.cs プロジェクト: chenmsg/sujin
        public static respModel <respPayDzeroModel> PayDzero(int UbkId, int Platform, decimal Amount)
        {
            string LogDic = "无卡支付接口";

            Logic.ChannelType channel = Logic.ChannelType.米刷;
            var ubk = userBankCardDao.Single(UbkId);

            var withBank = userBankCardDao.Single(" TypeId=0 and UserId=@UserId ", new { ubk.UserId });
            var user     = usersDao.Single(ubk.UserId);
            //获取请求流水号
            int keyId = payRecordDao.Init(UbkId, Amount, Platform, Ip.GetClientIp(), (int)channel);

            //int keyId = payRecordDao.Init(bta.UserId, Amount, Platform, Ip.GetClientIp(), bta.BankCard);
            Logs.WriteLog($"创建支付记录:UserId:{ubk.UserId},Platform:{Platform},keyId:{keyId},Amount={Amount}", MiShuaLogDic, LogDic);

            int requestId = yeepayLogDao.Init((int)MiShua.Enums.MiShuaType.无卡支付接口, ubk.UserId, Platform, keyId, (int)channel);

            Logs.WriteLog($"获取请求流水号:UserId:{ubk.UserId},Platform:{Platform},requestId:{requestId},keyId:{keyId}", MiShuaLogDic, LogDic);

            //reqModel model = new reqModel();
            //model.mchNo = mchNo;
            //model.


            reqPayDzeroModel model = new reqPayDzeroModel();

            model.versionNo   = "1";
            model.mchNo       = mchNo;
            model.price       = Amount.ToString("F2");
            model.description = "SJ商品";
            model.orderDate   = DateTime.Now.ToString("yyyyMMddHHmmss");
            model.tradeNo     = requestId.ToString();
            model.notifyUrl   = noticeUrl + "MiShuaNotice";
            model.callbackUrl = ITOrm.Utility.Const.Constant.CurrentApiHost + "itapi/pay/success?backState=0&message=支付成功";;
            model.payCardNo   = ubk.BankCard;
            model.userToken   = ubk.Mobile;
            model.accTel      = withBank.Mobile;
            model.accName     = user.RealName;
            model.accIdCard   = user.IdCard;
            model.bankName    = withBank.BankName;

            var bank = bankDao.Single("BankName=@BankName", new { withBank.BankName });

            model.bankCode = bank.UnionCode;
            model.cardNo   = withBank.BankCard;

            decimal[] r = Constant.GetRate(0, (Logic.VipType)user.VipType);
            model.downPayFee  = (r[0] * 1000M).ToString("F1");
            model.downDrawFee = r[1].ToString("F2");



            return(Post <respPayDzeroModel>(requestId, "payDzero", JObject.FromObject(model), LogDic));
        }