Replies: 1 comment 1 reply
-
Hey @tranhl, I think this would be awesome to provide a way to handle how Do you want to take a stab at it? If you do, I'd recommend branching off of #309 which changes a bunch of things in a breaking way. I'm expecting to merge it soon, so this would be safer. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Related to #513
My team and I are currently integrating with a payments processor that requires minor units in the request. The documentation for v2 suggests using
toSnapshot
to grab the amount in minor units, but this doesn't work when the scale for the Dinero object is greater than the currency's exponent.This is where
transformScale
comes in (or so we thought). Right now,transformScale
always truncates precision when going from a larger scale to a smaller scale.I suggest allowing us to provide a rounding mode (e.g.
halfUp
) when callingtransformScale
to allow flexibility in how we manage the loss of precision.For example, this is how this new feature could look like in code:
Note how the scaled Dinero's amount is
1235
instead of1234
, which is what we would get with current behavior.Beta Was this translation helpful? Give feedback.
All reactions