//Using enryption service to encrypt data public string encryptCreditCard(string creditcardnumber) { encrypted_data = ""; encryptdecrypt.ServiceClient service_dec = new encryptdecrypt.ServiceClient(); encrypted_data = service_dec.Encrypt(creditcardnumber); return(encrypted_data); }
//Check validity of Credit card by checking if it's already exisiting in the hashmap and also check balance public bool CheckValidTransaction(string encrypted_data, double amount) { encryptdecrypt.ServiceClient service_dec = new encryptdecrypt.ServiceClient(); string decrypted_data = service_dec.Decrypt(encrypted_data); encrypted_data = ""; foreach (var entry in bank_details) { if (entry.Key.Equals(decrypted_data)) { if (entry.Value > amount) { //Console.WriteLine("Sufficient Funds {0}", entry.Value); bank_details[entry.Key] = entry.Value - amount; return(true); } } } return(false); }