예제 #1
0
 internal void MergeHidden(MerchantDataCollection collection)
 {
     foreach (var item in collection.HiddenValues)
     {
         if (!this.HasKey(item.Key))
         {
             _collection.Add(item);
         }
     }
 }
예제 #2
0
        public static MerchantDataCollection Parse(string kvpString, Func <string, string> decoder = null)
        {
            var collection = new MerchantDataCollection();

            // decrypt the string
            var decryptedKvp = Encoding.UTF8.GetString(Convert.FromBase64String(kvpString));

            if (decoder != null)
            {
                decryptedKvp = decoder(decryptedKvp);
            }

            // build out the object
            var merchantData = decryptedKvp.Split('|');

            foreach (var kvp in merchantData)
            {
                var data = kvp.Split(':');
                collection.Add(data[0], data[1], bool.Parse(data[2]));
            }

            return(collection);
        }