public string receiveApi() { string url = ITOrm.Utility.Encryption.EncryptionHelper.AESEncrypt("https://www.baidu.com", ITOrm.Payment.Yeepay.YeepayDepository.YeepayHmacKey.Substring(0, 16)); string requestId = TQuery.GetInput("requestId"); return("{ \"code\": \"0000\", \"message\": \"收款发起成功\",\"mainCustomerNumber\":\"1111\",\"customerNumber\":\"123456\",\"url\":\"" + url + "\",\"requestId\":\"" + requestId + "\"}"); }
public string withDrawApi() { string externalNo = TQuery.GetInput("externalNo"); string amount = TQuery.GetInput("amount"); return("{ \"code\": \"0000\", \"message\": \"收款发起成功\",\"serialNo\":\"1111\",\"customerNumber\":\"123456\",\"amount\":\"" + amount + "\",\"externalNo\":\"" + externalNo + "\",\"mainCustomerNumber\":\"1111\",\"transferWay\":\"1\",\"hmac\":\"21212\"}"); }
//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); }