Skip to content

Enum Conversion issue with TaxNumberType on Contact #631

@terence-qu-tidy

Description

@terence-qu-tidy

SDK you're using (please complete the following information):

  • Version 12.4.0

Describe the bug
When retrieving Contacts through the AccountingApi#GetContactsAsync method, an exception is thrown, likely through an enum mapping issue.

Error converting value "TAXNUMBERTYPE/EIN" to type 'Xero.NetStandard.OAuth2.Model.Accounting.Contact+TaxNumberTypeEnum'. Path 'Contacts[309].TaxNumberType', line 17832, position 42.

To Reproduce
Steps to reproduce the behavior:

  1. Call AccountingApi#GetContactsAsync where one of the contacts returned has the Tax Number Type "EIN".
  2. An ApiException should be thrown.

Screenshots
Here is a snippet of the API response before it is deserialized via the SDK.

{
  "Id" : "e67709ec-08e7-41c6-831d-65c664274075",
  "Status" : "OK",
  "ProviderName" : "TidyStock (DEV)",
  "DateTimeUTC" : "/Date(1764133671124)/",
  "Contacts" : [ {
    "ContactID" : "9ba3c9d5-390d-4370-8dae-9cacb9886957",
    "AccountNumber" : "test",
    "ContactStatus" : "ACTIVE",
    "Name" : "Test",
    "FirstName" : "test",
    "LastName" : "test",
    "TaxNumber" : "xxxxxxx789",
    "Addresses" : [ {
      "AddressType" : "POBOX"
    }, {
      "AddressType" : "STREET"
    } ],
    "Phones" : [ {
      "PhoneType" : "DDI"
    }, {
      "PhoneType" : "DEFAULT"
    }, {
      "PhoneType" : "FAX"
    }, {
      "PhoneType" : "MOBILE"
    } ],
    "UpdatedDateUTC" : "/Date(1764133029790+0000)/",
    "ContactGroups" : [ ],
    "IsSupplier" : false,
    "IsCustomer" : false,
    "TaxNumberType" : "TAXNUMBERTYPE/EIN",  <-- Should be called 'EIN' without the 'TAXNUMBERTYPE/' part
    "ContactPersons" : [ ],
    "HasAttachments" : false,
    "HasValidationErrors" : false
  } ]
}

Expected behavior
The Contact list should be returned successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions