public dynamic TAWalletEncryptedKey(TAWalletpaymentModel obj) { dynamic objdata = new ExpandoObject(); try { if (string.IsNullOrEmpty(obj.user_id) || string.IsNullOrEmpty(obj.service_name) || string.IsNullOrEmpty(obj.transaction_desc) || string.IsNullOrEmpty(obj.order_id) || string.IsNullOrEmpty(obj.amount) || string.IsNullOrEmpty(obj.callback_url)) { objdata.status = 200; objdata.result = "Missing Input Parameters"; return(objdata); } string description = obj.service_name + " $^$" + obj.transaction_desc + "$^$" + obj.user_id + "$^$"; string strstring = "900020" + "&" + obj.order_id + "&" + description + "&" + obj.amount + "&" + obj.callback_url; string skey_encryption = Encryption.GetEncryptedText(Convert.ToBase64String(sessionKey.Key), Decryption.Decrypt_usingpassword(System.Configuration.ConfigurationManager.AppSettings["TAPublic_Key"].ToString())); string encrypted_data = Encryption.AESEncryption(strstring, Convert.ToBase64String(sessionKey.Key), false); objdata.status = 200; objdata.result = encrypted_data; objdata.sec_key = skey_encryption; objdata.url = "https://staging.transactionanalysts.com:444/TAPaymentGateway/RequestHandler.aspx"; } catch (Exception ex) { objdata.status = 500; objdata.result = ex.Message.ToString(); } return(objdata); }
public IHttpActionResult TAresponseDecrypt(dynamic data) { string serialized_data = JsonConvert.SerializeObject(data); TAWalletpaymentModel rootobj = JsonConvert.DeserializeObject <TAWalletpaymentModel>(serialized_data); return(Ok(_Hel.TAresponseDecrypt(rootobj))); }
public dynamic TAresponseDecrypt(TAWalletpaymentModel obj) { dynamic objdata = new ExpandoObject(); try { if (string.IsNullOrEmpty(obj.encrypted_data) || string.IsNullOrEmpty(obj.user_id)) { objdata.status = 200; objdata.result = "Missing Input Parameters"; return(objdata); } else { obj.encrypted_data = obj.encrypted_data.Replace(" ", "+"); string response_data = Decryption.AES_Decryption(obj.encrypted_data, Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(CalculateMD5Hash("TAGRAMSACHIVALAYAM" + obj.user_id))), false); string strDecrypted_data = Encoding.Default.GetString(Convert.FromBase64String(response_data)); TAWalletResponseModel taResponseObj = JsonConvert.DeserializeObject <TAWalletResponseModel>(strDecrypted_data); if (taResponseObj.Status == "Y") { objdata.status = 200; objdata.result = "Payment made Successfully !!!!"; } else { objdata.status = 400; objdata.result = "Failed to make Payment"; } } } catch (Exception ex) { objdata.status = 500; objdata.result = ex.Message.ToString(); } return(objdata); }