Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtp.Amount trim trailing zero (or not force the decimal part) #49

Open
jerome-laforge opened this issue Nov 30, 2023 · 2 comments
Open
Labels
question Further information is requested

Comments

@jerome-laforge
Copy link

Hello,
Is it possible to not force the decimal part of rtp.Amount?
Because some currencies:

  • don't have decimal part (i.e. XOF, XAF)
  • have more than 2 digits on decimal part (more unusual...)
@adamdecaf
Copy link
Member

adamdecaf commented Nov 30, 2023

This repository is used for RTP (by The Clearing House) which only allows USD. They don't support all of the currencies that ISO 20022 does.

Edit: See #47 (comment) for more details on how to support these differences.

@adamdecaf adamdecaf added the question Further information is requested label Nov 30, 2023
@jerome-laforge
Copy link
Author

jerome-laforge commented Nov 30, 2023

make sens, but is it possible to define global variable for precision of amount (as for ISODate jerome-laforge@ac6fa87) with default value set to 2 (current behavior for USD) ?

	f := 1.5
	fmt.Println(strconv.FormatFloat(f, 'f', -1, 64)) // 1.5 no trailling zeros
	fmt.Println(strconv.FormatFloat(f, 'f', 2, 64))  // 1.50 
	fmt.Println(strconv.FormatFloat(f, 'f', 3, 64))  // 1.500

https://go.dev/play/p/wQUjk5C34-5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants