Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.11.0] = 2025-12-10

### Added

- Methods to carta porte catalogs
- `SearchAirTranportCodes`, `SearchTransportConfigs`,`SearchRightsOfPassage`, `SearchCustomsDocuments`, `SearchPackagingTypes` `SearchTrailerTypes`, `SearchHazardousMaterials`, `SearchNavalAuthorizations`, `SearchPortStations`, `SearchMarineContainers`

## [4.10.1] = 2025-10-23

### Added
Expand Down
2 changes: 2 additions & 0 deletions FacturapiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class FacturapiClient
public Wrappers.ReceiptWrapper Receipt { get; private set; }
public Wrappers.RetentionWrapper Retention { get; private set; }
public Wrappers.CatalogWrapper Catalog { get; private set; }
public Wrappers.CatalogWrapper CartaporteCatalog { get; private set; }
public Wrappers.ToolWrapper Tool { get; private set; }

public FacturapiClient(string apiKey, string apiVersion = "v2")
Expand All @@ -20,6 +21,7 @@ public FacturapiClient(string apiKey, string apiVersion = "v2")
this.Receipt = new Wrappers.ReceiptWrapper(apiKey, apiVersion);
this.Retention = new Wrappers.RetentionWrapper(apiKey, apiVersion);
this.Catalog = new Wrappers.CatalogWrapper(apiKey, apiVersion);
this.CartaporteCatalog = new Wrappers.CatalogWrapper(apiKey, apiVersion);
this.Tool = new Wrappers.ToolWrapper(apiKey, apiVersion);
}
}
Expand Down
58 changes: 58 additions & 0 deletions Router/CartaporteCatalogRouter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System.Collections.Generic;

namespace Facturapi
{
internal static partial class Router
{
// Carta Porte 3.1 catalogs
public static string SearchCartaporteAirTransportCodes(Dictionary<string, object> query = null)
{
return UriWithQuery("catalogs/cartaporte/3.1/air-transport-codes", query);
}

public static string SearchCartaporteTransportConfigs(Dictionary<string, object> query = null)
{
return UriWithQuery("catalogs/cartaporte/3.1/transport-configs", query);
}

public static string SearchCartaporteRightsOfPassage(Dictionary<string, object> query = null)
{
return UriWithQuery("catalogs/cartaporte/3.1/rights-of-passage", query);
}

public static string SearchCartaporteCustomsDocuments(Dictionary<string, object> query = null)
{
return UriWithQuery("catalogs/cartaporte/3.1/customs-documents", query);
}

public static string SearchCartaportePackagingTypes(Dictionary<string, object> query = null)
{
return UriWithQuery("catalogs/cartaporte/3.1/packaging-types", query);
}

public static string SearchCartaporteTrailerTypes(Dictionary<string, object> query = null)
{
return UriWithQuery("catalogs/cartaporte/3.1/trailer-types", query);
}

public static string SearchCartaporteHazardousMaterials(Dictionary<string, object> query = null)
{
return UriWithQuery("catalogs/cartaporte/3.1/hazardous-materials", query);
}

public static string SearchCartaporteNavalAuthorizations(Dictionary<string, object> query = null)
{
return UriWithQuery("catalogs/cartaporte/3.1/naval-authorizations", query);
}

public static string SearchCartaportePortStations(Dictionary<string, object> query = null)
{
return UriWithQuery("catalogs/cartaporte/3.1/port-stations", query);
}

public static string SearchCartaporteMarineContainers(Dictionary<string, object> query = null)
{
return UriWithQuery("catalogs/cartaporte/3.1/marine-containers", query);
}
}
}
151 changes: 151 additions & 0 deletions Wrappers/CatalogWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,156 @@ public async Task<SearchResult<CatalogItem>> SearchUnits(Dictionary<string, obje
var searchResult = JsonConvert.DeserializeObject<SearchResult<CatalogItem>>(resultString, this.jsonSettings);
return searchResult;
}

// Carta Porte catalogs
public async Task<SearchResult<CatalogItem>> SearchAirTransportCodes(Dictionary<string, object> query = null)
{
var response = await client.GetAsync(Router.SearchCartaporteAirTransportCodes(query));
var resultString = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
var error = JsonConvert.DeserializeObject<JObject>(resultString, this.jsonSettings);
throw new FacturapiException(error["message"].ToString());
}

var searchResult = JsonConvert.DeserializeObject<SearchResult<CatalogItem>>(resultString, this.jsonSettings);
return searchResult;
}

public async Task<SearchResult<CatalogItem>> SearchTransportConfigs(Dictionary<string, object> query = null)
{
var response = await client.GetAsync(Router.SearchCartaporteTransportConfigs(query));
var resultString = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
var error = JsonConvert.DeserializeObject<JObject>(resultString, this.jsonSettings);
throw new FacturapiException(error["message"].ToString());
}

var searchResult = JsonConvert.DeserializeObject<SearchResult<CatalogItem>>(resultString, this.jsonSettings);
return searchResult;
}

public async Task<SearchResult<CatalogItem>> SearchRightsOfPassage(Dictionary<string, object> query = null)
{
var response = await client.GetAsync(Router.SearchCartaporteRightsOfPassage(query));
var resultString = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
var error = JsonConvert.DeserializeObject<JObject>(resultString, this.jsonSettings);
throw new FacturapiException(error["message"].ToString());
}

var searchResult = JsonConvert.DeserializeObject<SearchResult<CatalogItem>>(resultString, this.jsonSettings);
return searchResult;
}

public async Task<SearchResult<CatalogItem>> SearchCustomsDocuments(Dictionary<string, object> query = null)
{
var response = await client.GetAsync(Router.SearchCartaporteCustomsDocuments(query));
var resultString = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
var error = JsonConvert.DeserializeObject<JObject>(resultString, this.jsonSettings);
throw new FacturapiException(error["message"].ToString());
}

var searchResult = JsonConvert.DeserializeObject<SearchResult<CatalogItem>>(resultString, this.jsonSettings);
return searchResult;
}

public async Task<SearchResult<CatalogItem>> SearchPackagingTypes(Dictionary<string, object> query = null)
{
var response = await client.GetAsync(Router.SearchCartaportePackagingTypes(query));
var resultString = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
var error = JsonConvert.DeserializeObject<JObject>(resultString, this.jsonSettings);
throw new FacturapiException(error["message"].ToString());
}

var searchResult = JsonConvert.DeserializeObject<SearchResult<CatalogItem>>(resultString, this.jsonSettings);
return searchResult;
}

public async Task<SearchResult<CatalogItem>> SearchTrailerTypes(Dictionary<string, object> query = null)
{
var response = await client.GetAsync(Router.SearchCartaporteTrailerTypes(query));
var resultString = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
var error = JsonConvert.DeserializeObject<JObject>(resultString, this.jsonSettings);
throw new FacturapiException(error["message"].ToString());
}

var searchResult = JsonConvert.DeserializeObject<SearchResult<CatalogItem>>(resultString, this.jsonSettings);
return searchResult;
}

public async Task<SearchResult<CatalogItem>> SearchHazardousMaterials(Dictionary<string, object> query = null)
{
var response = await client.GetAsync(Router.SearchCartaporteHazardousMaterials(query));
var resultString = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
var error = JsonConvert.DeserializeObject<JObject>(resultString, this.jsonSettings);
throw new FacturapiException(error["message"].ToString());
}

var searchResult = JsonConvert.DeserializeObject<SearchResult<CatalogItem>>(resultString, this.jsonSettings);
return searchResult;
}

public async Task<SearchResult<CatalogItem>> SearchNavalAuthorizations(Dictionary<string, object> query = null)
{
var response = await client.GetAsync(Router.SearchCartaporteNavalAuthorizations(query));
var resultString = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
var error = JsonConvert.DeserializeObject<JObject>(resultString, this.jsonSettings);
throw new FacturapiException(error["message"].ToString());
}

var searchResult = JsonConvert.DeserializeObject<SearchResult<CatalogItem>>(resultString, this.jsonSettings);
return searchResult;
}

public async Task<SearchResult<CatalogItem>> SearchPortStations(Dictionary<string, object> query = null)
{
var response = await client.GetAsync(Router.SearchCartaportePortStations(query));
var resultString = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
var error = JsonConvert.DeserializeObject<JObject>(resultString, this.jsonSettings);
throw new FacturapiException(error["message"].ToString());
}

var searchResult = JsonConvert.DeserializeObject<SearchResult<CatalogItem>>(resultString, this.jsonSettings);
return searchResult;
}

public async Task<SearchResult<CatalogItem>> SearchMarineContainers(Dictionary<string, object> query = null)
{
var response = await client.GetAsync(Router.SearchCartaporteMarineContainers(query));
var resultString = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
var error = JsonConvert.DeserializeObject<JObject>(resultString, this.jsonSettings);
throw new FacturapiException(error["message"].ToString());
}

var searchResult = JsonConvert.DeserializeObject<SearchResult<CatalogItem>>(resultString, this.jsonSettings);
return searchResult;
}
}
}
2 changes: 1 addition & 1 deletion facturapi-net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
API Keys creando una cuenta gratuita en https://www.facturapi.io</Summary>
<PackageTags>factura factura-electronica cfdi facturapi mexico conekta</PackageTags>
<Title>Facturapi</Title>
<Version>4.10.1</Version>
<Version>4.11.0</Version>
<PackageVersion>$(Version)</PackageVersion>
<Owners>Facturapi</Owners>
<ApplicationIcon>facturapi.ico</ApplicationIcon>
Expand Down