refractory Counterparty -- step6 create the CounterpartId in the high level -- fixed the failed tests

This commit is contained in:
hongwei1 2017-12-06 09:33:16 +01:00
parent b719ebf07c
commit b1ea515e94
19 changed files with 73 additions and 148 deletions

View File

@ -1856,33 +1856,14 @@ Versions are groups of endpoints in a file
}
/**
* Create the explicit CounterpartyId, we can get info data from api level. (Used in `Create counterparty for an account` endpoint )
* Create the explicit CounterpartyId, (Used in `Create counterparty for an account` endpoint ).
* This is just a UUID, use both in Counterparty.counterpartyId and CounterpartyMetadata.counterpartyId
*/
def createExplicitCounterpartyId(
createdByUserId: String,
thisBankId: String,
thisAccountId : String,
thisViewId : String,
name: String,
otherAccountRoutingScheme : String,
otherAccountRoutingAddress : String,
otherBankRoutingScheme : String,
otherBankRoutingAddress : String,
otherBranchRoutingScheme: String,
otherBranchRoutingAddress: String,
isBeneficiary: Boolean,
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
description: String,
bespoke: List[PostCounterpartyBespoke]
)= createOBPId(s"$thisBankId$thisAccountId$thisViewId$name$otherAccountRoutingScheme" +
s"$otherAccountRoutingAddress$otherBankRoutingScheme$otherBankRoutingAddress$otherBranchRoutingScheme" +
s"$otherBranchRoutingAddress$isBeneficiary$otherAccountSecondaryRoutingScheme$otherAccountSecondaryRoutingAddress" +
s"$description${bespoke.map(_.value)}")
def createExplicitCounterpartyId()= UUID.randomUUID().toString
/**
* Create the implicit CounterpartyId, we can only get limit data from Adapter. (Used in `getTransactions` endpoint, we create the counterparty implicitly.)
* Note: The caller should take care of the `counterpartyName`,it depends how you get the data from transaction. and can gernerate the `counterpartyName`
* Note: The caller should take care of the `counterpartyName`,it depends how you get the data from transaction. and can generate the `counterpartyName`
*/
def createImplicitCounterpartyId(
thisBankId: String,

View File

@ -273,8 +273,9 @@ trait Connector extends MdcLoggable{
def getCounterpartyFromTransaction(bankId: BankId, accountId: AccountId, counterpartyID: String): Box[Counterparty] = {
// Please note that Metadata and Transaction can be at different locations
// Obtain all necessary data and then intersect they
val counterpartyMetadatas = Counterparties.counterparties.vend.getMetadata(bankId, accountId, counterpartyID).toList
//TODO, not good, we just want to get one counterparty, but we need first get all the transactions and than filter them...
val transactions = getTransactions(bankId, accountId).toList.flatten
val counterpartyMetadatas = Counterparties.counterparties.vend.getMetadata(bankId, accountId, counterpartyID).toList
val x = for {
transaction <- transactions
counterpartyMetadata <- counterpartyMetadatas if counterpartyID == counterpartyMetadata.metadataId
@ -290,12 +291,12 @@ trait Connector extends MdcLoggable{
def getCounterpartiesFromTransaction(bankId: BankId, accountId: AccountId): Box[List[Counterparty]] = {
// Please note that Metadata and Transaction can be at different locations
// Obtain all necessary data and then intersect they
val counterpartyMetadatas= Counterparties.counterparties.vend.getMetadatas(bankId, accountId)
val transactions= getTransactions(bankId, accountId).toList.flatten
val counterpartyMetadatas= Counterparties.counterparties.vend.getMetadatas(bankId, accountId)
val x = for {
transaction <- transactions
counterpartyName <- List(transaction+transaction.description.getOrElse("")+transaction.otherAccount.otherAccountRoutingAddress.getOrElse("")+transaction.otherAccount.thisAccountId.value)
counterpartyName <- List(transaction.otherAccount.name)
counterpartyId <- List(APIUtil.createImplicitCounterpartyId(bankId.value,accountId.value,counterpartyName))
counterpartyMetadata <- counterpartyMetadatas if counterpartyId == counterpartyMetadata.metadataId
} yield {
@ -311,17 +312,13 @@ trait Connector extends MdcLoggable{
new Counterparty(
//counterparty id is defined to be the id of its metadata as we don't actually have an id for the counterparty itself
counterPartyId = metadata.metadataId,
label = metadata.getHolder,
name = metadata.getHolder,
nationalIdentifier = t.otherAccount.nationalIdentifier,
otherBankRoutingAddress = None,
otherAccountRoutingAddress = t.otherAccount.otherAccountRoutingAddress,
thisAccountId = AccountId(t.thisAccount.accountId.value), //tis commit: set the thisAccountId from transaction, not from MetaData
thisBankId = t.otherAccount.thisBankId,
kind = t.otherAccount.kind,
// otherBankId = thisBankId,
// otherAccountId = thisAccountId,
// alreadyFoundMetadata = Some(metadata),
name = "",
otherBankRoutingScheme = "",
otherAccountRoutingScheme="",
otherAccountProvider = "",

View File

@ -1171,17 +1171,13 @@ object KafkaMappedConnector extends Connector with KafkaHelper with MdcLoggable
def createCounterparty(counterpartyId: String, counterpartyName: String, o: KafkaBankAccount, alreadyFoundMetadata : Option[CounterpartyMetadata]) = {
new Counterparty(
counterPartyId = alreadyFoundMetadata.map(_.metadataId).getOrElse(""),
label = counterpartyName,
name = counterpartyName,
nationalIdentifier = "",
otherBankRoutingAddress = None,
otherAccountRoutingAddress = None,
thisAccountId = AccountId(counterpartyId),
thisBankId = BankId(""),
kind = "",
// otherBankId = o.bankId,
// otherAccountId = o.accountId,
// alreadyFoundMetadata = alreadyFoundMetadata,
name = "",
otherBankRoutingScheme = "",
otherAccountRoutingScheme="",
otherAccountProvider = "",

View File

@ -1375,17 +1375,13 @@ object KafkaMappedConnector_JVMcompatible extends Connector with KafkaHelper wit
def createCounterparty(counterpartyId: String, counterpartyName: String, o: KafkaBankAccount, alreadyFoundMetadata : Option[CounterpartyMetadata]) = {
new Counterparty(
counterPartyId = alreadyFoundMetadata.map(_.metadataId).getOrElse(""),
label = counterpartyName,
name = counterpartyName,
nationalIdentifier = "",
otherBankRoutingAddress = None,
otherAccountRoutingAddress = None,
thisAccountId = AccountId(counterpartyId),
thisBankId = BankId(""),
kind = "",
// otherBankId = o.bankId,
// otherAccountId = o.accountId,
// alreadyFoundMetadata = alreadyFoundMetadata,
name = "",
otherBankRoutingScheme = "",
otherAccountRoutingScheme="",
otherAccountProvider = "",

View File

@ -326,17 +326,13 @@ object LocalMappedConnector extends Connector with MdcLoggable {
new Counterparty(
//counterparty id is defined to be the id of its metadata as we don't actually have an id for the counterparty itself
counterPartyId = t.metadataId,
label = t.getHolder,
name = t.getHolder,
nationalIdentifier = "",
otherBankRoutingAddress = None,
otherAccountRoutingAddress = None,
thisAccountId = thisAccountId,
thisBankId = BankId(""),
kind = "",
// otherBankId = thisBankId,
// otherAccountId = thisAccountId,
// alreadyFoundMetadata = Some(t),
name = "",
otherBankRoutingScheme = "",
otherAccountRoutingScheme="",
otherAccountProvider = "",

View File

@ -230,17 +230,13 @@ private object LocalRecordConnector extends Connector with MdcLoggable {
val otherAccount = new Counterparty(
counterPartyId = metadata.metadataId,
label = otherAccount_.holder.get,
name = otherAccount_.holder.get,
nationalIdentifier = otherAccount_.bank.get.national_identifier.get,
otherBankRoutingAddress = None,
otherAccountRoutingAddress = Some(otherAccount_.bank.get.IBAN.get),
thisAccountId = AccountId(otherAccount_.number.get),
thisBankId = BankId(otherAccount_.bank.get.name.get),
kind = otherAccount_.kind.get,
// otherBankId = theAccount.bankId,
// otherAccountId = theAccount.accountId,
// alreadyFoundMetadata = Some(metadata),
name = "",
otherBankRoutingScheme = "",
otherAccountRoutingScheme="",
otherAccountProvider = "",
@ -385,17 +381,13 @@ private object LocalRecordConnector extends Connector with MdcLoggable {
otherAccount : CounterpartyMetadata, otherAccountFromTransaction : OBPAccount) : Counterparty = {
new Counterparty(
counterPartyId = otherAccount.metadataId,
label = otherAccount.getHolder,
name = otherAccount.getHolder,
nationalIdentifier = otherAccountFromTransaction.bank.get.national_identifier.get,
otherBankRoutingAddress = None,
otherAccountRoutingAddress = Some(otherAccountFromTransaction.bank.get.IBAN.get),
thisAccountId = AccountId(otherAccountFromTransaction.number.get),
thisBankId = BankId(otherAccountFromTransaction.bank.get.name.get),
kind = "",
// otherBankId = originalPartyBankId,
// otherAccountId = originalPartyAccountId,
// alreadyFoundMetadata = Some(otherAccount),
name = "",
otherBankRoutingScheme = "",
otherAccountRoutingScheme="",
otherAccountProvider = "",

View File

@ -1135,17 +1135,13 @@ object ObpJvmMappedConnector extends Connector with MdcLoggable {
def createCounterparty(c: ObpJvmInboundTransactionCounterparty, o: ObpJvmBankAccount, alreadyFoundMetadata : Option[CounterpartyMetadata]) = {
new Counterparty(
counterPartyId = alreadyFoundMetadata.map(_.metadataId).getOrElse(""),
label = c.account_number.getOrElse(c.name.getOrElse("")),
name = c.account_number.getOrElse(c.name.getOrElse("")),
nationalIdentifier = "",
otherBankRoutingAddress = None,
otherAccountRoutingAddress = None,
thisAccountId = AccountId(c.account_number.getOrElse("")),
thisBankId = BankId(""),
kind = "",
// otherBankId = o.bankId,
// otherAccountId = o.accountId,
// alreadyFoundMetadata = alreadyFoundMetadata,
name = "",
otherBankRoutingScheme = "",
otherAccountRoutingScheme="",
otherAccountProvider = "",

View File

@ -1446,15 +1446,9 @@ trait KafkaMappedConnector_vJune2017 extends Connector with KafkaHelper with Mdc
// Here we only have one bankAccount, but we need a `dummyOtherBankAccount` for metaData.
// so we use the same account for both `Counterparty.thisAccountId` and `Counterparty.otherAccountId`.
//these define the counterparty
label = counterpartyName, // This will be used mapping `MappedCounterpartyMetadata.holder`
name = counterpartyName, // This will be used mapping `MappedCounterpartyMetadata.holder`
thisAccountId = bankAccount.accountId, //This will be used mapping `MappedCounterpartyMetadata.accountNumber`
// these define the obp account to which this counterparty belongs
// otherBankId = bankAccount.bankId, //This will be used mapping MappedCounterpartyMetadata.thisBankId
// otherAccountId = bankAccount.accountId, // This will be used mapping MappedCounterpartyMetadata.thisAccountId
//This two will be generated in obp side implicitly
// alreadyFoundMetadata = alreadyFoundMetadata,
counterPartyId = alreadyFoundMetadata.map(_.metadataId).getOrElse(""),
thisBankId = BankId(null),
@ -1462,7 +1456,6 @@ trait KafkaMappedConnector_vJune2017 extends Connector with KafkaHelper with Mdc
otherBankRoutingAddress = None,
otherAccountRoutingAddress = None,
kind = null,
name = null,
otherBankRoutingScheme = null,
otherAccountRoutingScheme = null,
otherAccountProvider = null,

View File

@ -1778,17 +1778,13 @@ trait KafkaMappedConnector_vMar2017 extends Connector with KafkaHelper with MdcL
def createCounterparty(counterpartyId: String, counterpartyName: String, o: BankAccount2, alreadyFoundMetadata : Option[CounterpartyMetadata]) = {
new Counterparty(
counterPartyId = alreadyFoundMetadata.map(_.metadataId).getOrElse(""),
label = counterpartyName,
name = counterpartyName,
nationalIdentifier = "1234",
otherBankRoutingAddress = None,
otherAccountRoutingAddress = None,
thisAccountId = AccountId(counterpartyId),
thisBankId = BankId(""),
kind = "1234",
// otherBankId = o.bankId,
// otherAccountId = o.accountId,
// alreadyFoundMetadata = alreadyFoundMetadata,
name = "sushan",
otherBankRoutingScheme = "obp",
otherAccountRoutingScheme="obp",
otherAccountProvider = "obp",

View File

@ -79,7 +79,7 @@ object ImporterAPI extends RestHelper with MdcLoggable {
val otherAcc = t.otherAccount
val otherAccJson = JObject(List(JField("holder",
JObject(List(
JField("holder", JString(otherAcc.label)),
JField("holder", JString(otherAcc.name)),
JField("alias", JString("no"))))),
JField("number", JString(otherAcc.thisAccountId.value)),
JField("kind", JString(otherAcc.kind)),

View File

@ -149,27 +149,10 @@ object MapperCounterparties extends Counterparties with MdcLoggable {
bespoke: List[PostCounterpartyBespoke]
): Box[CounterpartyTrait] = {
val counterpartyId = APIUtil.createExplicitCounterpartyId(
createdByUserId: String,
thisBankId: String,
thisAccountId : String,
thisViewId : String,
name: String,
otherAccountRoutingScheme : String,
otherAccountRoutingAddress : String,
otherBankRoutingScheme : String,
otherBankRoutingAddress : String,
otherBranchRoutingScheme: String,
otherBranchRoutingAddress: String,
isBeneficiary: Boolean,
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
description: String,
bespoke: List[PostCounterpartyBespoke]
)
val counterpartyId = APIUtil.createExplicitCounterpartyId()
//This is the `EXPLICIT` Counterparty, we also create the metaData for it
val metadata = Counterparties.counterparties.vend.getOrCreateMetadata(BankId(thisBankId), AccountId(thisAccountId), counterpartyId, name).openOrThrowException("Can not getOrCreateMetadata !")
val metadata = Counterparties.counterparties.vend.getOrCreateMetadata(BankId(thisBankId), AccountId(thisAccountId), counterpartyId, name).openOrThrowException("Can not getOrCreateMetadata !")
val mappedCounterparty = MappedCounterparty.create
.mCounterPartyId(metadata.metadataId)

View File

@ -660,21 +660,17 @@ class Counterparty(
@deprecated("older version, please first consider the V210, account scheme and address")
val nationalIdentifier: String, // This is the scheme a consumer would use to instruct a payment e.g. IBAN
// @deprecated("older version, please first consider the V210, account scheme and address")
//val alreadyFoundMetadata : Option[CounterpartyMetadata],
@deprecated("older version, please use name instead")
val label: String, // Reference given to the counterparty by the original party.
val kind: String, // Type of bank account.
// The following fields started from V210
val counterPartyId: String,
val name: String,
val otherAccountRoutingScheme: String, // This is the scheme a consumer would use to instruct a payment e.g. IBAN
val otherAccountRoutingAddress: Option[String], // The (IBAN) value e.g. 2349870987820374
val otherBankRoutingScheme: String, // This is the scheme a consumer would use to specify the bank e.g. BIC
val otherBankRoutingAddress: Option[String], // The (BIC) value e.g. 67895
val thisBankId: BankId, // i.e. the Account that sends/receives money to/from this Counterparty
val thisAccountId: AccountId, // These 2 fields specify the account that uses this Counterparty
val otherBankRoutingScheme: String, // This is the scheme a consumer would use to specify the bank e.g. BIC
val otherBankRoutingAddress: Option[String], // The (BIC) value e.g. 67895
val otherAccountRoutingScheme: String, // This is the scheme a consumer would use to instruct a payment e.g. IBAN
val otherAccountRoutingAddress: Option[String], // The (IBAN) value e.g. 2349870987820374
val otherAccountProvider: String, // hasBankId and hasAccountId would refer to an OBP account
val isBeneficiary: Boolean // True if the originAccount can send money to the Counterparty
) {

View File

@ -539,7 +539,7 @@ trait View {
//other account data
val otherAccountId = otherBankAccount.counterPartyId
val otherAccountLabel: AccountName = {
val realName = otherBankAccount.label
val realName = otherBankAccount.name
if (usePublicAliasIfOneExists) {

View File

@ -39,26 +39,28 @@ class MappedTransaction extends LongKeyedMapper[MappedTransaction] with IdPK wit
object description extends MappedString(this, 2000)
object chargePolicy extends MappedString(this, 32)
object counterpartyAccountNumber extends MappedAccountNumber(this)
object counterpartyAccountHolder extends MappedString(this, 255)
//still unclear exactly how what this is defined to mean
object counterpartyNationalId extends MappedString(this, 40)
//this should eventually be calculated using counterpartyNationalId
object counterpartyBankName extends MappedString(this, 100)
//this should eventually either generate counterpartyAccountNumber or be generated
object counterpartyIban extends MappedString(this, 100)
object counterpartyAccountKind extends MappedString(this, 40)
object counterpartyBankName extends MappedString(this, 100)
object counterpartyNationalId extends MappedString(this, 40)
@deprecated("use CPOtherAccountRoutingAddress instead. ","06/12/2017")
object counterpartyAccountNumber extends MappedAccountNumber(this)
@deprecated("use CPOtherAccountSecondaryRoutingAddress instead. ","06/12/2017")
//this should eventually be calculated using counterpartyNationalId
object counterpartyIban extends MappedString(this, 100)
//The following are the fields from CounterpartyTrait, previous just save BankAccount to simulate the counterparty.
//Now we save the real Counterparty data
//CP--> CounterParty
object CPOtherBankId extends MappedString(this, 36)
object CPOtherAccountId extends AccountIdString(this)
object CPOtherAccountProvider extends MappedString(this, 36)
object CPCounterPartyId extends UUIDString(this)
object CPOtherAccountProvider extends MappedString(this, 36)
object CPOtherAccountRoutingScheme extends MappedString(this, 255)
object CPOtherAccountRoutingAddress extends MappedString(this, 255)
object CPOtherAccountSecondaryRoutingScheme extends MappedString(this, 255)
object CPOtherAccountSecondaryRoutingAddress extends MappedString(this, 255)
object CPOtherBankRoutingScheme extends MappedString(this, 255)
object CPOtherBankRoutingAddress extends MappedString(this, 255)
@ -83,7 +85,8 @@ class MappedTransaction extends LongKeyedMapper[MappedTransaction] with IdPK wit
val i = counterpartyIban.get
if(i.isEmpty) None else Some(i)
}
//This method have the side affact, it will create the counterparty metaData...
def toTransaction(account: BankAccount): Option[Transaction] = {
val tBankId = theBankId
val tAccId = theAccountId
@ -107,15 +110,14 @@ class MappedTransaction extends LongKeyedMapper[MappedTransaction] with IdPK wit
counterPartyId = counterpartyId,
kind = counterpartyAccountKind.get,
nationalIdentifier = counterpartyNationalId.get,
label = counterpartyAccountHolder.get,
name = counterpartyAccountHolder.get,
thisAccountId = AccountId(counterpartyAccountNumber.get), //TODO? explain why map this?? we need create counterparty for all connectors, can not get it sometimes.
thisBankId = BankId(counterpartyBankName.get), //TODO? explain why map this??we need create counterparty for all connectors, can not get it sometimes.
otherAccountProvider = "",
otherBankRoutingScheme = "",
otherBankRoutingAddress = None,
otherAccountRoutingScheme="",
otherAccountRoutingAddress = getCounterpartyIban(),
thisBankId = BankId(theBankId.value),
thisAccountId = AccountId(theAccountId.value),
otherAccountProvider = counterpartyAccountHolder.get,
otherBankRoutingAddress = Some(CPOtherBankRoutingAddress.get),
otherBankRoutingScheme = CPOtherBankRoutingScheme.get,
otherAccountRoutingScheme = CPOtherAccountRoutingScheme.get,
otherAccountRoutingAddress = Some(CPOtherAccountRoutingAddress.get),
isBeneficiary = true
)
}
@ -125,7 +127,7 @@ class MappedTransaction extends LongKeyedMapper[MappedTransaction] with IdPK wit
//otherAccount ids are metadata ids, so the metadata needs to exist before we created the OtherBankAccount
//so that we know what id to give it.
//--> now it is clear, we create the counterpartyId first, and assign it to metadata.counterpartyId and counterparty.counterpartyId manually
val counterpartyName = description+CPOtherAccountRoutingAddress.get+counterpartyAccountNumber.get
val counterpartyName = counterpartyAccountHolder.get
val counterpartyId = APIUtil.createImplicitCounterpartyId(theBankId.value, theAccountId.value, counterpartyName)
val otherAccount = createCounterparty(counterpartyId)

View File

@ -43,12 +43,12 @@ import net.liftweb.json._
import net.liftweb.util.Helpers._
import _root_.net.liftweb.util.{Props, _}
import code.api.ErrorMessage
import code.setup.{APIResponse, DefaultUsers, PrivateUser2Accounts, User1AllPrivileges}
import code.setup.{APIResponse, DefaultUsers, PrivateUser2AccountsAndSetUpWithTestData, User1AllPrivileges}
import org.scalatest.Tag
import scala.util.Random._
class API1_2_1Test extends User1AllPrivileges with DefaultUsers with PrivateUser2Accounts {
class API1_2_1Test extends User1AllPrivileges with DefaultUsers with PrivateUser2AccountsAndSetUpWithTestData {
def v1_2_1Request = baseRequest / "obp" / "v1.2.1"

View File

@ -1,15 +1,11 @@
package code.management
import code.api._
import code.api.v1_2_1._
import code.bankconnectors.Connector
import code.model.{AccountId, BankId}
import code.api.util.APIUtil.OAuth.{Consumer, Token, _}
import code.setup.{APIResponse, DefaultUsers, PrivateUser2Accounts, User1AllPrivileges}
import net.liftweb.common.Empty
import code.api.v1_2_1._
import code.setup.{APIResponse, DefaultUsers, PrivateUser2AccountsAndSetUpWithTestData, User1AllPrivileges}
import org.scalatest.Tag
class AccountsAPITest extends API1_2_1Test with User1AllPrivileges with DefaultUsers with PrivateUser2Accounts {
class AccountsAPITest extends API1_2_1Test with User1AllPrivileges with DefaultUsers with PrivateUser2AccountsAndSetUpWithTestData {
//define Tags
object Management extends Tag("Management")

View File

@ -347,8 +347,8 @@ class SandboxDataLoadingTest extends FlatSpec with SendServerRequests with Match
//counterparty
if(transaction.counterparty.isDefined) {
transaction.counterparty.get.name match {
case Some(name) => otherAcc.label should equal(name)
case None => otherAcc.label.nonEmpty should equal(true) //it should generate a counterparty label
case Some(name) => otherAcc.name should equal(name)
case None => otherAcc.name.nonEmpty should equal(true) //it should generate a counterparty label
}
transaction.counterparty.get.account_number match {
@ -1246,7 +1246,7 @@ class SandboxDataLoadingTest extends FlatSpec with SendServerRequests with Match
createdTransaction.isDefined should equal(true)
val created = createdTransaction.openOrThrowException("Attempted to open an empty Box.")
created.otherAccount.label.nonEmpty should equal(true)
created.otherAccount.name.nonEmpty should equal(true)
created.otherAccount.thisAccountId.value should equal(t.counterparty.get.account_number.get)
}
@ -1274,7 +1274,7 @@ class SandboxDataLoadingTest extends FlatSpec with SendServerRequests with Match
createdTransaction.isDefined should equal(true)
val created = createdTransaction.openOrThrowException("Attempted to open an empty Box.")
created.otherAccount.label.nonEmpty should equal(true)
created.otherAccount.name.nonEmpty should equal(true)
created.otherAccount.thisAccountId.value should equal(t.counterparty.get.account_number.get)
}
@ -1302,7 +1302,7 @@ class SandboxDataLoadingTest extends FlatSpec with SendServerRequests with Match
createdTransaction.isDefined should equal(true)
val created = createdTransaction.openOrThrowException("Attempted to open an empty Box.")
created.otherAccount.label should equal(t.counterparty.get.name.get)
created.otherAccount.name should equal(t.counterparty.get.name.get)
created.otherAccount.thisAccountId.value should equal("")
}
@ -1329,7 +1329,7 @@ class SandboxDataLoadingTest extends FlatSpec with SendServerRequests with Match
createdTransaction.isDefined should equal(true)
val created = createdTransaction.openOrThrowException("Attempted to open an empty Box.")
created.otherAccount.label should equal(t.counterparty.get.name.get)
created.otherAccount.name should equal(t.counterparty.get.name.get)
created.otherAccount.thisAccountId.value should equal("")
}
@ -1512,8 +1512,7 @@ class SandboxDataLoadingTest extends FlatSpec with SendServerRequests with Match
counter2.thisAccountId.value should equal(counterpartyAccNumber2)
}
it should "always create a new counterparty if none was specified, rather than having all transactions without specified" +
"counterparties share a single one" in {
it should "always share a single one counterparty if none was specified (perfermance issue, if each time we create the new one)" in {
val (banks, users, accounts) = (standardBanks, standardUsers, standardAccounts)
@ -1551,12 +1550,12 @@ class SandboxDataLoadingTest extends FlatSpec with SendServerRequests with Match
val counter2 = foundTransaction2Box.openOrThrowException("Attempted to open an empty Box.").otherAccount
val counter3 = foundTransaction3Box.openOrThrowException("Attempted to open an empty Box.").otherAccount
counter1.counterPartyId should not equal(counter2.counterPartyId)
counter1.counterPartyId should not equal(counter3.counterPartyId)
counter2.counterPartyId should not equal(counter3.counterPartyId)
counter1.metadata.getPublicAlias should not equal(counter2.metadata.getPublicAlias)
counter1.metadata.getPublicAlias should not equal(counter3.metadata.getPublicAlias)
counter2.metadata.getPublicAlias should not equal(counter3.metadata.getPublicAlias)
counter1.counterPartyId should equal(counter2.counterPartyId)
counter1.counterPartyId should equal(counter3.counterPartyId)
counter2.counterPartyId should equal(counter3.counterPartyId)
counter1.metadata.getPublicAlias should equal(counter2.metadata.getPublicAlias)
counter1.metadata.getPublicAlias should equal(counter3.metadata.getPublicAlias)
counter2.metadata.getPublicAlias should equal(counter3.metadata.getPublicAlias)
}
it should "not create any transactions when one has an invalid or missing value" in {

View File

@ -123,6 +123,12 @@ trait LocalMappedConnectorTestSetup extends TestConnectorSetupWithStandardPermis
.counterpartyBankName(randomString(5))
.counterpartyIban(randomString(5))
.counterpartyNationalId(randomString(5))
.CPOtherAccountRoutingScheme(randomString(5))
.CPOtherAccountRoutingAddress(randomString(5))
.CPOtherAccountSecondaryRoutingScheme(randomString(5))
.CPOtherAccountSecondaryRoutingAddress(randomString(5))
.CPOtherBankRoutingScheme(randomString(5))
.CPOtherBankRoutingAddress(randomString(5))
.saveMe
.toTransaction.orNull
}

View File

@ -4,7 +4,7 @@ import code.bankconnectors.Connector
import code.model.{AccountId, User}
import net.liftweb.util.Helpers._
trait PrivateUser2Accounts {
trait PrivateUser2AccountsAndSetUpWithTestData {
self: ServerSetupWithTestData with DefaultUsers =>