File tree Expand file tree Collapse file tree
main/java/io/facturapi/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ public class InvoiceItem {
1414 private InvoiceItemThirdParty thirdParty ;
1515 private String complement ;
1616 private List <InvoiceItemPart > parts = new ArrayList <>();
17- private String propertyTaxAccount ;
17+ @ JsonProperty ("property_tax_account" )
18+ private List <String > propertyTaxAccounts = new ArrayList <>();
1819
1920 public Double getQuantity () { return quantity ; }
2021 public void setQuantity (Double quantity ) { this .quantity = quantity ; }
@@ -30,6 +31,8 @@ public class InvoiceItem {
3031 public void setComplement (String complement ) { this .complement = complement ; }
3132 public List <InvoiceItemPart > getParts () { return parts ; }
3233 public void setParts (List <InvoiceItemPart > parts ) { this .parts = parts ; }
33- public String getPropertyTaxAccount () { return propertyTaxAccount ; }
34- public void setPropertyTaxAccount (String propertyTaxAccount ) { this .propertyTaxAccount = propertyTaxAccount ; }
34+ @ JsonProperty ("property_tax_account" )
35+ public List <String > getPropertyTaxAccounts () { return propertyTaxAccounts ; }
36+ @ JsonProperty ("property_tax_account" )
37+ public void setPropertyTaxAccounts (List <String > propertyTaxAccounts ) { this .propertyTaxAccounts = propertyTaxAccounts ; }
3538}
Original file line number Diff line number Diff line change 1616import io .facturapi .enums .Taxability ;
1717import io .facturapi .http .FacturapiConfig ;
1818import io .facturapi .models .Customer ;
19+ import io .facturapi .models .InvoiceItem ;
1920import java .io .InputStream ;
2021import java .nio .charset .StandardCharsets ;
2122import java .time .Instant ;
2223import java .time .LocalDate ;
24+ import java .util .List ;
2325import java .util .Map ;
2426import org .junit .jupiter .api .Test ;
2527
@@ -320,4 +322,18 @@ void objectMapperDeserializesCodeEnums() throws Exception {
320322 assertEquals (TaxType .IEPS , tax .getType ());
321323 assertEquals (TaxFactor .EXENTO , tax .getFactor ());
322324 }
325+
326+ @ Test
327+ void objectMapperDeserializesPropertyTaxAccountsAsArrays () throws Exception {
328+ var mapper = FacturapiConfig .builder ("sk_test" ).build ().getObjectMapper ();
329+
330+ var empty = mapper .readValue ("{\" property_tax_account\" :[]}" , InvoiceItem .class );
331+ var accounts = mapper .readValue (
332+ "{\" property_tax_account\" :[\" 0102030405\" ]}" ,
333+ InvoiceItem .class
334+ );
335+
336+ assertEquals (List .of (), empty .getPropertyTaxAccounts ());
337+ assertEquals (List .of ("0102030405" ), accounts .getPropertyTaxAccounts ());
338+ }
323339}
You can’t perform that action at this time.
0 commit comments