diff --git a/Controllers/CardController.cs b/Controllers/CardController.cs index 38159e1..a9ab5cb 100644 --- a/Controllers/CardController.cs +++ b/Controllers/CardController.cs @@ -22,23 +22,23 @@ public class CardController : ControllerBase /// /// Almacena el numero de tarjeta original /// - public static string A { get; set; } = string.Empty; + public string A { get; set; } = string.Empty; /// /// Almacena el numero de tarjeta codificado /// - public static string AC { get; set; } = string.Empty; + public string AC { get; set; } = string.Empty; /// /// Almacena el numero de tarjeta encriptado y codificado /// - public static byte[]? AE { get; set; } + public byte[]? AE { get; set; } /// /// Almacena el numero de tarjeta codificado desencriptado /// - public static string B { get; set; } = string.Empty; + public string B { get; set; } = string.Empty; /// /// Almacena el numero de tarjeta codificado /// - public static string BC { get; set; } = string.Empty; + public string BC { get; set; } = string.Empty; /// /// Ctor @@ -107,10 +107,11 @@ public ClsResponse SetCard(CardDto card) byte[] key = Encoding.UTF8.GetBytes(encrypt.Key); byte[] iv = Encoding.UTF8.GetBytes(encrypt.Iv); - if (card.CardNumber is null) + if (string.IsNullOrEmpty(card.CardNumber)) { return response; } + //Save A A = card.CardNumber; //Mask credit Card Number (A) diff --git a/Data/DbUsersTest/DbUsers.cs b/Data/DbUsersTest/DbUsers.cs index 6d3afa4..04da873 100644 --- a/Data/DbUsersTest/DbUsers.cs +++ b/Data/DbUsersTest/DbUsers.cs @@ -5,24 +5,32 @@ namespace Entregable2_PD.Data.DbUsersTest /// /// /// - public static class DbUsers + public class DbUsers { + /// + /// + /// + protected DbUsers() + { + + } /// /// retorna dbusers /// /// - public static List ReturnUsersForTesting(IConfiguration _config) + public static List ReturnUsersForTesting(IConfiguration cfg) { try { + var _config = cfg; UserModel userIntA = new() { Name = _config.GetSection("CRED:EmailIntA").Value.Split('@')[0], Email = _config.GetSection("CRED:EmailIntA").Value, Password = _config.GetSection("CRED:PwdIntA").Value, Salt = _config.GetSection("CRED:SaltIntA").Value, - Type = (_config.GetSection("CRED:EmailIntA").Value.Contains("interno") ? "AUTHORIZED" : "UNAUTHORIZED"), - Role = (_config.GetSection("CRED:EmailIntA").Value.Contains("administrador") ? "ADMIN" : "USER"), + Type = _config.GetSection("CRED:EmailIntA").Value.Contains("interno") ? "AUTHORIZED" : "UNAUTHORIZED", + Role = _config.GetSection("CRED:EmailIntA").Value.Contains("administrador") ? "ADMIN" : "USER", RegDate = DateTime.Now, }; @@ -32,8 +40,8 @@ public static List ReturnUsersForTesting(IConfiguration _config) Email = _config.GetSection("CRED:EmailIntU").Value, Password = _config.GetSection("CRED:PwdIntU").Value, Salt = _config.GetSection("CRED:SaltIntU").Value, - Type = (_config.GetSection("CRED:EmailIntU").Value.Contains("interno") ? "AUTHORIZED" : "UNAUTHORIZED"), - Role = (_config.GetSection("CRED:EmailIntU").Value.Contains("administrador") ? "ADMIN" : "USER"), + Type = _config.GetSection("CRED:EmailIntU").Value.Contains("interno") ? "AUTHORIZED" : "UNAUTHORIZED", + Role = _config.GetSection("CRED:EmailIntU").Value.Contains("administrador") ? "ADMIN" : "USER", RegDate = DateTime.Now, }; @@ -44,7 +52,7 @@ public static List ReturnUsersForTesting(IConfiguration _config) Password = _config.GetSection("CRED:PwdExtA").Value, Salt = _config.GetSection("CRED:SaltExtA").Value, Type = "AUTHORIZED", - Role = (_config.GetSection("CRED:EmailExtA").Value.Contains("administrador") ? "ADMIN" : "USER"), + Role = _config.GetSection("CRED:EmailExtA").Value.Contains("administrador") ? "ADMIN" : "USER", RegDate = DateTime.Now, }; @@ -55,7 +63,7 @@ public static List ReturnUsersForTesting(IConfiguration _config) Password = _config.GetSection("CRED:PwdExtU").Value, Salt = _config.GetSection("CRED:SaltExtU").Value, Type = "UNAUTHORIZED", - Role = (_config.GetSection("CRED:EmailExtU").Value.Contains("administrador") ? "ADMIN" : "USER"), + Role = _config.GetSection("CRED:EmailExtU").Value.Contains("administrador") ? "ADMIN" : "USER", RegDate = DateTime.Now, }; return new List diff --git a/Models/DBO/DTO/CardDto.cs b/Models/DBO/DTO/CardDto.cs index 3752b82..5836470 100644 --- a/Models/DBO/DTO/CardDto.cs +++ b/Models/DBO/DTO/CardDto.cs @@ -37,7 +37,7 @@ public class CardDto : CardNum /// [StringLength(3)] [RegularExpression(@"^\d{3}$", ErrorMessage = "Invalid cvv format")] - public string? Cvv { get; set; } = string.Empty; + public string? Cvv { get; set; } /// /// /// diff --git a/Tools/Converters/ArrayBytesTo.cs b/Tools/Converters/ArrayBytesTo.cs index e9f3a05..2bcb7fc 100644 --- a/Tools/Converters/ArrayBytesTo.cs +++ b/Tools/Converters/ArrayBytesTo.cs @@ -5,9 +5,15 @@ namespace Entregable2_PD.Tools.Converters /// /// /// - public static class ArrayBytesTo + public class ArrayBytesTo { - + /// + /// + /// + protected ArrayBytesTo() + { + + } /// /// Funcion par apasar de array de bytes a string hexadecimal /// diff --git a/Tools/Converters/CardNumberTo.cs b/Tools/Converters/CardNumberTo.cs index f8596b9..20d28a4 100644 --- a/Tools/Converters/CardNumberTo.cs +++ b/Tools/Converters/CardNumberTo.cs @@ -1,16 +1,17 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Entregable2_PD.Tools.Converters +namespace Entregable2_PD.Tools.Converters { /// /// /// - public static class CardNumberTo + public class CardNumberTo { + /// + /// + /// + protected CardNumberTo() + { + + } /// /// Enmascarar con X el numero de tarjetas exeptuando los ultimos 4 digitos /// diff --git a/Tools/Converters/DataTableTo.cs b/Tools/Converters/DataTableTo.cs index d406e34..e1abcb4 100644 --- a/Tools/Converters/DataTableTo.cs +++ b/Tools/Converters/DataTableTo.cs @@ -10,8 +10,15 @@ namespace Entregable2_PD.Tools.Converters /// /// /// - public static class DataTableTo + public class DataTableTo { + /// + /// + /// + protected DataTableTo() + { + + } /// /// /// diff --git a/Tools/Converters/ModelToParams.cs b/Tools/Converters/ModelToParams.cs index acf38e3..d581d4a 100644 --- a/Tools/Converters/ModelToParams.cs +++ b/Tools/Converters/ModelToParams.cs @@ -5,8 +5,15 @@ namespace Entregable2_PD.Tools.Converters /// /// /// - public static class ModelToParams + public class ModelToParams { + /// + /// + /// + protected ModelToParams() + { + + } /// /// /// diff --git a/Tools/Converters/ModelToString.cs b/Tools/Converters/ModelToString.cs index e1e29c8..899f199 100644 --- a/Tools/Converters/ModelToString.cs +++ b/Tools/Converters/ModelToString.cs @@ -1,17 +1,20 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; +using System.Reflection; using System.Text; -using System.Threading.Tasks; namespace Entregable2_PD.Tools.Converters { /// /// /// - public static class ModelToString + public class ModelToString { + /// + /// + /// + protected ModelToString() + { + + } /// /// /// @@ -23,7 +26,7 @@ public static string GetString(T model) where T : class try { PropertyInfo[] lst = typeof(T).GetProperties(); - StringBuilder bld = new StringBuilder(); + StringBuilder bld = new(); foreach (PropertyInfo oProperty in lst) { var value = oProperty.GetValue(model);