Skip to content

Commit

Permalink
static to protected
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloDiazSSA committed Nov 30, 2023
1 parent d9c43d2 commit 3906629
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 34 deletions.
13 changes: 7 additions & 6 deletions Controllers/CardController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ public class CardController : ControllerBase
/// <summary>
/// Almacena el numero de tarjeta original
/// </summary>
public static string A { get; set; } = string.Empty;
public string A { get; set; } = string.Empty;
/// <summary>
/// Almacena el numero de tarjeta codificado
/// </summary>
public static string AC { get; set; } = string.Empty;
public string AC { get; set; } = string.Empty;
/// <summary>
/// Almacena el numero de tarjeta encriptado y codificado
/// </summary>
public static byte[]? AE { get; set; }
public byte[]? AE { get; set; }
/// <summary>
/// Almacena el numero de tarjeta codificado desencriptado
/// </summary>
public static string B { get; set; } = string.Empty;
public string B { get; set; } = string.Empty;
/// <summary>
/// Almacena el numero de tarjeta codificado
/// </summary>
public static string BC { get; set; } = string.Empty;
public string BC { get; set; } = string.Empty;

/// <summary>
/// Ctor
Expand Down Expand Up @@ -107,10 +107,11 @@ public ClsResponse<dynamic> 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)
Expand Down
24 changes: 16 additions & 8 deletions Data/DbUsersTest/DbUsers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,32 @@ namespace Entregable2_PD.Data.DbUsersTest
/// <summary>
///
/// </summary>
public static class DbUsers
public class DbUsers
{
/// <summary>
///
/// </summary>
protected DbUsers()
{

}
/// <summary>
/// retorna dbusers
/// </summary>
/// <returns></returns>
public static List<UserModel> ReturnUsersForTesting(IConfiguration _config)
public static List<UserModel> 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,
};

Expand All @@ -32,8 +40,8 @@ public static List<UserModel> 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,
};

Expand All @@ -44,7 +52,7 @@ public static List<UserModel> 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,
};

Expand All @@ -55,7 +63,7 @@ public static List<UserModel> 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<UserModel>
Expand Down
2 changes: 1 addition & 1 deletion Models/DBO/DTO/CardDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class CardDto : CardNum
/// </summary>
[StringLength(3)]
[RegularExpression(@"^\d{3}$", ErrorMessage = "Invalid cvv format")]
public string? Cvv { get; set; } = string.Empty;
public string? Cvv { get; set; }
/// <summary>
///
/// </summary>
Expand Down
10 changes: 8 additions & 2 deletions Tools/Converters/ArrayBytesTo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ namespace Entregable2_PD.Tools.Converters
/// <summary>
///
/// </summary>
public static class ArrayBytesTo
public class ArrayBytesTo
{

/// <summary>
///
/// </summary>
protected ArrayBytesTo()
{

}
/// <summary>
/// Funcion par apasar de array de bytes a string hexadecimal
/// </summary>
Expand Down
17 changes: 9 additions & 8 deletions Tools/Converters/CardNumberTo.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
///
/// </summary>
public static class CardNumberTo
public class CardNumberTo
{
/// <summary>
///
/// </summary>
protected CardNumberTo()
{

}
/// <summary>
/// Enmascarar con X el numero de tarjetas exeptuando los ultimos 4 digitos
/// </summary>
Expand Down
9 changes: 8 additions & 1 deletion Tools/Converters/DataTableTo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ namespace Entregable2_PD.Tools.Converters
/// <summary>
///
/// </summary>
public static class DataTableTo
public class DataTableTo
{
/// <summary>
///
/// </summary>
protected DataTableTo()
{

}
/// <summary>
///
/// </summary>
Expand Down
9 changes: 8 additions & 1 deletion Tools/Converters/ModelToParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ namespace Entregable2_PD.Tools.Converters
/// <summary>
///
/// </summary>
public static class ModelToParams
public class ModelToParams
{
/// <summary>
///
/// </summary>
protected ModelToParams()
{

}
/// <summary>
///
/// </summary>
Expand Down
17 changes: 10 additions & 7 deletions Tools/Converters/ModelToString.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
///
/// </summary>
public static class ModelToString
public class ModelToString
{
/// <summary>
///
/// </summary>
protected ModelToString()
{

}
/// <summary>
///
/// </summary>
Expand All @@ -23,7 +26,7 @@ public static string GetString<T>(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);
Expand Down

0 comments on commit 3906629

Please sign in to comment.