Невозможно интегрировать платежный шлюз axis easy pay in c#.net
уважаемый друг,
Банк предоставляет код интеграции, но я не могу интегрировать plz help me out.
Несоответствие суммы/недопустимое отображение ошибки суммы
Что я уже пробовал:
protected void Redirect_Click(object sender, EventArgs e) { //1. URL string TranUrl = "https://uat-etendering.axisbank.co.in/easypay2.0/frontend/index.php/api/payment"; //2. method to generate Checksum value. //CID + RID + CRN + AMT + "axis"; String strCID = string.Empty; String strRID = string.Empty; String strCRN = string.Empty; String strAMT = string.Empty; String strName = string.Empty; String strClass = string.Empty; String strRoll = string.Empty; strCID = "5000"; // update the same as assigned by AxisBank strRID = Generatetxnid(); strCRN = Generatetxnid(); strAMT = TextBox4.Text; strName = TextBox1.Text; strRoll = TextBox3.Text; strClass = TextBox2.Text; string StrCheckSumString = strCID + strRID + strCRN + strAMT + "axis"; string Checksum = sha256_hash(StrCheckSumString); //Sample values has been passed in each parameter. Please update with your values. string PlainText = "CID=" + strCID + "&RID=" + strRID + "&CRN=" + strCRN + "&AMT=" + TextBox4.Text + "&VER=1.0&TYP=TEST&CNY=INR&RTU=http://localhost:50864/Default.aspx/&PPI=A01/2554-trid|A01/2554|05/21/2016 12:39:14&RE1=MN&RE2=&RE3=&RE4=&RE5=&CKS=" + Checksum; string encryptedstring = Encrypt(PlainText, "axisbank12345678"); //Correct Value with checksum. NameValueCollection data = new NameValueCollection(); data.Add("i", encryptedstring); RedirectAndPOST(this.Page, TranUrl, data); } private static String PreparePOSTForm(string url, NameValueCollection data) { try { //Set a name for the form string formID = "PostForm"; //Build the form using the specified data to be posted. StringBuilder strForm = new StringBuilder(); strForm.Append(""); foreach (string key in data) { strForm.Append(""); } strForm.Append(""); //Build the JavaScript which will do the Posting operation. StringBuilder strScript = new StringBuilder(); strScript.Append(""); strScript.Append("var v" + formID + " = document." + formID + ";"); strScript.Append("v" + formID + ".submit();"); strScript.Append(""); //Return the form and the script concatenated. (The order is important, Form then JavaScript) return strForm.ToString() + strScript.ToString(); } catch (Exception) { throw; } } private void RedirectAndPOST(Page page, string TranUrl, NameValueCollection data) { try { //Prepare the Posting form string strForm = PreparePOSTForm(TranUrl, data); //Add a literal control the specified page holding the Post Form, this is to submit the Posting form with the request. page.Controls.Add(new LiteralControl(strForm)); } catch { } } public string Encrypt(string input, string key) { byte[] keyArray = UTF8Encoding.UTF8.GetBytes(key); byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(input); Aes kgen = Aes.Create("AES"); kgen.Mode = CipherMode.ECB; //kgen.Padding = PaddingMode.None; kgen.Key = keyArray; ICryptoTransform cTransform = kgen.CreateEncryptor(); byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); return Convert.ToBase64String(resultArray, 0, resultArray.Length); } public static String sha256_hash(String value) { StringBuilder Sb = new StringBuilder(); using (SHA256 hash = SHA256Managed.Create()) { Encoding enc = Encoding.UTF8; Byte[] result = hash.ComputeHash(enc.GetBytes(value)); foreach (Byte b in result) Sb.Append(b.ToString("x2")); } return Sb.ToString(); }