mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 16:36:54 +00:00
Tweaked NewStyle.function.isValidCurrencyISOCode
This commit is contained in:
parent
36b96493c1
commit
a5709e7dce
@ -412,6 +412,11 @@ object NewStyle {
|
||||
assert(APIUtil.isValidCurrencyISOCode(currencyCode))
|
||||
}
|
||||
}
|
||||
def isValidCurrencyISOCode(currencyCode: String, failMsg: String, callContext: Option[CallContext])= {
|
||||
tryons(failMsg = failMsg,400, callContext) {
|
||||
assert(APIUtil.isValidCurrencyISOCode(currencyCode))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def hasEntitlement(failMsg: String)(bankId: String, userId: String, role: ApiRole): Future[Box[Unit]] = {
|
||||
|
||||
@ -430,9 +430,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
(bank, callContext ) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(fromAccount, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
|
||||
failMsg = ErrorMessages.InvalidISOCurrencyCode.concat("Please specify a valid value for CURRENCY of your Bank Account. ")
|
||||
_ <- NewStyle.function.tryons(failMsg, 400, callContext) {
|
||||
assert(isValidCurrencyISOCode(fromAccount.currency))
|
||||
}
|
||||
_ <- NewStyle.function.isValidCurrencyISOCode(fromAccount.currency, failMsg, callContext)
|
||||
view <- NewStyle.function.view(viewId, BankIdAccountId(fromAccount.bankId, fromAccount.accountId), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = UserNoPermissionAccessView) {
|
||||
u.hasViewAccess(view)
|
||||
|
||||
@ -713,10 +713,7 @@ trait APIMethods310 {
|
||||
val value = httpParams.filter(_.name == amount).map(_.values.head).head
|
||||
new java.math.BigDecimal(value)
|
||||
}
|
||||
_ <- Helper.booleanToFuture(failMsg = InvalidISOCurrencyCode) {
|
||||
val currencyCode = httpParams.filter(_.name == currency).map(_.values.head).head
|
||||
isValidCurrencyISOCode(currencyCode)
|
||||
}
|
||||
_ <- NewStyle.function.isValidCurrencyISOCode(httpParams.filter(_.name == currency).map(_.values.head).head, callContext)
|
||||
_ <- NewStyle.function.moderatedBankAccount(account, view, Full(u))
|
||||
} yield {
|
||||
val ccy = httpParams.filter(_.name == currency).map(_.values.head).head
|
||||
|
||||
Loading…
Reference in New Issue
Block a user