244 karma · joined Oct 11, 2015 (11y ago) · 43 submissions
2.
Terraform AWS Organization Foundation(github.com ↗)
2 points · by eriksencosta · 6mo ago · 1 comment
comment 2y ago · link · parent
Anyway, I'm not a Kotlin die-hard but I found it quite fun to code in the language. IMHO, it has a gentle learning curve and the community has plenty of great libraries (e.g., Ktor, Koin).
Nevertheless, I think I leaned too much on using the syntactic sugar of the language when writing the docs and the introductory article. But by no means users are bound to this way of coding.
comment 2y ago · link · parent
Anyway, the allocation may be tweaked to favour where the additional/missing pennies will be allocated. You can find more at: https://github.com/eriksencosta/money/blob/trunk/docs/usage/...
comment 2y ago · link · parent
Check for more: https://github.com/eriksencosta/money/blob/trunk/docs/usage/...
comment 2y ago · link · parent
It is a (quick) spike solution, but I've implemented the currency codes as enums and added support for 20.percent.
Not so sure about supporting 50.btc and 25.3.usd. I need to check if doing so would affect code completion.
comment 2y ago · link · parent
comment 2y ago · link · parent
val amount = 1 money "USD" // USD 1.00
val rate = 5.4905 money "BRL" // BRL 5.4905
amount exchange rate // BRL 5.49
It's up to implementers to hook up in other datasets and to consume the rates. Exchange rates datasets differ from country to country and some foreign exchange companies offer short-term contracts to hold a transaction at a given rate (sort of "guaranteed rate/price"). I don't see myself supporting this use case.
Nevertheless, Java Money (Moneta) has this feature. Never used it so, I don't know how it works.
comment 2y ago · link · parent
When I was designing the API, I created methods like toUSD() and toEUR(). But with 306+ circulating/tender currencies and 2000+ cryptocurrencies, I thought it could lead to a bad experience when using code completion.
comment 2y ago · link · parent
For cryptocurrency data, take a look at the DTIF.org dataset: https://github.com/eriksencosta/money/blob/trunk/docs/append...
comment 2y ago · link · parent
comment 2y ago · link · parent
When I was designing the API, I created methods like toUSD() and toEUR(). But with 306+ circulating/tender currencies and 2000+ cryptocurrencies, I thought it could lead to a bad experience when using code completion.
comment 2y ago · link · parent
But I think I'll make it explicit in the documentation. Thanks for pointing out!
comment 2y ago · link · parent
Anyway, the library uses the CLDR dataset through ICU: https://github.com/eriksencosta/money/blob/trunk/docs/append...
comment 2y ago · link · parent
The examples were written using the infix notation but you can just use regular method calls. For example:
val price = Money.of(100, "USD")
val shipping = Money.of(5, "USD")
val subtotal = price.plus(shipping)
val discount = Percentage.of(10)
val total = subtotal.decreaseBy(discount)
total.allocate(2)
total.allocate(60.percent(), 40.percent())
comment 2y ago · link · parent
1. You get an exception
2. You may specify the rounding rule: https://github.com/eriksencosta/money/blob/trunk/docs/usage/...
3. It has some parsing capabilities. The extra digit is kept, rounding is only applied when doing an operation with the Money object
4. Same as 2
comment 2y ago · link · parent
References:
Brazil: https://blog.eriksen.com.br/en/platform-engineering-n26 Europe: https://medium.com/insiden26/engineering-at-n26-a-tour-of-ou...