public string Post([FromBody] string xmlData) { // creating object of CultureInfo CultureInfo cultures = new CultureInfo("en-US"); XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlData); #region data fetched from xml string txnId, amount, senderBIC, receiverBIC, receiverAccNo, senderName, receiverName = string.Empty; txnId = doc.GetElementsByTagName("TxId").Item(0).InnerText; amount = doc.GetElementsByTagName("IntrBkSttlmAmt").Item(0).InnerText; senderBIC = doc.GetElementsByTagName("BICFI").Item(0).InnerText; receiverBIC = doc.GetElementsByTagName("BICFI").Item(3).InnerText; receiverAccNo = doc.GetElementsByTagName("Id").Item(8).InnerText; senderName = doc.GetElementsByTagName("Nm").Item(0).InnerText; receiverName = doc.GetElementsByTagName("Nm").Item(1).InnerText; #endregion var receiver = _businessLayer.GetAllBankUsers().Where(m => m.AccountNumber == receiverAccNo).FirstOrDefault(); receiver.Balance += Convert.ToDecimal(amount, cultures); receiver.EntityState = IDTPDomainModel.EntityState.Modified; _businessLayer.UpdateBankUser(receiver); //ISOComposer composer = new ISOComposer(); //var pacs002xml = composer.GetDataForPacs002Single(senderBIC, receiverBIC, senderName,receiverName, txnId, amount); var pacs002xml = ISOComposer.GetDataForPacs002Single(senderBIC, txnId, amount, "pacs.008.001.04"); XDocument doc02 = new XDocument(pacs002xml); //return doc02.Root.ToString(); //return Regex.Unescape(pacs002xml.InnerXml); return(pacs002xml.OuterXml.Replace(@"\", "", StringComparison.CurrentCulture)); }
public string Post([FromBody] string xml) { // creating object of CultureInfo CultureInfo cultures = new CultureInfo("en-US"); try { XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); #region data fetched from xml string amount, senderBIC, receiverBIC, receiverAccNo = string.Empty; //txnId = doc.GetElementsByTagName("TxId").Item(0).InnerText; amount = doc.GetElementsByTagName("IntrBkSttlmAmt").Item(0).InnerText; senderBIC = doc.GetElementsByTagName("BICFI").Item(0).InnerText; receiverBIC = doc.GetElementsByTagName("BICFI").Item(1).InnerText; //senderAccNo = doc.GetElementsByTagName("Id").Item(0).InnerText; //receiverAccNo = doc.GetElementsByTagName("Id").Item(2).InnerText; #endregion #region get data from DB //var transaction = businessLayer.GetAllTransactions().Where(x => x.TransactionId == txnId).FirstOrDefault(); //var sender = businessLayer.GetAllBankUsers().Where(x => x.Id == transaction.SenderId).FirstOrDefault(); //var recevier = businessLayer.GetAllBankUsers().Where(x => x.Id == transaction.ReceiverId).FirstOrDefault(); //var senderName = businessLayer.GetAllTransactions().SingleOrDefault(m => m.TransactionId == txnId).Sender.AccountName; //var receiverName = businessLayer.GetAllTransactions().SingleOrDefault(m => m.TransactionId == txnId).Receiver.AccountName; //var senderName = sender.AccountName; //var receiverName = recevier.AccountName; #endregion var bank = _businessLayer.GetBankBySwiftBic(senderBIC); var senderName = bank.FinancialInstitution.InstitutionName; //var receiverName = ""; string txnId = ""; Double.TryParse(amount, NumberStyles.Any, cultures, out double balance); BBSettlement settlement = new BBSettlement { Id = bank.Id, Balance = balance, ModifiedOn = DateTime.Now, EntityState = EntityState.Modified }; _businessLayer.UpdateBBSettlement(settlement); var transactionID = Guid.NewGuid().ToString(); //ISOComposer composer = new ISOComposer(); //var pacs002xml = composer.GetDataForPacs002Single(senderBIC, receiverBIC, senderName, receiverName, txnId, amount); var pacs002xml = ISOComposer.GetDataForPacs002Single(senderBIC, txnId, amount, "pacs.009.001.04"); return(pacs002xml.InnerXml); } catch (Exception ex) { throw new Exception(ex.Message); //return ex.Message; } }
public IActionResult Settlement() { //Uri bbUri = new Uri("https://localhost:44305/api/Settlement"); Uri bbUri = new Uri("http://idtp-bangladeshbank-api.azurewebsites.net/api/Settlement"); List <TransactionRequestLog> logs = new List <TransactionRequestLog>(); List <ParticipantDebitCap> participants = new List <ParticipantDebitCap>(); var participantList = _businessLayer.GetAllParticipantDebitCaps().Where(x => x.SettlementStatus == false).ToList(); if (participantList.Count == 0) { TempData["TxSts"] = "Null"; return(RedirectToAction("Index", "Settlement")); } else { var responseResultFromBB = string.Empty; foreach (ParticipantDebitCap p in participantList) { TransactionRequestLog transactionRequestLog = new TransactionRequestLog(); TransactionRequestLog transactionRequestLogReceive = new TransactionRequestLog(); var bank = _businessLayer.GetBankById(p.Id); var sendingBankSwiftBic = bank.SwiftBic; var sendingBankCbaAcc = bank.CbaccountNo; var receiverBankSwiftBic = ""; var transactionId = ""; var receivingBankCbaAcc = ""; var SendingBankRoutingNo = ""; var ReceivingBankRoutingNo = ""; var narration = "Settlement"; string amount = Convert.ToString(p.CurrentNetDebitCap, new CultureInfo("en-US")); //var composer = new ISOComposer(); var pacs009xml = ISOComposer.GetDataForPacs009Single(sendingBankSwiftBic, receiverBankSwiftBic, transactionId, amount, SendingBankRoutingNo, sendingBankCbaAcc, ReceivingBankRoutingNo, receivingBankCbaAcc, narration); transactionRequestLog.RequestFrom = "IDTP"; transactionRequestLog.RequestTo = "Bangladesh Bank"; transactionRequestLog.RequestMessage = pacs009xml.InnerXml; transactionRequestLog.RequestTime = DateTime.Now; transactionRequestLog.EntityState = IDTPDomainModel.EntityState.Added; logs.Add(transactionRequestLog); responseResultFromBB = HttpClientHelper.Post(bbUri, pacs009xml.InnerXml); p.SettlementStatus = true; p.EntityState = IDTPDomainModel.EntityState.Modified; _businessLayer.UpdateParticipantDebitCap(p); transactionRequestLogReceive.RequestFrom = "Bangladesh Bank"; transactionRequestLogReceive.RequestTo = "IDTP"; transactionRequestLogReceive.RequestMessage = responseResultFromBB; transactionRequestLogReceive.RequestTime = DateTime.Now; transactionRequestLogReceive.EntityState = IDTPDomainModel.EntityState.Added; logs.Add(transactionRequestLogReceive); } _businessLayer.AddTransactionRequestLog(logs.ToArray()); XmlDocument doc = new XmlDocument(); DayEndTasks(); responseResultFromBB = responseResultFromBB.Replace("\\", "", StringComparison.CurrentCulture); responseResultFromBB = responseResultFromBB[1..^ 1];
public string GetPacs008(Pacs008DTO pacs008DTO) { string response = string.Empty; try { if (pacs008DTO != null) { string otherData = string.Empty; /*otherData = "<BillInfo>"+pacs008DTO.BillInfo + "</BillInfo>" +"+"+ "<EntityName>" + pacs008DTO.EntityName + "</EntityName>" + "+" + "<MobileNumber>" + pacs008DTO.MobileNumber + "</MobileNumber>" + "+" + "<LatLong>" + pacs008DTO.LatLong + "</LatLong>"+ "+" + "<Location>" + pacs008DTO.Location+ "</Location>" + "+" + "<IP>" +pacs008DTO.IP + "</IP>" + "+" + "<IEMEIID>" + pacs008DTO.IEMEIID + "</IEMEIID>" + "+" +"<OS>" + pacs008DTO.OS + "</OS>" + "+" + "<App>" + pacs008DTO.App + "</App>" + "+" + "<Capability>" + pacs008DTO.Capability+ "</Capability>";*/ /*otherData = pacs008DTO.BillInfo + "-" + pacs008DTO.EntityName + "-" + pacs008DTO.MobileNumber + "-" + pacs008DTO.LatLong + "-" + pacs008DTO.Location + "-" + pacs008DTO.IP + "-" + pacs008DTO.IEMEIID + "-" + pacs008DTO.OS + "-" + pacs008DTO.App + "-" + pacs008DTO.Capability;*/ /*otherData ="Bill " +pacs008DTO.BillInfo + "-Entity " + pacs008DTO.EntityName + "-Cell " + pacs008DTO.MobileNumber + "-Latlong " + pacs008DTO.LatLong + "-Location " + pacs008DTO.Location + "-IP" + pacs008DTO.IP + "-" + pacs008DTO.IEMEIID + "-OS " + pacs008DTO.OS + "-App " + pacs008DTO.App + "-Capability " + pacs008DTO.Capability;*/ otherData = "BillNo:" + pacs008DTO.BillInfo + ", Cell:" + pacs008DTO.MobileNumber + ", Purpose:" + pacs008DTO.PaymentPurpose; int length = otherData.Length; if (length >= 140) { otherData = otherData.Substring(0, 139); } //ISOComposer composer = new ISOComposer(); XmlDocument xmlDocument = ISOComposer.GetPacs008Data(pacs008DTO.SenderBankBIC, pacs008DTO.ReceiverBankBIC, pacs008DTO.SenderName, pacs008DTO.ReceiverName, pacs008DTO.TransactionId, pacs008DTO.SenderAccount, pacs008DTO.SenderBranchRoutingNo, pacs008DTO.SendingBankCBAccount, pacs008DTO.ReceiverBranchRoutingNo, pacs008DTO.ReceivingBankCBAccount, pacs008DTO.ReceiverAccount, pacs008DTO.Amount, otherData); response = xmlDocument.InnerXml.ToString(); } return response; } catch (Exception) { response = IDTPXmlParser.PrepareFailResponse("Pacs008"); return response; } }
public string GetPAIN013(string transactionId, string initiatorName, string initiatorId, string debtorName, string debtorId, string debtorAccount, string debtorAgentBIC, string debtorAgentName, string instructedAmount, string creditorAgentBIC, string creditorAgentName, string creditorName, string creditorId, string creditorAccount) { string response; try { //ISOComposer composer = new ISOComposer(); XmlDocument xmlDocument = ISOComposer.GetDataForPAIN013(transactionId, initiatorName, initiatorId, debtorName, debtorId, debtorAccount, debtorAgentBIC, debtorAgentName, instructedAmount, creditorAgentBIC, creditorAgentName, creditorName, creditorId, creditorAccount); response = xmlDocument.InnerXml.ToString(); return(response); } catch (WebException) { response = IDTPXmlParser.PrepareFailResponse("PAIN013"); return(response); } }
public string TransactionBill([FromBody] string xmlData) { // creating object of CultureInfo CultureInfo cultures = new CultureInfo("en-US"); try { XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlData); #region data fetched from xml string txnId, amount, senderBIC, receiverBIC, senderAccNo, receiverAccNo, sendingBankRoutingNo, receivingBankRoutingNo, purpose = string.Empty; txnId = doc.GetElementsByTagName("TxId").Item(0).InnerText; amount = doc.GetElementsByTagName("IntrBkSttlmAmt").Item(0).InnerText; senderBIC = doc.GetElementsByTagName("BICFI").Item(0).InnerText; receiverBIC = doc.GetElementsByTagName("BICFI").Item(3).InnerText; senderAccNo = doc.GetElementsByTagName("Id").Item(0).InnerText; receiverAccNo = doc.GetElementsByTagName("Id").Item(8).InnerText; sendingBankRoutingNo = doc.GetElementsByTagName("Id").Item(2).InnerText; receivingBankRoutingNo = doc.GetElementsByTagName("Id").Item(5).InnerText; purpose = doc.GetElementsByTagName("Ustrd").Item(0).InnerText; DateTime txnDt = DateTime.Now; DateTime stlmntDt = DateTime.Now; #endregion #region data fetched from db for further operation var sender = _businessLayer.GetAllBankUsers().SingleOrDefault(m => m.AccountNumber == senderAccNo); var senderBank = _businessLayer.GetAllBanks().SingleOrDefault(m => m.SwiftBic == senderBIC); #endregion //DBManager db = new DBManager(transactionRepository, sendingBankUserRepository, receivingBankUserRepository, bankNetDebitCapRepository, suspenseTransactionRepository, bankRepository); //update Sending Bank Net Debit Cap var senderInstitutionDebitCap = _businessLayer.GetParticipantDebitCapById(senderBank.Id); senderInstitutionDebitCap.CurrentNetDebitCap -= System.Convert.ToDecimal(amount, cultures); senderInstitutionDebitCap.EntityState = EntityState.Modified; _businessLayer.UpdateParticipantDebitCap(senderInstitutionDebitCap); //create suspense transaction var suspenseTransaction = new SuspenseTransaction { SuspenseTransactionId = Guid.NewGuid(), SenderAccountNo = senderAccNo, SendingBankId = senderBank.Id, SendingBankSuspanseAccount = senderBank.SuspenseAccount, Amount = Convert.ToDecimal(amount, cultures), TransactionInitiatedOn = txnDt, SuspenseClearingTime = DateTime.Now, TransactionId = txnId, SuspenseStatus = false, EntityState = EntityState.Added }; _businessLayer.AddSuspenseTransaction(suspenseTransaction); TransactionRequestLog transactionRequestLog = new TransactionRequestLog(); List <TransactionRequestLog> logs = new List <TransactionRequestLog>(); var responseResult = string.Empty; var responseResultFromBB = string.Empty; var responseDesco = string.Empty; using (var client = new HttpClient()) { transactionRequestLog.TransactionId = txnId; transactionRequestLog.RequestFrom = "IDTP"; transactionRequestLog.RequestTo = "Desco"; transactionRequestLog.RequestMessage = xmlData; transactionRequestLog.RequestTime = DateTime.Now; transactionRequestLog.CreatedBy = "IDTP"; transactionRequestLog.CreatedOn = DateTime.Now; transactionRequestLog.ModifiedBy = "IDTP"; transactionRequestLog.ModifiedOn = DateTime.Now; transactionRequestLog.EntityState = EntityState.Added; //_businessLayer.AddTransactionRequestLog(transactionRequestLog); logs.Add(transactionRequestLog); TransactionBillDTO tbd = new TransactionBillDTO { TransactionId = txnId, SenderAccNo = senderAccNo, SenderBankId = senderBank.Id, Amount = decimal.Parse(amount, cultures) }; //receiver bank call //responseResult = HttpClientHelper.Post("https://*****:*****@"\", "", StringComparison.CurrentCulture); TransactionRequestLog transactionRequestLogReceive = new TransactionRequestLog { TransactionId = txnId, RequestFrom = "Desco", RequestTo = "IDTP", RequestMessage = xmlReturn, RequestTime = DateTime.Now, CreatedBy = "IDTP", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, ModifiedBy = "IDTP", EntityState = EntityState.Added }; //_businessLayer.AddTransactionRequestLog(transactionRequestLogReceive); logs.Add(transactionRequestLogReceive); _businessLayer.AddTransactionRequestLog(logs.ToArray()); return(xmlReturn); } catch (Exception ex) { throw new Exception(ex.Message); } }
public string PayGovtDues([FromBody] string xmlData) { var responseResult = string.Empty; // creating object of CultureInfo CultureInfo cultures = new CultureInfo("en-US"); try { XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlData); #region data fetched from xml string txnId, amountStr, senderBIC, receiverBIC, senderAccNo, receiverAccNo, sendingBankRoutingNo, receivingBankRoutingNo, otherInfo; txnId = doc.GetElementsByTagName("TxId").Item(0).InnerText; amountStr = doc.GetElementsByTagName("IntrBkSttlmAmt").Item(0).InnerText; senderBIC = doc.GetElementsByTagName("BICFI").Item(0).InnerText; receiverBIC = doc.GetElementsByTagName("BICFI").Item(3).InnerText; senderAccNo = doc.GetElementsByTagName("Id").Item(0).InnerText; receiverAccNo = doc.GetElementsByTagName("Id").Item(8).InnerText; sendingBankRoutingNo = doc.GetElementsByTagName("Id").Item(2).InnerText; receivingBankRoutingNo = doc.GetElementsByTagName("Id").Item(5).InnerText; otherInfo = doc.GetElementsByTagName("Ustrd").Item(0).InnerText; DateTime txnDt = DateTime.Now; DateTime stlmntDt = DateTime.Now; #endregion #region data fetched from db for further operation var sender = _businessLayer.GetAllIDTPUserEntities().SingleOrDefault(m => m.AccountNo == senderAccNo); var receiver = _businessLayer.GetAllIDTPUserEntities().SingleOrDefault(m => m.AccountNo == receiverAccNo); //var senderBank = _businessLayer.GetAllBanks().SingleOrDefault(m => m.SwiftBic == senderBIC); //var receiverBank = _businessLayer.GetAllBanks().SingleOrDefault(m => m.SwiftBic == receiverBIC); #endregion /* //update Sending Bank Net Debit Cap * var senderInstitutionDebitCap = _businessLayer.GetParticipantDebitCapById(senderBank.Id); * senderInstitutionDebitCap.NetDebitCap -= System.Convert.ToDecimal(amount); * senderInstitutionDebitCap.EntityState = EntityState.Modified; * _businessLayer.UpdateParticipantDebitCap(senderInstitutionDebitCap);*/ //int deviceLocationInfoId = ParseDeviceLocationInfo.SaveInfo(doc); double.TryParse(amountStr, NumberStyles.Any, cultures, out double amount); string[] otherInfos = otherInfo.Split(','); string[] billInfos = otherInfos[0].Split(':'); GovtBillPayment govtBillPayment = new GovtBillPayment { SenderId = sender.Id, ReceiverId = receiver.Id, Amount = amount, ReferenceNumber = txnId, BillInfo = billInfos[1], OtherInfo = otherInfo, EntityState = EntityState.Added }; _businessLayer.AddGovtBillPayment(govtBillPayment); /*//update receiver bank net debit cap * if (isSameBank) * { * senderInstitutionDebitCap.NetDebitCap += System.Convert.ToDecimal(amount); * senderInstitutionDebitCap.EntityState = EntityState.Modified; * _businessLayer.UpdateParticipantDebitCap(senderInstitutionDebitCap); * } * else * { * var receiverInstitutionDebitCap = _businessLayer.GetParticipantDebitCapById(receiverBank.Id); * receiverInstitutionDebitCap.NetDebitCap += System.Convert.ToDecimal(amount); * receiverInstitutionDebitCap.EntityState = EntityState.Modified; * _businessLayer.UpdateParticipantDebitCap(receiverInstitutionDebitCap); * * }*/ //ISOComposer composer = new ISOComposer(); var pacs002xml = ISOComposer.GetDataForPacs002Single(senderBIC, txnId, amountStr, "pacs.008.001.04"); responseResult = pacs002xml.InnerXml.ToString(); return(responseResult); } catch (Exception) { responseResult = IDTPXmlParser.PrepareFailResponse("PayGovtDues"); return(responseResult); } }
public string CreateDeclinedResponse([FromBody] string xmlData) { string response; try { XmlDocument doc = new XmlDocument(); //ISOComposer composer = new ISOComposer(); doc.LoadXml(xmlData); #region data fetched from xml string transactionId, initiatorName, initiatorId, debitorAgentName, creditorAgentName, originalPaymentInfoId, debitorAgentBic, debitorAccount, debitorName, transactionAmount, creditorAgentBIC, creditorAccount, creditorName, responseStatus; transactionId = doc.GetElementsByTagName("MsgId").Item(0).InnerText; initiatorName = doc.GetElementsByTagName("Nm").Item(0).InnerText; initiatorId = doc.GetElementsByTagName("Id").Item(1).InnerText; originalPaymentInfoId = doc.GetElementsByTagName("PmtInfId").Item(0).InnerText; debitorAgentBic = doc.GetElementsByTagName("DbtrAgt").Item(0).InnerXml; var tempDoc = new XmlDocument(); tempDoc.LoadXml(debitorAgentBic); debitorAgentBic = tempDoc.GetElementsByTagName("Cd").Item(0).InnerText; debitorAgentName = tempDoc.GetElementsByTagName("Nm").Item(0).InnerText; debitorAccount = doc.GetElementsByTagName("DbtrAcct").Item(0).InnerXml; tempDoc = new XmlDocument(); tempDoc.LoadXml(debitorAccount); debitorAccount = tempDoc.GetElementsByTagName("Id").Item(0).InnerText; debitorName = doc.GetElementsByTagName("Dbtr").Item(0).FirstChild.InnerText; transactionAmount = doc.GetElementsByTagName("InstdAmt").Item(0).InnerText; creditorAgentBIC = doc.GetElementsByTagName("CdtrAgt").Item(0).InnerXml; tempDoc = new XmlDocument(); tempDoc.LoadXml(creditorAgentBIC); creditorAgentBIC = tempDoc.GetElementsByTagName("Cd").Item(0).InnerText; creditorAgentName = tempDoc.GetElementsByTagName("Nm").Item(0).InnerText; creditorAccount = doc.GetElementsByTagName("CdtrAcct").Item(0).InnerXml; tempDoc = new XmlDocument(); tempDoc.LoadXml(creditorAccount); creditorAccount = tempDoc.GetElementsByTagName("Id").Item(0).InnerText; creditorName = doc.GetElementsByTagName("Cdtr").Item(0).FirstChild.InnerText; responseStatus = "RJCT"; #endregion var pain014 = ISOComposer.DeclinedResponsePAIN014(transactionId, initiatorId, initiatorName, debitorAgentBic, debitorAgentName, debitorAccount, debitorName, transactionAmount, creditorAgentBIC, creditorAgentName, creditorAccount, creditorName, responseStatus); response = pain014.InnerXml.ToString(); return(response); } catch (Exception) { response = IDTPXmlParser.PrepareFailResponse("PAIN013TOPAIN014)"); return(response); } }
public async Task <IActionResult> Create([FromForm] TransactionBillDTO tbd) { // creating object of CultureInfo try { CultureInfo cultures = new CultureInfo("en-US"); if (tbd != null) { #region fetch data db var sender = _businessLayer.GetAllBankUsers().Where(u => u.AccountNumber == tbd.SenderAccNo).FirstOrDefault(); if (sender == null) { TempData["error"] = "User Not Found"; return(RedirectToAction(nameof(Index))); } var SenderBank = _businessLayer.GetAllBanks().Where(b => b.Id == tbd.SenderBankId).FirstOrDefault(); var senderBranch = _businessLayer.GetAllBranchs().Where(br => br.Id == tbd.SenderBranchId).FirstOrDefault(); #endregion var senderBankRoutingNo = senderBranch.RoutingNumber; //var receiverBankRoutingNo = receiverBranch.RoutingNumber; var transactionId = SenderBank.SwiftBic.Substring(0, 4) + DateTime.Now.ToString("yyyyMMddHHmmss", cultures); #region create pacs008 xml //ISOComposer composer = new ISOComposer(); var pacs008xml = ISOComposer.GetPacs008Data(SenderBank.SwiftBic, "", sender.AccountName, tbd.ReceiverName, transactionId, tbd.SenderAccNo, senderBankRoutingNo, SenderBank.CbaccountNo, "", "", "", tbd.Amount.ToString(), "Bill Payment"); #endregion #region fetch data db sender.Balance -= tbd.Amount; sender.EntityState = EntityState.Modified; _businessLayer.UpdateBankUser(sender); #endregion #region get token for session //login as user LoginDTO loginDTO = new LoginDTO { UserName = Helper.Constants.UserName, MasterToken = Helper.Constants.UserSecret }; //get token string token = await HttpClientAuthorization.GetAuthorizationToken(loginDTO); HttpContext.Session.SetString("token", token); #endregion TransactionRequestLog transactionRequestLog = new TransactionRequestLog(); TransactionRequestLog transactionRequestLogReceive = new TransactionRequestLog(); List <TransactionRequestLog> logs = new List <TransactionRequestLog>(); var responseResult = string.Empty; //Uri uri = new Uri("https://localhost:44321/TransactionBill"); //var uri = "https://idtp-fundtransfer.azurewebsites.net/TransactionBill"; var uri = new Uri(Helper.Constants.IDTPApiGatewayUrl + "ft/TransactionBill"); using (var client = new HttpClient()) { transactionRequestLog.TransactionId = transactionId; transactionRequestLog.RequestFrom = SenderBank.FinancialInstitution.InstitutionName; transactionRequestLog.RequestTo = "IDTP"; transactionRequestLog.RequestMessage = pacs008xml.InnerXml; transactionRequestLog.RequestTime = DateTime.Now; transactionRequestLog.CreatedBy = SenderBank.FinancialInstitution.InstitutionName; transactionRequestLog.CreatedOn = DateTime.Now; transactionRequestLog.ModifiedBy = SenderBank.FinancialInstitution.InstitutionName; transactionRequestLog.ModifiedOn = DateTime.Now; transactionRequestLog.EntityState = EntityState.Added; logs.Add(transactionRequestLog); //_businessLayer.AddTransactionRequestLog(transactionRequestLog); //calling to IDTP API responseResult = HttpClientHelper.Post(uri, pacs008xml.InnerXml, token); } responseResult = responseResult.Replace("\\", "", StringComparison.CurrentCulture); responseResult = responseResult.Substring(1, responseResult.Length - 2); transactionRequestLogReceive.TransactionId = transactionId; transactionRequestLogReceive.RequestFrom = "IDTP"; transactionRequestLogReceive.RequestTo = SenderBank.FinancialInstitution.InstitutionName; transactionRequestLogReceive.RequestMessage = responseResult; transactionRequestLogReceive.RequestTime = DateTime.Now; transactionRequestLogReceive.CreatedBy = "IDTP"; transactionRequestLogReceive.CreatedOn = DateTime.Now; transactionRequestLogReceive.ModifiedBy = "IDTP"; transactionRequestLogReceive.ModifiedOn = DateTime.Now; transactionRequestLogReceive.EntityState = EntityState.Added; logs.Add(transactionRequestLogReceive); _businessLayer.AddTransactionRequestLog(logs.ToArray()); //responseResult = "<" + responseResult + ">"; XmlDocument doc = new XmlDocument(); doc.LoadXml(responseResult); TempData["txnId"] = doc.GetElementsByTagName("OrgnlTxId").Item(0).InnerText; } return(RedirectToAction(nameof(Index))); } catch (Exception ex) { TempData["error"] = ex.Message; return(RedirectToAction(nameof(Index))); } }