More helpful error messages for failed payments

This commit is contained in:
Everett Sochowski 2014-04-11 10:28:50 +02:00
parent 3c357c9c1b
commit fc383879de

View File

@ -994,10 +994,10 @@ def checkIfLocationPossible(lat:Double,lon:Double) : Box[Unit] = {
" not found"}
}
sameCurrency <- booleanToBox(fromAccount.currency == toAccount.currency, {
s"Cannot send payment to account with differenct currency (From ${fromAccount.currency} to ${toAccount.currency}"
s"Cannot send payment to account with different currency (From ${fromAccount.currency} to ${toAccount.currency}"
})
rawAmt <- tryo {BigDecimal(makeTransJson.amount)} ?~! "amount not convertable to number"//TODO: this completely ignores currency
isPositiveAmtToSend <- booleanToBox(rawAmt > BigDecimal("0"), "Can't send a payment with a value of 0 or less")
rawAmt <- tryo {BigDecimal(makeTransJson.amount)} ?~! s"amount ${makeTransJson.amount} not convertible to number"
isPositiveAmtToSend <- booleanToBox(rawAmt > BigDecimal("0"), s"Can't send a payment with a value of 0 or less. (${makeTransJson.amount})")
} yield {
val fromTransAmt = -rawAmt //from account balance should decrease
val toTransAmt = rawAmt //to account balance should increase