public static OrderedDictionary GetRedirectDictionary(PaymentInfo paymentInfo, string apiSecretKey, string shopId) { var result = new OrderedDictionary(); result.Add("URLMS", paymentInfo.UrlMs); result.Add("URLDONE", paymentInfo.UrlDone); result.Add("ORDERID", paymentInfo.OrderId); result.Add("SHOPID", shopId); result.Add("AMOUNT", paymentInfo.Amount); result.Add("CURRENCY", paymentInfo.Currency); result.Add("EXPONENT", paymentInfo.Exponent); result.Add("ACCOUNTINGMODE", paymentInfo.AccountingMode); result.Add("AUTHORMODE", paymentInfo.AuthorMode); result.Add("OPTIONS", paymentInfo.GetOptions()); if (paymentInfo.GetOptions() != null && paymentInfo.GetOptions().Contains("B")) { result.Add("NAME", paymentInfo.Name); result.Add("SURNAME", paymentInfo.Surname); } result.Add("TAXID", paymentInfo.TaxId); result.Add("LOCKCARD", paymentInfo.Lockcard); if (paymentInfo.GetOptions() != null && paymentInfo.GetOptions().Contains("F")) { result.Add("COMMIS", paymentInfo.Commis); } if (paymentInfo.GetOptions() != null && (paymentInfo.GetOptions().Contains("O") || paymentInfo.GetOptions().Contains("V"))) { result.Add("ORDDESCR", paymentInfo.OrdDescr); } result.Add("VSID", paymentInfo.Vsid); result.Add("OPDESCR", paymentInfo.OpDescr); if (paymentInfo.GetOptions() != null && paymentInfo.GetOptions().Contains("D")) { result.Add("REMAININGDURATION", paymentInfo.RemainingDuration); } result.Add("USERID", paymentInfo.UserId); result.Add("BP_POSTEPAY", paymentInfo.BpPostepay); result.Add("BP_CARDS", paymentInfo.BpCards); if (paymentInfo.Network != null && paymentInfo.Network.Equals("91")) { result.Add("PHONENUMBER", paymentInfo.PhoneNumber); result.Add("CAUSATION", paymentInfo.Causation); result.Add("USER", paymentInfo.User); } result.Add("PRODUCTREF", paymentInfo.ProductRef); result.Add("ANTIFRAUD", paymentInfo.AntiFraud); if (paymentInfo.Data3DS != null) { result.Add("3DSDATA", AESEncoder.Encode3DSData(apiSecretKey, paymentInfo.Data3DS.ToJSONString())); } result.Add("TRECURR", paymentInfo.TRecurr); result.Add("CRECURR", paymentInfo.CRecurr); result.Add("TOKEN", paymentInfo.Token); result.Add("EXPDATE", paymentInfo.ExpDate); result.Add("NETWORK", paymentInfo.Network); result.Add("IBAN", paymentInfo.IBAN); return(result); }
static void Main(string[] args) { string origin = "Test.This is a test"; AESEncoder encoder = new AESEncoder(); using (RijndaelManaged rijAlg = new RijndaelManaged()) { rijAlg.GenerateKey(); rijAlg.GenerateIV(); string encrypted = encoder.EncryptToBase64(origin, rijAlg.Key, rijAlg.IV); string decrypted = encoder.DecryptStringFromBase64String(encrypted, rijAlg.Key, rijAlg.IV); Console.WriteLine("Original : {0}", origin); Console.WriteLine("Encrypted : {0}", encrypted); Console.WriteLine("Decrypted : {0}", decrypted); } }