mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 16:36:54 +00:00
More helpful error messages for failed payments
This commit is contained in:
parent
3c357c9c1b
commit
fc383879de
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user