Create call for POST Counterparty (aka Other Account) #201, renamed OtherBankAccount -> Counterparty, second commit

This commit is contained in:
Marko Milic 2016-11-08 16:44:43 +01:00
parent 6ba7a2a6b9
commit 903e29989b
7 changed files with 403 additions and 403 deletions

View File

@ -105,9 +105,9 @@ trait Connector {
def getBankAccount(bankId : BankId, accountId : AccountId) : Box[AccountType]
def getOtherBankAccount(bankId: BankId, accountID : AccountId, otherAccountID : String) : Box[Counterparty]
def getCounterparty(bankId: BankId, accountID : AccountId, counterpartyID : String) : Box[Counterparty]
def getOtherBankAccounts(bankId: BankId, accountID : AccountId): List[Counterparty]
def getCounterpaties(bankId: BankId, accountID : AccountId): List[Counterparty]
def getTransactions(bankId: BankId, accountID: AccountId, queryParams: OBPQueryParam*): Box[List[Transaction]]

View File

@ -431,13 +431,13 @@ object KafkaMappedConnector extends Connector with CreateViewImpls with Loggable
// Get all counterparties related to an account
override def getOtherBankAccounts(bankId: BankId, accountID: AccountId): List[Counterparty] =
override def getCounterpaties(bankId: BankId, accountID: AccountId): List[Counterparty] =
Counterparties.counterparties.vend.getMetadatas(bankId, accountID).flatMap(getOtherBankAccount(bankId, accountID, _))
// Get one counterparty related to a bank account
override def getOtherBankAccount(bankId: BankId, accountID: AccountId, otherAccountID: String): Box[Counterparty] =
override def getCounterparty(bankId: BankId, accountID: AccountId, counterpartyID: String): Box[Counterparty] =
// Get the metadata and pass it to getOtherBankAccount to construct the other account.
Counterparties.counterparties.vend.getMetadata(bankId, accountID, otherAccountID).flatMap(getOtherBankAccount(bankId, accountID, _))
Counterparties.counterparties.vend.getMetadata(bankId, accountID, counterpartyID).flatMap(getOtherBankAccount(bankId, accountID, _))
override def getPhysicalCards(user: User): Set[PhysicalCard] =
Set.empty

View File

@ -51,7 +51,7 @@ private object LocalConnector extends Connector with Loggable {
}
override def getOtherBankAccount(bankId: BankId, accountId : AccountId, otherAccountID : String): Box[Counterparty] = {
override def getCounterparty(bankId: BankId, accountId : AccountId, counterpartyID : String): Box[Counterparty] = {
/**
* In this implementation (for legacy reasons), the "otherAccountID" is actually the mongodb id of the
@ -59,7 +59,7 @@ private object LocalConnector extends Connector with Loggable {
*/
for{
objId <- tryo{ new ObjectId(otherAccountID) }
objId <- tryo{ new ObjectId(counterpartyID) }
otherAccountmetadata <- {
//"otherAccountID" is actually the mongodb id of the other account metadata" object.
val query = QueryBuilder.
@ -84,7 +84,7 @@ private object LocalConnector extends Connector with Loggable {
}
}
override def getOtherBankAccounts(bankId: BankId, accountId : AccountId): List[Counterparty] = {
override def getCounterpaties(bankId: BankId, accountId : AccountId): List[Counterparty] = {
/**
* In this implementation (for legacy reasons), the "otherAccountID" is actually the mongodb id of the

View File

@ -157,13 +157,13 @@ object LocalMappedConnector extends Connector with Loggable {
}
// Get all counterparties related to an account
override def getOtherBankAccounts(bankId: BankId, accountID: AccountId): List[Counterparty] =
override def getCounterpaties(bankId: BankId, accountID: AccountId): List[Counterparty] =
Counterparties.counterparties.vend.getMetadatas(bankId, accountID).flatMap(getOtherBankAccount(bankId, accountID, _))
// Get one counterparty related to a bank account
override def getOtherBankAccount(bankId: BankId, accountID: AccountId, otherAccountID: String): Box[Counterparty] =
override def getCounterparty(bankId: BankId, accountID: AccountId, counterpartyID: String): Box[Counterparty] =
// Get the metadata and pass it to getOtherBankAccount to construct the other account.
Counterparties.counterparties.vend.getMetadata(bankId, accountID, otherAccountID).flatMap(getOtherBankAccount(bankId, accountID, _))
Counterparties.counterparties.vend.getMetadata(bankId, accountID, counterpartyID).flatMap(getOtherBankAccount(bankId, accountID, _))
override def getPhysicalCards(user: User): Set[PhysicalCard] =
Set.empty

View File

@ -520,7 +520,7 @@ trait BankAccount {
*/
final def moderatedOtherBankAccounts(view : View, user : Box[User]) : Box[List[ModeratedOtherBankAccount]] =
if(authorizedAccess(view, user))
Full(Connector.connector.vend.getOtherBankAccounts(bankId, accountId).map(oAcc => view.moderate(oAcc)).flatten)
Full(Connector.connector.vend.getCounterpaties(bankId, accountId).map(oAcc => view.moderate(oAcc)).flatten)
else
viewNotAllowed(view)
/**
@ -532,7 +532,7 @@ trait BankAccount {
*/
final def moderatedOtherBankAccount(otherAccountID : String, view : View, user : Box[User]) : Box[ModeratedOtherBankAccount] =
if(authorizedAccess(view, user))
Connector.connector.vend.getOtherBankAccount(bankId, accountId, otherAccountID).flatMap(oAcc => view.moderate(oAcc))
Connector.connector.vend.getCounterparty(bankId, accountId, otherAccountID).flatMap(oAcc => view.moderate(oAcc))
else
viewNotAllowed(view)

File diff suppressed because it is too large Load Diff

View File

@ -56,9 +56,9 @@ class PhysicalCardsTest extends ServerSetup with DefaultUsers {
override def getBank(bankId : BankId) : Box[Bank] = Empty
override def getBanks : List[Bank] = Nil
override def getBankAccount(bankId : BankId, accountId : AccountId) : Box[BankAccount] = Empty
override def getOtherBankAccount(bankId: BankId, accountID : AccountId, otherAccountID : String) : Box[Counterparty] =
override def getCounterparty(bankId: BankId, accountID : AccountId, counterpartyID : String) : Box[Counterparty] =
Empty
override def getOtherBankAccounts(bankId: BankId, accountID : AccountId): List[Counterparty] =
override def getCounterpaties(bankId: BankId, accountID : AccountId): List[Counterparty] =
Nil
override def getTransactions(bankId: BankId, accountID: AccountId, queryParams: OBPQueryParam*): Box[List[Transaction]] =
Empty