summaryrefslogtreecommitdiff
path: root/sandbox/src/main/kotlin/tech/libeufin
diff options
context:
space:
mode:
authorms <ms@taler.net>2023-03-20 18:20:25 +0100
committerms <ms@taler.net>2023-03-20 18:20:25 +0100
commitb92a628982bde6582269734713183f3760e1f5e6 (patch)
tree1d5490a258a6ddf10d1ff9ecc9a203f85cee888c /sandbox/src/main/kotlin/tech/libeufin
parentda28f823688911eb41ca004ba637f0cb8f171f1d (diff)
downloadlibeufin-b92a628982bde6582269734713183f3760e1f5e6.tar.gz
libeufin-b92a628982bde6582269734713183f3760e1f5e6.tar.bz2
libeufin-b92a628982bde6582269734713183f3760e1f5e6.zip
rounding the estimate
Diffstat (limited to 'sandbox/src/main/kotlin/tech/libeufin')
-rw-r--r--sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt4
1 files changed, 3 insertions, 1 deletions
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
index 4fd041ee..e9a87cad 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
@@ -389,7 +389,9 @@ fun circuitApi(circuitRoute: Route) {
amountDebit.amount.toBigDecimal()
} catch (e: Exception) { throw badRequest("POSTed debit amount has invalid number.") }
val estimate = applyCashoutRatioAndFee(amountDebitValue, ratiosAndFees)
- call.respond(object { val amount_credit = "$FIAT_CURRENCY:$estimate" })
+ val twoDigitsRounding = MathContext(2)
+ val estimateRounded = estimate.round(twoDigitsRounding)
+ call.respond(object { val amount_credit = "$FIAT_CURRENCY:$estimateRounded" })
}
// Create a cash-out operation.
circuitRoute.post("/cashouts") {