Web service, currency input
Web service API: I开发者_JAVA百科 noticed that some companies like to pass integer as the "currency" amount, rather than pass a decimal data type with a decimal place ($ 100.29) is there a good reason why they choose integer for currency over decimal data type?
Example, they do this
- 100 = $1.00
- 10043 = $100.43
Why not do this
- 1.00 or 1 = $1
- 100.43 = $100.43
Not all cultures use the same character for the decimal point. By using the smallest relevant currency unit (so here cents rather than dollars), questions of what decimal point character should be accepted / emitted can be avoided.
No, I don't see any real benefit of getting it factor with 100 to become an integer before submitting to server for conversion. And, this is very much up to their internal implementation of what was the best way to them.
I do noticed this in one of the web service that having this implementation, and the reason I found out was because they want to get the value combined with other params to be HASH for their internal checksum verification.
精彩评论