From f46538d004d8ff11552069fd3c51ecf9368ff0d0 Mon Sep 17 00:00:00 2001 From: blancfabian Date: Tue, 19 Sep 2023 14:16:26 -0300 Subject: [PATCH] chore: set default values for empty properties --- doppler-beplic/Models/Config/DefaultValuesoptions.cs | 9 +++++---- doppler-beplic/Models/DTO/UserCreationDTO.cs | 12 ++++++------ doppler-beplic/Services/Classes/BeplicService.cs | 1 + doppler-beplic/appsettings.json | 7 +++++++ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/doppler-beplic/Models/Config/DefaultValuesoptions.cs b/doppler-beplic/Models/Config/DefaultValuesoptions.cs index 47a308a..084abf6 100644 --- a/doppler-beplic/Models/Config/DefaultValuesoptions.cs +++ b/doppler-beplic/Models/Config/DefaultValuesoptions.cs @@ -12,10 +12,11 @@ public class DefaultCustomer { public const string Customer = "Customer"; - public string Partner { get; set; } = "DOPPLER"; - public string BusinessName { get; set; } = "Sin definir"; - public string Address { get; set; } = "Sin definir"; - public string Cuit { get; set; } = "Sin definir"; + public string Partner { get; set; } = string.Empty; + public string BusinessName { get; set; } = string.Empty; + public string LegalName { get; set; } = string.Empty; + public string Address { get; set; } = string.Empty; + public string Cuit { get; set; } = string.Empty; } public class DefaultPlan diff --git a/doppler-beplic/Models/DTO/UserCreationDTO.cs b/doppler-beplic/Models/DTO/UserCreationDTO.cs index 5d26ec2..fc0d0a6 100644 --- a/doppler-beplic/Models/DTO/UserCreationDTO.cs +++ b/doppler-beplic/Models/DTO/UserCreationDTO.cs @@ -10,18 +10,18 @@ public class UserCreationDTO public class UserCreationCustomer { + [JsonProperty("partner")] + public string? Partner { get; set; } [JsonProperty("cuit")] - public string Cuit { get; set; } = string.Empty; + public string? Cuit { get; set; } [JsonProperty("address")] - public string Address { get; set; } = string.Empty; + public string? Address { get; set; } [JsonProperty("razonSocial")] - public string BusinessName { get; set; } = string.Empty; + public string? BusinessName { get; set; } [JsonProperty("legalName")] - public string LegalName { get; set; } = string.Empty; + public string? LegalName { get; set; } [JsonProperty("idExternal")] public string IdExternal { get; set; } = string.Empty; - [JsonProperty("partner")] - public string Partner { get; set; } = string.Empty; [JsonProperty("apiKey")] public string ApiKey { get; set; } = string.Empty; [JsonProperty("plan")] diff --git a/doppler-beplic/Services/Classes/BeplicService.cs b/doppler-beplic/Services/Classes/BeplicService.cs index 7e0f636..8e1b0da 100644 --- a/doppler-beplic/Services/Classes/BeplicService.cs +++ b/doppler-beplic/Services/Classes/BeplicService.cs @@ -21,6 +21,7 @@ public async Task CreateUser(UserCreationDTO accountData) { accountData.Customer.Partner ??= _options.Customer.Partner; accountData.Customer.BusinessName ??= _options.Customer.BusinessName; + accountData.Customer.LegalName ??= _options.Customer.LegalName; accountData.Customer.Address ??= _options.Customer.Address; accountData.Customer.Cuit ??= _options.Customer.Cuit; diff --git a/doppler-beplic/appsettings.json b/doppler-beplic/appsettings.json index d4b5438..43937e1 100644 --- a/doppler-beplic/appsettings.json +++ b/doppler-beplic/appsettings.json @@ -12,6 +12,13 @@ "BaseUrl": "https://api.beplic.io/v1" }, "DefaultValues": { + "Customer": { + "Partner": "DOPPLER", + "BusinessName": "Sin Definir", + "LegalName": "Sin Definir", + "Address": "Sin Definir", + "Cuit": "Sin Definir" + }, "Room": { "Name": "Sala A", "Group": "Grupo A",