mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 18:46:46 +00:00
temp solution to support getCoreBankAccounts
This commit is contained in:
parent
f34e4395b4
commit
a627fd7632
@ -5,7 +5,7 @@ import code.api.util.APIUtil.{OBPEndpoint, _}
|
||||
import code.api.util.NewStyle.HttpCode
|
||||
import code.api.util.{APIUtil, CallContext, OBPQueryParam}
|
||||
import code.api.v3_1_0.OBPAPI3_1_0.oauthServe
|
||||
import com.openbankproject.commons.model.InboundAdapterCallContext
|
||||
import com.openbankproject.commons.model.{AccountId, BankId, BankIdAccountId, InboundAdapterCallContext}
|
||||
import com.openbankproject.commons.util.ReflectUtils
|
||||
import com.openbankproject.commons.util.ReflectUtils.{getType, toValueObject}
|
||||
import net.liftweb.common.{Box, Empty, Failure, Full}
|
||||
@ -36,7 +36,18 @@ object ConnectorEndpoints extends RestHelper{
|
||||
OBPQueryParam.toToDate(req.param("toDate"))
|
||||
).filter(_.isDefined).map(_.openOrThrowException("Impossible exception!"))
|
||||
|
||||
val paramValues: Seq[Any] = getParamValues(params, methodSymbol.paramLists.headOption.getOrElse(Nil), optionCC, queryParams)
|
||||
// TODO need wait for confirm the rule, after that do refactor
|
||||
val paramValues: Seq[Any] =
|
||||
if(methodName == "getCoreBankAccounts"){
|
||||
val bankIdAcountIds = params(1).split(";").map(it => {
|
||||
val bkIdAnAcId = it.split(",", 2)
|
||||
BankIdAccountId(BankId(bkIdAnAcId(0)), AccountId(bkIdAnAcId(1)))
|
||||
}).toList
|
||||
Seq(bankIdAcountIds, optionCC)
|
||||
} else {
|
||||
getParamValues(params, methodSymbol.paramLists.headOption.getOrElse(Nil), optionCC, queryParams)
|
||||
}
|
||||
|
||||
val value = invokeMethod(methodSymbol, paramValues :_*)
|
||||
|
||||
// convert any to Future[(Box[_], Option[CallContext])] type
|
||||
|
||||
@ -441,7 +441,13 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
|
||||
private[this] val baseUrl = "http://localhost:8080/restConnector"
|
||||
|
||||
private[this] def getUrl(methodName: String, variables: (String, Any)*):String = {
|
||||
variables.foldLeft(s"$baseUrl/$methodName")((url, pair) => url.concat(s"/${pair._1}/${pair._2}"))
|
||||
// TODO need wait for confirm the rule, after that do refactor
|
||||
val urlValueConverter = (obj: Any) => obj match {
|
||||
case null => ""
|
||||
case seq: Seq[_] => seq.map(_.toString.replaceFirst("^\\w+\\((.*)\\)$", "$1")).mkString(";")
|
||||
case other => other.toString
|
||||
}
|
||||
variables.foldLeft(s"$baseUrl/$methodName")((url, pair) => url.concat(s"/${pair._1}/${urlValueConverter(pair._2)}"))
|
||||
}
|
||||
|
||||
private[this] def sendRequest[T : TypeTag: Manifest](url: String, callContext: Option[CallContext], method: HttpMethod, entityJsonString: String = "") :Future[Box[T]] = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user