Ensured counterparty is unique for name/ bank_id/account_id/view_id;

Added Test for Create counterparty ;
Added Test scenarios for SEPA;
This commit is contained in:
hongwei1 2016-11-29 15:13:20 +01:00
parent 34b47459bf
commit 39fcb408cb
15 changed files with 775 additions and 458 deletions

View File

@ -169,7 +169,7 @@ class Boot extends Loggable{
// ensure our relational database's tables are created/fit the schema
if(Props.get("connector").getOrElse("") == "mapped" ||
Props.get("connector").getOrElse("") == "kafka" )
Props.get("connector").getOrElse("").startsWith("kafka") )
schemifyAll()
// This sets up MongoDB config (for the mongodb connector)

View File

@ -96,9 +96,9 @@ object ErrorMessages {
val AtmNotFoundByAtmId = "OBP-30009: ATM not found. Please specify a valid value for ATM_ID."
val BranchNotFoundByBranchId = "OBP-300010: Branch not found. Please specify a valid value for BRANCH_ID."
val ProductNotFoundByProductCode = "OBP-30011: Product not found. Please specify a valid value for PRODUCT_CODE."
val CounterpartyNotFoundByIban = "OBP-30012: Counterparty not found. The IBan specified does not exist on this server."
val CounterpartyNotFoundByIban = "OBP-30012: Counterparty not found. The IBAN specified does not exist on this server."
val CounterpartyBeneficiaryPermit = "OBP-30013: The account can not send money to the Counterparty.Please set the Counterparty 'isBeneficiary' true first"
val CounterpartiesNotFound = "OBP-30014: No products available. License may not be set."
val CounterpartyAlreadyExists = "OBP-30014: Counterparty already exists. Please specify a different value for BANK_ID or ACCOUNT_ID or VIEW_ID or NAME."
val MeetingsNotSupported = "OBP-30101: Meetings are not supported on this server."
val MeetingApiKeyNotConfigured = "OBP-30102: Meeting provider API Key is not configured."

View File

@ -20,8 +20,7 @@ import code.branches.Branches.BranchId
import code.customer.{Customer, MockCreditLimit, MockCreditRating, MockCustomerFaceImage}
import code.entitlement.Entitlement
import code.fx.fx
import code.metadata.counterparties.MappedCounterpartyMetadata
import code.metadata.counterparties.Counterparties
import code.metadata.counterparties.{Counterparties, MappedCounterparty, MappedCounterpartyMetadata}
import code.model.dataAccess.OBPUser
import code.model.{BankId, ViewId, _}
import code.products.Products
@ -111,7 +110,7 @@ trait APIMethods210 {
allowDataImportProp <- Props.get("allow_sandbox_data_import") ~> APIFailure("Data import is disabled for this API instance.", 403)
allowDataImport <- Helper.booleanToBox(allowDataImportProp == "true") ~> APIFailure("Data import is disabled for this API instance.", 403)
canCreateSandbox <- booleanToBox(hasEntitlement("", u.userId, CanCreateSandbox), s"$CanCreateSandbox entitlement required")
importData <- tryo {json.extract[SandboxDataImport]} ?~ "invalid json"
importData <- tryo {json.extract[SandboxDataImport]} ?~ {ErrorMessages.InvalidJsonFormat}
importWorked <- OBPDataImport.importer.vend.importData(importData)
} yield {
successJsonResponse(JsRaw("{}"), 201)
@ -688,7 +687,7 @@ trait APIMethods210 {
for {
u <- user ?~! ErrorMessages.UserNotLoggedIn
canCreateCardsForBank <- booleanToBox(hasEntitlement("", u.userId, CanCreateCardsForBank), s"CanCreateCardsForBank entitlement required")
postJson <- tryo {json.extract[PostPhysicalCardJSON]} ?~ "invalid json"
postJson <- tryo {json.extract[PostPhysicalCardJSON]} ?~ {ErrorMessages.InvalidJsonFormat}
postedAllows <- postJson.allows match {
case List() => booleanToBox(true)
case _ => booleanToBox(postJson.allows.forall(a => CardAction.availableValues.contains(a))) ?~ {"Allowed values are: " + CardAction.availableValues.mkString(", ")}
@ -776,7 +775,7 @@ trait APIMethods210 {
| * charge : The charge to the customer for each one of these
|
|${authenticationRequiredMessage(getTransactionTypesIsPublic)}""",
Extraction.decompose(TransactionTypeJSON(TransactionTypeId("wuwjfuha234678"), "1", "2", "3", "4", AmountOfMoneyJSON("eur", "123"))),
Extraction.decompose(TransactionTypeJSON(TransactionTypeId("wuwjfuha234678"), "1", "2", "3", "4", AmountOfMoneyJSON("EUR", "123"))),
emptyObjectJson,
emptyObjectJson :: Nil,
Catalogs(notCore,notPSD2,notOBWG),
@ -1022,17 +1021,22 @@ trait APIMethods210 {
u <- user ?~! ErrorMessages.UserNotLoggedIn
bank <- Bank(bankId) ?~! ErrorMessages.BankNotFound
account <- BankAccount(bankId, AccountId(accountId.value)) ?~! {ErrorMessages.AccountNotFound}
postJson <- tryo {json.extract[PostCounterpartyJSON]} ?~ "invalid json"
// TODO ensure counterparty is unique for bank_id/account_id/view_id
postJson <- tryo {json.extract[PostCounterpartyJSON]} ?~ {ErrorMessages.InvalidJsonFormat}
checkAvailable <- tryo(assert(Counterparties.counterparties.vend.
checkCounterpartyAvailable(postJson.name,bankId.value, accountId.value,viewId.value) == true)
) ?~! ErrorMessages.CounterpartyAlreadyExists
couterparty <- Counterparties.counterparties.vend.createCounterparty(createdByUserId=u.userId,
thisBankId=bankId.value,
thisAccountId=accountId.value,
thisViewId = viewId.value,
name=postJson.name,
otherBankId =postJson.other_bank_id,
otherAccountId =postJson.other_account_id,
accountRoutingScheme=postJson.account_routing_scheme,
accountRoutingAddress=postJson.account_routing_address,
bankRoutingScheme=postJson.bank_routing_scheme,
bankRoutingAddress=postJson.bank_routing_address
bankRoutingAddress=postJson.bank_routing_address,
isBeneficiary=postJson.is_beneficiary
)
metadata <- Counterparties.counterparties.vend.getMetadata(bankId, accountId, couterparty.counterPartyId) ?~ "Cannot find the metadata"
availableViews <- Full(account.permittedViews(user))

View File

@ -42,7 +42,7 @@ import code.customer.Customer
import code.metadata.counterparties.CounterpartyTrait
import code.model._
import code.transactionrequests.TransactionRequests._
import code.model.{AmountOfMoney, Consumer, CounterpartyMetadataIban, Iban}
import code.model.{AmountOfMoney, Consumer, AccountRoutingAddress, Iban}
import code.metadata.counterparties.CounterpartyTrait
import net.liftweb.common.{Box, Full}
import net.liftweb.json.JValue

View File

@ -23,24 +23,37 @@ trait Counterparties {
def getCounterparty(counterPartyId : String): Box[CounterpartyTrait]
def getCounterpartyByIban(iBan : String): Box[CounterpartyTrait]
def getCounterpartyByIban(iban : String): Box[CounterpartyTrait]
def createCounterparty(createdByUserId: String,
thisBankId: String,
thisAccountId : String,
name: String,
otherBankId : String,
accountRoutingScheme : String,
accountRoutingAddress : String,
bankRoutingScheme : String,
bankRoutingAddress : String
def createCounterparty(
createdByUserId: String,
thisBankId: String,
thisAccountId: String,
thisViewId: String,
name: String,
otherBankId: String,
otherAccountId: String,
accountRoutingScheme: String,
accountRoutingAddress: String,
bankRoutingScheme: String,
bankRoutingAddress: String,
isBeneficiary:Boolean
): Box[CounterpartyTrait]
def checkCounterpartyAvailable(
name: String,
thisBankId: String,
thisAccountId: String,
thisViewId: String
): Boolean
}
trait CounterpartyTrait {
def createdByUserId: String
def name: String
def thisBankId: String
def thisAccountId: String
def thisViewId: String
def otherBankId: String
def otherAccountId: String
def otherAccountProvider: String

View File

@ -1,12 +1,12 @@
package code.metadata.counterparties
import java.util.{UUID, Date}
import java.util.{Date, UUID}
import code.model._
import code.model.dataAccess.APIUser
import code.util.{MappedAccountNumber, DefaultStringField, MappedUUID}
import net.liftweb.common.{Loggable, Box, Full}
import net.liftweb.mapper._
import code.util.{DefaultStringField, MappedAccountNumber, MappedUUID}
import net.liftweb.common.{Box, Full, Loggable}
import net.liftweb.mapper.{By, _}
import net.liftweb.util.Helpers.tryo
object MapperCounterparties extends Counterparties with Loggable {
@ -111,19 +111,22 @@ object MapperCounterparties extends Counterparties with Loggable {
override def getCounterparty(counterPartyId : String): Box[CounterpartyTrait] = {
MappedCounterparty.find(By(MappedCounterparty.mCounterPartyId, counterPartyId))
}
override def getCounterpartyByIban(Iban : String): Box[CounterpartyTrait] = {
MappedCounterparty.find(By(MappedCounterparty.mAccountRoutingAddress, Iban))
override def getCounterpartyByIban(iban : String): Box[CounterpartyTrait] = {
MappedCounterparty.find(By(MappedCounterparty.mAccountRoutingAddress, iban))
}
override def createCounterparty(createdByUserId: String,
thisBankId: String,
thisAccountId : String,
thisViewId : String,
name: String,
otherBankId : String,
otherAccountId:String,
accountRoutingScheme : String,
accountRoutingAddress : String,
bankRoutingScheme : String,
bankRoutingAddress : String
bankRoutingAddress : String,
isBeneficiary: Boolean
): Box[CounterpartyTrait] = {
val metadata = MappedCounterpartyMetadata.create
.thisAccountBankId(thisBankId)
@ -133,18 +136,43 @@ object MapperCounterparties extends Counterparties with Loggable {
Some(
MappedCounterparty.create
.mCounterPartyId(metadata.metadataId)
.mName(name)
.mCreatedByUserId(createdByUserId)
.mThisBankId(thisBankId)
.mThisAccountId(thisAccountId)
.mThisViewId(thisViewId)
.mOtherBankId(otherBankId)
.mCounterPartyId(metadata.metadataId)
.mOtherAccountId(otherAccountId)
.mAccountRoutingScheme(accountRoutingScheme)
.mAccountRoutingAddress(accountRoutingAddress)
.mBankRoutingScheme(bankRoutingScheme)
.mBankRoutingAddress(bankRoutingAddress)
.mIsBeneficiary(isBeneficiary)
.saveMe()
)
}
override def checkCounterpartyAvailable(
name: String,
thisBankId: String,
thisAccountId: String,
thisViewId: String
): Boolean = {
val counterparties = MappedCounterparty.findAll(
By(MappedCounterparty.mName, name),
By(MappedCounterparty.mThisBankId, thisBankId),
By(MappedCounterparty.mThisAccountId, thisAccountId),
By(MappedCounterparty.mThisViewId, thisViewId)
)
val available: Boolean = counterparties.size match {
case 0 => true
case _ => false
}
available
}
}
class MappedCounterpartyMetadata extends CounterpartyMetadata with LongKeyedMapper[MappedCounterpartyMetadata] with IdPK with CreatedUpdated {
@ -280,14 +308,16 @@ class MappedCounterparty extends CounterpartyTrait with LongKeyedMapper[MappedCo
def getSingleton = MappedCounterparty
object mCreatedByUserId extends MappedString(this, 36)
object mName extends MappedString(this, 36)
object mThisBankId extends MappedString(this, 36)
object mThisAccountId extends MappedString(this, 255)
object mThisViewId extends MappedString(this, 36)
object mOtherBankId extends MappedString(this, 36)
object mOtherAccountId extends MappedString(this, 36)
object mOtherAccountProvider extends MappedString(this, 36)
object mCounterPartyId extends MappedString(this, 36)
object mAccountRoutingScheme extends MappedString(this, 255)
object mAccountRoutingAddress extends MappedString(this, 255)
object mOtherAccountId extends MappedString(this, 36)
object mOtherAccountProvider extends MappedString(this, 36)
object mBankRoutingScheme extends MappedString(this, 255)
object mBankRoutingAddress extends MappedString(this, 255)
object mIsBeneficiary extends MappedBoolean(this)
@ -295,19 +325,21 @@ class MappedCounterparty extends CounterpartyTrait with LongKeyedMapper[MappedCo
override def createdByUserId = mCreatedByUserId.get
override def name = mName.get
override def thisBankId = mThisBankId.get
override def thisAccountId = mThisAccountId.get
override def thisViewId = mThisViewId.get
override def otherBankId = mOtherBankId.get
override def otherAccountId: String = mOtherAccountId.get
override def otherAccountProvider: String = mOtherAccountProvider.get
override def counterPartyId = mCounterPartyId.get
override def accountRoutingScheme = mAccountRoutingScheme.get
override def accountRoutingAddress = mAccountRoutingAddress.get
override def otherAccountId: String = mOtherAccountId.get
override def otherAccountProvider: String = mOtherAccountProvider.get
override def bankRoutingScheme: String = mBankRoutingScheme.get
override def bankRoutingAddress: String = mBankRoutingAddress.get
override def isBeneficiary: Boolean = mIsBeneficiary.get
}
object MappedCounterparty extends MappedCounterparty with LongKeyedMetaMapper[MappedCounterparty] {
override def dbIndexes = UniqueIndex(mCounterPartyId) :: super.dbIndexes
override def dbIndexes = UniqueIndex(mCounterPartyId) :: UniqueIndex(mName, mThisBankId, mThisAccountId, mThisViewId) :: super.dbIndexes
}

View File

@ -101,17 +101,29 @@ object MongoCounterparties extends Counterparties with Loggable {
else firstAliasAttempt
}
def getCounterparty(counterPartyId : String): Box[CounterpartyTrait] = Empty
override def getCounterparty(counterPartyId : String): Box[CounterpartyTrait] = Empty
def getCounterpartyByIban(counterPartyId : String): Box[CounterpartyTrait] = Empty
override def getCounterpartyByIban(counterPartyId : String): Box[CounterpartyTrait] = Empty
def createCounterparty(userId: String,
bankId: String,
accountId : String,
name: String,
counterPartyBankId : String,
accountRoutingScheme : String,
accountRoutingAddress : String,
bankRoutingScheme : String,
bamkRoutingAddress : String): Box[CounterpartyTrait] = Empty
override def createCounterparty(
createdByUserId: String,
thisBankId: String,
thisAccountId: String,
thisViewId: String,
name: String,
otherBankId: String,
otherAccountId: String,
accountRoutingScheme: String,
accountRoutingAddress: String,
bankRoutingScheme: String,
bankRoutingAddress: String,
isBeneficiary: Boolean
): Box[CounterpartyTrait] = Empty
override def checkCounterpartyAvailable(
name: String,
thisBankId: String,
thisAccountId: String,
thisViewId: String
): Boolean = false
}

View File

@ -112,11 +112,11 @@ object BankId {
def unapply(id : String) = Some(BankId(id))
}
case class CounterpartyMetadataIban(val value : String) {
case class AccountRoutingAddress(val value : String) {
override def toString = value
}
object CounterpartyMetadataIban {
def unapply(id : String) = Some(CounterpartyMetadataIban(id))
object AccountRoutingAddress {
def unapply(id : String) = Some(AccountRoutingAddress(id))
}
case class CustomerId(val value : String) {

View File

@ -353,11 +353,11 @@ import net.liftweb.util.Helpers._
}
else {
if (Props.getBool("kafka.user.authentication", false)) {
Props.get("connector").openOrThrowException("no connector set") match {
case "kafka" =>
Props.get("connector").openOrThrowException("no connector set").startsWith("kafka") match {
case true =>
for { kafkaUser <- getUserFromKafka(name, password)
kafkaUserId <- tryo{kafkaUser.user} } yield kafkaUserId.toLong
case _ => Empty
case false => Empty
}
} else {
Empty }
@ -447,7 +447,7 @@ import net.liftweb.util.Helpers._
case Full(user) if !user.validated_? =>
S.error(S.?("account.validation.error"))
case _ => if (Props.get("connector").openOrThrowException("no connector set") == "kafka")
case _ => if (Props.get("connector").openOrThrowException("no connector set").startsWith("kafka"))
{
// If not found locally, try to authenticate user via Kafka, if enabled in props
if (Props.getBool("kafka.user.authentication", false)) {
@ -486,7 +486,7 @@ import net.liftweb.util.Helpers._
def externalUserHelper(name: String, password: String): Box[OBPUser] = {
if (Props.get("connector").openOrThrowException("no connector set") == "kafka") {
if (Props.get("connector").openOrThrowException("no connector set").startsWith("kafka")) {
for {
user <- getUserFromKafka(name, password)
u <- APIUser.find(By(APIUser.name_, user.username))
@ -499,7 +499,7 @@ import net.liftweb.util.Helpers._
def registeredUserHelper(username: String) = {
if (Props.get("connector").openOrThrowException("no connector set") == "kafka") {
if (Props.get("connector").openOrThrowException("no connector set").startsWith("kafka")) {
for {
u <- APIUser.find(By(APIUser.name_, username))
v <- tryo {KafkaMappedConnector.updateUserAccountViews(u)}

View File

@ -9,7 +9,7 @@ import net.liftweb.common.Box
import net.liftweb.mapper.MetaMapper
import net.liftweb.util.Helpers._
import code.entitlement.{Entitlement, MappedEntitlement}
import code.metadata.counterparties.{MappedCounterparty, MappedCounterpartyMetadata}
import code.metadata.counterparties.{CounterpartyTrait, MappedCounterparty, MappedCounterpartyMetadata}
import code.transaction.MappedTransaction
import scala.util.Random
@ -27,13 +27,14 @@ trait LocalMappedConnectorTestSetup extends TestConnectorSetupWithStandardPermis
.national_identifier(randomString(5)).saveMe
}
override protected def createCounterparty(bankId:String, accountId:String, iBan:String):MappedCounterparty = {
override protected def createCounterparty(bankId:String, accountId:String, accountRoutingAddress:String, isBeneficiary:Boolean):CounterpartyTrait = {
MappedCounterparty.create.
mCounterPartyId(UUID.randomUUID().toString).
mAccountRoutingAddress(iBan).
mName(UUID.randomUUID().toString).
mAccountRoutingAddress(accountRoutingAddress).
mOtherBankId(bankId).
mOtherAccountId(accountId).
mIsBeneficiary(true).
mIsBeneficiary(isBeneficiary).
saveMe
}

View File

@ -3,7 +3,7 @@ package code.api
import java.util.{Calendar, Date}
import code.bankconnectors.{Connector, OBPLimit, OBPOffset}
import code.metadata.counterparties.{MappedCounterparty}
import code.metadata.counterparties.{CounterpartyTrait, MappedCounterparty}
import code.model._
import net.liftweb.util.Helpers._
@ -14,7 +14,7 @@ trait TestConnectorSetup {
protected def createAccount(bankId: BankId, accountId : AccountId, currency : String) : BankAccount
protected def createTransaction(account : BankAccount, startDate : Date, finishDate : Date)
protected def createCounterparty(BankId:String, AccountId:String, iBan:String):MappedCounterparty
protected def createCounterparty(bankId:String, accountId:String, iban:String, isBeneficiary:Boolean):CounterpartyTrait
final protected def createAccountAndOwnerView(accountOwner: Option[User], bankId: BankId, accountId : AccountId, currency : String) : BankAccount = {
val account = createAccount(bankId, accountId, currency)

View File

@ -0,0 +1,113 @@
package code.api.v2_1_0
import code.api.DefaultUsers
import code.api.util.APIUtil.OAuth._
import code.api.util.ErrorMessages
import code.model.{AccountId, ViewId}
import net.liftweb.json.JsonAST.{JField, JObject, JString}
import net.liftweb.json.Serialization.write
class CreateCounterpartyTest extends V210ServerSetup with DefaultUsers {
val customerPostJSON = PostCounterpartyJSON(
name = "Company Salary",
other_bank_id ="gh.29.de",
other_account_id="007a268b-98bf-44ef-8f6a-9944618378cf",
other_account_provider="OBP",
account_routing_scheme="IBAN",
account_routing_address="DE12 1234 5123 4510 2207 8077 877",
bank_routing_scheme="BIC",
bank_routing_address="123456",
is_beneficiary = true
)
override def beforeAll() {
super.beforeAll()
}
override def afterAll() {
super.afterAll()
}
feature("Assuring that endpoint 'Create counterparty for an account' works as expected - v2.1.0") {
scenario("There is a user has the owner view and the BankAccount") {
Given("The user ower access and BankAccount")
val testBank = createBank("transactions-test-bank")
val bankId = testBank.bankId
val accountId = AccountId("__acc1")
val viewId =ViewId("owner")
val bankAccount = createAccountAndOwnerView(Some(obpuser1), bankId, accountId, "EUR")
When("We make the request Create counterparty for an account")
val requestPost = (v2_1Request / "banks" / bankId.value / "accounts" / accountId.value / viewId.value / "counterparties" ).POST <@ (user1)
val responsePost = makePostRequest(requestPost, write(customerPostJSON))
Then("We should get a 200 and check all the fields")
responsePost.code should equal(200)
var thisAccount = (responsePost.body \ "this_account" \ "bank_id") match {
case JString(i) => i
case _ => ""
}
thisAccount should equal(bankId.value)
var accountRoutingAddress = (responsePost.body \ "account_routing" \ "address") match {
case JString(i) => i
case _ => ""
}
accountRoutingAddress should equal(customerPostJSON.account_routing_address)
var bankRoutingScheme = (responsePost.body \ "bank_routing" \ "scheme" ) match {
case JString(i) => i
case _ => ""
}
bankRoutingScheme should equal(customerPostJSON.bank_routing_scheme)
}
scenario("No BankAccount in Database") {
Given("The user ,but no BankAccount")
val testBank = createBank("transactions-test-bank")
val bankId = testBank.bankId
val accountId = AccountId("__acc1")
val viewId =ViewId("owner")
val ownerView = createOwnerView(bankId, accountId)
grantAccessToView(obpuser1, ownerView)
val requestPost = (v2_1Request / "banks" / bankId.value / "accounts" / accountId.value / viewId.value / "counterparties" ).POST <@ (user1)
val responsePost = makePostRequest(requestPost, write(customerPostJSON))
Then("We should get a 400")
responsePost.code should equal(400)
val error = for { JObject(o) <- responsePost.body; JField("error", JString(error)) <- o } yield error
error should contain (ErrorMessages.AccountNotFound)
}
scenario("counterparty is not unique for name/bank_id/account_id/view_id") {
Given("The user ower access and BankAccount")
val testBank = createBank("transactions-test-bank")
val bankId = testBank.bankId
val accountId = AccountId("__acc1")
val viewId =ViewId("owner")
val bankAccount = createAccountAndOwnerView(Some(obpuser1), bankId, accountId, "EUR")
When("We make the request Create counterparty for an account")
val requestPost = (v2_1Request / "banks" / bankId.value / "accounts" / accountId.value / viewId.value / "counterparties" ).POST <@ (user1)
var responsePost = makePostRequest(requestPost, write(customerPostJSON))
Then("We make the request again, the same name/bank_id/account_id/view_id")
responsePost = makePostRequest(requestPost, write(customerPostJSON))
Then("We should get a 400 and check the error massage")
responsePost.code should equal(400)
val error = for { JObject(o) <- responsePost.body; JField("error", JString(error)) <- o } yield error
error should contain (ErrorMessages.CounterpartyAlreadyExists)
}
}
}

View File

@ -15,7 +15,7 @@ import net.liftweb.json.Serialization.write
import net.liftweb.util.Props
import org.scalatest.Tag
class TransactionRequestsFreeformTest extends ServerSetupWithTestData with DefaultUsers with V210ServerSetup {
class TransactionReqFreeforTest extends ServerSetupWithTestData with DefaultUsers with V210ServerSetup {
object TransactionRequest extends Tag("transactionRequests")
@ -84,9 +84,7 @@ class TransactionRequestsFreeformTest extends ServerSetupWithTestData with Defau
Then("we should get a 201 created code")
response.code should equal(201)
println(response.body)
//created a transaction request, check some return values. As type is SANDBOX_TAN and value is < 1000, we expect no challenge
//created a transaction request, check some return values. As type is FreeForm and value is < 1000, we expect no challenge
val transRequestId: String = (response.body \ "id") match {
case JString(i) => i
case _ => ""
@ -150,7 +148,6 @@ class TransactionRequestsFreeformTest extends ServerSetupWithTestData with Defau
transactions.size should equal(1)
//check that the description has been set
println(response.body)
/*val description = (((response.body \ "transactions")(0) \ "details") \ "description") match {
case JString(i) => i
case _ => ""
@ -227,7 +224,7 @@ class TransactionRequestsFreeformTest extends ServerSetupWithTestData with Defau
Then("we should get a 201 created code")
response.code should equal(201)
//created a transaction request, check some return values. As type is SANDBOX_TAN and value is < 1000, we expect no challenge
//created a transaction request, check some return values. As type is FreeForm and value is < 1000, we expect no challenge
val transRequestId: String = (response.body \ "id") match {
case JString(i) => i
case _ => ""
@ -345,7 +342,7 @@ class TransactionRequestsFreeformTest extends ServerSetupWithTestData with Defau
Then("we should get a 400 created code")
response.code should equal(400)
//created a transaction request, check some return values. As type is SANDBOX_TAN and value is < 1000, we expect no challenge
//created a transaction request, check some return values. As type is FreeForm and value is < 1000, we expect no challenge
val error: String = (response.body \ "error") match {
case JString(i) => i
case _ => ""
@ -405,7 +402,7 @@ class TransactionRequestsFreeformTest extends ServerSetupWithTestData with Defau
Then("we should get a 400 created code")
response.code should equal(400)
//created a transaction request, check some return values. As type is SANDBOX_TAN and value is < 1000, we expect no challenge
//created a transaction request, check some return values. As type is FreeForm and value is < 1000, we expect no challenge
val error: String = (response.body \ "error") match {
case JString(i) => i
case _ => ""
@ -487,7 +484,7 @@ class TransactionRequestsFreeformTest extends ServerSetupWithTestData with Defau
val responseBody = response.body
//created a transaction request, check some return values. As type is SANDBOX_TAN, we expect no challenge
//created a transaction request, check some return values. As type is FreeForm, we expect no challenge
val transRequestId: String = (response.body \ "id") match {
case JString(i) => i
case _ => ""
@ -666,7 +663,7 @@ class TransactionRequestsFreeformTest extends ServerSetupWithTestData with Defau
Then("we should get a 201 created code")
response.code should equal(201)
//ok, created a transaction request, check some return values. As type is SANDBOX_TAN but over 100, we expect a challenge
//ok, created a transaction request, check some return values. As type is FreeForm but over 100, we expect a challenge
val transRequestId: String = (response.body \ "id") match {
case JString(i) => i
case _ => ""
@ -855,7 +852,7 @@ class TransactionRequestsFreeformTest extends ServerSetupWithTestData with Defau
Then("we should get a 201 created code")
response.code should equal(201)
//created a transaction request, check some return values. As type is SANDBOX_TAN, we expect no challenge
//created a transaction request, check some return values. As type is FreeForm, we expect no challenge
val transRequestId: String = (response.body \ "id") match {
case JString(i) => i
case _ => ""

View File

@ -84,8 +84,6 @@ class TransactionRequestsTest extends ServerSetupWithTestData with DefaultUsers
Then("we should get a 201 created code")
response.code should equal(201)
println(response.body)
//created a transaction request, check some return values. As type is SANDBOX_TAN and value is < 1000, we expect no challenge
val transRequestId: String = (response.body \ "id") match {
case JString(i) => i
@ -150,7 +148,6 @@ class TransactionRequestsTest extends ServerSetupWithTestData with DefaultUsers
transactions.size should equal(1)
//check that the description has been set
println(response.body)
/*val description = (((response.body \ "transactions")(0) \ "details") \ "description") match {
case JString(i) => i
case _ => ""