diff --git a/obp-api/src/main/scala/code/api/util/NewStyle.scala b/obp-api/src/main/scala/code/api/util/NewStyle.scala index 073675c50..9caa00f7e 100644 --- a/obp-api/src/main/scala/code/api/util/NewStyle.scala +++ b/obp-api/src/main/scala/code/api/util/NewStyle.scala @@ -2275,31 +2275,6 @@ object NewStyle extends MdcLoggable{ ) map { i => (unboxFullOrFail(i._1, callContext, UnknownError, 400), i._2) } - - def addBankAccount( - bankId: BankId, - accountType: String, - accountLabel: String, - currency: String, - initialBalance: BigDecimal, - accountHolderName: String, - branchId: String, - accountRoutings: List[AccountRouting], - callContext: Option[CallContext] - ): OBPReturnType[BankAccount] = - Connector.connector.vend.addBankAccount( - bankId: BankId, - accountType: String, - accountLabel: String, - currency: String, - initialBalance: BigDecimal, - accountHolderName: String, - branchId: String, - accountRoutings: List[AccountRouting], - callContext: Option[CallContext] - ) map { - i => (unboxFullOrFail(i._1, callContext, UnknownError, 400), i._2) - } def updateBankAccount( bankId: BankId, diff --git a/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala b/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala index 21f646de3..8b963c508 100644 --- a/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala +++ b/obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala @@ -2608,8 +2608,9 @@ trait APIMethods400 extends MdcLoggable { _ <- Helper.booleanToFuture(s"$AccountRoutingAlreadyExist (${alreadyExistingAccountRouting.mkString("; ")})", cc=callContext) { alreadyExistingAccountRouting.isEmpty } - (bankAccount,callContext) <- NewStyle.function.addBankAccount( + (bankAccount,callContext) <- NewStyle.function.createBankAccount( bankId, + AccountId(APIUtil.generateUUID()), accountType, accountLabel, currency, diff --git a/obp-api/src/main/scala/code/bankconnectors/Connector.scala b/obp-api/src/main/scala/code/bankconnectors/Connector.scala index e55d18e09..34b1b8c2a 100644 --- a/obp-api/src/main/scala/code/bankconnectors/Connector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/Connector.scala @@ -795,18 +795,6 @@ trait Connector extends MdcLoggable { /* non-standard calls --do not make sense in the regular context but are used for e.g. tests */ - - def addBankAccount( - bankId: BankId, - accountType: String, - accountLabel: String, - currency: String, - initialBalance: BigDecimal, - accountHolderName: String, - branchId: String, - accountRoutings: List[AccountRouting], - callContext: Option[CallContext] - ): OBPReturnType[Box[BankAccount]] = Future{(Failure(setUnimplementedError(nameOf(addBankAccount _))), callContext)} def updateBankAccount( @@ -821,8 +809,6 @@ trait Connector extends MdcLoggable { - //generates an unused account number and then creates the sandbox account using that number - //TODO, this is new style method, it return future, but do not use it yet. only for messageDoc now. def createBankAccount( bankId: BankId, accountId: AccountId, diff --git a/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala b/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala index c72fcc46c..bbf8f809b 100644 --- a/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala +++ b/obp-api/src/main/scala/code/bankconnectors/ConnectorBuilderUtil.scala @@ -375,33 +375,29 @@ object ConnectorBuilderUtil { "validateChallengeAnswerC5", "validateChallengeAnswerV2", "getCounterpartyByIbanAndBankAccountId", + "getStatus", + "getChargeValue", + "saveTransactionRequestTransaction", + "saveTransactionRequestChallenge", + "getTransactionRequestTypes", + "updateAccountLabel", + "getProduct", + "createOrUpdateBranch", + "createOrUpdateAtm", + "createOrUpdateProduct", + "createOrUpdateFXRate", + "getTransactionRequestTypeCharges", + "getCounterpartyFromTransaction", + "getCounterpartiesFromTransaction", + "saveTransactionRequestStatusImpl" ).distinct /** * these connector methods have special parameter or return type */ val specialMethods = List( - "getPhysicalCards", - "createTransactionRequest", - "getStatus", - "getChargeValue", - "saveTransactionRequestTransaction", - "saveTransactionRequestChallenge", - "getTransactionRequests", - "getTransactionRequestTypes", - "createTransactionAfterChallenge", - "updateAccountLabel", - "getProduct", - "createOrUpdateBranch", "createOrUpdateBank", - "createOrUpdateAtm", - "createOrUpdateProduct", - "createOrUpdateFXRate", - "getCurrentFxRate", - "getTransactionRequestTypeCharges", - "getCounterpartyFromTransaction", - "getCounterpartiesFromTransaction", - "saveTransactionRequestStatusImpl", + "getCurrentFxRate" ).distinct val omitMethods = List( @@ -409,7 +405,6 @@ object ConnectorBuilderUtil { // "deleteAttributeDefinition", // should not be auto generated // "getAttributeDefinition", // should not be auto generated // "createStandingOrder", // should not be auto generated - // "addBankAccount", // non-standard calls, should be used for test //** the follow 5 methods should not be generated, should create manually // "dynamicEntityProcess", diff --git a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala index d5d4befad..e0741fc27 100644 --- a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala @@ -2098,47 +2098,6 @@ object LocalMappedConnector extends Connector with MdcLoggable { }, callContext) } - - override def addBankAccount( - bankId: BankId, - accountType: String, - accountLabel: String, - currency: String, - initialBalance: BigDecimal, - accountHolderName: String, - branchId: String, - accountRoutings: List[AccountRouting], - callContext: Option[CallContext] - ): OBPReturnType[Box[BankAccount]] = Future { - val accountId = AccountId(APIUtil.generateUUID()) - val uniqueAccountNumber = { - def exists(number: String) = LocalMappedConnectorInternal.accountExists(bankId, number).openOrThrowException(attemptedToOpenAnEmptyBox) - - def appendUntilOkay(number: String): String = { - val newNumber = number + Random.nextInt(10) - if (!exists(newNumber)) newNumber - else appendUntilOkay(newNumber) - } - - //generates a random 8 digit account number - val firstTry = (Random.nextDouble() * 10E8).toInt.toString - appendUntilOkay(firstTry) - } - (LocalMappedConnectorInternal.createSandboxBankAccount( - bankId, - accountId, - uniqueAccountNumber, - accountType, - accountLabel, - currency, - initialBalance, - accountHolderName, - branchId: String, //added field in V220 - accountRoutings - ), callContext) - } - - override def createBankAccount( bankId: BankId, accountId: AccountId, 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 efafb0599..2fafc5ffe 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 @@ -1146,9 +1146,6 @@ case class InBoundCreateTransactionAfterChallenge(status: Status, data: Transact override val inboundAdapterCallContext: InboundAdapterCallContext = InboundAdapterCallContext() } -case class OutBoundAddBankAccount(outboundAdapterCallContext: OutboundAdapterCallContext, bankId: BankId, accountType: String, accountLabel: String, currency: String, initialBalance: BigDecimal, accountHolderName: String, branchId: String, accountRoutings: List[AccountRouting]) extends TopicTrait -case class InBoundAddBankAccount(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: BankAccountCommons) extends InBoundTrait[BankAccountCommons] - case class BankAndBankAccount(bank: BankCommons, account: BankAccountCommons) case class OutBoundCreateBankAndAccount(bankName: String, bankNationalIdentifier: String, accountNumber: String, accountType: String, accountLabel: String, currency: String, accountHolderName: String, branchId: String, accountRoutingScheme: String, accountRoutingAddress: String) extends TopicTrait case class InBoundCreateBankAndAccount(status: Status, value: BankAndBankAccount) extends InBoundTrait[(Bank, BankAccount)] {