Example #1
0
 public override List <ICardDetails> Select()
 {
     try
     {
         bool Response = new Security(UserProfileObj).AuthenticateUser();
         if (Response == true)
         {
             List <ICardDetails> DecryptedCardDetailsList = new List <ICardDetails>();
             foreach (ICardDetails EncryptedCardObj in CardDetailsDataLayerObj.Select())
             {
                 ICardDetails DecryptedCardDetails = new CardDetails();
                 AESObj.SetIV(EncryptedCardObj.GetIV());
                 AESObj.SetKey(EncryptedCardObj.GetDecryptionKey());
                 DecryptedCardDetails.SetCardID(EncryptedCardObj.GetCardID());
                 DecryptedCardDetails.SetName(AESObj.Decrypt(EncryptedCardObj.GetName()));
                 DecryptedCardDetails.SetCardNumber(AESObj.Decrypt(EncryptedCardObj.GetCardNumber()).ToString());
                 DecryptedCardDetails.SetExpiryMonth(AESObj.Decrypt(EncryptedCardObj.GetExpiryMonth()));
                 DecryptedCardDetails.SetExpiryYear(AESObj.Decrypt(EncryptedCardObj.GetExpiryYear()));
                 DecryptedCardDetails.SetCvv(AESObj.Decrypt(EncryptedCardObj.GetCvv()));
                 DecryptedCardDetailsList.Add(DecryptedCardDetails);
             }
             return(DecryptedCardDetailsList);
         }
         else
         {
             return(null);
         }
     }
     catch (NullReferenceException nex)
     {
         Logger.Instance().Log(Warn.Instance(), new LogInfo("Received null reference while fetching card details (Routine : AuthenticateUser), might be token manipulation. Check token : " + UserProfileObj.GetToken()));
         throw nex;
     }
     catch (Exception ex)
     {
         Logger.Instance().Log(Fatal.Instance(), ex);
         throw ex;
     }
 }