feature/Add currency to a counterparty

This commit is contained in:
Guillaume Kergreis 2020-09-14 16:18:11 +02:00
parent 9a47b9bea9
commit a8c95a0878
29 changed files with 583 additions and 46 deletions

View File

@ -16,7 +16,7 @@ import code.api.v3_0_0.JSONFactory300.createBranchJsonV300
import code.api.v3_0_0.custom.JSONFactoryCustom300
import code.api.v3_0_0.{LobbyJsonV330, _}
import code.api.v3_1_0.{AccountBalanceV310, AccountsBalancesV310Json, BadLoginStatusJson, ContactDetailsJson, CustomerWithAttributesJsonV310, InviteeJson, ObpApiLoopbackJson, PhysicalCardWithAttributesJsonV310, PutUpdateCustomerEmailJsonV310, _}
import code.api.v4_0_0.{APIInfoJson400, AccountTagJSON, AccountTagsJSON, AttributeDefinitionJsonV400, AttributeDefinitionResponseJsonV400, AttributeDefinitionsResponseJsonV400, BankJson400, BanksJson400, ChallengeJsonV400, CustomerAttributeJsonV400, CustomerAttributesResponseJson, DirectDebitJsonV400, EnergySource400, HostedAt400, HostedBy400, LogoutLinkJson, ModeratedAccountJSON400, ModeratedCoreAccountJsonV400, PostAccountAccessJsonV400, PostAccountTagJSON, PostCustomerPhoneNumberJsonV400, PostDirectDebitJsonV400, PostStandingOrderJsonV400, PostViewJsonV400, RefundJson, RevokedJsonV400, SettlementAccountJson, SettlementAccountRequestJson, SettlementAccountResponseJson, SettlementAccountsJson, StandingOrderJsonV400, TransactionAttributeJsonV400, TransactionAttributeResponseJson, TransactionAttributesResponseJson, TransactionRequestBodyRefundJsonV400, TransactionRequestBodySEPAJsonV400, TransactionRequestReasonJsonV400, TransactionRequestWithChargeJSON400, UserLockStatusJson, When}
import code.api.v4_0_0.{APIInfoJson400, AccountTagJSON, AccountTagsJSON, AttributeDefinitionJsonV400, AttributeDefinitionResponseJsonV400, AttributeDefinitionsResponseJsonV400, BankJson400, BanksJson400, ChallengeJsonV400, CounterpartiesJson400, CounterpartyJson400, CounterpartyWithMetadataJson400, CustomerAttributeJsonV400, CustomerAttributesResponseJson, DirectDebitJsonV400, EnergySource400, HostedAt400, HostedBy400, LogoutLinkJson, ModeratedAccountJSON400, ModeratedCoreAccountJsonV400, PostAccountAccessJsonV400, PostAccountTagJSON, PostCustomerPhoneNumberJsonV400, PostDirectDebitJsonV400, PostStandingOrderJsonV400, PostViewJsonV400, RefundJson, RevokedJsonV400, SettlementAccountJson, SettlementAccountRequestJson, SettlementAccountResponseJson, SettlementAccountsJson, StandingOrderJsonV400, TransactionAttributeJsonV400, TransactionAttributeResponseJson, TransactionAttributesResponseJson, TransactionRequestBodyRefundJsonV400, TransactionRequestBodySEPAJsonV400, TransactionRequestReasonJsonV400, TransactionRequestWithChargeJSON400, UserLockStatusJson, When, PostCounterpartyJson400}
import code.api.v3_1_0.{AccountBalanceV310, AccountsBalancesV310Json, BadLoginStatusJson, ContactDetailsJson, InviteeJson, ObpApiLoopbackJson, PhysicalCardWithAttributesJsonV310, PutUpdateCustomerEmailJsonV310, _}
import code.branches.Branches.{Branch, DriveUpString, LobbyString}
import code.consent.ConsentStatus
@ -2324,6 +2324,22 @@ object SwaggerDefinitionsJSON {
bespoke = List(postCounterpartyBespokeJson)
)
val postCounterpartyJson400 = PostCounterpartyJson400(
name = "CounterpartyName",
description ="My landlord",
currency = currencyExample.value,
other_account_routing_scheme = counterpartyOtherAccountRoutingSchemeExample.value,
other_account_routing_address = counterpartyOtherAccountRoutingAddressExample.value,
other_account_secondary_routing_scheme = counterpartyOtherAccountSecondaryRoutingSchemeExample.value,
other_account_secondary_routing_address = counterpartyOtherAccountSecondaryRoutingAddressExample.value,
other_bank_routing_scheme = counterpartyOtherBankRoutingSchemeExample.value,
other_bank_routing_address = counterpartyOtherBankRoutingAddressExample.value,
other_branch_routing_scheme = counterpartyOtherBranchRoutingSchemeExample.value,
other_branch_routing_address = counterpartyOtherBranchRoutingAddressExample.value,
is_beneficiary = true,
bespoke = List(postCounterpartyBespokeJson)
)
val metricsJson = MetricsJson(
metrics = List(metricJson)
)
@ -2454,6 +2470,27 @@ object SwaggerDefinitionsJSON {
other_account_secondary_routing_address= counterpartyOtherAccountSecondaryRoutingAddressExample.value,
bespoke = postCounterpartyJSON.bespoke
)
val counterpartyJson400 = CounterpartyJson400(
name = postCounterpartyJson400.name,
description = postCounterpartyJson400.description,
currency = postCounterpartyJson400.currency,
created_by_user_id = ExampleValue.userIdExample.value,
this_bank_id = bankIdExample.value,
this_account_id =accountIdExample.value,
this_view_id = SYSTEM_OWNER_VIEW_ID,
counterparty_id = counterpartyIdExample.value,
other_bank_routing_scheme = postCounterpartyJson400.other_bank_routing_scheme,
other_bank_routing_address = postCounterpartyJson400.other_bank_routing_address,
other_branch_routing_scheme = postCounterpartyJson400.other_branch_routing_scheme,
other_branch_routing_address = postCounterpartyJson400.other_branch_routing_address,
other_account_routing_scheme = postCounterpartyJson400.other_account_routing_scheme,
other_account_routing_address = postCounterpartyJson400.other_account_routing_address,
is_beneficiary = true,
other_account_secondary_routing_scheme = counterpartyOtherAccountSecondaryRoutingSchemeExample.value,
other_account_secondary_routing_address= counterpartyOtherAccountSecondaryRoutingAddressExample.value,
bespoke = postCounterpartyJson400.bespoke
)
val counterpartyMetadataJson = CounterpartyMetadataJson(
public_alias = "String",
@ -2487,10 +2524,36 @@ object SwaggerDefinitionsJSON {
metadata = counterpartyMetadataJson
)
val counterpartyWithMetadataJson400 = CounterpartyWithMetadataJson400(
name = postCounterpartyJson400.name,
description = postCounterpartyJson400.description,
currency = postCounterpartyJson400.currency,
created_by_user_id = ExampleValue.userIdExample.value,
this_bank_id = bankIdExample.value,
this_account_id =accountIdExample.value,
this_view_id = SYSTEM_OWNER_VIEW_ID,
counterparty_id = counterpartyIdExample.value,
other_bank_routing_scheme = postCounterpartyJson400.other_bank_routing_scheme,
other_bank_routing_address = postCounterpartyJson400.other_bank_routing_address,
other_branch_routing_scheme = postCounterpartyJson400.other_branch_routing_scheme,
other_branch_routing_address = postCounterpartyJson400.other_branch_routing_address,
other_account_routing_scheme = postCounterpartyJson400.other_account_routing_scheme,
other_account_routing_address = postCounterpartyJson400.other_account_routing_address,
is_beneficiary = true,
other_account_secondary_routing_scheme = counterpartyOtherAccountSecondaryRoutingSchemeExample.value,
other_account_secondary_routing_address= counterpartyOtherAccountSecondaryRoutingAddressExample.value,
bespoke = postCounterpartyJson400.bespoke,
metadata = counterpartyMetadataJson
)
val counterpartiesJsonV220 = CounterpartiesJsonV220(
counterparties = List(counterpartyJsonV220)
)
val counterpartiesJson400 = CounterpartiesJson400(
counterparties = List(counterpartyJson400)
)
val bankJSONV220 = BankJSONV220(
id = "gh.29.uk.x",
full_name = "uk",

View File

@ -2275,6 +2275,7 @@ object NewStyle {
def createCounterparty(
name: String,
description: String,
currency: String,
createdByUserId: String,
thisBankId: String,
thisAccountId: String,
@ -2294,6 +2295,7 @@ object NewStyle {
unboxFullOrFail(Connector.connector.vend.createCounterparty(
name: String,
description: String,
currency: String,
createdByUserId: String,
thisBankId: String,
thisAccountId: String,

View File

@ -1151,6 +1151,7 @@ trait APIMethods220 {
(counterparty, callContext) <- NewStyle.function.createCounterparty(
name=postJson.name,
description=postJson.description,
currency = "",
createdByUserId=u.userId,
thisBankId=bankId.value,
thisAccountId=accountId.value,

View File

@ -45,6 +45,7 @@ import code.transactionrequests.TransactionRequests.TransactionRequestTypes.{app
import code.userlocks.UserLocksProvider
import code.users.Users
import code.util.Helper
import code.util.Helper.booleanToFuture
import com.openbankproject.commons.util.JsonUtils
import code.views.Views
import com.github.dwickern.macros.NameOf.nameOf
@ -4206,13 +4207,13 @@ trait APIMethods400 {
}
staticResourceDocs += ResourceDoc(
createCounterpartyForAnyAccount,
createCounterparty,
implementedInApiVersion,
"createCounterpartyForAnyAccount",
"createCounterparty",
"POST",
"/management/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparties",
"Create Counterparty for any account (Explicit)",
s"""Create Counterparty for any Account. (Explicit)
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparties",
"Create Counterparty (Explicit)",
s"""Create Counterparty (Explicit) for an Account.
|
|In OBP, there are two types of Counterparty.
|
@ -4227,6 +4228,8 @@ trait APIMethods400 {
|
|description : the human readable name (e.g. Piano teacher, Miss Nipa)
|
|currency : counterparty account currency (e.g. EUR, GBP, USD, ...)
|
|bank_routing_scheme : eg: bankId or bankCode or any other strings
|
|bank_routing_address : eg: `gh.29.uk`, must be valid sandbox bankIds
@ -4257,6 +4260,7 @@ trait APIMethods400 {
| {
| "name": "Tesobe1",
| "description": "Good Company",
| "currency": "EUR",
| "other_bank_routing_scheme": "OBP",
| "other_bank_routing_address": "gh.29.uk",
| "other_account_routing_scheme": "OBP",
@ -4275,6 +4279,7 @@ trait APIMethods400 {
| {
| "name": "Tesobe2",
| "description": "Good Company",
| "currency": "EUR",
| "other_bank_routing_scheme": "OBP",
| "other_bank_routing_address": "gh.29.uk",
| "other_account_routing_scheme": "OBP",
@ -4290,8 +4295,8 @@ trait APIMethods400 {
|${authenticationRequiredMessage(true)}
|
|""".stripMargin,
postCounterpartyJSON,
counterpartyWithMetadataJson,
postCounterpartyJson400,
counterpartyWithMetadataJson400,
List(
UserNotLoggedIn,
InvalidAccountIdFormat,
@ -4299,25 +4304,30 @@ trait APIMethods400 {
BankNotFound,
AccountNotFound,
InvalidJsonFormat,
InvalidISOCurrencyCode,
ViewNotFound,
CounterpartyAlreadyExists,
UnknownError
),
Catalogs(notCore, notPSD2, notOBWG),
List(apiTagCounterparty, apiTagAccount),
Some(List(canCreateCounterpartyAtBank)))
List(apiTagCounterparty, apiTagAccount))
lazy val createCounterpartyForAnyAccount: OBPEndpoint = {
case "management" :: "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId):: "counterparties" :: Nil JsonPost json -> _ => {
lazy val createCounterparty: OBPEndpoint = {
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "counterparties" :: Nil JsonPost json -> _ => {
cc =>
for {
(Full(u), callContext) <- authenticatedAccess(cc)
postJson <- NewStyle.function.tryons(InvalidJsonFormat, 400, cc.callContext) {
json.extract[PostCounterpartyJSON]
(Full(u), callContext) <- authenticatedAccess(cc)
_ <- Helper.booleanToFuture(InvalidAccountIdFormat) {isValidID(accountId.value)}
_ <- Helper.booleanToFuture(InvalidBankIdFormat) {isValidID(bankId.value)}
(bank, callContext ) <- NewStyle.function.getBank(bankId, callContext)
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
postJson <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $PostCounterpartyJSON", 400, cc.callContext) {
json.extract[PostCounterpartyJson400]
}
_ <- Helper.booleanToFuture(s"$InvalidValueLength. The maximum length of `description` field is ${MappedCounterparty.mDescription.maxLen}"){postJson.description.length <= 36}
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
_ <- Helper.booleanToFuture(s"$NoViewPermission can_add_counterparty. Please use a view with that permission or add the permission to this view.") {view.canAddCounterparty}
(counterparty, callContext) <- Connector.connector.vend.checkCounterpartyExists(postJson.name, bankId.value, accountId.value, viewId.value, callContext)
@ -4325,6 +4335,12 @@ trait APIMethods400 {
s"COUNTERPARTY_NAME(${postJson.name}) for the BANK_ID(${bankId.value}) and ACCOUNT_ID(${accountId.value}) and VIEW_ID($viewId)")){
counterparty.isEmpty
}
_ <- booleanToFuture(s"$InvalidValueLength. The maximum length of `description` field is ${MappedCounterparty.mDescription.maxLen}"){
postJson.description.length <= 36
}
_ <- Helper.booleanToFuture(s"$InvalidISOCurrencyCode Current input is: '${postJson.currency}'") {
isValidCurrencyISOCode(postJson.currency)
}
//If other_account_routing_scheme=="OBP" or other_account_secondary_routing_address=="OBP" we will check if it is a real obp bank account.
(_, callContext)<- if (postJson.other_bank_routing_scheme == "OBP" && postJson.other_account_routing_scheme =="OBP"){
@ -4350,6 +4366,186 @@ trait APIMethods400 {
(counterparty, callContext) <- NewStyle.function.createCounterparty(
name=postJson.name,
description=postJson.description,
currency=postJson.currency,
createdByUserId=u.userId,
thisBankId=bankId.value,
thisAccountId=accountId.value,
thisViewId = viewId.value,
otherAccountRoutingScheme=postJson.other_account_routing_scheme,
otherAccountRoutingAddress=postJson.other_account_routing_address,
otherAccountSecondaryRoutingScheme=postJson.other_account_secondary_routing_scheme,
otherAccountSecondaryRoutingAddress=postJson.other_account_secondary_routing_address,
otherBankRoutingScheme=postJson.other_bank_routing_scheme,
otherBankRoutingAddress=postJson.other_bank_routing_address,
otherBranchRoutingScheme=postJson.other_branch_routing_scheme,
otherBranchRoutingAddress=postJson.other_branch_routing_address,
isBeneficiary=postJson.is_beneficiary,
bespoke=postJson.bespoke.map(bespoke =>CounterpartyBespoke(bespoke.key,bespoke.value))
, callContext)
(counterpartyMetadata, callContext) <- NewStyle.function.getOrCreateMetadata(bankId, accountId, counterparty.counterpartyId, postJson.name, callContext)
} yield {
(JSONFactory400.createCounterpartyWithMetadataJson400(counterparty,counterpartyMetadata), HttpCode.`201`(callContext))
}
}
}
staticResourceDocs += ResourceDoc(
createCounterpartyForAnyAccount,
implementedInApiVersion,
"createCounterpartyForAnyAccount",
"POST",
"/management/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparties",
"Create Counterparty for any account (Explicit)",
s"""Create Counterparty for any Account. (Explicit)
|
|In OBP, there are two types of Counterparty.
|
|* Explicit Counterparties (those here) which we create explicitly and are used in COUNTERPARTY Transaction Requests
|
|* Implicit Counterparties (AKA Other Accounts) which are generated automatically from the other sides of Transactions.
|
|Explicit Counterparties are created for the account / view
|They are how the user of the view (e.g. account owner) refers to the other side of the transaction
|
|name : the human readable name (e.g. Piano teacher, Miss Nipa)
|
|description : the human readable name (e.g. Piano teacher, Miss Nipa)
|
|currency : counterparty account currency (e.g. EUR, GBP, USD, ...)
|
|bank_routing_scheme : eg: bankId or bankCode or any other strings
|
|bank_routing_address : eg: `gh.29.uk`, must be valid sandbox bankIds
|
|account_routing_scheme : eg: AccountId or AccountNumber or any other strings
|
|account_routing_address : eg: `1d65db7c-a7b2-4839-af41-95`, must be valid accountIds
|
|other_account_secondary_routing_scheme : eg: IBan or any other strings
|
|other_account_secondary_routing_address : if it is an IBAN, it should be unique for each counterparty.
|
|other_branch_routing_scheme : eg: branchId or any other strings or you can leave it empty, not useful in sandbox mode.
|
|other_branch_routing_address : eg: `branch-id-123` or you can leave it empty, not useful in sandbox mode.
|
|is_beneficiary : must be set to `true` in order to send payments to this counterparty
|
|bespoke: It supports a list of key-value, you can add it to the counterparty.
|
|bespoke.key : any info-key you want to add to this counterparty
|
|bespoke.value : any info-value you want to add to this counterparty
|
|The view specified by VIEW_ID must have the canAddCounterparty permission
|
|A minimal example for TransactionRequestType == COUNTERPARTY
| {
| "name": "Tesobe1",
| "description": "Good Company",
| "currency": "EUR",
| "other_bank_routing_scheme": "OBP",
| "other_bank_routing_address": "gh.29.uk",
| "other_account_routing_scheme": "OBP",
| "other_account_routing_address": "8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
| "is_beneficiary": true,
| "other_account_secondary_routing_scheme": "",
| "other_account_secondary_routing_address": "",
| "other_branch_routing_scheme": "",
| "other_branch_routing_address": "",
| "bespoke": []
|}
|
|
|A minimal example for TransactionRequestType == SEPA
|
| {
| "name": "Tesobe2",
| "description": "Good Company",
| "currency": "EUR",
| "other_bank_routing_scheme": "OBP",
| "other_bank_routing_address": "gh.29.uk",
| "other_account_routing_scheme": "OBP",
| "other_account_routing_address": "8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
| "other_account_secondary_routing_scheme": "IBAN",
| "other_account_secondary_routing_address": "DE89 3704 0044 0532 0130 00",
| "is_beneficiary": true,
| "other_branch_routing_scheme": "",
| "other_branch_routing_address": "",
| "bespoke": []
|}
|
|${authenticationRequiredMessage(true)}
|
|""".stripMargin,
postCounterpartyJson400,
counterpartyWithMetadataJson400,
List(
UserNotLoggedIn,
InvalidAccountIdFormat,
InvalidBankIdFormat,
BankNotFound,
AccountNotFound,
InvalidJsonFormat,
InvalidISOCurrencyCode,
ViewNotFound,
CounterpartyAlreadyExists,
UnknownError
),
Catalogs(notCore, notPSD2, notOBWG),
List(apiTagCounterparty, apiTagAccount),
Some(List(canCreateCounterpartyAtBank)))
lazy val createCounterpartyForAnyAccount: OBPEndpoint = {
case "management" :: "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId):: "counterparties" :: Nil JsonPost json -> _ => {
cc =>
for {
(Full(u), callContext) <- authenticatedAccess(cc)
postJson <- NewStyle.function.tryons(InvalidJsonFormat, 400, cc.callContext) {
json.extract[PostCounterpartyJson400]
}
_ <- Helper.booleanToFuture(s"$InvalidValueLength. The maximum length of `description` field is ${MappedCounterparty.mDescription.maxLen}"){postJson.description.length <= 36}
(counterparty, callContext) <- Connector.connector.vend.checkCounterpartyExists(postJson.name, bankId.value, accountId.value, viewId.value, callContext)
_ <- Helper.booleanToFuture(CounterpartyAlreadyExists.replace("value for BANK_ID or ACCOUNT_ID or VIEW_ID or NAME.",
s"COUNTERPARTY_NAME(${postJson.name}) for the BANK_ID(${bankId.value}) and ACCOUNT_ID(${accountId.value}) and VIEW_ID($viewId)")){
counterparty.isEmpty
}
_ <- Helper.booleanToFuture(s"$InvalidISOCurrencyCode Current input is: '${postJson.currency}'") {
isValidCurrencyISOCode(postJson.currency)
}
//If other_account_routing_scheme=="OBP" or other_account_secondary_routing_address=="OBP" we will check if it is a real obp bank account.
(_, callContext)<- if (postJson.other_bank_routing_scheme == "OBP" && postJson.other_account_routing_scheme =="OBP"){
for{
(_, callContext) <- NewStyle.function.getBank(BankId(postJson.other_bank_routing_address), Some(cc))
(account, callContext) <- NewStyle.function.checkBankAccountExists(BankId(postJson.other_bank_routing_address), AccountId(postJson.other_account_routing_address), callContext)
} yield {
(account, callContext)
}
} else if (postJson.other_bank_routing_scheme == "OBP" && postJson.other_account_secondary_routing_scheme=="OBP"){
for{
(_, callContext) <- NewStyle.function.getBank(BankId(postJson.other_bank_routing_address), Some(cc))
(account, callContext) <- NewStyle.function.checkBankAccountExists(BankId(postJson.other_bank_routing_address), AccountId(postJson.other_account_secondary_routing_address), callContext)
} yield {
(account, callContext)
}
}
else
Future{(Full(), Some(cc))}
(counterparty, callContext) <- NewStyle.function.createCounterparty(
name=postJson.name,
description=postJson.description,
currency=postJson.currency,
createdByUserId=u.userId,
thisBankId=bankId.value,
thisAccountId=accountId.value,
@ -4369,7 +4565,100 @@ trait APIMethods400 {
(counterpartyMetadata, callContext) <- NewStyle.function.getOrCreateMetadata(bankId, accountId, counterparty.counterpartyId, postJson.name, callContext)
} yield {
(JSONFactory220.createCounterpartyWithMetadataJSON(counterparty,counterpartyMetadata), HttpCode.`201`(callContext))
(JSONFactory400.createCounterpartyWithMetadataJson400(counterparty,counterpartyMetadata), HttpCode.`201`(callContext))
}
}
}
staticResourceDocs += ResourceDoc(
getExplictCounterpartiesForAccount,
implementedInApiVersion,
"getExplictCounterpartiesForAccount",
"GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparties",
"Get Counterparties (Explicit)",
s"""Get the Counterparties (Explicit) for the account / view.
|
|${authenticationRequiredMessage(true)}
|""".stripMargin,
emptyObjectJson,
counterpartiesJson400,
List(
UserNotLoggedIn,
BankAccountNotFound,
ViewNotFound,
NoViewPermission,
UserNoPermissionAccessView,
UnknownError
),
Catalogs(Core, PSD2, OBWG),
List(apiTagCounterparty, apiTagPSD2PIS, apiTagAccount))
lazy val getExplictCounterpartiesForAccount : OBPEndpoint = {
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "counterparties" :: Nil JsonGet req => {
cc =>
for {
(Full(u), callContext) <- authenticatedAccess(cc)
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), Some(u), callContext)
_ <- Helper.booleanToFuture(failMsg = s"${NoViewPermission}canAddCounterparty") {
view.canAddCounterparty == true
}
(counterparties, callContext) <- NewStyle.function.getCounterparties(bankId,accountId,viewId, callContext)
//Here we need create the metadata for all the explicit counterparties. maybe show them in json response.
//Note: actually we need update all the counterparty metadata when they from adapter. Some counterparties may be the first time to api, there is no metadata.
_ <- Helper.booleanToFuture(CreateOrUpdateCounterpartyMetadataError, 400) {
{
for {
counterparty <- counterparties
} yield {
Counterparties.counterparties.vend.getOrCreateMetadata(bankId, accountId, counterparty.counterpartyId, counterparty.name) match {
case Full(_) => true
case _ => false
}
}
}.forall(_ == true)
}
} yield {
val counterpartiesJson = JSONFactory400.createCounterpartiesJson400(counterparties)
(counterpartiesJson, HttpCode.`200`(callContext))
}
}
}
staticResourceDocs += ResourceDoc(
getExplictCounterpartyById,
implementedInApiVersion,
"getExplictCounterpartyById",
"GET",
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/counterparties/COUNTERPARTY_ID",
"Get Counterparty by Counterparty Id (Explicit)",
s"""Information returned about the Counterparty specified by COUNTERPARTY_ID:
|
|${authenticationRequiredMessage(true)}
|""".stripMargin,
emptyObjectJson,
counterpartyWithMetadataJson400,
List(UserNotLoggedIn, BankNotFound, UnknownError),
Catalogs(Core, PSD2, OBWG),
List(apiTagCounterparty, apiTagPSD2PIS, apiTagCounterpartyMetaData)
)
lazy val getExplictCounterpartyById : OBPEndpoint = {
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "counterparties" :: CounterpartyId(counterpartyId) :: Nil JsonGet req => {
cc =>
for {
(Full(u), callContext) <- authenticatedAccess(cc)
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), Some(u), callContext)
_ <- Helper.booleanToFuture(failMsg = s"${NoViewPermission}canAddCounterparty") {
view.canAddCounterparty == true
}
counterpartyMetadata <- NewStyle.function.getMetadata(bankId, accountId, counterpartyId.value, callContext)
(counterparty, callContext) <- NewStyle.function.getCounterpartyTrait(bankId, accountId, counterpartyId.value, callContext)
} yield {
val counterpartyJson = JSONFactory400.createCounterpartyWithMetadataJson400(counterparty,counterpartyMetadata)
(counterpartyJson, HttpCode.`200`(callContext))
}
}
}
@ -4387,7 +4676,7 @@ trait APIMethods400 {
|
|""".stripMargin,
emptyObjectJson,
counterpartyWithMetadataJson,
counterpartyWithMetadataJson400,
List(
UserNotLoggedIn,
InvalidAccountIdFormat,
@ -4419,7 +4708,7 @@ trait APIMethods400 {
(counterpartyMetadata, callContext) <- NewStyle.function.getOrCreateMetadata(bankId, accountId, counterparty.counterpartyId, counterparty.name, callContext)
} yield {
(JSONFactory220.createCounterpartyWithMetadataJSON(counterparty,counterpartyMetadata), HttpCode.`200`(callContext))
(JSONFactory400.createCounterpartyWithMetadataJson400(counterparty,counterpartyMetadata), HttpCode.`200`(callContext))
}
}
}

View File

@ -35,7 +35,8 @@ import code.api.v1_2_1.JSONFactory.{createAmountOfMoneyJSON, createOwnersJSON}
import code.api.v1_2_1.{BankRoutingJsonV121, JSONFactory, UserJSONV121, ViewJSONV121}
import code.api.v1_4_0.JSONFactory1_4_0.TransactionRequestAccountJsonV140
import code.api.v2_0_0.TransactionRequestChargeJsonV200
import code.api.v2_1_0.{IbanJson, ResourceUserJSON}
import code.api.v2_1_0.{IbanJson, JSONFactory210, PostCounterpartyBespokeJson, ResourceUserJSON}
import code.api.v2_2_0.CounterpartyMetadataJson
import code.api.v3_0_0.JSONFactory300.createAccountRoutingsJSON
import code.api.v3_0_0.{CustomerAttributeResponseJsonV300, ViewBasicV300}
import code.api.v3_1_0.AccountAttributeResponseJson
@ -360,6 +361,70 @@ case class SettlementAccountsJson(
settlement_accounts: List[SettlementAccountJson]
)
case class CounterpartyWithMetadataJson400(
name: String,
description: String,
currency: String,
created_by_user_id: String,
this_bank_id: String,
this_account_id: String,
this_view_id: String,
counterparty_id: String,
other_bank_routing_scheme: String,
other_bank_routing_address: String,
other_branch_routing_scheme: String,
other_branch_routing_address: String,
other_account_routing_scheme: String,
other_account_routing_address: String,
other_account_secondary_routing_scheme: String,
other_account_secondary_routing_address: String,
is_beneficiary: Boolean,
bespoke:List[PostCounterpartyBespokeJson],
metadata: CounterpartyMetadataJson
)
case class PostCounterpartyJson400(
name: String,
description: String,
currency: String,
other_account_routing_scheme: String,
other_account_routing_address: String,
other_account_secondary_routing_scheme: String,
other_account_secondary_routing_address: String,
other_bank_routing_scheme: String,
other_bank_routing_address: String,
other_branch_routing_scheme: String,
other_branch_routing_address: String,
is_beneficiary: Boolean,
bespoke: List[PostCounterpartyBespokeJson]
)
case class CounterpartyJson400(
name: String,
description: String,
currency: String,
created_by_user_id: String,
this_bank_id: String,
this_account_id: String,
this_view_id: String,
counterparty_id: String,
other_bank_routing_scheme: String,
other_bank_routing_address: String,
other_branch_routing_scheme: String,
other_branch_routing_address: String,
other_account_routing_scheme: String,
other_account_routing_address: String,
other_account_secondary_routing_scheme: String,
other_account_secondary_routing_address: String,
is_beneficiary: Boolean,
bespoke:List[PostCounterpartyBespokeJson]
)
case class CounterpartiesJson400(
counterparties: List[CounterpartyJson400]
)
object JSONFactory400 {
def createBankJSON400(bank: Bank): BankJson400 = {
val obp = BankRoutingJsonV121("OBP", bank.bankId.value)
@ -649,6 +714,65 @@ object JSONFactory400 {
userLock.typeOfLock,
userLock.lastLockDate)
}
def createCounterpartyWithMetadataJson400(counterparty: CounterpartyTrait, counterpartyMetadata: CounterpartyMetadata): CounterpartyWithMetadataJson400 = {
CounterpartyWithMetadataJson400(
name = counterparty.name,
description = counterparty.description,
currency = counterparty.currency,
created_by_user_id = counterparty.createdByUserId,
this_bank_id = counterparty.thisBankId,
this_account_id = counterparty.thisAccountId,
this_view_id = counterparty.thisViewId,
counterparty_id = counterparty.counterpartyId,
other_bank_routing_scheme = counterparty.otherBankRoutingScheme,
other_bank_routing_address = counterparty.otherBankRoutingAddress,
other_account_routing_scheme = counterparty.otherAccountRoutingScheme,
other_account_routing_address = counterparty.otherAccountRoutingAddress,
other_account_secondary_routing_scheme = counterparty.otherAccountSecondaryRoutingScheme,
other_account_secondary_routing_address = counterparty.otherAccountSecondaryRoutingAddress,
other_branch_routing_scheme = counterparty.otherBranchRoutingScheme,
other_branch_routing_address =counterparty.otherBranchRoutingAddress,
is_beneficiary = counterparty.isBeneficiary,
bespoke = counterparty.bespoke.map(bespoke =>PostCounterpartyBespokeJson(bespoke.key,bespoke.value)),
metadata=CounterpartyMetadataJson(
public_alias = counterpartyMetadata.getPublicAlias,
more_info = counterpartyMetadata.getMoreInfo,
url = counterpartyMetadata.getUrl,
image_url = counterpartyMetadata.getImageURL,
open_corporates_url = counterpartyMetadata.getOpenCorporatesURL,
corporate_location = JSONFactory210.createLocationJSON(counterpartyMetadata.getCorporateLocation),
physical_location = JSONFactory210.createLocationJSON(counterpartyMetadata.getPhysicalLocation),
private_alias = counterpartyMetadata.getPrivateAlias
)
)
}
def createCounterpartyJson400(counterparty: CounterpartyTrait): CounterpartyJson400 = {
CounterpartyJson400(
name = counterparty.name,
description = counterparty.description,
currency = counterparty.currency,
created_by_user_id = counterparty.createdByUserId,
this_bank_id = counterparty.thisBankId,
this_account_id = counterparty.thisAccountId,
this_view_id = counterparty.thisViewId,
counterparty_id = counterparty.counterpartyId,
other_bank_routing_scheme = counterparty.otherBankRoutingScheme,
other_bank_routing_address = counterparty.otherBankRoutingAddress,
other_account_routing_scheme = counterparty.otherAccountRoutingScheme,
other_account_routing_address = counterparty.otherAccountRoutingAddress,
other_account_secondary_routing_scheme = counterparty.otherAccountSecondaryRoutingScheme,
other_account_secondary_routing_address = counterparty.otherAccountSecondaryRoutingAddress,
other_branch_routing_scheme = counterparty.otherBranchRoutingScheme,
other_branch_routing_address =counterparty.otherBranchRoutingAddress,
is_beneficiary = counterparty.isBeneficiary,
bespoke = counterparty.bespoke.map(bespoke =>PostCounterpartyBespokeJson(bespoke.key,bespoke.value))
)
}
def createCounterpartiesJson400(counterparties: List[CounterpartyTrait]): CounterpartiesJson400 =
CounterpartiesJson400(counterparties.map(createCounterpartyJson400))
}

View File

@ -1720,6 +1720,7 @@ trait Connector extends MdcLoggable {
def createCounterparty(
name: String,
description: String,
currency: String,
createdByUserId: String,
thisBankId: String,
thisAccountId: String,

View File

@ -1161,6 +1161,7 @@ object KafkaMappedConnector extends Connector with KafkaHelper with MdcLoggable
def otherBranchRoutingAddress: String = counterparty.other_branch_routing_address
def isBeneficiary : Boolean = counterparty.is_beneficiary
def description: String = ""
def currency: String = ""
def otherAccountSecondaryRoutingScheme: String = ""
def otherAccountSecondaryRoutingAddress: String = ""
def bespoke: List[CounterpartyBespoke] = Nil

View File

@ -1334,6 +1334,7 @@ object KafkaMappedConnector_JVMcompatible extends Connector with KafkaHelper wit
def otherBranchRoutingAddress: String = counterparty.other_branch_routing_address
def isBeneficiary : Boolean = counterparty.is_beneficiary
def description: String = ""
def currency: String = ""
def otherAccountSecondaryRoutingScheme: String = ""
def otherAccountSecondaryRoutingAddress: String = ""
def bespoke: List[CounterpartyBespoke] = Nil

View File

@ -2585,6 +2585,7 @@ object LocalMappedConnector extends Connector with MdcLoggable {
override def createCounterparty(
name: String,
description: String,
currency: String,
createdByUserId: String,
thisBankId: String,
thisAccountId: String,
@ -2616,6 +2617,7 @@ object LocalMappedConnector extends Connector with MdcLoggable {
otherAccountSecondaryRoutingScheme = otherAccountSecondaryRoutingScheme,
otherAccountSecondaryRoutingAddress = otherAccountSecondaryRoutingAddress,
description = description,
currency = currency,
bespoke = bespoke
).map(counterparty => (counterparty, callContext))

View File

@ -740,6 +740,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -783,6 +784,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -826,6 +828,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -871,6 +874,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
data=List( CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -2450,6 +2454,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
toCounterparty= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -2535,6 +2540,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
toCounterparty= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -2648,6 +2654,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
OutBoundCreateCounterparty(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext,
name="string",
description="string",
currency=currencyExample.value,
createdByUserId="string",
thisBankId="string",
thisAccountId="string",
@ -2670,6 +2677,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -2689,9 +2697,9 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
adapterImplementation = Some(AdapterImplementation("- Core", 1))
)
override def createCounterparty(name: String, description: String, createdByUserId: String, thisBankId: String, thisAccountId: String, thisViewId: String, otherAccountRoutingScheme: String, otherAccountRoutingAddress: String, otherAccountSecondaryRoutingScheme: String, otherAccountSecondaryRoutingAddress: String, otherBankRoutingScheme: String, otherBankRoutingAddress: String, otherBranchRoutingScheme: String, otherBranchRoutingAddress: String, isBeneficiary: Boolean, bespoke: List[CounterpartyBespoke], callContext: Option[CallContext]): Box[(CounterpartyTrait, Option[CallContext])] = {
override def createCounterparty(name: String, description: String, currency: String, createdByUserId: String, thisBankId: String, thisAccountId: String, thisViewId: String, otherAccountRoutingScheme: String, otherAccountRoutingAddress: String, otherAccountSecondaryRoutingScheme: String, otherAccountSecondaryRoutingAddress: String, otherBankRoutingScheme: String, otherBankRoutingAddress: String, otherBranchRoutingScheme: String, otherBranchRoutingAddress: String, isBeneficiary: Boolean, bespoke: List[CounterpartyBespoke], callContext: Option[CallContext]): Box[(CounterpartyTrait, Option[CallContext])] = {
import com.openbankproject.commons.dto.{OutBoundCreateCounterparty => OutBound, InBoundCreateCounterparty => InBound}
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, name, description, createdByUserId, thisBankId, thisAccountId, thisViewId, otherAccountRoutingScheme, otherAccountRoutingAddress, otherAccountSecondaryRoutingScheme, otherAccountSecondaryRoutingAddress, otherBankRoutingScheme, otherBankRoutingAddress, otherBranchRoutingScheme, otherBranchRoutingAddress, isBeneficiary, bespoke)
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, name, description, currency, createdByUserId, thisBankId, thisAccountId, thisViewId, otherAccountRoutingScheme, otherAccountRoutingAddress, otherAccountSecondaryRoutingScheme, otherAccountSecondaryRoutingAddress, otherBankRoutingScheme, otherBankRoutingAddress, otherBranchRoutingScheme, otherBranchRoutingAddress, isBeneficiary, bespoke)
val response: Future[Box[InBound]] = (southSideActor ? req).mapTo[InBound].recoverWith(recoverFunction).map(Box !! _)
response.map(convertToTuple[CounterpartyTraitCommons](callContext))
}

View File

@ -1663,6 +1663,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -1739,6 +1740,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -1815,6 +1817,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -1891,6 +1894,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -1969,6 +1973,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
data=List( CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -2047,6 +2052,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
data=List( CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -4724,6 +4730,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
toCounterparty= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -4842,6 +4849,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
toCounterparty= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -4988,6 +4996,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
name=usernameExample.value))))))))),
name="string",
description="string",
currency=currencyExample.value,
createdByUserId="string",
thisBankId="string",
thisAccountId="string",
@ -5017,6 +5026,7 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -5036,10 +5046,10 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
adapterImplementation = Some(AdapterImplementation("- Core", 1))
)
// url example: /createCounterparty
override def createCounterparty(name: String, description: String, createdByUserId: String, thisBankId: String, thisAccountId: String, thisViewId: String, otherAccountRoutingScheme: String, otherAccountRoutingAddress: String, otherAccountSecondaryRoutingScheme: String, otherAccountSecondaryRoutingAddress: String, otherBankRoutingScheme: String, otherBankRoutingAddress: String, otherBranchRoutingScheme: String, otherBranchRoutingAddress: String, isBeneficiary: Boolean, bespoke: List[CounterpartyBespoke], callContext: Option[CallContext]): Box[(CounterpartyTrait, Option[CallContext])] = {
override def createCounterparty(name: String, description: String, currency: String, createdByUserId: String, thisBankId: String, thisAccountId: String, thisViewId: String, otherAccountRoutingScheme: String, otherAccountRoutingAddress: String, otherAccountSecondaryRoutingScheme: String, otherAccountSecondaryRoutingAddress: String, otherBankRoutingScheme: String, otherBankRoutingAddress: String, otherBranchRoutingScheme: String, otherBranchRoutingAddress: String, isBeneficiary: Boolean, bespoke: List[CounterpartyBespoke], callContext: Option[CallContext]): Box[(CounterpartyTrait, Option[CallContext])] = {
import com.openbankproject.commons.dto.{OutBoundCreateCounterparty => OutBound, InBoundCreateCounterparty => InBound}
val url = getUrl(callContext, "createCounterparty")
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull , name, description, createdByUserId, thisBankId, thisAccountId, thisViewId, otherAccountRoutingScheme, otherAccountRoutingAddress, otherAccountSecondaryRoutingScheme, otherAccountSecondaryRoutingAddress, otherBankRoutingScheme, otherBankRoutingAddress, otherBranchRoutingScheme, otherBranchRoutingAddress, isBeneficiary, bespoke)
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull , name, description, currency, createdByUserId, thisBankId, thisAccountId, thisViewId, otherAccountRoutingScheme, otherAccountRoutingAddress, otherAccountSecondaryRoutingScheme, otherAccountSecondaryRoutingAddress, otherBankRoutingScheme, otherBankRoutingAddress, otherBranchRoutingScheme, otherBranchRoutingAddress, isBeneficiary, bespoke)
val result: OBPReturnType[Box[CounterpartyTraitCommons]] = sendRequest[InBound](url, HttpMethods.POST, req, callContext).map(convertToTuple(callContext))
result
}

View File

@ -887,6 +887,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -930,6 +931,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -973,6 +975,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -1018,6 +1021,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
data=List( CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -3101,6 +3105,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
toCounterparty= CounterpartyTraitCommons(createdByUserId="string",
name=counterpartyNameExample.value,
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -3192,6 +3197,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
toCounterparty= CounterpartyTraitCommons(createdByUserId="string",
name=counterpartyNameExample.value,
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -3401,6 +3407,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
OutBoundCreateCounterparty(outboundAdapterCallContext=MessageDocsSwaggerDefinitions.outboundAdapterCallContext,
name="string",
description="string",
currency=currencyExample.value,
createdByUserId="string",
thisBankId="string",
thisAccountId="string",
@ -3423,6 +3430,7 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
data= CounterpartyTraitCommons(createdByUserId="string",
name="string",
description="string",
currency=currencyExample.value,
thisBankId="string",
thisAccountId="string",
thisViewId="string",
@ -3442,9 +3450,9 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
adapterImplementation = Some(AdapterImplementation("- Core", 1))
)
override def createCounterparty(name: String, description: String, createdByUserId: String, thisBankId: String, thisAccountId: String, thisViewId: String, otherAccountRoutingScheme: String, otherAccountRoutingAddress: String, otherAccountSecondaryRoutingScheme: String, otherAccountSecondaryRoutingAddress: String, otherBankRoutingScheme: String, otherBankRoutingAddress: String, otherBranchRoutingScheme: String, otherBranchRoutingAddress: String, isBeneficiary: Boolean, bespoke: List[CounterpartyBespoke], callContext: Option[CallContext]): Box[(CounterpartyTrait, Option[CallContext])] = {
override def createCounterparty(name: String, description: String, currency: String, createdByUserId: String, thisBankId: String, thisAccountId: String, thisViewId: String, otherAccountRoutingScheme: String, otherAccountRoutingAddress: String, otherAccountSecondaryRoutingScheme: String, otherAccountSecondaryRoutingAddress: String, otherBankRoutingScheme: String, otherBankRoutingAddress: String, otherBranchRoutingScheme: String, otherBranchRoutingAddress: String, isBeneficiary: Boolean, bespoke: List[CounterpartyBespoke], callContext: Option[CallContext]): Box[(CounterpartyTrait, Option[CallContext])] = {
import com.openbankproject.commons.dto.{InBoundCreateCounterparty => InBound, OutBoundCreateCounterparty => OutBound}
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, name, description, createdByUserId, thisBankId, thisAccountId, thisViewId, otherAccountRoutingScheme, otherAccountRoutingAddress, otherAccountSecondaryRoutingScheme, otherAccountSecondaryRoutingAddress, otherBankRoutingScheme, otherBankRoutingAddress, otherBranchRoutingScheme, otherBranchRoutingAddress, isBeneficiary, bespoke)
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, name, description, currency, createdByUserId, thisBankId, thisAccountId, thisViewId, otherAccountRoutingScheme, otherAccountRoutingAddress, otherAccountSecondaryRoutingScheme, otherAccountSecondaryRoutingAddress, otherBankRoutingScheme, otherBankRoutingAddress, otherBranchRoutingScheme, otherBranchRoutingAddress, isBeneficiary, bespoke)
val response: Future[Box[InBound]] = sendRequest[InBound]("obp_create_counterparty", req, callContext)
response.map(convertToTuple[CounterpartyTraitCommons](callContext))
}

View File

@ -266,6 +266,7 @@ case class InternalCounterparty(
otherBranchRoutingAddress: String,
isBeneficiary: Boolean,
description: String,
currency: String,
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
bespoke: List[CounterpartyBespoke]) extends CounterpartyTrait

View File

@ -1164,6 +1164,7 @@ trait KafkaMappedConnector_vJune2017 extends Connector with KafkaHelper with Mdc
otherBranchRoutingAddress= "String",
isBeneficiary = false,
description= "String",
currency= "String",
otherAccountSecondaryRoutingScheme= "String",
otherAccountSecondaryRoutingAddress= "String",
bespoke = List(CounterpartyBespoke(
@ -1175,6 +1176,7 @@ trait KafkaMappedConnector_vJune2017 extends Connector with KafkaHelper with Mdc
override def createCounterparty(
name: String,
description: String,
currency: String,
createdByUserId: String,
thisBankId: String,
thisAccountId: String,
@ -1392,6 +1394,7 @@ trait KafkaMappedConnector_vJune2017 extends Connector with KafkaHelper with Mdc
otherBranchRoutingAddress = "",
isBeneficiary = true,
description = "",
currency= "",
otherAccountSecondaryRoutingScheme = "",
otherAccountSecondaryRoutingAddress = "",
bespoke = List(
@ -1463,7 +1466,7 @@ trait KafkaMappedConnector_vJune2017 extends Connector with KafkaHelper with Mdc
)
),
exampleInboundMessage = (
InboundGetCounterparty(authInfoExample, statusExample, Some(InternalCounterparty(createdByUserId = "String", name = "String", thisBankId = "String", thisAccountId = "String", thisViewId = "String", counterpartyId = "String", otherAccountRoutingScheme = "String", otherAccountRoutingAddress = "String", otherBankRoutingScheme = "String", otherBankRoutingAddress = "String", otherBranchRoutingScheme = "String", otherBranchRoutingAddress = "String", isBeneficiary = true, description = "String", otherAccountSecondaryRoutingScheme = "String", otherAccountSecondaryRoutingAddress = "String", bespoke = Nil)))
InboundGetCounterparty(authInfoExample, statusExample, Some(InternalCounterparty(createdByUserId = "String", name = "String", thisBankId = "String", thisAccountId = "String", thisViewId = "String", counterpartyId = "String", otherAccountRoutingScheme = "String", otherAccountRoutingAddress = "String", otherBankRoutingScheme = "String", otherBankRoutingAddress = "String", otherBranchRoutingScheme = "String", otherBranchRoutingAddress = "String", isBeneficiary = true, description = "String", currency = "String", otherAccountSecondaryRoutingScheme = "String", otherAccountSecondaryRoutingAddress = "String", bespoke = Nil)))
)
)
override def getCounterpartyByCounterpartyId(counterpartyId: CounterpartyId, callContext: Option[CallContext]) = saveConnectorMetric{

View File

@ -293,6 +293,7 @@ case class CounterpartyTrait2(counterparty: InboundCounterparty) extends Counter
def otherBranchRoutingAddress: String = counterparty.otherBranchRoutingAddress
def isBeneficiary: Boolean = counterparty.isBeneficiary
def description: String = ""
def currency: String = ""
def otherAccountSecondaryRoutingScheme: String = ""
def otherAccountSecondaryRoutingAddress: String = ""
def bespoke: List[CounterpartyBespoke] = Nil

View File

@ -257,6 +257,7 @@ case class InternalGetTransactionRequests(
case class OutboundCounterparty(
name: String,
description: String,
currency: String,
createdByUserId: String,
thisBankId: String,
thisAccountId: String,
@ -311,6 +312,7 @@ case class InternalCounterparty(
otherBranchRoutingAddress: String,
isBeneficiary: Boolean,
description: String,
currency: String,
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
bespoke: List[CounterpartyBespoke]) extends CounterpartyTrait

View File

@ -995,6 +995,7 @@ trait KafkaMappedConnector_vSept2018 extends Connector with KafkaHelper with Mdc
OutboundCounterparty(
name = "name",
description = "description",
currency = "currency",
createdByUserId = "createdByUserId",
thisBankId = "thisBankId",
thisAccountId = "thisAccountId",
@ -1032,7 +1033,8 @@ trait KafkaMappedConnector_vSept2018 extends Connector with KafkaHelper with Mdc
otherBranchRoutingAddress= "String",
isBeneficiary = false,
description= "String",
otherAccountSecondaryRoutingScheme= "String",
currency= "String",
otherAccountSecondaryRoutingScheme= "String",
otherAccountSecondaryRoutingAddress= "String",
bespoke = List(CounterpartyBespoke(
key = "String",
@ -1044,6 +1046,7 @@ trait KafkaMappedConnector_vSept2018 extends Connector with KafkaHelper with Mdc
override def createCounterparty(
name: String,
description: String,
currency: String,
createdByUserId: String,
thisBankId: String,
thisAccountId: String,
@ -1066,6 +1069,7 @@ trait KafkaMappedConnector_vSept2018 extends Connector with KafkaHelper with Mdc
counterparty = OutboundCounterparty(
name: String,
description: String,
currency: String,
createdByUserId: String,
thisBankId: String,
thisAccountId: String,
@ -1250,6 +1254,7 @@ trait KafkaMappedConnector_vSept2018 extends Connector with KafkaHelper with Mdc
otherBranchRoutingAddress = "",
isBeneficiary = true,
description = "",
currency = "",
otherAccountSecondaryRoutingScheme = "",
otherAccountSecondaryRoutingAddress = "",
bespoke = List(
@ -1329,7 +1334,7 @@ trait KafkaMappedConnector_vSept2018 extends Connector with KafkaHelper with Mdc
)
),
exampleInboundMessage = (
InboundGetCounterparty(inboundAuthInfoExample, statusExample, Some(InternalCounterparty(createdByUserId = "String", name = "String", thisBankId = "String", thisAccountId = "String", thisViewId = "String", counterpartyId = "String", otherAccountRoutingScheme = "String", otherAccountRoutingAddress = "String", otherBankRoutingScheme = "String", otherBankRoutingAddress = "String", otherBranchRoutingScheme = "String", otherBranchRoutingAddress = "String", isBeneficiary = true, description = "String", otherAccountSecondaryRoutingScheme = "String", otherAccountSecondaryRoutingAddress = "String", bespoke = Nil)))
InboundGetCounterparty(inboundAuthInfoExample, statusExample, Some(InternalCounterparty(createdByUserId = "String", name = "String", thisBankId = "String", thisAccountId = "String", thisViewId = "String", counterpartyId = "String", otherAccountRoutingScheme = "String", otherAccountRoutingAddress = "String", otherBankRoutingScheme = "String", otherBankRoutingAddress = "String", otherBranchRoutingScheme = "String", otherBranchRoutingAddress = "String", isBeneficiary = true, description = "String", currency = "String", otherAccountSecondaryRoutingScheme = "String", otherAccountSecondaryRoutingAddress = "String", bespoke = Nil)))
),
adapterImplementation = Some(AdapterImplementation("Payments", 1))
)
@ -1396,7 +1401,7 @@ trait KafkaMappedConnector_vSept2018 extends Connector with KafkaHelper with Mdc
exampleInboundMessage = (
InboundGetCounterparty(inboundAuthInfoExample,
statusExample,
Some(InternalCounterparty(createdByUserId = "String", name = "String", thisBankId = "String", thisAccountId = "String", thisViewId = "String", counterpartyId = "String", otherAccountRoutingScheme = "String", otherAccountRoutingAddress = "String", otherBankRoutingScheme = "String", otherBankRoutingAddress = "String", otherBranchRoutingScheme = "String", otherBranchRoutingAddress = "String", isBeneficiary = true, description = "String", otherAccountSecondaryRoutingScheme = "String", otherAccountSecondaryRoutingAddress = "String", bespoke = Nil)))
Some(InternalCounterparty(createdByUserId = "String", name = "String", thisBankId = "String", thisAccountId = "String", thisViewId = "String", counterpartyId = "String", otherAccountRoutingScheme = "String", otherAccountRoutingAddress = "String", otherBankRoutingScheme = "String", otherBankRoutingAddress = "String", otherBranchRoutingScheme = "String", otherBranchRoutingAddress = "String", isBeneficiary = true, description = "String", currency = "String", otherAccountSecondaryRoutingScheme = "String", otherAccountSecondaryRoutingAddress = "String", bespoke = Nil)))
),
adapterImplementation = Some(AdapterImplementation("Payments", 1))
)

View File

@ -54,6 +54,7 @@ trait Counterparties {
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
description: String,
currency: String,
bespoke: List[CounterpartyBespoke]
): Box[CounterpartyTrait]
@ -114,6 +115,7 @@ class RemotedataCounterpartiesCaseClasses {
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
description: String,
currency: String,
bespoke: List[CounterpartyBespoke]
)

View File

@ -155,6 +155,7 @@ object MapperCounterparties extends Counterparties with MdcLoggable {
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
description: String,
currency: String,
bespoke: List[CounterpartyBespoke]
): Box[CounterpartyTrait] = {
@ -173,6 +174,7 @@ object MapperCounterparties extends Counterparties with MdcLoggable {
.mOtherBranchRoutingScheme(otherBranchRoutingScheme)
.mIsBeneficiary(isBeneficiary)
.mDescription(description)
.mCurrency(currency)
.mOtherAccountSecondaryRoutingScheme(otherAccountSecondaryRoutingScheme)
.mOtherAccountSecondaryRoutingAddress(otherAccountSecondaryRoutingAddress)
.saveMe()
@ -437,6 +439,7 @@ class MappedCounterparty extends CounterpartyTrait with LongKeyedMapper[MappedCo
object mOtherBranchRoutingAddress extends MappedString(this, 255)
object mIsBeneficiary extends MappedBoolean(this)
object mDescription extends MappedString(this, 36)
object mCurrency extends MappedString(this, 255)
object mOtherAccountSecondaryRoutingScheme extends MappedString(this, 255)
object mOtherAccountSecondaryRoutingAddress extends MappedString(this, 255)
object mBespoke extends MappedOneToMany(MappedCounterpartyBespoke, MappedCounterpartyBespoke.mCounterparty, OrderBy(MappedCounterpartyBespoke.id, Ascending))
@ -455,6 +458,7 @@ class MappedCounterparty extends CounterpartyTrait with LongKeyedMapper[MappedCo
override def otherBankRoutingAddress: String = mOtherBankRoutingAddress.get
override def isBeneficiary: Boolean = mIsBeneficiary.get
override def description: String = mDescription.get
override def currency: String = mCurrency.toString
override def otherAccountSecondaryRoutingScheme: String = mOtherAccountSecondaryRoutingScheme.get
override def otherAccountSecondaryRoutingAddress: String = mOtherAccountSecondaryRoutingAddress.get
override def bespoke: List[CounterpartyBespoke] =

View File

@ -127,6 +127,7 @@ object MongoCounterparties extends Counterparties with MdcLoggable {
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
description: String,
currency: String,
bespoke: List[CounterpartyBespoke]
): Box[CounterpartyTrait] = Empty

View File

@ -56,6 +56,7 @@ object RemotedataCounterparties extends ObpActorInit with Counterparties {
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
description: String,
currency: String,
bespoke: List[CounterpartyBespoke]): Box[CounterpartyTrait] = getValueFromFuture(
(actor ? cc.createCounterparty(createdByUserId,
thisBankId,
@ -70,6 +71,7 @@ object RemotedataCounterparties extends ObpActorInit with Counterparties {
otherAccountSecondaryRoutingScheme,
otherAccountSecondaryRoutingAddress,
description,
currency,
bespoke)).mapTo[Box[CounterpartyTrait]]
)

View File

@ -39,6 +39,7 @@ class RemotedataCounterpartiesActor extends Actor with ObpActorHelper with MdcLo
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
description: String,
currency: String,
bespoke: List[CounterpartyBespoke]
) =>
logger.debug(s"createCounterparty($createdByUserId, $thisBankId, $thisAccountId, $thisViewId, $name, " +
@ -60,6 +61,7 @@ class RemotedataCounterpartiesActor extends Actor with ObpActorHelper with MdcLo
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
description: String,
currency: String,
bespoke: List[CounterpartyBespoke]
))

View File

@ -26,7 +26,7 @@ class CounterpartyTest extends V400ServerSetup {
*/
object VersionOfApi extends Tag(ApiVersion.v4_0_0.toString)
object ApiEndpoint1 extends Tag(nameOf(Implementations4_0_0.createCounterpartyForAnyAccount))
object ApiEndpoint2 extends Tag(nameOf(Implementations2_2_0.getExplictCounterpartyById))
object ApiEndpoint2 extends Tag(nameOf(Implementations4_0_0.getExplictCounterpartyById))
object ApiEndpoint3 extends Tag(nameOf(Implementations4_0_0.getCounterpartyByNameForAnyAccount))
@ -40,7 +40,7 @@ class CounterpartyTest extends V400ServerSetup {
val viewId =ViewId(SYSTEM_OWNER_VIEW_ID)
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJSON.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJson400.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, CanCreateCounterpartyAtBank.toString)
When("We make the request Create counterparty for an account")
@ -49,7 +49,7 @@ class CounterpartyTest extends V400ServerSetup {
Then("We should get a 201 and check all the fields")
responsePost.code should equal(201)
val counterpartyWithMetadataJson = responsePost.body.extract[CounterpartyWithMetadataJson]
val counterpartyWithMetadataJson = responsePost.body.extract[CounterpartyWithMetadataJson400]
counterpartyWithMetadataJson.other_account_routing_address should equal(counterpartyPostJSON.other_account_routing_address)
counterpartyWithMetadataJson.other_account_secondary_routing_scheme should equal(counterpartyPostJSON.other_account_secondary_routing_scheme)
@ -63,7 +63,7 @@ class CounterpartyTest extends V400ServerSetup {
Then("We should get a 200 and check all the fields")
responseGet.code should equal(200)
val counterpartyWithMetadataJsonGet = responseGet.body.extract[CounterpartyWithMetadataJson]
val counterpartyWithMetadataJsonGet = responseGet.body.extract[CounterpartyWithMetadataJson400]
counterpartyWithMetadataJsonGet.other_account_routing_address should equal(counterpartyPostJSON.other_account_routing_address)
@ -81,7 +81,7 @@ class CounterpartyTest extends V400ServerSetup {
//This will use a non exiting obp account, and it should also work
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJSON.copy(other_bank_routing_scheme = "xx")
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJson400.copy(other_bank_routing_scheme = "xx")
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, CanCreateCounterpartyAtBank.toString)
When("We make the request Create counterparty for an account")
@ -90,7 +90,7 @@ class CounterpartyTest extends V400ServerSetup {
Then("We should get a 201 and check all the fields")
responsePost.code should equal(201)
val counterpartyWithMetadataJson = responsePost.body.extract[CounterpartyWithMetadataJson]
val counterpartyWithMetadataJson = responsePost.body.extract[CounterpartyWithMetadataJson400]
counterpartyWithMetadataJson.other_account_routing_address should equal(counterpartyPostJSON.other_account_routing_address)
counterpartyWithMetadataJson.other_account_secondary_routing_scheme should equal(counterpartyPostJSON.other_account_secondary_routing_scheme)
@ -104,7 +104,7 @@ class CounterpartyTest extends V400ServerSetup {
Then("We should get a 200 and check all the fields")
responseGet.code should equal(200)
val counterpartyWithMetadataJsonGet = responseGet.body.extract[CounterpartyWithMetadataJson]
val counterpartyWithMetadataJsonGet = responseGet.body.extract[CounterpartyWithMetadataJson400]
counterpartyWithMetadataJsonGet.other_account_routing_address should equal(counterpartyPostJSON.other_account_routing_address)
@ -120,7 +120,7 @@ class CounterpartyTest extends V400ServerSetup {
val accountId = testAccountId1
val viewId =ViewId(SYSTEM_OWNER_VIEW_ID)
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJSON.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJson400.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
val requestPost = (v4_0_0_Request / "management" /"banks" / bankId.value / "accounts" / accountId.value / viewId.value / "counterparties" ).POST <@ (user1)
val responsePost = makePostRequest(requestPost, write(counterpartyPostJSON))
@ -140,7 +140,7 @@ class CounterpartyTest extends V400ServerSetup {
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, CanCreateCounterpartyAtBank.toString)
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJSON.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJson400.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
val requestPost = (v4_0_0_Request / "management" /"banks" / bankId.value / "accounts" / accountId.value / viewId.value / "counterparties" ).POST <@ (user1)
val responsePost = makePostRequest(requestPost, write(counterpartyPostJSON))
@ -157,7 +157,7 @@ class CounterpartyTest extends V400ServerSetup {
val viewId =ViewId(SYSTEM_OWNER_VIEW_ID)
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, CanCreateCounterpartyAtBank.toString)
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJSON.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJson400.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
When("We make the request Create counterparty for an account")
val requestPost = (v4_0_0_Request /"management" / "banks" / bankId.value / "accounts" / accountId.value / viewId.value / "counterparties" ).POST <@ (user1)
@ -183,7 +183,7 @@ class CounterpartyTest extends V400ServerSetup {
val viewId =ViewId(SYSTEM_OWNER_VIEW_ID)
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJSON.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJson400.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, CanCreateCounterpartyAtBank.toString)
When("We make the request Create counterparty for an account")
@ -208,7 +208,7 @@ class CounterpartyTest extends V400ServerSetup {
Then("We should get a 200 and check all the fields")
responseGet.code should equal(200)
val counterpartyWithMetadataJsonGet = responseGet.body.extract[CounterpartyWithMetadataJson]
val counterpartyWithMetadataJsonGet = responseGet.body.extract[CounterpartyWithMetadataJson400]
counterpartyWithMetadataJsonGet.other_account_routing_address should equal(counterpartyPostJSON.other_account_routing_address)
@ -223,7 +223,7 @@ class CounterpartyTest extends V400ServerSetup {
val viewId =ViewId(SYSTEM_OWNER_VIEW_ID)
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJSON.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
val counterpartyPostJSON = SwaggerDefinitionsJSON.postCounterpartyJson400.copy(other_bank_routing_address=bankId.value,other_account_routing_address=accountId.value)
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, CanCreateCounterpartyAtBank.toString)
When("We make the request Create counterparty for an account")
@ -232,7 +232,7 @@ class CounterpartyTest extends V400ServerSetup {
Then("We should get a 201 and check all the fields")
responsePost.code should equal(201)
val counterpartyWithMetadataJson = responsePost.body.extract[CounterpartyWithMetadataJson]
val counterpartyWithMetadataJson = responsePost.body.extract[CounterpartyWithMetadataJson400]
counterpartyWithMetadataJson.other_account_routing_address should equal(counterpartyPostJSON.other_account_routing_address)
counterpartyWithMetadataJson.other_account_secondary_routing_scheme should equal(counterpartyPostJSON.other_account_secondary_routing_scheme)

View File

@ -355,7 +355,8 @@ class KafkaTest extends KafkaSetup with ServerSetupWithTestData {
val box = Connector.connector.vend.createCounterparty(
outBound.counterparty.name,
outBound.counterparty.description,
outBound.counterparty.createdByUserId,
outBound.counterparty.currency,
outBound.counterparty.createdByUserId,
outBound.counterparty.thisBankId,
outBound.counterparty.thisAccountId,
outBound.counterparty.thisViewId,

View File

@ -52,6 +52,7 @@ trait LocalMappedConnectorTestSetup extends TestConnectorSetupWithStandardPermis
otherAccountSecondaryRoutingScheme ="IBAN",
otherAccountSecondaryRoutingAddress ="DE89 3704 0044 0532 0130 00",
description = "String",
currency = "String",
bespoke = Nil
).openOrThrowException(attemptedToOpenAnEmptyBox)
}

View File

@ -482,7 +482,7 @@ case class OutBoundCreateChallenge(outboundAdapterCallContext: OutboundAdapterCa
case class InBoundCreateChallenge(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: String) extends InBoundTrait[String]
case class OutBoundCreateCounterparty(outboundAdapterCallContext: OutboundAdapterCallContext, name: String, description: String, createdByUserId: String, thisBankId: String, thisAccountId: String, thisViewId: String, otherAccountRoutingScheme: String, otherAccountRoutingAddress: String, otherAccountSecondaryRoutingScheme: String, otherAccountSecondaryRoutingAddress: String, otherBankRoutingScheme: String, otherBankRoutingAddress: String, otherBranchRoutingScheme: String, otherBranchRoutingAddress: String, isBeneficiary: Boolean, bespoke: List[CounterpartyBespoke]) extends TopicTrait
case class OutBoundCreateCounterparty(outboundAdapterCallContext: OutboundAdapterCallContext, name: String, description: String, currency: String, createdByUserId: String, thisBankId: String, thisAccountId: String, thisViewId: String, otherAccountRoutingScheme: String, otherAccountRoutingAddress: String, otherAccountSecondaryRoutingScheme: String, otherAccountSecondaryRoutingAddress: String, otherBankRoutingScheme: String, otherBankRoutingAddress: String, otherBranchRoutingScheme: String, otherBranchRoutingAddress: String, isBeneficiary: Boolean, bespoke: List[CounterpartyBespoke]) extends TopicTrait
case class InBoundCreateCounterparty(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: CounterpartyTraitCommons) extends InBoundTrait[CounterpartyTraitCommons]

View File

@ -283,6 +283,7 @@ case class CounterpartyTraitCommons(
createdByUserId :String,
name :String,
description :String,
currency: String,
thisBankId :String,
thisAccountId :String,
thisViewId :String,

View File

@ -46,6 +46,7 @@ trait CounterpartyTrait {
def otherBranchRoutingScheme: String
def otherBranchRoutingAddress: String
def isBeneficiary : Boolean
def currency: String
def bespoke: List[CounterpartyBespoke]
}