예제 #1
0
        public ActionResult tool()
        {
            decimal Amount     = TQuery.GetDecimal("Amount", 10000);
            decimal Rate1      = TQuery.GetDecimal("Rate1", 0.0038M);
            decimal Rate3      = TQuery.GetDecimal("Rate3", 2M);
            decimal BasicRate1 = TQuery.GetDecimal("BasicRate1", 0.0038M);
            decimal BasicRate3 = TQuery.GetDecimal("BasicRate3", 2M);
            ToolPay model      = new ToolPay(Amount == 0M ? 10000 : Amount, Rate1 == 0M ? 0.0043M : Rate1, Rate3 == 0 ? 2 : Rate3, BasicRate1 == 0M ? 0.0038M : BasicRate1, BasicRate3 == 0M ? 2M : BasicRate3);

            return(View(model));
        }
예제 #2
0
        public ActionResult LendTargetFeeQuery()
        {
            int     UserId = TQuery.GetInt("UserId");
            decimal Amount = TQuery.GetDecimal("Amount", 0m);
            respLendTargetFeeQueryModel result = new respLendTargetFeeQueryModel();

            if (UserId == 0 || Amount == 0m)
            {
                result.backState = -100;
                result.message   = "";
            }
            else
            {
                result = YeepayDepository.LendTargetFeeQuery(UserId, (int)Logic.Platform.系统, Amount);
            }
            return(View(result));
        }
예제 #3
0
        //api.itorm.com/itapi/server/receiveApiNotice?requestId=100000029&amount=100
        public string receiveApiNotice()
        {
            string result               = "fail";
            bool   flag                 = false;
            string requestId            = TQuery.GetInput("requestId");
            noticeReceiveApiModel model = new noticeReceiveApiModel();

            model.code           = "0000";
            model.message        = "支付成功";
            model.amount         = TQuery.GetDecimal("amount", 0m).ToString("F2");
            model.fee            = (TQuery.GetDecimal("amount", 0m) * 0.002m).ToString("F2");
            model.externalld     = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            model.payerPhone     = "15110167786";
            model.payerName      = "陈鑫";
            model.payTime        = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            model.requestId      = requestId;
            model.src            = "B";
            model.status         = "SUCCESS";
            model.lastNo         = "0239";
            model.bankCode       = "icbc";
            model.busiType       = "COMMON";
            model.customerNumber = "123456";

            //返回后日志记录
            Logs.WriteLog("回调参数:" + JsonConvert.SerializeObject(model), "d:\\Log\\Yeepay", "ReceiveApi");
            yeepayLogParasDao.Init(Convert.ToInt32(requestId), JsonConvert.SerializeObject(model), 2);

            //更新
            yeepayLogDao.UpdateState(Convert.ToInt32(requestId), model.code, model.message, (model.backState == 0 && model.status == "SUCCESS") ? 10 : -1);

            if (model.backState == 0 && model.status == "SUCCESS")//成功
            {
                var yeepayLog = yeepayLogDao.Single(Convert.ToInt32(requestId));
                var payRecord = payRecordDao.Single(yeepayLog.KeyId);
                if (payRecord.State == 1)
                {
                    result = "SUCCESS";
                    return(result);
                }
                //修改订单信息
                payRecord.PayTime    = Convert.ToDateTime(model.payTime);
                payRecord.State      = 1;
                payRecord.PayerPhone = model.payerPhone;
                payRecord.PayerName  = model.payerName;
                payRecord.LastNo     = model.lastNo;
                payRecord.Message    = model.message;
                payRecord.BankCode   = model.bankCode;
                payRecord.Fee        = Convert.ToDecimal(model.fee);
                payRecord.Src        = model.src;
                flag = payRecordDao.Update(payRecord);
                //添加支付银行卡
                int ubkCnt = userBankCardDao.Count(" UserId=@UserId and TypeId=0 and State=1 and  BankCard=@BankCard ", new { payRecord.UserId, payRecord.BankCard });
                if (ubkCnt == 0)
                {
                    UserBankCard ubk = new UserBankCard();
                    ubk.BankCard = payRecord.BankCard;
                    ubk.TypeId   = 1;
                    ubk.State    = 1;
                    ubk.UserId   = payRecord.UserId;
                    ubk.Mobile   = model.payerPhone;
                    ubk.IP       = ITOrm.Utility.Client.Ip.GetClientIp();
                    ubk.Platform = 1;
                    ubk.BankCode = model.bankCode;
                    userBankCardDao.Insert(ubk);
                }

                if (flag)
                {
                    result = "SUCCESS";
                }
            }
            return(result);
        }