-
Notifications
You must be signed in to change notification settings - Fork 53
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
[money-protocol] Add integer and string methods #85
Comments
Good work team. I've implemented the protocol in https://github.com/kipcole9/money in the I have a few observations. Some with
|
We've addressed your valid concerns by updating the docs. We've put this in bold:
After all, the merchant must understand the subtleties of finance and currency conversion to take care of their profits and losses.
|
Got it, looks good. Especially helpful to know that |
We have some test cases here. I'm sure you'll devise some more test cases than we have! 🙂 |
And i'm sure you'll tell me if any tests are failing because of my bad code :-) I'm really enjoying the collaboration - I think this is a great way to leverage the efforts of many in a way that multiplies the benefit for all. |
* Adds `to_string` and `to_integer` to the protocol * Fixes #62 and #85 * Implements all protocol methods for `ex_money` * Adds integration test with ex_money * Adapted Monei with protocol updates * Adds test for `Any` * The default rounding strategy for implementations of Gringotts.Money protocol is HALF-EVEN. * Updated public API docs with "perils of rounding".
* Adds `to_string` and `to_integer` to the protocol * Fixes #62 and #85 * Implements all protocol methods for `ex_money` * Adds integration test with ex_money * Adapted Monei with protocol updates * Adds test for `Any` * The default rounding strategy for implementations of Gringotts.Money protocol is HALF-EVEN. * Updated public API docs with "perils of rounding".
Additions to the protocol
to_integer
(for lack of a better name)The
exponent
is not used and is just being made available to the application if need be.This is useful for gateways that require amount as
integer
(like cents instead of dollars)Examples:
to_string
Returns a tuple of
ISO4217
currency code and theamount
asstring
. Theamount
must match this regex:~r[\d+\.\d\d{n}]
wheren+1
should match the required precision for thecurrency
. Gringotts cannot and will not validate this of course.Examples:
The text was updated successfully, but these errors were encountered: