//private string Payment(VPosTransactionResponseContract model, string userIP, string campaignSlug) //{ //var siteUrl = _configuration["Frontend:Domain"]; //var uri = _configuration["KuveytTurk:UriToPost"]; //KuveytTurkVPosMessage request = new KuveytTurkVPosMessage(); //request.TransactionType = "Sale"; //request.CardNumber = model.VPosMessage.CardNumber; //request.CardExpireDateMonth = model.VPosMessage.CardExpireDateMonth; //request.CardExpireDateYear = model.VPosMessage.CardExpireDateYear; //request.CardType = model.VPosMessage.CardType; //request.CardCVV2 = model.VPosMessage.CardCVV2; //request.CardHolderName = model.VPosMessage.CardHolderName; //request.CurrencyCode = "0949"; //request.APIVersion = "1.0.0"; //request.MerchantId = Convert.ToInt32(_configuration["KuveytTurk:MerchantID"]); //request.CustomerId = Convert.ToInt32(_configuration["KuveytTurk:CustomerId"]); //request.MerchantOrderId = model.VPosMessage.MerchantOrderId; //request.Amount = model.VPosMessage.Amount; //request.DisplayAmount = Helper.ToAmountString(model.VPosMessage.Amount); //request.OkUrl = siteUrl + "odemetamamlandi/"; //request.FailUrl = siteUrl + "odeme/" + campaignSlug; //request.TransactionSecurity = model.VPosMessage.TransactionSecurity; //request.Description = model.VPosMessage.Description; //request.UserName = _configuration["KuveytTurk:UserName"].ToString(); //string password = _configuration["KuveytTurk:Password"].ToString(); //password = Helper.ComputeHash(password); //request.CustomerIPAddress = userIP; //request.CardHolderIPAddress = userIP; //string newHash = Helper.CreateHashString(request, password); //request.HashData = Helper.ComputeHash(newHash); //XmlSerializer x = new XmlSerializer(request.GetType()); //StringWriter sw = new StringWriter(); //x.Serialize(sw, request); //string str = sw.ToString(); //str = str.Replace("encoding=\"utf-16\"", "encoding=\"ISO-8859-1\""); //string result = Helper.DataPost(uri, str); //_logger.LogInformation(result); //if (string.IsNullOrWhiteSpace(result)) // result = "Boş Cevap"; //return result; // return ""; //} public TransactionResult PaymentComplete(string paymentForms, string merchantOrderId) { try { _logger.LogInformation(paymentForms); if (!string.IsNullOrWhiteSpace(merchantOrderId)) { var bought = _dbContext.BoughtHistory .Include(i => i.Campain) .FirstOrDefault(i => i.Id == new Guid(merchantOrderId)); if (bought != null && !bought.IsPaid) { bought.IsPaid = true; _dbContext.SaveChanges(); _userEngine.ClearUserToken(bought.UserId); _notificationService.AddNotification(bought.UserId, NotificationTypes.PaymentComplete, param: bought.Campain.Price.HasValue ? bought.Campain.Price.Value.ToString() : string.Empty, itemId: bought.Id.ToString()); } } return(new TransactionResult() { Type = TransactionType.Success }); } catch (Exception ex) { _logger.LogError("Payment Complete Error", ex); return(new TransactionResult(message: "Beklenmedik bir hata oluştu. Lütfen tekrar deneyiniz.", type: TransactionType.Error)); } }