Aggiunta ricerca indirizzo

This commit is contained in:
2025-07-24 15:51:01 +02:00
parent b34f6cb213
commit 9c69884cc9
11 changed files with 453 additions and 196 deletions

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class AutoCompleteAddressDTO
{
[JsonPropertyName("description")]
public string Description { get; set; }
[JsonPropertyName("placeId")]
public string PlaceId { get; set; }
}

View File

@@ -0,0 +1,36 @@
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class IndirizzoDTO
{
[JsonPropertyName("idPosizione")]
public int IdPosizione { get; set; }
[JsonPropertyName("via")]
public string? Via { get; set; }
[JsonPropertyName("numeroCivico")]
public string? NumeroCivico { get; set; }
[JsonPropertyName("indirizzo")]
public string? Indirizzo { get; set; }
[JsonPropertyName("cap")]
public string? Cap { get; set; }
[JsonPropertyName("citta")]
public string? Citta { get; set; }
[JsonPropertyName("prov")]
public string? Prov { get; set; }
[JsonPropertyName("nazione")]
public string? Nazione { get; set; }
[JsonPropertyName("lat")]
public decimal? Lat { get; set; }
[JsonPropertyName("lng")]
public decimal? Lng { get; set; }
}

View File

@@ -16,4 +16,9 @@ public interface IIntegryApiService
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
Task SaveContact(CRMCreateContactRequestDTO request);
Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request);
//Google
Task<List<IndirizzoDTO>?> Geocode(string address);
Task<List<AutoCompleteAddressDTO>?> AutoCompleteAddress(string address, string language, string uuid);
Task<IndirizzoDTO?> PlaceDetails(string placeId, string uuid);
}

View File

@@ -74,4 +74,38 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
public Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request) =>
integryApiRestClient.Post<CheckVatResponseDTO>("checkPartitaIva", request)!;
public Task<List<IndirizzoDTO>?> Geocode(string address)
{
var queryParams = new Dictionary<string, object>
{
{"address", address},
{"retrieveAll", true}
};
return integryApiRestClient.Get<List<IndirizzoDTO>>("geocode", queryParams);
}
public Task<List<AutoCompleteAddressDTO>?> AutoCompleteAddress(string address, string language, string uuid)
{
var queryParams = new Dictionary<string, object>
{
{"address", address},
{"language", language},
{"uuid", uuid}
};
return integryApiRestClient.Get<List<AutoCompleteAddressDTO>>("google/places/autoCompleteAddress", queryParams);
}
public Task<IndirizzoDTO?> PlaceDetails(string placeId, string uuid)
{
var queryParams = new Dictionary<string, object>
{
{ "placeId", placeId },
{ "uuid", uuid }
};
return integryApiRestClient.Get<IndirizzoDTO>("google/places/placeDetails", queryParams);
}
}