Closes #75 - createAccount shouldn't ignore type and should accept label

This commit is contained in:
Petar Bozin 2016-08-18 17:50:08 +02:00
parent 85025f30a0
commit e1a4644510
11 changed files with 90 additions and 46 deletions

View File

@ -1002,8 +1002,8 @@ trait APIMethods200 {
|
|If USER_ID is not specified the account will be owned by the logged in User.
|
|Note: Type is currently ignored and the Amount must be zero. You can update the account label with another call (see 1_2_1-updateAccountLabel)""".stripMargin,
Extraction.decompose(CreateAccountJSON("A user_id","CURRENT", AmountOfMoneyJSON121("EUR", "0"))),
|Note: The Amount must be zero.""".stripMargin,
Extraction.decompose(CreateAccountJSON("A user_id","CURRENT", "Label", AmountOfMoneyJSON121("EUR", "0"))),
emptyObjectJson,
emptyObjectJson :: Nil,
false,
@ -1035,13 +1035,14 @@ trait APIMethods200 {
isAllowed <- booleanToBox(hasEntitlement(bankId.value, loggedInUser.userId, CanCreateAccount) == true || (user_id == loggedInUser.userId) , s"User must either create account for self or have role $CanCreateAccount")
initialBalanceAsString <- tryo (jsonBody.balance.amount) ?~ ErrorMessages.InvalidAccountBalanceAmount
accountType <- tryo(jsonBody.`type`) ?~ ErrorMessages.InvalidAccountType
accountLabel <- tryo(jsonBody.`type`) //?~ ErrorMessages.InvalidAccountLabel
initialBalanceAsNumber <- tryo {BigDecimal(initialBalanceAsString)} ?~! ErrorMessages.InvalidAccountInitalBalance
isTrue <- booleanToBox(0 == initialBalanceAsNumber) ?~ s"Initial balance must be zero"
currency <- tryo (jsonBody.balance.currency) ?~ ErrorMessages.InvalidAccountBalanceCurrency
// TODO Since this is a PUT, we should replace the resource if it already exists but will need to check persmissions
accountDoesNotExist <- booleanToBox(BankAccount(bankId, accountId).isEmpty,
s"Account with id $accountId already exists at bank $bankId")
bankAccount <- Connector.connector.vend.createSandboxBankAccount(bankId, accountId, currency, initialBalanceAsNumber, postedOrLoggedInUser.name)
bankAccount <- Connector.connector.vend.createSandboxBankAccount(bankId, accountId, accountType, accountLabel, currency, initialBalanceAsNumber, postedOrLoggedInUser.name)
} yield {
BankAccountCreation.setAsOwner(bankId, accountId, postedOrLoggedInUser)

View File

@ -35,16 +35,16 @@ import java.net.URL
import java.util.Date
import code.TransactionTypes.TransactionType.TransactionType
import code.meetings.Meeting
import code.entitlement.Entitlement
import code.meetings.Meeting
import code.model.dataAccess.OBPUser
import code.transactionrequests.TransactionRequests._
import net.liftweb.common.{Full, Box}
import net.liftweb.common.{Box, Full}
// import code.api.util.APIUtil.ApiLink
import code.api.v1_2_1.{AmountOfMoneyJSON, JSONFactory => JSONFactory121, MinimalBankJSON => MinimalBankJSON121, OtherAccountJSON => OtherAccountJSON121, ThisAccountJSON => ThisAccountJSON121, TransactionDetailsJSON => TransactionDetailsJSON121, UserJSON => UserJSON121, ViewJSON => ViewJSON121}
import code.api.v1_4_0.JSONFactory1_4_0.{CustomerFaceImageJson, ChallengeJSON, TransactionRequestAccountJSON}
import code.api.v1_4_0.JSONFactory1_4_0.{ChallengeJSON, CustomerFaceImageJson, TransactionRequestAccountJSON}
import code.kycchecks.KycCheck
import code.kycdocuments.KycDocument
import code.kycmedias.KycMedia
@ -143,6 +143,7 @@ case class BasicAccountJSON(
// Json used in account creation
case class CreateAccountJSON(
user_id : String,
label : String,
`type` : String,
balance : AmountOfMoneyJSON
)

View File

@ -8,7 +8,6 @@ import code.api.util.ErrorMessages
import code.fx.fx
import code.management.ImporterAPI.ImporterTransaction
import code.model.{OtherBankAccount, Transaction, User, _}
import code.tesobe.CashTransaction
import code.transactionrequests.TransactionRequests
import code.transactionrequests.TransactionRequests._
import code.util.Helper._
@ -522,10 +521,11 @@ trait Connector {
*/
//creates a bank account (if it doesn't exist) and creates a bank (if it doesn't exist)
def createBankAndAccount(bankName : String, bankNationalIdentifier : String, accountNumber : String, accountHolderName : String) : (Bank, BankAccount)
def createBankAndAccount(bankName : String, bankNationalIdentifier : String, accountNumber : String,
accountType: String, accountLabel:String, currency: String, accountHolderName : String) : (Bank, BankAccount)
//generates an unused account number and then creates the sandbox account using that number
def createSandboxBankAccount(bankId : BankId, accountId : AccountId, currency : String, initialBalance : BigDecimal, accountHolderName : String) : Box[BankAccount] = {
def createSandboxBankAccount(bankId : BankId, accountId : AccountId, accountType: String, accountLabel: String, currency : String, initialBalance : BigDecimal, accountHolderName : String) : Box[BankAccount] = {
val uniqueAccountNumber = {
def exists(number : String) = Connector.connector.vend.accountExists(bankId, number)
@ -540,12 +540,23 @@ trait Connector {
appendUntilOkay(firstTry)
}
createSandboxBankAccount(bankId, accountId, uniqueAccountNumber, currency, initialBalance, accountHolderName)
createSandboxBankAccount(
bankId,
accountId,
uniqueAccountNumber,
accountType,
accountLabel,
currency,
initialBalance,
accountHolderName
)
}
//creates a bank account for an existing bank, with the appropriate values set. Can fail if the bank doesn't exist
def createSandboxBankAccount(bankId : BankId, accountId : AccountId, accountNumber: String,
currency : String, initialBalance : BigDecimal, accountHolderName : String) : Box[BankAccount]
accountType: String, accountLabel: String, currency : String,
initialBalance : BigDecimal, accountHolderName : String) : Box[BankAccount]
//sets a user as an account owner/holder
def setAccountHolder(bankAccountUID: BankAccountUID, user : User) : Unit

View File

@ -568,9 +568,10 @@ object KafkaMappedConnector extends Connector with CreateViewImpls with Loggable
//creates a bank account (if it doesn't exist) and creates a bank (if it doesn't exist)
//again assume national identifier is unique
override def createBankAndAccount(bankName: String, bankNationalIdentifier: String, accountNumber: String, accountHolderName: String): (Bank, BankAccount) = {
override def createBankAndAccount(bankName: String, bankNationalIdentifier: String, accountNumber: String,
accountType: String, accountLabel: String, currency: String, accountHolderName: String): (Bank, BankAccount) = {
//don't require and exact match on the name, just the identifier
val bank = MappedBank.find(By(MappedBank.national_identifier, bankNationalIdentifier)) match {
val bank: Bank = MappedBank.find(By(MappedBank.national_identifier, bankNationalIdentifier)) match {
case Full(b) =>
logger.info(s"bank with id ${b.bankId} and national identifier ${b.nationalIdentifier} found")
b
@ -586,7 +587,16 @@ object KafkaMappedConnector extends Connector with CreateViewImpls with Loggable
}
//TODO: pass in currency as a parameter?
val account = createAccountIfNotExisting(bank.bankId, AccountId(UUID.randomUUID().toString), accountNumber, "EUR", 0L, accountHolderName)
val account = createAccountIfNotExisting(
bank.bankId,
AccountId(UUID.randomUUID().toString),
accountNumber,
accountType,
accountLabel,
currency,
0L,
accountHolderName
)
(bank, account)
}
@ -666,14 +676,15 @@ object KafkaMappedConnector extends Connector with CreateViewImpls with Loggable
//creates a bank account for an existing bank, with the appropriate values set. Can fail if the bank doesn't exist
override def createSandboxBankAccount(bankId: BankId, accountID: AccountId, accountNumber: String,
currency: String, initialBalance: BigDecimal, accountHolderName: String): Box[BankAccount] = {
accountType: String, accountLabel: String, currency: String,
initialBalance: BigDecimal, accountHolderName: String): Box[BankAccount] = {
for {
bank <- getBank(bankId) //bank is not really used, but doing this will ensure account creations fails if the bank doesn't
} yield {
val balanceInSmallestCurrencyUnits = Helper.convertToSmallestCurrencyUnits(initialBalance, currency)
createAccountIfNotExisting(bankId, accountID, accountNumber, currency, balanceInSmallestCurrencyUnits, accountHolderName)
createAccountIfNotExisting(bankId, accountID, accountNumber, accountType, accountLabel, currency, balanceInSmallestCurrencyUnits, accountHolderName)
}
}
@ -684,7 +695,8 @@ object KafkaMappedConnector extends Connector with CreateViewImpls with Loggable
}
private def createAccountIfNotExisting(bankId: BankId, accountID: AccountId, accountNumber: String,
currency: String, balanceInSmallestCurrencyUnits: Long, accountHolderName: String) : BankAccount = {
accountType: String, accountLabel: String, currency: String,
balanceInSmallestCurrencyUnits: Long, accountHolderName: String) : BankAccount = {
getBankAccount(bankId, accountID) match {
case Full(a) =>
logger.info(s"account with id $accountID at bank with id $bankId already exists. No need to create a new one.")
@ -695,6 +707,8 @@ object KafkaMappedConnector extends Connector with CreateViewImpls with Loggable
.bank(bankId.value)
.theAccountId(accountID.value)
.accountNumber(accountNumber)
.accountType(accountType)
.accountLabel(accountLabel)
.accountCurrency(currency)
.accountBalance(balanceInSmallestCurrencyUnits)
.holder(accountHolderName)

View File

@ -7,7 +7,6 @@ import code.management.ImporterAPI.ImporterTransaction
import code.metadata.counterparties.{Counterparties, Metadata, MongoCounterparties}
import code.model._
import code.model.dataAccess._
import code.tesobe.CashTransaction
import code.transactionrequests.TransactionRequests._
import code.util.Helper
import com.mongodb.QueryBuilder
@ -23,7 +22,6 @@ import org.bson.types.ObjectId
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent._
import scala.math.BigDecimal.RoundingMode
private object LocalConnector extends Connector with Loggable {
@ -353,7 +351,8 @@ private object LocalConnector extends Connector with Loggable {
}
//Need to pass in @hostedBank because the Account model doesn't have any references to BankId, just to the mongo id of the Bank object (which itself does have the bank id)
private def createAccount(hostedBank : HostedBank, accountId : AccountId, accountNumber: String, currency : String, initialBalance : BigDecimal, holderName : String) : BankAccount = {
private def createAccount(hostedBank : HostedBank, accountId : AccountId, accountNumber: String,
accountType: String, accountLabel: String, currency : String, initialBalance : BigDecimal, holderName : String) : BankAccount = {
import net.liftweb.mongodb.BsonDSL._
Account.find(
(Account.accountNumber.name -> accountNumber)~
@ -371,11 +370,11 @@ private object LocalConnector extends Connector with Loggable {
.accountBalance(initialBalance)
.holder(holderName)
.accountNumber(accountNumber)
.kind("current")
.kind(accountType)
.accountLabel(accountLabel)
.accountName("")
.permalink(accountId.value)
.bankID(hostedBank.id.is)
.accountLabel("")
.accountCurrency(currency)
.accountIban("")
.accountLastUpdate(now)
@ -386,7 +385,7 @@ private object LocalConnector extends Connector with Loggable {
}
//creates a bank account (if it doesn't exist) and creates a bank (if it doesn't exist)
override def createBankAndAccount(bankName : String, bankNationalIdentifier : String, accountNumber : String, accountHolderName : String): (Bank, BankAccount) = {
override def createBankAndAccount(bankName : String, bankNationalIdentifier : String, accountNumber : String, accountType: String, accountLabel: String, currency: String, accountHolderName : String): (Bank, BankAccount) = {
// TODO: use a more unique id for the long term
val hostedBank = {
@ -414,7 +413,7 @@ private object LocalConnector extends Connector with Loggable {
}
val createdAccount = createAccount(hostedBank, AccountId(UUID.randomUUID().toString),
accountNumber, "EUR", BigDecimal("0.00"), accountHolderName)
accountNumber, accountType, accountLabel, currency, BigDecimal("0.00"), accountHolderName)
(hostedBank, createdAccount)
}
@ -456,9 +455,10 @@ private object LocalConnector extends Connector with Loggable {
//creates a bank account for an existing bank, with the appropriate values set
override def createSandboxBankAccount(bankId: BankId, accountId: AccountId, accountNumber: String,
currency: String, initialBalance: BigDecimal, accountHolderName: String): Box[BankAccount] = {
accountType: String, accountLabel: String, currency: String,
initialBalance: BigDecimal, accountHolderName: String): Box[BankAccount] = {
HostedBank.find(bankId) match {
case Full(b) => Full(createAccount(b, accountId, accountNumber, currency, initialBalance, accountHolderName))
case Full(b) => Full(createAccount(b, accountId, accountNumber, accountType, accountLabel, currency, initialBalance, accountHolderName))
case _ => Failure(s"Bank with id ${bankId.value} not found. Cannot create account at non-existing bank.")
}

View File

@ -331,7 +331,7 @@ object LocalMappedConnector extends Connector with Loggable {
//creates a bank account (if it doesn't exist) and creates a bank (if it doesn't exist)
//again assume national identifier is unique
override def createBankAndAccount(bankName: String, bankNationalIdentifier: String, accountNumber: String, accountHolderName: String): (Bank, BankAccount) = {
override def createBankAndAccount(bankName: String, bankNationalIdentifier: String, accountNumber: String, accountType: String, accountLabel: String, currency: String, accountHolderName: String): (Bank, BankAccount) = {
//don't require and exact match on the name, just the identifier
val bank = MappedBank.find(By(MappedBank.national_identifier, bankNationalIdentifier)) match {
case Full(b) =>
@ -349,7 +349,7 @@ object LocalMappedConnector extends Connector with Loggable {
}
//TODO: pass in currency as a parameter?
val account = createAccountIfNotExisting(bank.bankId, AccountId(UUID.randomUUID().toString), accountNumber, "EUR", 0L, accountHolderName)
val account = createAccountIfNotExisting(bank.bankId, AccountId(UUID.randomUUID().toString), accountNumber, accountType, accountLabel, currency, 0L, accountHolderName)
(bank, account)
}
@ -434,6 +434,7 @@ object LocalMappedConnector extends Connector with Loggable {
//creates a bank account for an existing bank, with the appropriate values set. Can fail if the bank doesn't exist
override def createSandboxBankAccount(bankId: BankId, accountId: AccountId, accountNumber: String,
accountType: String, accountLabel: String,
currency: String, initialBalance: BigDecimal, accountHolderName: String): Box[BankAccount] = {
for {
@ -441,7 +442,7 @@ object LocalMappedConnector extends Connector with Loggable {
} yield {
val balanceInSmallestCurrencyUnits = Helper.convertToSmallestCurrencyUnits(initialBalance, currency)
createAccountIfNotExisting(bankId, accountId, accountNumber, currency, balanceInSmallestCurrencyUnits, accountHolderName)
createAccountIfNotExisting(bankId, accountId, accountNumber, accountType, accountLabel, currency, balanceInSmallestCurrencyUnits, accountHolderName)
}
}
@ -452,7 +453,8 @@ object LocalMappedConnector extends Connector with Loggable {
}
private def createAccountIfNotExisting(bankId: BankId, accountId: AccountId, accountNumber: String,
currency: String, balanceInSmallestCurrencyUnits: Long, accountHolderName: String) : BankAccount = {
accountType: String, accountLabel: String, currency: String,
balanceInSmallestCurrencyUnits: Long, accountHolderName: String) : BankAccount = {
getBankAccount(bankId, accountId) match {
case Full(a) =>
logger.info(s"account with id $accountId at bank with id $bankId already exists. No need to create a new one.")
@ -462,6 +464,8 @@ object LocalMappedConnector extends Connector with Loggable {
.bank(bankId.value)
.theAccountId(accountId.value)
.accountNumber(accountNumber)
.kind(accountType)
.accountLabel(accountLabel)
.accountCurrency(currency)
.accountBalance(balanceInSmallestCurrencyUnits)
.holder(accountHolderName)

View File

@ -139,12 +139,17 @@ import com.tesobe.model.{CreateBankAccount, UpdateBankAccount}
case msg@AMQPMessage(message: CreateBankAccount) => {
logger.info(s"got message to create account/bank: ${message.accountNumber} / ${message.bankIdentifier}")
//TODO: Revise those dummy values
val accountType = "AMPQ"
val accountLabel = message.accountNumber
val currency = "EUR"
val foundUser = Users.users.vend.getUserByProviderId(message.accountOwnerProvider, message.accountOwnerId)
val result = for {
user <- foundUser ?~!
s"user ${message.accountOwnerId} at ${message.accountOwnerProvider} not found. Could not create the account with owner view"
} yield {
val (_, bankAccount) = Connector.connector.vend.createBankAndAccount(message.bankName, message.bankIdentifier, message.accountNumber, user.name)
val (_, bankAccount) = Connector.connector.vend.createBankAndAccount(message.bankName, message.bankIdentifier, message.accountNumber, accountType, accountLabel, currency, user.name)
logger.info(s"created account with id ${bankAccount.bankId.value} with number ${bankAccount.number} at bank with identifier ${message.bankIdentifier}")
BankAccountCreation.setAsOwner(bankAccount.bankId, bankAccount.accountId, user)
}

View File

@ -20,9 +20,11 @@ object CreateTestAccountForm{
var bankId = ""
var currency = ""
var initialBalance = ""
var accountType = ""
var accountLabel = ""
val processForm : () => JsCmd = () => {
val createdAccount = createAccount(AccountId(accountId), BankId(bankId), currency, initialBalance)
val createdAccount = createAccount(AccountId(accountId), BankId(bankId), accountType, accountLabel, currency, initialBalance)
createdAccount match {
case Full(acc) => showSuccess(acc)
case Failure(msg, _, _) => showError(msg)
@ -66,7 +68,7 @@ object CreateTestAccountForm{
* Attempts to create a new account, based on form params
* @return a box containing the created account or reason for account creation failure
*/
def createAccount(accountId : AccountId, bankId : BankId, currency : String, initialBalance : String) : Box[BankAccount] = {
def createAccount(accountId : AccountId, bankId : BankId, accountType: String, accountLabel: String, currency : String, initialBalance : String) : Box[BankAccount] = {
if(accountId.value == "") Failure("Account id cannot be empty")
else if(bankId.value == "") Failure("Bank id cannot be empty")
else if(currency == "") Failure("Currency cannot be empty")
@ -79,7 +81,7 @@ object CreateTestAccountForm{
bank <- Bank(bankId) ?~ s"Bank $bankId not found"
accountDoesNotExist <- booleanToBox(BankAccount(bankId, accountId).isEmpty,
s"Account with id $accountId already exists at bank $bankId")
bankAccount <- Connector.connector.vend.createSandboxBankAccount(bankId, accountId, currency, initialBalanceAsNumber, user.name)
bankAccount <- Connector.connector.vend.createSandboxBankAccount(bankId, accountId, accountType, accountLabel, currency, initialBalanceAsNumber, user.name)
} yield {
BankAccountCreation.setAsOwner(bankId, accountId, user)
bankAccount

View File

@ -7,7 +7,6 @@ import code.api.{DefaultUsers, ServerSetup}
import code.bankconnectors.{Connector, OBPQueryParam}
import code.management.ImporterAPI.ImporterTransaction
import code.model.{PhysicalCard, Consumer => OBPConsumer, Token => OBPToken, _}
import code.tesobe.CashTransaction
import code.transactionrequests.TransactionRequests._
import net.liftweb.common.{Box, Empty, Failure, Loggable}
@ -111,8 +110,9 @@ class PhysicalCardsTest extends ServerSetup with DefaultUsers {
Failure("not supported")
}
override def createBankAndAccount(bankName : String, bankNationalIdentifier : String,
accountNumber : String, accountHolderName : String): (Bank, BankAccount) = ???
override def createBankAndAccount(bankName : String, bankNationalIdentifier : String, accountNumber : String,
accountType: String, accountLabel: String, currency: String,
accountHolderName : String): (Bank, BankAccount) = ???
//sets a user as an account owner/holder
override def setAccountHolder(bankAccountUID: BankAccountUID, user: User): Unit = ???
@ -123,8 +123,8 @@ class PhysicalCardsTest extends ServerSetup with DefaultUsers {
override def removeAccount(bankId: BankId, accountId: AccountId) : Boolean = ???
//creates a bank account for an existing bank, with the appropriate values set. Can fail if the bank doesn't exist
override def createSandboxBankAccount(bankId: BankId, accountId: AccountId,
accountNumber: String, currency: String,
override def createSandboxBankAccount(bankId: BankId, accountId: AccountId, accountNumber: String,
accountType: String, accountLabel: String, currency: String,
initialBalance: BigDecimal, accountHolderName: String): Box[AccountType] = ???
//used by transaction import api call to check for duplicates

View File

@ -18,6 +18,7 @@ class AccountTest extends V200ServerSetup with DefaultUsers {
val mockBankId = BankId("testBank1")
val newAccountId1 = "NEW_ACCOUNT_ID_01"
val newAccountLabel1 = "NEW_ACCOUNT_LABEL_01"
override def beforeAll() {
@ -36,7 +37,7 @@ class AccountTest extends V200ServerSetup with DefaultUsers {
val testBank = mockBankId
Then("We create an private account at the bank")
val accountPutJSON = CreateAccountJSON(obpuser1.userId,"CURRENT", AmountOfMoneyJSON121("EUR", "0"))
val accountPutJSON = CreateAccountJSON(obpuser1.userId, "CURRENT", newAccountLabel1, AmountOfMoneyJSON121("EUR", "0"))
val requestPut = (v2_0Request / "banks" / testBank.value / "accounts" / newAccountId1).PUT <@ (user1)
val responsePut = makePutRequest(requestPut, write(accountPutJSON))
@ -84,7 +85,7 @@ class AccountTest extends V200ServerSetup with DefaultUsers {
val testBank = mockBankId
Then("We create an private account at the bank")
val accountPutJSON = CreateAccountJSON(obpuser1.userId,"CURRENT", AmountOfMoneyJSON121("EUR", "0"))
val accountPutJSON = CreateAccountJSON(obpuser1.userId,"CURRENT", newAccountLabel1, AmountOfMoneyJSON121("EUR", "0"))
val requestPut = (v2_0Request / "banks" / testBank.value / "accounts" / newAccountId1).PUT <@ (user1)
val responsePut = makePutRequest(requestPut, write(accountPutJSON))

View File

@ -24,6 +24,9 @@ class BankAccountCreationTest extends ServerSetup with DefaultUsers with Default
val accountNumber = "12313213"
val accountHolderName = "Rolf Rolfson"
val accountLabel = accountNumber + " " + accountHolderName
val accountType = "some-type"
val currency = "EUR"
// scenario("Creating a duplicate bank should fail") {
//
@ -58,7 +61,7 @@ class BankAccountCreationTest extends ServerSetup with DefaultUsers with Default
Connector.connector.vend.getBanks.size should equal(0)
When("We create an account at that bank")
val (_, returnedAccount) = Connector.connector.vend.createBankAndAccount(bankName, bankNationalIdentifier, accountNumber, accountHolderName)
val (_, returnedAccount) = Connector.connector.vend.createBankAndAccount(bankName, bankNationalIdentifier, accountNumber, accountType, accountLabel, currency, accountHolderName)
Then("A bank should now exist, with the correct parameters")
val allBanks = Connector.connector.vend.getBanks
@ -86,7 +89,7 @@ class BankAccountCreationTest extends ServerSetup with DefaultUsers with Default
When("We create an account at that bank")
val (_, returnedAccount) = Connector.connector.vend.createBankAndAccount(existingBank.fullName, existingBank.nationalIdentifier, accountNumber, accountHolderName)
val (_, returnedAccount) = Connector.connector.vend.createBankAndAccount(existingBank.fullName, existingBank.nationalIdentifier, accountNumber, accountType, accountLabel, currency, accountHolderName)
Then("No new bank should be created")
val allBanksAfter = Connector.connector.vend.getBanks
@ -113,13 +116,15 @@ class BankAccountCreationTest extends ServerSetup with DefaultUsers with Default
val initialBalance = BigDecimal("1000.00")
val accountHolderName = "Some Person"
val defaultAccountNumber = "1231213213"
val accountType = "some-type"
val accountLabel = defaultAccountNumber + " " + accountHolderName
scenario("Creating a bank account when the associated bank does not exist") {
Given("A bank that doesn't exist")
Connector.connector.vend.getBank(bankId).isDefined should equal(false)
When("We try to create an account at that bank")
Connector.connector.vend.createSandboxBankAccount(bankId, accountId, defaultAccountNumber, currency, initialBalance, accountHolderName)
Connector.connector.vend.createSandboxBankAccount(bankId, accountId, defaultAccountNumber, accountType, accountLabel, currency, initialBalance, accountHolderName)
Then("No account is created")
Connector.connector.vend.getBankAccount(bankId, accountId).isDefined should equal(false)
@ -132,7 +137,7 @@ class BankAccountCreationTest extends ServerSetup with DefaultUsers with Default
Connector.connector.vend.getBank(bankId).isDefined should equal(true)
When("We try to create an account at that bank")
Connector.connector.vend.createSandboxBankAccount(bankId, accountId, defaultAccountNumber, currency, initialBalance, accountHolderName)
Connector.connector.vend.createSandboxBankAccount(bankId, accountId, defaultAccountNumber, accountType, accountLabel, currency, initialBalance, accountHolderName)
Then("An account with the proper parameters should be created")
val createdAccBox = Connector.connector.vend.getBankAccount(bankId, accountId)
@ -153,7 +158,7 @@ class BankAccountCreationTest extends ServerSetup with DefaultUsers with Default
Connector.connector.vend.getBank(bankId).isDefined should equal(true)
When("We try to create an account at that bank")
Connector.connector.vend.createSandboxBankAccount(bankId, accountId, currency, initialBalance, accountHolderName)
Connector.connector.vend.createSandboxBankAccount(bankId, accountId, accountType, accountLabel, currency, initialBalance, accountHolderName)
Then("An account with the proper parameters should be created")
val createdAccBox = Connector.connector.vend.getBankAccount(bankId, accountId)