public async Task <ActionResult> UpdateUserCardInfo([FromBody] JObject objJson) { try { if (string.IsNullOrEmpty(Convert.ToString(Request.Headers["api_key"]))) { return(StatusCode(StatusCodes.Status401Unauthorized, (new { Status = "Error", Error = "Invalid ApiKey" }))); } string strUserId = UserLoginSessionKeys.GetUserIdByApiKey(_appDbContext, Guid.Parse(Request.Headers["api_key"])); if (string.IsNullOrEmpty(strUserId)) { return(StatusCode(StatusCodes.Status401Unauthorized, (new { Status = "Error", Error = "Invalid ApiKey" }))); } var objUserCardInfoDetails = from uci in _appDbContext.UserCardInfo where (uci.Id == Convert.ToInt32(objJson.SelectToken("usercardinfoid")) && uci.UserId == strUserId) select uci; if (objUserCardInfoDetails.Count() <= 0) { return(StatusCode(StatusCodes.Status401Unauthorized, (new { Status = "Error", Error = "Card info doesn’t exist or Invalid User." }))); } clsAppCrypt objclsAppCrypt = new clsAppCrypt(configuration); UserCardInfo objUserCardInfo = new UserCardInfo(); objUserCardInfo.Id = Convert.ToInt32(objJson.SelectToken("usercardinfoid")); objUserCardInfo.NameOnCard = Convert.ToString(objJson.SelectToken("nameoncard")); objUserCardInfo.CardNumber = objclsAppCrypt.EncryptTripleDES(Convert.ToString(objJson.SelectToken("cardnumber"))); objUserCardInfo.ExpiryDate = Convert.ToString(objJson.SelectToken("expirydate")); objUserCardInfo.CardType = Convert.ToString(objJson.SelectToken("cardtype")); objUserCardInfo.Issuer = Convert.ToString(objJson.SelectToken("issuer")); objUserCardInfo.SecurityNumber = objclsAppCrypt.EncryptTripleDES(Convert.ToString(objJson.SelectToken("securitynumber"))); objUserCardInfo.LastUpdatedDate = DateTime.UtcNow; _appDbContext.UserCardInfo.Attach(objUserCardInfo); _appDbContext.Entry(objUserCardInfo).Property("NameOnCard").IsModified = true; _appDbContext.Entry(objUserCardInfo).Property("CardNumber").IsModified = true; _appDbContext.Entry(objUserCardInfo).Property("ExpiryDate").IsModified = true; _appDbContext.Entry(objUserCardInfo).Property("CardType").IsModified = true; _appDbContext.Entry(objUserCardInfo).Property("Issuer").IsModified = true; _appDbContext.Entry(objUserCardInfo).Property("SecurityNumber").IsModified = true; _appDbContext.Entry(objUserCardInfo).Property("LastUpdatedDate").IsModified = true; int returnVal = await _appDbContext.SaveChangesAsync(); if (returnVal > 0) { return(Ok(new { Status = "OK", Detail = "Card Info Updated." })); } else { return(StatusCode(StatusCodes.Status500InternalServerError, (new { Status = "Error", Error = "Internal Server error. Please contact customer support" }))); } } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, (new { Status = "Error", Error = "Internal Server error. Please contact customer support", SystemError = ex.Message }))); } }
public String Payment(UserCardInfo cardInfo) { int CargoPrice = 20; DateTime RecordDate = DateTime.Now; CartVM model = new CartVM(); ViewBag.Result = ""; ePayment.cc5payment payment = new ePayment.cc5payment { host = "host", name = "", password = "", clientid = "", orderresult = 0, cardnumber = cardInfo.CardNumber, expmonth = cardInfo.ExpMonth, expyear = cardInfo.ExpYear.ToString(), cv2 = cardInfo.SecurityNumber, currency = "949", chargetype = "Auth", ip = Request.ServerVariables["REMOTE_ADDR"], subtotal = model.Price.ToString(), taksit = "1" }; string bankasonuc = payment.processorder(); string bankaAppr = payment.appr; if (bankasonuc == "1") { if (bankaAppr == "Approved") { ViewBag.Result = "Ödeme işlemi başarıyla tamamlandı."; } else if (bankaAppr == "Declined") { ViewBag.Result = "Banka ödemeyi reddetti."; } else { ViewBag.Result = "Banka ile iletişim kurulamadı."; } } using (Db db = new Db()) { // Init DTO PaymentSummary dto = new PaymentSummary(); dto.CargoPrice = CargoPrice; dto.RecordDate = RecordDate; // Save DTO db.PaymentSummary.Add(dto); db.SaveChanges(); } return("Ödeme Başarılı.Onay Bekliyor" + "\n" + "Ödeme Tarihi:" + RecordDate + " " + "Kargo Ücreti" + CargoPrice + "TL"); }
public async Task <ActionResult> AddUserCardInfo([FromBody] JObject objJson) { try { if (string.IsNullOrEmpty(Convert.ToString(Request.Headers["api_key"]))) { return(StatusCode(StatusCodes.Status401Unauthorized, (new { Status = "Error", Error = "Invalid ApiKey" }))); } string strUserId = UserLoginSessionKeys.GetUserIdByApiKey(_appDbContext, Guid.Parse(Request.Headers["api_key"])); if (string.IsNullOrEmpty(strUserId)) { return(StatusCode(StatusCodes.Status401Unauthorized, (new { Status = "Error", Error = "Invalid ApiKey" }))); } clsAppCrypt objclsAppCrypt = new clsAppCrypt(configuration); UserCardInfo objUserCardInfo = new UserCardInfo(); objUserCardInfo.UserId = strUserId; objUserCardInfo.NameOnCard = Convert.ToString(objJson.SelectToken("nameoncard")); objUserCardInfo.CardNumber = objclsAppCrypt.EncryptTripleDES(Convert.ToString(objJson.SelectToken("cardnumber"))); objUserCardInfo.ExpiryDate = Convert.ToString(objJson.SelectToken("expirydate")); objUserCardInfo.CardType = Convert.ToString(objJson.SelectToken("cardtype")); objUserCardInfo.Issuer = Convert.ToString(objJson.SelectToken("issuer")); objUserCardInfo.SecurityNumber = objclsAppCrypt.EncryptTripleDES(Convert.ToString(objJson.SelectToken("securitynumber"))); objUserCardInfo.AddedDate = DateTime.UtcNow; await _appDbContext.UserCardInfo.AddAsync(objUserCardInfo); int returnVal = await _appDbContext.SaveChangesAsync(); if (returnVal > 0) { return(Ok(new { Status = "OK", Detail = "Card Info Added." })); } else { return(StatusCode(StatusCodes.Status500InternalServerError, (new { Status = "Error", Error = "Internal Server error. Please contact customer support" }))); } } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, (new { Status = "Error", Error = "Internal Server error. Please contact customer support", SystemError = ex.Message }))); } }
public async Task <ActionResult> DeleteUserCard([FromBody] JObject objJson) { try { if (string.IsNullOrEmpty(Convert.ToString(Request.Headers["api_key"]))) { return(StatusCode(StatusCodes.Status401Unauthorized, (new { Status = "Error", Error = "Invalid ApiKey" }))); } string strUserId = UserLoginSessionKeys.GetUserIdByApiKey(_appDbContext, Guid.Parse(Request.Headers["api_key"])); if (string.IsNullOrEmpty(strUserId)) { return(StatusCode(StatusCodes.Status401Unauthorized, (new { Status = "Error", Error = "Invalid ApiKey" }))); } UserCardInfo objUserCardInfo = _appDbContext.UserCardInfo .Where(uci => uci.Id == Convert.ToInt32(objJson.SelectToken("usercardinfoid")) && uci.UserId == strUserId) .FirstOrDefault(); if (objUserCardInfo == null) { return(StatusCode(StatusCodes.Status401Unauthorized, (new { Status = "Error", Error = "Card info doesn’t exist or Invalid User." }))); } else { _appDbContext.UserCardInfo.Remove(objUserCardInfo); int returnVal = await _appDbContext.SaveChangesAsync(); if (returnVal > 0) { return(Ok(new { Status = "OK", Detail = "Card Info Deleted." })); } else { return(StatusCode(StatusCodes.Status500InternalServerError, (new { Status = "Error", Error = "Internal Server error. Please contact customer support" }))); } } } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, (new { Status = "Error", Error = "Internal Server error. Please contact customer support", SystemError = ex.Message }))); } }
/// <summary> /// 检查每个用户是否合符资格可以退卡 /// </summary> /// <param name="listCardUserInfos">用户信息</param> /// <returns></returns> List<UserCardInfo> checkReturnCardInfo(List<CardUserMaster_cus_Info> listCardUserInfos) { if (listCardUserInfos == null) { return null; } List<UserCardInfo> listCheckInfo = new List<UserCardInfo>(); foreach (CardUserMaster_cus_Info userInfo in listCardUserInfos) { UserCardInfo checkInfo = new UserCardInfo(userInfo); bool res = true; //账户信息 if (checkInfo.UserInfo.AccountInfo == null) { checkInfo.UserInfo.AccountInfo = this._ICardUserAccountBL.SearchRecords(new CardUserAccount_cua_Info() { cua_cCUSID = userInfo.cus_cRecordID }).FirstOrDefault(); } if (checkInfo.UserInfo.AccountInfo.cua_fCurrentBalance != decimal.Zero) { res = res && false; checkInfo.Ext_CheckResult = "不能退卡:账户余额不为零。"; } //检查未缴款项 List<PreConsumeRecord_pcs_Info> listPreCost = this._IPreConsumeRecordBL.SearchRecords(new PreConsumeRecord_pcs_Info() { pcs_cAccountID = checkInfo.UserInfo.AccountInfo.cua_cRecordID, pcs_cUserID = userInfo.cus_cRecordID }); if (listPreCost != null && listPreCost.Count > 0) { listPreCost = listPreCost.Where(x => x.pcs_lIsSettled == false).ToList(); if (listPreCost != null && listPreCost.Count > 0) { res = res && false; checkInfo.Ext_CheckResult = "不能退卡:存在未结算的预收款记录。"; } } checkInfo.Ext_IsPassed = res; if (res) { checkInfo.Ext_CheckResult = "可以退卡。"; } listCheckInfo.Add(checkInfo); } return listCheckInfo; }
/// <summary> /// 转换加工需要显示的用户信息 /// </summary> /// <param name="listSource"></param> /// <returns></returns> List<UserCardInfo> exchangeDisplayInfo(List<CardUserMaster_cus_Info> listSource) { if (listSource == null) { return null; } try { List<UserCardInfo> listReturn = new List<UserCardInfo>(); foreach (CardUserMaster_cus_Info item in listSource) { UserCardInfo displayInfo = new UserCardInfo(item); bool res = true; //账户信息 if (displayInfo.UserInfo.AccountInfo == null) { displayInfo.UserInfo.AccountInfo = this._ICardUserAccountBL.SearchRecords(new CardUserAccount_cua_Info() { cua_cCUSID = item.cus_cRecordID }).FirstOrDefault(); } if (displayInfo.UserInfo.AccountInfo.cua_fCurrentBalance != decimal.Zero) { res = res && false; displayInfo.Ext_ValidMsg = "不能退卡:账户余额不为零。"; } //检查未缴款项 List<PreConsumeRecord_pcs_Info> listPreCost = this._IPreConsumeRecordBL.SearchRecords(new PreConsumeRecord_pcs_Info() { pcs_cAccountID = displayInfo.UserInfo.AccountInfo.cua_cRecordID, pcs_cUserID = item.cus_cRecordID }); if (listPreCost != null && listPreCost.Count > 0) { listPreCost = listPreCost.Where(x => x.pcs_lIsSettled == false).ToList(); if (listPreCost != null && listPreCost.Count > 0) { res = res && false; displayInfo.Ext_ValidMsg = "不能退卡:存在未结算的预收款记录。"; } } displayInfo.Ext_Valid = res; if (res) { displayInfo.Ext_ValidMsg = "可以退卡。"; } listReturn.Add(displayInfo); } return listReturn; } catch (Exception ex) { throw ex; } }
public bool UserCardInfoDelete(UserCardInfo model) { throw new NotImplementedException(); }