diff --git a/obp-api/pom.xml b/obp-api/pom.xml index bfeeadfb5..577ad5ee1 100644 --- a/obp-api/pom.xml +++ b/obp-api/pom.xml @@ -26,7 +26,6 @@ com.tesobe obp-commons - ${project.version} com.github.everit-org.json-schema diff --git a/obp-api/src/main/scala/code/api/util/CodeGenerateUtils.scala b/obp-api/src/main/scala/code/api/util/CodeGenerateUtils.scala index f64e1f5e5..be7235ca9 100644 --- a/obp-api/src/main/scala/code/api/util/CodeGenerateUtils.scala +++ b/obp-api/src/main/scala/code/api/util/CodeGenerateUtils.scala @@ -170,7 +170,7 @@ object CodeGenerateUtils { } else if (pre <:< ru.typeOf[AccountAttributeType.type]) { "AccountAttributeType.INTEGER" } else if (valName == "scaMethod") { - "code.api.util.StrongCustomerAuthentication.SMS" + "Some(code.api.util.StrongCustomerAuthentication.SMS)" } else { createDocExample(symbol.info, Some(valName), fieldName, Some(tp)) } diff --git a/obp-api/src/main/scala/code/bankconnectors/Connector.scala b/obp-api/src/main/scala/code/bankconnectors/Connector.scala index 5707693d5..2fd1a9529 100644 --- a/obp-api/src/main/scala/code/bankconnectors/Connector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/Connector.scala @@ -1658,7 +1658,7 @@ trait Connector extends MdcLoggable with CustomJsonFormats{ productCode: ProductCode, productAttributeId: Option[String], name: String, - attributType: ProductAttributeType.Value, + productAttributeType: ProductAttributeType.Value, value: String, callContext: Option[CallContext] ): OBPReturnType[Box[ProductAttribute]] = Future{(Failure(setUnimplementedError), callContext)} @@ -1689,7 +1689,7 @@ trait Connector extends MdcLoggable with CustomJsonFormats{ productCode: ProductCode, productAttributeId: Option[String], name: String, - attributType: AccountAttributeType.Value, + accountAttributeType: AccountAttributeType.Value, value: String, callContext: Option[CallContext] ): OBPReturnType[Box[AccountAttribute]] = Future{(Failure(setUnimplementedError), callContext)} @@ -1711,7 +1711,7 @@ trait Connector extends MdcLoggable with CustomJsonFormats{ cardId: Option[String], cardAttributeId: Option[String], name: String, - attributeType: CardAttributeType.Value, + cardAttributeType: CardAttributeType.Value, value: String, callContext: Option[CallContext] ): OBPReturnType[Box[CardAttribute]] = Future{(Failure(setUnimplementedError), callContext)} diff --git a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnectorBuilder.scala b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnectorBuilder.scala index 9c2ca73ff..b0084a428 100644 --- a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnectorBuilder.scala +++ b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnectorBuilder.scala @@ -31,49 +31,49 @@ object RestConnectorBuilder extends App { "getChallengeThreshold", "getChargeLevel", "createChallenge", -// "validateChallengeAnswer", -// "getBankLegacy", + // "validateChallengeAnswer", + // "getBankLegacy", "getBank", -// "getBanksLegacy", + // "getBanksLegacy", "getBanks", -// "getBankAccountsForUserLegacy", + // "getBankAccountsForUserLegacy", "getBankAccountsForUser", "getUser", -// "updateUserAccountViewsOld", + // "updateUserAccountViewsOld", "getBankAccount", -// "getBankAccountLegacy", + // "getBankAccountLegacy", "getBankAccount", -// "getBankAccountByIban", ********* -// "getBankAccountByRouting", -// "getBankAccounts", + // "getBankAccountByIban", ********* + // "getBankAccountByRouting", + // "getBankAccounts", "getBankAccountsBalances", -// "getCoreBankAccountsLegacy", + // "getCoreBankAccountsLegacy", "getCoreBankAccounts", -// "getBankAccountsHeldLegacy", + // "getBankAccountsHeldLegacy", "getBankAccountsHeld", -// "checkBankAccountExistsLegacy", + // "checkBankAccountExistsLegacy", "checkBankAccountExists", -// "getEmptyBankAccount", //not useful! -// "getCounterpartyFromTransaction", //not useful! -// "getCounterpartiesFromTransaction",//not useful! + // "getEmptyBankAccount", //not useful! + // "getCounterpartyFromTransaction", //not useful! + // "getCounterpartiesFromTransaction",//not useful! "getCounterparty", "getCounterpartyTrait", -// "getCounterpartyByCounterpartyIdLegacy", + // "getCounterpartyByCounterpartyIdLegacy", "getCounterpartyByCounterpartyId", "getCounterpartyByIban", -// "getCounterpartiesLegacy", + // "getCounterpartiesLegacy", "getCounterparties", -// "getTransactionsLegacy", + // "getTransactionsLegacy", "getTransactions", "getTransactionsCore", -// "getTransactionLegacy", + // "getTransactionLegacy", "getTransaction", "getPhysicalCards", "getPhysicalCardForBank", "deletePhysicalCardForBank", -// "getPhysicalCardsForBankLegacy", + // "getPhysicalCardsForBankLegacy", "getPhysicalCardsForBank", -// "createPhysicalCardLegacy", + // "createPhysicalCardLegacy", "createPhysicalCard", "updatePhysicalCard", "makePayment", @@ -108,7 +108,7 @@ object RestConnectorBuilder extends App { "updateBankAccount", "createBankAndAccount", "createBankAccount", -// "createBankAccountLegacy", + // "createBankAccountLegacy", "createSandboxBankAccount", "setAccountHolder", "accountExists", @@ -126,10 +126,10 @@ object RestConnectorBuilder extends App { "createOrUpdateAtm", "createOrUpdateProduct", "createOrUpdateFXRate", -// "getBranchLegacy", + // "getBranchLegacy", "getBranch", "getBranches", -// "getAtmLegacy", + // "getAtmLegacy", "getAtm", "getAtms", "accountOwnerExists", @@ -149,7 +149,7 @@ object RestConnectorBuilder extends App { "updateCustomerCreditData", "updateCustomerGeneralData", "getCustomersByUserId", -// "getCustomerByCustomerIdLegacy", + // "getCustomerByCustomerIdLegacy", "getCustomerByCustomerId", "getCustomerByCustomerNumber", "getCustomerAddress", @@ -212,7 +212,7 @@ object RestConnectorBuilder extends App { // "getKycMedias", // "getKycStatuses", // "createBankAccount", -// "createCustomer", + // "createCustomer", // "createMeeting", // "createMessage" ) @@ -229,8 +229,8 @@ object RestConnectorBuilder extends App { .map(it => { val (methodName, typeSignature) = (it.name.toString, it.typeSignature) methodName match { -// case name if(name.matches("(get|check).*")) => GetGenerator(methodName, typeSignature) -// case name if(name.matches("(create|make).*")) => PostGenerator(methodName, typeSignature) + // case name if(name.matches("(get|check).*")) => GetGenerator(methodName, typeSignature) + // case name if(name.matches("(create|make).*")) => PostGenerator(methodName, typeSignature) case _ => PostGenerator(methodName, typeSignature)//throw new NotImplementedError(s" not support method name: $methodName") } @@ -269,6 +269,9 @@ case class GetGenerator(methodName: String, tp: Type) { .replaceAll("(\\w+\\.)+", "") .replaceFirst("\\)", "): ") .replaceFirst("""\btype\b""", "`type`") + .replace("cardAttributeType: Value", "cardAttributeType: CardAttributeType.Value") // scala enum is bad for Reflection + .replace("productAttributeType: Value", "productAttributeType: ProductAttributeType.Value") // scala enum is bad for Reflection + .replace("accountAttributeType: Value", "accountAttributeType: AccountAttributeType.Value") // scala enum is bad for Reflection .replaceFirst("""callContext:\s*Option\[CallContext\]""", "@CacheKeyOmit callContext: Option[CallContext]") private[this] val params = tp.paramLists(0).filterNot(_.asTerm.info =:= ru.typeOf[Option[CallContext]]).map(_.name.toString) @@ -383,6 +386,9 @@ case class PostGenerator(methodName: String, tp: Type) { private[this] def paramAnResult = tp.toString .replaceAll("(\\w+\\.)+", "") .replaceFirst("\\)", "): ") + .replace("cardAttributeType: Value", "cardAttributeType: CardAttributeType.Value") // scala enum is bad for Reflection + .replace("productAttributeType: Value", "productAttributeType: ProductAttributeType.Value") // scala enum is bad for Reflection + .replace("accountAttributeType: Value", "accountAttributeType: AccountAttributeType.Value") // scala enum is bad for Reflection .replaceFirst("""\btype\b""", "`type`") private[this] val params = tp.paramLists(0).filterNot(_.asTerm.info =:= ru.typeOf[Option[CallContext]]).map(_.name.toString).mkString(", ", ", ", "").replaceFirst("""\btype\b""", "`type`") @@ -427,6 +433,7 @@ case class PostGenerator(methodName: String, tp: Type) { case v if(v.matches("(delete|remove).+")) => "HttpMethods.DELETE" case _ => "HttpMethods.POST" } + /** * Get all the parameters name as a String from `typeSignature` object. * eg: it will return diff --git a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala index 72e56f929..9bd6994df 100644 --- a/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala +++ b/obp-api/src/main/scala/code/bankconnectors/rest/RestConnector_vMar2019.scala @@ -170,7 +170,6 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable - //---------------- dynamic start -------------------please don't modify this line //---------------- dynamic end ---------------------please don't modify this line @@ -178,7 +177,10 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable - + + + + //In RestConnector, we use the headers to propagate the parameters to Adapter. The parameters come from the CallContext.outboundAdapterAuthInfo.userAuthContext //We can set them from UserOauthContext or the http request headers. @@ -196,7 +198,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable * @tparam T * @return */ - private[this] implicit def convertFuture[T](future: Future[T]): T = Await.result(future, 1.minute) + //private[this] implicit def convertFuture[T](future: Future[T]): T = Await.result(future, 1.minute) //TODO please modify this baseUrl to your remote api server base url of this connector private[this] val baseUrl = "http://localhost:8080/restConnector" diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/dto/JsonsTransfer.scala b/obp-commons/src/main/scala/com/openbankproject/commons/dto/JsonsTransfer.scala index b4c7985a6..a743af3b8 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/dto/JsonsTransfer.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/dto/JsonsTransfer.scala @@ -329,7 +329,7 @@ case class OutBoundCreateOrUpdateProductAttribute(outboundAdapterCallContext: Ou productCode: ProductCode, productAttributeId: Option[String], name: String, - attributType: ProductAttributeType.Value, + productAttributeType: ProductAttributeType.Value, value: String) extends TopicTrait case class InBoundCreateOrUpdateProductAttribute(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: ProductAttributeCommons) extends InBoundTrait[ProductAttributeCommons] @@ -351,7 +351,7 @@ case class OutBoundCreateOrUpdateAccountAttribute(outboundAdapterCallContext: Ou productCode: ProductCode, productAttributeId: Option[String], name: String, - attributType: AccountAttributeType.Value, + accountAttributeType: AccountAttributeType.Value, value: String) extends TopicTrait case class InBoundCreateOrUpdateAccountAttribute(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: AccountAttributeCommons) extends InBoundTrait[AccountAttributeCommons] @@ -403,7 +403,7 @@ case class InBoundGetProductCollectionItem(inboundAdapterCallContext: InboundAda case class OutBoundGetProductCollectionItemsTree(outboundAdapterCallContext: OutboundAdapterCallContext, collectionCode: String, bankId: String) extends TopicTrait -case class InBoundGetProductCollectionItemsTree(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: List[(ProductCollectionItemCommons, ProductCommons, List[ProductAttributeCommons])]) +case class InBoundGetProductCollectionItemsTree(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: List[(ProductCollectionItemCommons, ProductCommons, List[ProductAttributeCommons])])extends InBoundTrait[List[(ProductCollectionItemCommons, ProductCommons, List[ProductAttributeCommons])]] case class OutBoundCreateMeeting(outboundAdapterCallContext: OutboundAdapterCallContext, @@ -439,7 +439,13 @@ case class InBoundGetUser(inboundAdapterCallContext: InboundAdapterCallContext, //create bound case classes -case class OutBoundCreateChallenge(outboundAdapterCallContext: OutboundAdapterCallContext, bankId: BankId, accountId: AccountId, userId: String, transactionRequestType: TransactionRequestType, transactionRequestId: String, scaMethod: Option[Any]) extends TopicTrait +case class OutBoundCreateChallenge(outboundAdapterCallContext: OutboundAdapterCallContext, + bankId: BankId, + accountId: AccountId, + userId: String, + transactionRequestType: TransactionRequestType, + transactionRequestId: String, + scaMethod: Option[Any]) extends TopicTrait case class InBoundCreateChallenge(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: String) extends InBoundTrait[String] @@ -533,7 +539,7 @@ case class OutBoundCreateOrUpdateCardAttribute(outboundAdapterCallContext: Outbo cardId: Option[String], cardAttributeId: Option[String], name: String, - attributeType: CardAttributeType.Value, + cardAttributeType: CardAttributeType.Value, value: String ) extends TopicTrait case class InBoundCreateOrUpdateCardAttribute(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: CardAttributeCommons) extends InBoundTrait[CardAttributeCommons] @@ -668,29 +674,36 @@ case class InBoundGetPhysicalCardForBank(inboundAdapterCallContext: InboundAdapt case class OutBoundGetPhysicalCardsForBank(outboundAdapterCallContext: OutboundAdapterCallContext, bank: Bank, - user: User) extends TopicTrait + user: User, + limit: Int, + offset: Int, + fromDate: String, + toDate: String) extends TopicTrait case class InBoundGetPhysicalCardsForBank(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: List[PhysicalCard]) extends InBoundTrait[List[PhysicalCard]] - +//bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId case class OutBoundCreatePhysicalCard(outboundAdapterCallContext: OutboundAdapterCallContext, - bankCardNumber: String, - nameOnCard: String, - issueNumber: String, - serialNumber: String, - validFrom: Date, - expires: Date, - enabled: Boolean, - cancelled: Boolean, - onHotList: Boolean, - technology: String, - networks: List[String], - allows: List[String], - accountId: String, - bankId: String, - replacement: Option[CardReplacementInfo], - pinResets: List[PinResetInfo], - collected: Option[CardCollectionInfo], - posted: Option[CardPostedInfo]) extends TopicTrait + bankCardNumber: String, + nameOnCard: String, + cardType: String, + issueNumber: String, + serialNumber: String, + validFrom: Date, + expires: Date, + enabled: Boolean, + cancelled: Boolean, + onHotList: Boolean, + technology: String, + networks: List[String], + allows: List[String], + accountId: String, + bankId: String, + replacement: Option[CardReplacementInfo], + pinResets: List[PinResetInfo], + collected: Option[CardCollectionInfo], + posted: Option[CardPostedInfo], + customerId: String + ) extends TopicTrait case class InBoundCreatePhysicalCard(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: PhysicalCard) extends InBoundTrait[PhysicalCard] diff --git a/obp-commons/src/main/scala/com/openbankproject/commons/util/ReflectUtils.scala b/obp-commons/src/main/scala/com/openbankproject/commons/util/ReflectUtils.scala index 32dacbee7..77dcf7900 100644 --- a/obp-commons/src/main/scala/com/openbankproject/commons/util/ReflectUtils.scala +++ b/obp-commons/src/main/scala/com/openbankproject/commons/util/ReflectUtils.scala @@ -306,7 +306,7 @@ object ReflectUtils { tp.typeSymbol.isClass && !tp.typeSymbol.asClass.isTrait match { case false => Map.empty[String, ru.Type] case true => { - ReflectUtils.getPrimaryConstructor(tp) + getPrimaryConstructor(tp) .paramLists .headOption .getOrElse(Nil) diff --git a/pom.xml b/pom.xml index 023e6fb5b..b45925766 100644 --- a/pom.xml +++ b/pom.xml @@ -71,6 +71,11 @@ + + com.tesobe + obp-commons + ${project.version} + net.liftweb lift-common_${scala.version}