add more info for resouce doc and fix a issue for SEPA

This commit is contained in:
hongwei1 2018-03-14 12:22:57 +01:00
parent a6c4d35452
commit bd3d09c163
8 changed files with 69 additions and 23 deletions

View File

@ -793,8 +793,8 @@ object SwaggerDefinitionsJSON {
country = "DE"
)
val challengeAnswerJSON = ChallengeAnswerJSON(
id = "123456",
answer = "any string you can post here."
id = "This is challenge.id, you can get it from `Create Transaction Request.` response, only is useful if status ==`INITIATED` there.",
answer = "123"
)
val postCustomerJson = PostCustomerJson(

View File

@ -321,7 +321,7 @@ val dateformat = new java.text.SimpleDateFormat("yyyy-MM-dd")
val InvalidChargePolicy = "OBP-40013: Invalid Charge Policy. Please specify a valid value for Charge_Policy: SHARED, SENDER or RECEIVER. "
val AllowedAttemptsUsedUp = "OBP-40014: Sorry, you've used up your allowed attempts. "
val InvalidChallengeType = "OBP-40015: Invalid Challenge Type. Please specify a valid value for CHALLENGE_TYPE, when you create the transaction request."
val InvalidChallengeAnswer = "OBP-40016: Invalid Challenge Answer. Please specify a valid value for answer in Json body."
val InvalidChallengeAnswer = "OBP-40016: Invalid Challenge Answer. Please specify a valid value for answer in Json body. If it is sandbox mode, the answer must be `123`. If it kafka mode, the answer can be got by phone message or other security ways."
val InvalidPhoneNumber = "OBP-40017: Invalid Phone Number. Please specify a valid value for PHONE_NUMBER. Eg:+9722398746 "

View File

@ -532,7 +532,7 @@ trait APIMethods210 {
|
|3) `id` : is `challenge.id` field in createTransactionRequest response body.
|
|4) `answer` : is `challenge.answer` can be any Interge in sandbox mode.
|4) `answer` : must be `123`. if it is in sandbox mode. If it kafka mode, the answer can be got by phone message or other security ways.
|
""".stripMargin,
challengeAnswerJSON,

View File

@ -1018,28 +1018,72 @@ trait APIMethods220 {
|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 is the human readable name (e.g. Piano teacher, Miss Nipa)
|name : the human readable name (e.g. Piano teacher, Miss Nipa)
|
|other_bank_id is an (internal) ID for the bank of the bank of the counterparty (if known)
|description : the human readable name (e.g. Piano teacher, Miss Nipa)
|
|other_account_id is an (internal) ID for the bank account of the counterparty (if known)
|bank_routing_scheme : eg: bankId or bankCode or any other strings
|
|other_account_provider is a code that tells the system where that bank is hosted. Will be OBP if its known to the API. Usage of this flag (in API / connectors) is work in progress.
|bank_routing_address : eg: `gh.29.uk`, must be valid sandbox bankIds
|
|account_routing_scheme is a code that dictates the nature of the account_routing_address e.g. IBAN
|account_routing_scheme : eg: AccountId or AccountNumber or any other strings
|
|account_routing_address is an instance of account_routing_scheme that can be used to route payments to external systems. e.g. an IBAN number
|account_routing_address : eg: `1d65db7c-a7b2-4839-af41-95`, must be valid accountIds
|
|bank_routing_scheme is a code that dictates the nature of the bank_routing_address e.g. "BIC",
|other_account_secondary_routing_scheme : eg: IBan or any other strings
|
|bank_routing_address is an instance of bank_routing_scheme
|other_account_secondary_routing_address : if it is IBan, it should be unique for each counterparty.
|
|is_beneficiary must be set to true in order to send payments to this counterparty
|other_branch_routing_scheme : eg: branchId or any other strings or you can leave it empty, not useful in sandbox mode.
|
|The view specified by VIEW_ID must have the canAddCounterparty permission
|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 support list of key-value, you can add it to the counterarty.
|
|bespoke.key : any info-key you want to add to this counerparty
|
|bespoke.value : any info-value you want to add to this counerparty
|
|The view specified by VIEW_ID must have the canAddCounterparty permission
|
|A minimal example for TransactionRequestType == COUNTERPARTY
| {
| "name": "Tesobe1",
| "description": "Good Company",
| "other_bank_routing_scheme": "bankId",
| "other_bank_routing_address": "gh.29.uk",
| "other_account_routing_scheme": "accountId",
| "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",
| "other_bank_routing_scheme": "bankId",
| "other_bank_routing_address": "gh.29.uk",
| "other_account_routing_scheme": "accountId",
| "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)}
|
|${authenticationRequiredMessage(true)}
|
|""".stripMargin,
postCounterpartyJSON,
counterpartyWithMetadataJson,

