XeroAPI / Xero-NetStandard

A wrapper of the Xero API in the .NetStandard 2.0 framework. Supports Accounting, Payroll AU/US, and Files
MIT License
120 stars 119 forks source link

Xero.NetStandard.OAuth2.Model.Accounting.CurrencyCode value for Turkish Lira is confusing #469

Open Tim-Hodge opened 1 year ago

Tim-Hodge commented 1 year ago

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

Describe the bug See Xero.NetStandard.OAuth2.Model.Accounting.CurrencyCode CurrencyCode enum name for Turkish Lira is TRY_LIRA, which breaks expectations when using .ToString()

To Reproduce Steps to reproduce the behavior:

  1. Call .ToString() on a CurrencyCode value
  2. If that CurrencyCode is Turkish Lira (TRY_LIRA) then the output is TRY_LIRA

Expected behavior Expect value to be TRY as this is the ISO4217 code.

Additional context enum.ToString() is commonly used as the most obvious way to get the 3 letter ISO4217 code. Turkish Lira is the only exception to the rule and it is not immediately obvious that this is a potentally invalid operation if a downstream client expects a 3 letter string.

This is also inconsistent with other CurrencyCode types across the codebase. Xero.NetStandard.OAuth2.Model.Bankfeeds.CurrencyCode and Xero.NetStandard.OAuth2.Model.Project.CurrenctCode both use the name TRY.

It is possible to fetch the EnumMember attribute via reflection but this is not immediately intuitive. There is no way to protect against accidental use of ToString, other than via code review.

github-actions[bot] commented 1 year ago

PETOSS-271

github-actions[bot] commented 1 year ago

Thanks for raising an issue, a ticket has been created to track your request