From 95d03b57f3e742f5e8bdd77d94bf5648fd4d1281 Mon Sep 17 00:00:00 2001 From: javorosas Date: Fri, 17 Jul 2026 17:12:08 +0200 Subject: [PATCH] fix: expose property tax accounts --- CHANGELOG.md | 4 ++++ FacturapiTest/ClientCompatibilityTests.cs | 26 +++++++++++++++++++++++ Models/InvoiceItem.cs | 3 +++ facturapi-net.csproj | 2 +- 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b103992..2edb696 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ 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). +## [6.5.1] - 2026-07-17 +### Fixed +- Expose `InvoiceItem.PropertyTaxAccount` as a list of property tax account numbers. + ## [6.5.0] - 2026-06-07 ### Added - Expose structured API error metadata on `FacturapiException`, including `Code`, `Path`, `Location`, `Errors`, `LogId`, and response `Headers`. diff --git a/FacturapiTest/ClientCompatibilityTests.cs b/FacturapiTest/ClientCompatibilityTests.cs index c3a167a..9b01c39 100644 --- a/FacturapiTest/ClientCompatibilityTests.cs +++ b/FacturapiTest/ClientCompatibilityTests.cs @@ -52,6 +52,32 @@ public async Task RetentionCancelAsync_ThrowsFacturapiExceptionWithStatus() Assert.Equal("bad retention", exception.Message); } + [Fact] + public async Task InvoiceRetrieveAsync_DeserializesPropertyTaxAccounts() + { + var handler = new StubHttpMessageHandler((request, cancellationToken) => + { + var response = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent( + "{\"id\":\"inv_123\",\"items\":[{\"property_tax_account\":[\"0102030405\"]}]}", + Encoding.UTF8, + "application/json") + }; + return Task.FromResult(response); + }); + + var httpClient = new HttpClient(handler) + { + BaseAddress = new Uri("https://www.facturapi.io/v2/") + }; + var wrapper = new InvoiceWrapper("test_key", "v2", httpClient); + + var invoice = await wrapper.RetrieveAsync("inv_123"); + + Assert.Equal(new[] { "0102030405" }, invoice.Items[0].PropertyTaxAccount); + } + [Fact] public async Task InvoiceStampDraftAsync_AndLegacyMethod_BothWork() { diff --git a/Models/InvoiceItem.cs b/Models/InvoiceItem.cs index 906a18a..0f048b6 100644 --- a/Models/InvoiceItem.cs +++ b/Models/InvoiceItem.cs @@ -1,5 +1,7 @@ using System; +using System.Collections.Generic; + namespace Facturapi { public class InvoiceItem @@ -8,5 +10,6 @@ public class InvoiceItem public Decimal Discount { get; set; } public string Description { get; set; } public Product Product { get; set; } + public List PropertyTaxAccount { get; set; } } } diff --git a/facturapi-net.csproj b/facturapi-net.csproj index 5a243c5..95b9c94 100644 --- a/facturapi-net.csproj +++ b/facturapi-net.csproj @@ -11,7 +11,7 @@ SDK oficial de Facturapi para .NET para facturación electrónica en México (CFDI), envío de documentos, búsqueda y trazabilidad. factura factura-electronica facturacion cfdi cfdi40 sat invoice invoicing facturapi mexico Facturapi - 6.5.0 + 6.5.1 $(Version) MIT false