View File

@ -114,10 +114,12 @@ object MapperCounterparties extends Counterparties with MdcLoggable {
override def getCounterparty(counterpartyId : String): Box[CounterpartyTrait] = {
MappedCounterparty.find(By(MappedCounterparty.mCounterPartyId, counterpartyId))
}
//TODO, here has a problem, MappedCounterparty has no unique constrain on IBan. But we get Counterparty By Iban. For now, we do not support update Counterpary endpoint. Here we only return the latest record.
override def getCounterpartyByIban(iban : String): Box[CounterpartyTrait] = {
MappedCounterparty.find(
By(MappedCounterparty.mOtherAccountRoutingAddress, iban),
By(MappedCounterparty.mOtherAccountRoutingScheme, "IBAN")
By(MappedCounterparty.mOtherAccountSecondaryRoutingAddress, iban),
OrderBy(MappedCounterparty.id, Descending) //Always use the latest record.
)
}

View File

@ -569,7 +569,7 @@ object BankAccount {
for{
toBankId <- Full(BankId(counterparty.otherBankRoutingAddress))
toAccountId <- Full(AccountId(counterparty.otherAccountRoutingAddress))
toAccount <- BankAccount(toBankId, toAccountId) ?~! s"${ErrorMessages.CounterpartyNotFound} Now $toBankId and $toAccountId, please use correct OBP BankAccount to create the Counterparty. "
toAccount <- BankAccount(toBankId, toAccountId) ?~! s"${ErrorMessages.CounterpartyNotFound} Now BANK_ID(counterparty.otherBankRoutingAddress=$toBankId) and ACCOUNT_ID(counterparty.otherAccountRoutingAddress=$toAccountId), please use correct OBP BankAccount to create the Counterparty. "
} yield{
toAccount
}

View File

@ -100,7 +100,7 @@ class TransactionRequestsTest extends V210ServerSetup with DefaultUsers {
//For Counterpart local mapper, the mOtherAccountRoutingScheme='OBP' and mOtherBankRoutingScheme = 'OBP'
val counterpartyCounterparty = createCounterparty(bankId.value, accountId2.value, "IBAN", "OBP", true, UUID.randomUUID.toString);
var transactionRequestBodySEPA = TransactionRequestBodySEPAJSON(bodyValue, IbanJson(counterpartySEPA.otherAccountRoutingAddress), discription, sharedChargePolicy)
var transactionRequestBodySEPA = TransactionRequestBodySEPAJSON(bodyValue, IbanJson(counterpartySEPA.otherAccountSecondaryRoutingAddress), discription, sharedChargePolicy)
var transactionRequestBodyCounterparty = TransactionRequestBodyCounterpartyJSON(CounterpartyIdJson(counterpartyCounterparty.counterpartyId), bodyValue, discription, sharedChargePolicy)

View File

@ -43,15 +43,15 @@ trait LocalMappedConnectorTestSetup extends TestConnectorSetupWithStandardPermis
thisAccountId = accountId,
thisViewId = "",
name = UUID.randomUUID().toString,
otherAccountRoutingAddress = accountId,
otherAccountRoutingScheme = otherAccountRoutingScheme,
otherAccountRoutingAddress = accountId,
otherBankRoutingScheme = "OBP",
otherBankRoutingAddress = bankId,
otherBranchRoutingScheme ="OBP",
otherBranchRoutingAddress ="Berlin",
isBeneficiary = isBeneficiary,
otherAccountSecondaryRoutingScheme ="String",
otherAccountSecondaryRoutingAddress ="String",
otherAccountSecondaryRoutingScheme ="IBAN",
otherAccountSecondaryRoutingAddress ="DE89 3704 0044 0532 0130 00",
description = "String",
bespoke = Nil
).openOrThrowException(attemptedToOpenAnEmptyBox)