Xero-NetStandard icon indicating copy to clipboard operation
Xero-NetStandard copied to clipboard

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

Open Tim-Hodge opened this issue 3 years ago • 2 comments

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

  • 3.31.0

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.

Tim-Hodge avatar Feb 16 '23 11:02 Tim-Hodge

PETOSS-271

github-actions[bot] avatar Feb 16 '23 11:02 github-actions[bot]

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

github-actions[bot] avatar Feb 16 '23 11:02 github-actions[bot]