mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 19:16:53 +00:00
#511 Get rid of JValue from case class ResourceDoc -- 11 added response body for V140 V130 V121
This commit is contained in:
parent
022aa04138
commit
da280c5637
@ -1,12 +1,8 @@
|
||||
package code.api.ResourceDocs1_4_0
|
||||
|
||||
import java.util.Date
|
||||
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.APIUtil.defaultJValue
|
||||
import code.api.util.APIUtil._
|
||||
import code.api.v2_2_0.CounterpartyJsonV220
|
||||
import net.liftweb.json.Extraction
|
||||
import net.liftweb.json.JsonAST.JValue
|
||||
|
||||
/**
|
||||
* Created by zhanghongwei on 07/04/2017.
|
||||
@ -19,6 +15,7 @@ import net.liftweb.json.JsonAST.JValue
|
||||
*/
|
||||
object SwaggerDefinitionsJSON {
|
||||
|
||||
|
||||
// from code.model, not from normal version JSON Factory
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -50,6 +47,14 @@ object SwaggerDefinitionsJSON {
|
||||
|
||||
val bankId = BankId(value = "gh.uk.9j")
|
||||
|
||||
val transactionRequestId = TransactionRequestId(value = "123")
|
||||
|
||||
val counterpartyId = CounterpartyId(value = "123")
|
||||
|
||||
val accountId = AccountId(value = "123")
|
||||
|
||||
val viewId = ViewId(value = "owner")
|
||||
|
||||
|
||||
// from code.TransactionTypes.TransactionType, not from normal version Factory
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -66,6 +71,58 @@ object SwaggerDefinitionsJSON {
|
||||
)
|
||||
|
||||
|
||||
// code.transactionrequests.TransactionRequests
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
import code.transactionrequests.TransactionRequests._
|
||||
|
||||
val transactionRequestCharge = TransactionRequestCharge(
|
||||
summary = "String",
|
||||
value = amountOfMoney
|
||||
)
|
||||
|
||||
val transactionRequestChallenge = TransactionRequestChallenge(
|
||||
id= "String",
|
||||
allowed_attempts= 4,
|
||||
challenge_type= "String"
|
||||
)
|
||||
|
||||
val transactionRequestAccount = TransactionRequestAccount(
|
||||
bank_id= "String",
|
||||
account_id= "String"
|
||||
)
|
||||
|
||||
val transactionRequestBody = TransactionRequestBody(
|
||||
to = transactionRequestAccount,
|
||||
value= amountOfMoney,
|
||||
description= "String"
|
||||
)
|
||||
|
||||
val transactionRequest = TransactionRequest(
|
||||
id= transactionRequestId,
|
||||
`type`= "String",
|
||||
from= transactionRequestAccount,
|
||||
details= defaultJValue, // Note= This is unstructured! (allows multiple "to" accounts etc.)
|
||||
body= transactionRequestBody, // Note= This is structured with one "to" account etc.
|
||||
transaction_ids= "String",
|
||||
status= "String",
|
||||
start_date= exampleDate,
|
||||
end_date= exampleDate,
|
||||
challenge= transactionRequestChallenge,
|
||||
charge= transactionRequestCharge,
|
||||
charge_policy= "String",
|
||||
counterparty_id= counterpartyId,
|
||||
name= "String",
|
||||
this_bank_id= bankId,
|
||||
this_account_id= accountId,
|
||||
this_view_id= viewId,
|
||||
other_account_routing_scheme= "String",
|
||||
other_account_routing_address= "String",
|
||||
other_bank_routing_scheme= "String",
|
||||
other_bank_routing_address= "String",
|
||||
is_beneficiary= true
|
||||
)
|
||||
|
||||
// from code.bankconnectors, not from normal version Factory
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -81,17 +138,21 @@ object SwaggerDefinitionsJSON {
|
||||
|
||||
val messageDocsJson = MessageDocsJson(messageDocs = List(messageDocJson))
|
||||
|
||||
|
||||
// from code.model, not from normal version JSON Factory
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//V121 - code.api.v1_2_1
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
import code.api.v1_2_1._
|
||||
|
||||
val makePaymentJson = MakePaymentJson(
|
||||
bank_id = "String",
|
||||
account_id = "String",
|
||||
amount = "String"
|
||||
)
|
||||
|
||||
val transactionIdJson = TransactionIdJson(
|
||||
transaction_id = "123"
|
||||
)
|
||||
|
||||
val hostedBy = HostedBy(
|
||||
organisation = "String",
|
||||
email = "String",
|
||||
@ -492,7 +553,7 @@ object SwaggerDefinitionsJSON {
|
||||
posted = exampleDate
|
||||
)
|
||||
|
||||
//V140 -- code.api.v1_4_0.JSONFactory1_4_0
|
||||
//V140 -- code.api.v1_4_0.JSONFactory1_4_0
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
import code.api.v1_4_0.JSONFactory1_4_0._
|
||||
@ -509,7 +570,7 @@ object SwaggerDefinitionsJSON {
|
||||
|
||||
val transactionRequestChargeJsonV140 = TransactionRequestChargeJsonV140(
|
||||
summary = "Good",
|
||||
value = amountOfMoneyJsonV121
|
||||
value = amountOfMoneyJsonV121 //amountOfMoneyJSON
|
||||
)
|
||||
|
||||
val transactionRequestTypeJsonV140 = TransactionRequestTypeJsonV140(
|
||||
@ -592,8 +653,9 @@ object SwaggerDefinitionsJSON {
|
||||
last_ok_date = exampleDate
|
||||
)
|
||||
|
||||
val customerJSONs = CustomersJsonV140(customers = List(customerJsonV140))
|
||||
|
||||
val customersJsonV140 = CustomersJsonV140(
|
||||
customers = List(customerJsonV140)
|
||||
)
|
||||
|
||||
val customerMessageJson = CustomerMessageJson(
|
||||
id = "String",
|
||||
@ -631,7 +693,6 @@ object SwaggerDefinitionsJSON {
|
||||
|
||||
val branchesJson = BranchesJson(branches = List(branchJson))
|
||||
|
||||
|
||||
val atmJson = AtmJson(
|
||||
id = "String",
|
||||
name = "String",
|
||||
@ -642,7 +703,6 @@ object SwaggerDefinitionsJSON {
|
||||
|
||||
val atmsJson = AtmsJson(atms = List(atmJson))
|
||||
|
||||
|
||||
val productJson = ProductJson(
|
||||
code = "String",
|
||||
name = "String",
|
||||
@ -684,7 +744,7 @@ object SwaggerDefinitionsJSON {
|
||||
description = "String",
|
||||
example_request_body = successMessage, //TODO maybe need fix
|
||||
success_response_body = successMessage,
|
||||
error_response_bodies = List("OBP-10001: Incorrect json format."),
|
||||
error_response_bodies = List("OBP-10001= Incorrect json format."),
|
||||
implemented_by = implementedByJson,
|
||||
is_core = true,
|
||||
is_psd2 = true,
|
||||
@ -712,7 +772,7 @@ object SwaggerDefinitionsJSON {
|
||||
challenge = challengeJsonV140
|
||||
)
|
||||
|
||||
//V200
|
||||
//V200
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
import code.api.v2_0_0.JSONFactory200._
|
||||
@ -723,6 +783,14 @@ object SwaggerDefinitionsJSON {
|
||||
short_name = "HHH",
|
||||
is_public = true
|
||||
)
|
||||
|
||||
val basicAccountJSON = BasicAccountJSON(
|
||||
id = "8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
|
||||
label = "NoneLabel",
|
||||
bank_id = "gh.29.uk",
|
||||
views_available = List(basicViewJSON)
|
||||
)
|
||||
|
||||
val coreAccountJSON = CoreAccountJSON(
|
||||
id = "8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
|
||||
label = "NoneLabel",
|
||||
@ -730,7 +798,6 @@ object SwaggerDefinitionsJSON {
|
||||
_links = defaultJValue
|
||||
)
|
||||
|
||||
|
||||
val moderatedCoreAccountJSON = ModeratedCoreAccountJSON(
|
||||
id = "8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
|
||||
label = "NoneLabel",
|
||||
@ -744,11 +811,77 @@ object SwaggerDefinitionsJSON {
|
||||
account_routing = accountRoutingJSON
|
||||
)
|
||||
|
||||
val entitlementJSON = EntitlementJSON(
|
||||
entitlement_id = "6fb17583-1e49-4435-bb74-a14fe0996723",
|
||||
role_name = "CanQueryOtherUser",
|
||||
bank_id = "gh.29.uk"
|
||||
val basicAccountsJSON = BasicAccountsJSON(
|
||||
accounts = List(basicAccountJSON)
|
||||
)
|
||||
val coreAccountsJSON = CoreAccountsJSON(accounts = List(coreAccountJSON))
|
||||
|
||||
val kycDocumentJSON = KycDocumentJSON(
|
||||
bank_id = "PlaceholderString",
|
||||
customer_id = "PlaceholderString",
|
||||
id = "PlaceholderString",
|
||||
customer_number = "PlaceholderString",
|
||||
`type` = "PlaceholderString",
|
||||
number = "PlaceholderString",
|
||||
issue_date = exampleDate,
|
||||
issue_place = "PlaceholderString",
|
||||
expiry_date = exampleDate
|
||||
)
|
||||
|
||||
val kycDocumentsJSON = KycDocumentsJSON(
|
||||
documents = List(kycDocumentJSON)
|
||||
)
|
||||
val kycMediaJSON = KycMediaJSON(
|
||||
bank_id = "PlaceholderString",
|
||||
customer_id = "PlaceholderString",
|
||||
id = "PlaceholderString",
|
||||
customer_number = "PlaceholderString",
|
||||
`type` = "PlaceholderString",
|
||||
url = "PlaceholderString",
|
||||
date = exampleDate,
|
||||
relates_to_kyc_document_id = "PlaceholderString",
|
||||
relates_to_kyc_check_id = "PlaceholderString"
|
||||
)
|
||||
val kycMediasJSON = KycMediasJSON(medias = List(kycMediaJSON))
|
||||
|
||||
|
||||
val kycCheckJSON = KycCheckJSON(
|
||||
bank_id = "PlaceholderString",
|
||||
customer_id = "PlaceholderString",
|
||||
id = "PlaceholderString",
|
||||
customer_number = "PlaceholderString",
|
||||
date = exampleDate,
|
||||
how = "PlaceholderString",
|
||||
staff_user_id = "PlaceholderString",
|
||||
staff_name = "PlaceholderString",
|
||||
satisfied = true,
|
||||
comments = "PlaceholderString"
|
||||
)
|
||||
var kycChecksJSON = KycChecksJSON(checks = List(kycCheckJSON))
|
||||
|
||||
var kycStatusJSON = KycStatusJSON(
|
||||
customer_id = "PlaceholderString",
|
||||
customer_number = "PlaceholderString",
|
||||
ok = true,
|
||||
date = exampleDate
|
||||
)
|
||||
var kycStatusesJSON = KycStatusesJSON(statuses = List(kycStatusJSON))
|
||||
|
||||
var socialMediaJSON = SocialMediaJSON(
|
||||
customer_number = "PlaceholderString",
|
||||
`type` = "PlaceholderString",
|
||||
handle = "PlaceholderString",
|
||||
date_added = exampleDate,
|
||||
date_activated = exampleDate
|
||||
)
|
||||
var socialMediasJSON = SocialMediasJSON(checks = List(socialMediaJSON))
|
||||
|
||||
val entitlementJSON =
|
||||
code.api.v2_0_0.EntitlementJSON(
|
||||
entitlement_id = "6fb17583-1e49-4435-bb74-a14fe0996723",
|
||||
role_name = "CanQueryOtherUser",
|
||||
bank_id = "gh.29.uk"
|
||||
)
|
||||
val entitlementJSONs = EntitlementJSONs(
|
||||
list = List(entitlementJSON)
|
||||
)
|
||||
@ -806,7 +939,7 @@ object SwaggerDefinitionsJSON {
|
||||
value = amountOfMoneyJsonV121
|
||||
)
|
||||
|
||||
val transactionRequestWithChargeJSON = TransactionRequestWithChargeJson(
|
||||
val transactionRequestWithChargeJson = TransactionRequestWithChargeJson(
|
||||
id = "82f92531-9c63-4246-abfc-96c20ec46188",
|
||||
`type` = "SANDBOX_TAN",
|
||||
from = transactionRequestAccountJsonV140,
|
||||
@ -825,7 +958,18 @@ object SwaggerDefinitionsJSON {
|
||||
description = "Good"
|
||||
)
|
||||
|
||||
val transactionTypeJsonV200 = TransactionTypeJsonV200(
|
||||
id = transactionTypeId,
|
||||
bank_id = "PlaceholderString",
|
||||
short_code = "PlaceholderString",
|
||||
summary = "PlaceholderString",
|
||||
description = "PlaceholderString",
|
||||
charge = amountOfMoneyJsonV121
|
||||
)
|
||||
|
||||
val transactionTypesJsonV200 = TransactionTypesJsonV200(
|
||||
transaction_types = List(transactionTypeJsonV200)
|
||||
)
|
||||
val linkJson = LinkJson(
|
||||
href = "String",
|
||||
rel = "String",
|
||||
@ -853,7 +997,7 @@ object SwaggerDefinitionsJSON {
|
||||
users = List(createUserJson)
|
||||
)
|
||||
|
||||
val createMeetingJSON = CreateMeetingJson(
|
||||
val createMeetingJson = CreateMeetingJson(
|
||||
provider_id = "String",
|
||||
purpose_id = "String"
|
||||
)
|
||||
@ -869,7 +1013,7 @@ object SwaggerDefinitionsJSON {
|
||||
customer_user_id = "String"
|
||||
)
|
||||
|
||||
val meetingJSON = MeetingJson(
|
||||
val meetingJson = MeetingJson(
|
||||
meeting_id = "String",
|
||||
provider_id = "String",
|
||||
purpose_id = "String",
|
||||
@ -879,12 +1023,12 @@ object SwaggerDefinitionsJSON {
|
||||
when = exampleDate
|
||||
)
|
||||
|
||||
val meetingJSONs = MeetingsJson(
|
||||
meetings = List(meetingJSON)
|
||||
val meetingsJson = MeetingsJson(
|
||||
meetings = List(meetingJson)
|
||||
)
|
||||
|
||||
|
||||
val userCustomerLinkJSON = UserCustomerLinkJson(
|
||||
val userCustomerLinkJson = UserCustomerLinkJson(
|
||||
user_customer_link_id = "String",
|
||||
customer_id = "String",
|
||||
user_id = "String",
|
||||
@ -892,26 +1036,15 @@ object SwaggerDefinitionsJSON {
|
||||
is_active = true
|
||||
)
|
||||
|
||||
val userCustomerLinkJSONs = UserCustomerLinksJson(
|
||||
l = List(userCustomerLinkJSON)
|
||||
val userCustomerLinksJson = UserCustomerLinksJson(
|
||||
l = List(userCustomerLinkJson)
|
||||
)
|
||||
|
||||
val createUserCustomerLinkJSON = CreateUserCustomerLinkJson(
|
||||
val createUserCustomerLinkJson = CreateUserCustomerLinkJson(
|
||||
user_id = "String",
|
||||
customer_id = "String"
|
||||
)
|
||||
|
||||
val basicAccountJSON = BasicAccountJSON(
|
||||
id = "String",
|
||||
label = "String",
|
||||
bank_id = "String",
|
||||
views_available = List(basicViewJSON)
|
||||
)
|
||||
|
||||
val basicAccountsJSON = BasicAccountsJSON(
|
||||
accounts = List(basicAccountJSON)
|
||||
)
|
||||
|
||||
val createAccountJSON = CreateAccountJSON(
|
||||
user_id = "String",
|
||||
label = "String",
|
||||
@ -928,20 +1061,6 @@ object SwaggerDefinitionsJSON {
|
||||
expiry_date = exampleDate
|
||||
)
|
||||
|
||||
val kycDocumentJSON = KycDocumentJSON(
|
||||
bank_id = "String",
|
||||
customer_id = "String",
|
||||
id = "String",
|
||||
customer_number = "String",
|
||||
`type` = "String",
|
||||
number = "String",
|
||||
issue_date = exampleDate,
|
||||
issue_place = "String",
|
||||
expiry_date = exampleDate
|
||||
)
|
||||
|
||||
val kycDocumentsJSON = KycDocumentsJSON(documents = List(kycDocumentJSON))
|
||||
|
||||
val postKycMediaJSON = PostKycMediaJSON(
|
||||
customer_number = "String",
|
||||
`type` = "String",
|
||||
@ -951,20 +1070,6 @@ object SwaggerDefinitionsJSON {
|
||||
relates_to_kyc_check_id = "String"
|
||||
)
|
||||
|
||||
val kycMediaJSON = KycMediaJSON(
|
||||
bank_id = "String",
|
||||
customer_id = "String",
|
||||
id = "String",
|
||||
customer_number = "String",
|
||||
`type` = "String",
|
||||
url = "String",
|
||||
date = exampleDate,
|
||||
relates_to_kyc_document_id = "String",
|
||||
relates_to_kyc_check_id = "String"
|
||||
)
|
||||
|
||||
val kycMediasJSON = KycMediasJSON(medias = List(kycMediaJSON))
|
||||
|
||||
val postKycCheckJSON = PostKycCheckJSON(
|
||||
customer_number = "String",
|
||||
date = exampleDate,
|
||||
@ -975,46 +1080,12 @@ object SwaggerDefinitionsJSON {
|
||||
comments = "String"
|
||||
)
|
||||
|
||||
val kycCheckJSON = KycCheckJSON(
|
||||
bank_id = "String",
|
||||
customer_id = "String",
|
||||
id = "String",
|
||||
customer_number = "String",
|
||||
date = exampleDate,
|
||||
how = "String",
|
||||
staff_user_id = "String",
|
||||
staff_name = "String",
|
||||
satisfied = true,
|
||||
comments = "String"
|
||||
)
|
||||
|
||||
val kycChecksJSON = KycChecksJSON(checks = List(kycCheckJSON))
|
||||
|
||||
val postKycStatusJSON = PostKycStatusJSON(
|
||||
customer_number = "String",
|
||||
ok = true,
|
||||
date = exampleDate
|
||||
)
|
||||
|
||||
val kycStatusJSON = KycStatusJSON(
|
||||
customer_id = "String",
|
||||
customer_number = "String",
|
||||
ok = true,
|
||||
date = exampleDate
|
||||
)
|
||||
|
||||
val kycStatusesJSON = KycStatusesJSON(statuses = List(kycStatusJSON))
|
||||
|
||||
val socialMediaJSON = SocialMediaJSON(
|
||||
customer_number = "String",
|
||||
`type` = "String",
|
||||
handle = "String",
|
||||
date_added = exampleDate,
|
||||
date_activated = exampleDate
|
||||
)
|
||||
|
||||
val socialMediasJSON = SocialMediasJSON(checks = List(socialMediaJSON))
|
||||
|
||||
val createCustomerJson = CreateCustomerJson(
|
||||
user_id = "String",
|
||||
customer_number = "String",
|
||||
@ -1032,19 +1103,6 @@ object SwaggerDefinitionsJSON {
|
||||
last_ok_date = exampleDate
|
||||
)
|
||||
|
||||
val transactionTypeJsonV200 = TransactionTypeJsonV200(
|
||||
id = transactionTypeId,
|
||||
bank_id = "String",
|
||||
short_code = "String",
|
||||
summary = "String",
|
||||
description = "String",
|
||||
charge = amountOfMoneyJsonV121
|
||||
)
|
||||
|
||||
val transactionTypesJSON = TransactionTypesJsonV200(
|
||||
transaction_types = List(transactionTypeJsonV200)
|
||||
)
|
||||
|
||||
val transactionRequestJsonV200 = TransactionRequestJsonV200(
|
||||
id = "String",
|
||||
`type` = "String",
|
||||
@ -1057,8 +1115,8 @@ object SwaggerDefinitionsJSON {
|
||||
challenge = challengeJsonV140
|
||||
)
|
||||
|
||||
val transactionRequestWithChargeJSONs = TransactionRequestWithChargesJson(
|
||||
transaction_requests_with_charges = List(transactionRequestWithChargeJSON)
|
||||
val transactionRequestWithChargesJson = TransactionRequestWithChargesJson(
|
||||
transaction_requests_with_charges = List(transactionRequestWithChargeJson)
|
||||
)
|
||||
|
||||
val usersJSONV200 = UsersJSONV200(
|
||||
@ -1069,7 +1127,7 @@ object SwaggerDefinitionsJSON {
|
||||
counterparties = List(coreCounterpartyJSON)
|
||||
)
|
||||
|
||||
//V210
|
||||
//V210
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
import code.api.v2_1_0._
|
||||
@ -1135,23 +1193,23 @@ object SwaggerDefinitionsJSON {
|
||||
)
|
||||
|
||||
val customerJsonV210 = CustomerJsonV210(
|
||||
customer_id = "123",
|
||||
customer_number = "123",
|
||||
legal_name = "legal_name",
|
||||
mobile_phone_number = "123",
|
||||
email = "contact@tesobe.com",
|
||||
face_image = customerFaceImageJson,
|
||||
date_of_birth = exampleDate,
|
||||
relationship_status = "123",
|
||||
dependants = 123,
|
||||
dob_of_dependants = List(exampleDate),
|
||||
credit_rating = Option(customerCreditRatingJSON),
|
||||
credit_limit = Option(amountOfMoneyJsonV121),
|
||||
highest_education_attained = "123",
|
||||
employment_status = "123",
|
||||
kyc_status = true,
|
||||
last_ok_date = exampleDate
|
||||
)
|
||||
customer_id = "123",
|
||||
customer_number = "123",
|
||||
legal_name = "legal_name",
|
||||
mobile_phone_number = "123",
|
||||
email = "contact@tesobe.com",
|
||||
face_image = customerFaceImageJson,
|
||||
date_of_birth = exampleDate,
|
||||
relationship_status = "123",
|
||||
dependants = 123,
|
||||
dob_of_dependants = List(exampleDate),
|
||||
credit_rating = Option(customerCreditRatingJSON),
|
||||
credit_limit = Option(amountOfMoneyJsonV121),
|
||||
highest_education_attained = "123",
|
||||
employment_status = "123",
|
||||
kyc_status = true,
|
||||
last_ok_date = exampleDate
|
||||
)
|
||||
|
||||
val userJSONV210 = UserJSONV210(
|
||||
id = "123",
|
||||
@ -1269,7 +1327,7 @@ object SwaggerDefinitionsJSON {
|
||||
driveUpJson
|
||||
)
|
||||
|
||||
val branchJsonPost = BranchJsonPost("123","gh.29.fi", "OBP",
|
||||
val branchJsonPost = BranchJsonPost("123", "gh.29.fi", "OBP",
|
||||
addressJson,
|
||||
locationJson,
|
||||
metaJson,
|
||||
|
||||
@ -6,11 +6,12 @@ import code.api.util.ErrorMessages
|
||||
import code.sandbox.{OBPDataImport, SandboxDataImport}
|
||||
import code.util.Helper
|
||||
import net.liftweb.http.S
|
||||
import net.liftweb.http.js.JE.JsRaw
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import net.liftweb.http.rest.RestHelper
|
||||
import net.liftweb.util.Helpers._
|
||||
import net.liftweb.util.Props
|
||||
import code.util.Helper.MdcLoggable
|
||||
import net.liftweb.json.Extraction
|
||||
|
||||
|
||||
object SandboxApiCalls extends OBPRestHelper with MdcLoggable {
|
||||
@ -33,7 +34,7 @@ object SandboxApiCalls extends OBPRestHelper with MdcLoggable {
|
||||
importData <- tryo{json.extract[SandboxDataImport]} ?~ ErrorMessages.InvalidJsonFormat
|
||||
importWorked <- OBPDataImport.importer.vend.importData(importData)
|
||||
} yield {
|
||||
successJsonResponse(JsRaw("""{"success":"Success"}"""), 201)
|
||||
successJsonResponse(Extraction.decompose(successMessage), 201)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ object ErrorMessages {
|
||||
val TransactionRequestStatusNotInitiated = "OBP-40011: Transaction Request Status is not INITIATED."
|
||||
val CounterpartyNotFoundOtherAccountProvider = "OBP-40012: Please set up the otherAccountRoutingScheme and otherBankRoutingScheme fields of the Counterparty to 'OBP'"
|
||||
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 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 UnKnownError = "OBP-50000: Unknown Error."
|
||||
|
||||
@ -19,20 +19,10 @@ import net.liftweb.util.Props
|
||||
|
||||
import scala.collection.immutable.Nil
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
// Makes JValue assignment to Nil work
|
||||
import net.liftweb.json.JsonDSL._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerJSONFactory._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import code.api.util.ErrorMessages._
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case class MakePaymentJson(
|
||||
bank_id : String,
|
||||
account_id : String,
|
||||
amount : String)
|
||||
|
||||
trait APIMethods121 {
|
||||
//needs to be a RestHelper to get access to JsonGet, JsonPost, etc.
|
||||
self: RestHelper =>
|
||||
@ -107,8 +97,8 @@ trait APIMethods121 {
|
||||
|* Hosted by information
|
||||
|* Git Commit""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
apiInfoJSON,
|
||||
List(UnKnownError),
|
||||
Catalogs(Core, notPSD2, OBWG),
|
||||
apiTagApiInfo :: Nil)
|
||||
|
||||
@ -133,8 +123,8 @@ trait APIMethods121 {
|
||||
|* Logo URL
|
||||
|* Website""",
|
||||
emptyObjectJson,
|
||||
BanksJSON(List(BankJSON("gh.29.uk", "EFG", "Eurobank", "None", "www.eurobank.rs",BankRoutingJSON("obp","gh.29.uk")))),
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
banksJSON,
|
||||
List(UnKnownError),
|
||||
Catalogs(Core, notPSD2, OBWG),
|
||||
apiTagBank :: Nil)
|
||||
|
||||
@ -169,7 +159,7 @@ trait APIMethods121 {
|
||||
|* Logo URL
|
||||
|* Website""",
|
||||
emptyObjectJson,
|
||||
BankJSON("gh.29.uk", "EFG", "Eurobank", "None", "www.eurobank.rs",BankRoutingJSON("obp","gh.29.uk")),
|
||||
bankJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, notPSD2, OBWG),
|
||||
apiTagBank :: Nil)
|
||||
@ -208,8 +198,8 @@ trait APIMethods121 {
|
||||
|If you need the previous behaviour, please use the API call for private accounts (..../accounts/private).
|
||||
|""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
accountJSON,
|
||||
List(UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
apiTagAccount :: Nil)
|
||||
|
||||
@ -233,7 +223,7 @@ trait APIMethods121 {
|
||||
|
|
||||
|Authentication via OAuth is required.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
accountJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
apiTagAccount :: Nil)
|
||||
@ -243,7 +233,7 @@ trait APIMethods121 {
|
||||
case "accounts" :: "private" :: Nil JsonGet json => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~ "user not found"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
} yield {
|
||||
val availableAccounts = BankAccount.nonPublicAccounts(u)
|
||||
successJsonResponse(bankAccountsListToJson(availableAccounts, Full(u)))
|
||||
@ -261,8 +251,8 @@ trait APIMethods121 {
|
||||
"""Returns the list of private (non-public) accounts the user has access to at all banks.
|
||||
|For each account the API returns the ID and the available views. Authentication via OAuth is required.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
accountJSON,
|
||||
List(UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
apiTagAccount :: Nil)
|
||||
|
||||
@ -292,7 +282,7 @@ trait APIMethods121 {
|
||||
|If you need the previous behaviour, please use the API call for private accounts (..../accounts/private)
|
||||
""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
accountJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
apiTagAccount :: Nil)
|
||||
@ -322,7 +312,7 @@ trait APIMethods121 {
|
||||
|
|
||||
|Authentication via OAuth is required.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
accountJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
apiTagAccount :: Nil)
|
||||
@ -332,7 +322,7 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: "private" :: Nil JsonGet json => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~ "user not found"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
bank <- Bank(bankId)
|
||||
} yield {
|
||||
val availableAccounts = bank.nonPublicAccounts(u)
|
||||
@ -352,7 +342,7 @@ trait APIMethods121 {
|
||||
|
|
||||
|Authentication via OAuth is not required.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
accountJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
apiTagAccount :: apiTagPublicData :: Nil)
|
||||
@ -392,7 +382,7 @@ trait APIMethods121 {
|
||||
|
|
||||
|Authentication is required if the 'is_public' field in view (VIEW_ID) is not set to `true`.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
moderatedAccountJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
apiTagAccount :: Nil)
|
||||
@ -422,13 +412,9 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID",
|
||||
"Update Account Label.",
|
||||
"Update the label for the account. The label is how the account is known to the account owner e.g. 'My savings account' ",
|
||||
UpdateAccountJSON(
|
||||
"ACCOUNT_ID of the account we want to update",
|
||||
"New label",
|
||||
"BANK_ID"
|
||||
),
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
updateAccountJSON,
|
||||
successMessage,
|
||||
List(InvalidJsonFormat, UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagMetaData)
|
||||
)
|
||||
@ -439,12 +425,12 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: Nil JsonPost json -> _ => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~ "user not found"
|
||||
json <- tryo { json.extract[UpdateAccountJSON] } ?~ "wrong JSON format"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
json <- tryo { json.extract[UpdateAccountJSON] } ?~ InvalidJsonFormat
|
||||
account <- BankAccount(bankId, accountId)
|
||||
} yield {
|
||||
account.updateLabel(u, json.label)
|
||||
successJsonResponse(Extraction.decompose(SuccessMessage("ok")), 200)
|
||||
successJsonResponse(Extraction.decompose(successMessage), 200)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -481,7 +467,7 @@ trait APIMethods121 {
|
||||
|
|
||||
|OAuth authentication is required and the user needs to have access to the owner view.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
viewsJSONV121,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagView))
|
||||
@ -491,7 +477,7 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "views" :: Nil JsonGet json => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~ "user not found"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
account <- BankAccount(bankId, accountId)
|
||||
views <- account views u // In other words: views = account.views(u) This calls BankingData.scala BankAccount.views
|
||||
} yield {
|
||||
@ -521,20 +507,9 @@ trait APIMethods121 {
|
||||
| The 'hide_metadata_if_alias_used' field in the JSON can take boolean values. If it is set to `true` and there is an alias on the other account then the other accounts' metadata (like more_info, url, image_url, open_corporates_url, etc.) will be hidden. Otherwise the metadata will be shown.
|
||||
|
|
||||
| The 'allowed_actions' field is a list containing the name of the actions allowed on this view, all the actions contained will be set to `true` on the view creation, the rest will be set to `false`.""",
|
||||
CreateViewJSON(
|
||||
"Name of view to create",
|
||||
"Description of view (this example is public, uses the public alias, and has limited access to account data)",
|
||||
true,
|
||||
"_public_",
|
||||
true,
|
||||
List(
|
||||
"can_see_transaction_start_date",
|
||||
"can_see_bank_account_label",
|
||||
"can_see_tags"
|
||||
)
|
||||
),
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
createViewJSON,
|
||||
viewJSONV121,
|
||||
List(UserNotLoggedIn,InvalidJsonFormat, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagView)
|
||||
)
|
||||
@ -544,8 +519,8 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "views" :: Nil JsonPost json -> _ => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~ "user not found"
|
||||
json <- tryo{json.extract[CreateViewJSON]} ?~ "wrong JSON format"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
json <- tryo{json.extract[CreateViewJSON]} ?~ InvalidJsonFormat
|
||||
account <- BankAccount(bankId, accountId)
|
||||
view <- account createView (u, json)
|
||||
} yield {
|
||||
@ -568,15 +543,9 @@ trait APIMethods121 {
|
||||
|
|
||||
|The json sent is the same as during view creation (above), with one difference: the 'name' field
|
||||
|of a view is not editable (it is only set when a view is created)""",
|
||||
UpdateViewJSON(
|
||||
"New description of view",
|
||||
false,
|
||||
"_public_",
|
||||
true,
|
||||
List("can_see_transaction_start_date", "can_see_bank_account_label")
|
||||
),
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
updateViewJSON,
|
||||
viewJSONV121,
|
||||
List(InvalidJsonFormat,UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagView)
|
||||
)
|
||||
@ -587,10 +556,9 @@ trait APIMethods121 {
|
||||
) :: "views" :: ViewId(viewId) :: Nil JsonPut json -> _ => {
|
||||
user =>
|
||||
for {
|
||||
updateJson <- tryo{ json.extract[UpdateViewJSON] } ?~ InvalidJsonFormat
|
||||
account <- BankAccount(bankId, accountId)
|
||||
u <- user ?~ "user not found"
|
||||
updateJson <- tryo
|
||||
{ json.extract[UpdateViewJSON] } ?~ InvalidJsonFormat
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
updatedView <- account.updateView(u, viewId, updateJson)
|
||||
} yield {
|
||||
val viewJSON = JSONFactory.createViewJSON(updatedView)
|
||||
@ -620,7 +588,7 @@ trait APIMethods121 {
|
||||
) :: "views" :: ViewId(viewId) :: Nil JsonDelete json => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~ "user not found"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
account <- BankAccount(bankId, accountId)
|
||||
view <- account removeView(u, viewId)
|
||||
} yield noContentJsonResponse
|
||||
@ -638,7 +606,7 @@ trait APIMethods121 {
|
||||
|
|
||||
|OAuth authentication is required and the user needs to have access to the owner view.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
permissionsJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagView, apiTagEntitlement)
|
||||
@ -649,7 +617,7 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "permissions" :: Nil JsonGet json => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~ "user not found"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
account <- BankAccount(bankId, accountId)
|
||||
permissions <- account permissions u
|
||||
} yield {
|
||||
@ -671,7 +639,7 @@ trait APIMethods121 {
|
||||
|
|
||||
|OAuth authentication is required and the user needs to have access to the owner view.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
viewsJSONV121,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagView, apiTagEntitlement)
|
||||
@ -683,7 +651,7 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "permissions" :: providerId :: userId :: Nil JsonGet json => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~ "user not found"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
account <- BankAccount(bankId, accountId)
|
||||
permission <- account permission(u, providerId, userId)
|
||||
} yield {
|
||||
@ -705,8 +673,8 @@ trait APIMethods121 {
|
||||
|All url parameters must be [%-encoded](http://en.wikipedia.org/wiki/Percent-encoding), which is often especially relevant for USER_ID and PROVIDER_ID.
|
||||
|
|
||||
|OAuth authentication is required and the user needs to have access to the owner view.""",
|
||||
ViewIdsJson(List("owner", "auditor", "investor")),
|
||||
emptyObjectJson,
|
||||
viewIdsJson,
|
||||
viewsJSONV121,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagPerson, apiTagUser, apiTagAccount, apiTagView, apiTagEntitlement, apiTagOwnerRequired))
|
||||
@ -716,7 +684,7 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "permissions" :: providerId :: userId :: "views" :: Nil JsonPost json -> _ => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~ "user not found"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
account <- BankAccount(bankId, accountId)
|
||||
viewIds <- tryo{json.extract[ViewIdsJson]} ?~ "wrong format JSON"
|
||||
addedViews <- account addPermissions(u, viewIds.views.map(viewIdString => ViewUID(ViewId(viewIdString), bankId, accountId)), providerId, userId)
|
||||
@ -740,7 +708,7 @@ trait APIMethods121 {
|
||||
|
|
||||
|Granting access to a public view will return an error message, as the user already has access.""",
|
||||
emptyObjectJson, // No Json body required
|
||||
emptyObjectJson,
|
||||
viewJSONV121,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagPerson, apiTagUser, apiTagAccount, apiTagView, apiTagEntitlement, apiTagOwnerRequired))
|
||||
@ -750,7 +718,7 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "permissions" :: providerId :: userId :: "views" :: ViewId(viewId) :: Nil JsonPost json -> _ => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~ "user not found"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
account <- BankAccount(bankId, accountId)
|
||||
// TODO Check Error cases
|
||||
addedView <- account addPermission(u, ViewUID(viewId, bankId, accountId), providerId, userId)
|
||||
@ -784,7 +752,7 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "permissions" :: providerId :: userId :: "views" :: ViewId(viewId) :: Nil JsonDelete json => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~ "user not found"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
account <- BankAccount(bankId, accountId)
|
||||
isRevoked <- account revokePermission(u, ViewUID(viewId, bankId, accountId), providerId, userId)
|
||||
if(isRevoked)
|
||||
@ -813,7 +781,7 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: "permissions" :: providerId :: userId :: "views" :: Nil JsonDelete json => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~ "user not found"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
account <- BankAccount(bankId, accountId)
|
||||
isRevoked <- account revokeAllPermissions(u, providerId, userId)
|
||||
if(isRevoked)
|
||||
@ -832,8 +800,11 @@ trait APIMethods121 {
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|Authentication is required if the view VIEW_ID is not public.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
otherAccountsJSON,
|
||||
List(
|
||||
BankAccountNotFound,
|
||||
UnKnownError
|
||||
),
|
||||
Catalogs(notCore, PSD2, OBWG),
|
||||
List(apiTagPerson, apiTagUser, apiTagAccount, apiTagCounterparty))
|
||||
|
||||
@ -842,7 +813,7 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "other_accounts" :: Nil JsonGet json => {
|
||||
user =>
|
||||
for {
|
||||
account <- BankAccount(bankId, accountId)
|
||||
account <- BankAccount(bankId, accountId) ?~! BankAccountNotFound
|
||||
view <- View.fromUrl(viewId, account)
|
||||
otherBankAccounts <- account.moderatedOtherBankAccounts(view, user)
|
||||
} yield {
|
||||
@ -863,8 +834,8 @@ trait APIMethods121 {
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|Authentication is required if the view is not public.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
otherAccountJSON,
|
||||
List(BankAccountNotFound, UnKnownError),
|
||||
Catalogs(notCore, PSD2, OBWG),
|
||||
List(apiTagAccount, apiTagCounterparty))
|
||||
|
||||
@ -873,7 +844,7 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "other_accounts":: other_account_id :: Nil JsonGet json => {
|
||||
user =>
|
||||
for {
|
||||
account <- BankAccount(bankId, accountId)
|
||||
account <- BankAccount(bankId, accountId) ?~!BankAccountNotFound
|
||||
view <- View.fromUrl(viewId, account)
|
||||
otherBankAccount <- account.moderatedOtherBankAccount(other_account_id, view, user)
|
||||
} yield {
|
||||
@ -895,7 +866,7 @@ trait APIMethods121 {
|
||||
|
|
||||
|Authentication via OAuth is required if the view is not public.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
otherAccountMetadataJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -927,8 +898,8 @@ trait APIMethods121 {
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|OAuth authentication is required if the view is not public.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
aliasJSON,
|
||||
List(UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
|
||||
@ -965,9 +936,9 @@ trait APIMethods121 {
|
||||
|the public alias was deleted.
|
||||
|
|
||||
|The VIEW_ID parameter should be a view the caller is permitted to access to and that has permission to create public aliases.""",
|
||||
AliasJSON("An Alias"),
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
aliasJSON,
|
||||
successMessage,
|
||||
List(UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
|
||||
@ -1001,8 +972,8 @@ trait APIMethods121 {
|
||||
|
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|Authentication is required if the view is not public.""",
|
||||
AliasJSON("An Alias"),
|
||||
emptyObjectJson,
|
||||
aliasJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1039,7 +1010,7 @@ trait APIMethods121 {
|
||||
|Authentication is required if the view is not public.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
List( UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
|
||||
@ -1071,7 +1042,7 @@ trait APIMethods121 {
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|Authentication is required if the view is not public.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
aliasJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1104,8 +1075,8 @@ trait APIMethods121 {
|
||||
|
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|Authentication is required if the view is not public.""",
|
||||
AliasJSON("An Alias"),
|
||||
emptyObjectJson,
|
||||
aliasJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1141,8 +1112,8 @@ trait APIMethods121 {
|
||||
|
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|Authentication is required if the view is not public.""",
|
||||
AliasJSON("An Alias"),
|
||||
emptyObjectJson,
|
||||
aliasJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1210,8 +1181,8 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/more_info",
|
||||
"Add Counterparty More Info",
|
||||
"Add a description of the counter party from the perpestive of the account e.g. My dentist.",
|
||||
MoreInfoJSON("More info"),
|
||||
emptyObjectJson,
|
||||
moreInfoJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1244,8 +1215,8 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/more_info",
|
||||
"Update Counterparty More Info",
|
||||
"Update the more info description of the counter party from the perpestive of the account e.g. My dentist.",
|
||||
MoreInfoJSON("More info"),
|
||||
emptyObjectJson,
|
||||
moreInfoJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1310,8 +1281,8 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/url",
|
||||
"Add url to other bank account.",
|
||||
"A url which represents the counterparty (home page url etc.)",
|
||||
UrlJSON("www.example.com"),
|
||||
emptyObjectJson,
|
||||
urlJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1345,8 +1316,8 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/url",
|
||||
"Update url of other bank account.",
|
||||
"A url which represents the counterparty (home page url etc.)",
|
||||
UrlJSON("www.example.com"),
|
||||
emptyObjectJson,
|
||||
urlJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1411,8 +1382,8 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/image_url",
|
||||
"Add image url to other bank account.",
|
||||
"Add a url that points to the logo of the counterparty",
|
||||
ImageUrlJSON("www.example.com/logo.png"),
|
||||
emptyObjectJson,
|
||||
imageUrlJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1445,9 +1416,9 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/image_url",
|
||||
"Update Counterparty Image Url",
|
||||
"Update the url that points to the logo of the counterparty",
|
||||
ImageUrlJSON("www.example.com/logo.png"),
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
imageUrlJSON,
|
||||
successMessage,
|
||||
List(UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
|
||||
@ -1481,7 +1452,7 @@ trait APIMethods121 {
|
||||
"Delete image url of other bank account.",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
List(UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty)) // Tag general then specific for consistent sorting
|
||||
|
||||
@ -1511,9 +1482,9 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/open_corporates_url",
|
||||
"Add Open Corporates URL to Counterparty",
|
||||
"Add open corporates url to other bank account.",
|
||||
OpenCorporateUrlJSON("https://opencorporates.com/companies/gb/04351490"),
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
openCorporateUrlJSON,
|
||||
successMessage,
|
||||
List(UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
|
||||
@ -1545,8 +1516,8 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/open_corporates_url",
|
||||
"Update Open Corporates Url of Counterparty",
|
||||
"Update open corporate url of other bank account.",
|
||||
OpenCorporateUrlJSON("https://opencorporates.com/companies/gb/04351490"),
|
||||
emptyObjectJson,
|
||||
openCorporateUrlJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1611,8 +1582,8 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/corporate_location",
|
||||
"Add Corporate Location to Counterparty",
|
||||
"Add the geolocation of the counterparty's registered address",
|
||||
CorporateLocationJSON(JSONFactory.createLocationPlainJSON(52.5571573,13.3728025)),
|
||||
emptyObjectJson,
|
||||
corporateLocationJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1647,8 +1618,8 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/corporate_location",
|
||||
"Update Counterparty Corporate Location",
|
||||
"Update the geolocation of the counterparty's registered address",
|
||||
CorporateLocationJSON(JSONFactory.createLocationPlainJSON(52.5571573,13.3728025)),
|
||||
emptyObjectJson,
|
||||
corporateLocationJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1719,8 +1690,8 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/physical_location",
|
||||
"Add physical location to other bank account.",
|
||||
"Add geocoordinates of the counterparty's main location",
|
||||
PhysicalLocationJSON(JSONFactory.createLocationPlainJSON(52.5571573,13.3728025)),
|
||||
emptyObjectJson,
|
||||
physicalLocationJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1756,8 +1727,8 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/other_accounts/OTHER_ACCOUNT_ID/metadata/physical_location",
|
||||
"Update Counterparty Physical Location",
|
||||
"Update geocoordinates of the counterparty's main location",
|
||||
PhysicalLocationJSON(JSONFactory.createLocationPlainJSON(52.5571573,13.3728025)),
|
||||
emptyObjectJson,
|
||||
physicalLocationJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagCounterparty))
|
||||
@ -1841,8 +1812,8 @@ trait APIMethods121 {
|
||||
|
|
||||
|**Date format parameter**: "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" (2014-07-01T00:00:00.000Z) ==> time zone is UTC.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
transactionsJSON,
|
||||
List(UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagTransaction))
|
||||
|
||||
@ -1878,8 +1849,8 @@ trait APIMethods121 {
|
||||
|
|
||||
|""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
transactionJSON,
|
||||
List(BankAccountNotFound, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagTransaction))
|
||||
|
||||
@ -1888,7 +1859,7 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "transactions" :: TransactionId(transactionId) :: "transaction" :: Nil JsonGet json => {
|
||||
user =>
|
||||
for {
|
||||
account <- BankAccount(bankId, accountId)
|
||||
account <- BankAccount(bankId, accountId) ?~! BankAccountNotFound
|
||||
view <- View.fromUrl(viewId, account)
|
||||
moderatedTransaction <- account.moderatedTransaction(transactionId, view, user)
|
||||
} yield {
|
||||
@ -1909,8 +1880,8 @@ trait APIMethods121 {
|
||||
|
|
||||
|Authentication via OAuth is required if the view is not public.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
transactionNarrativeJSON,
|
||||
List(UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
|
||||
@ -1943,9 +1914,9 @@ trait APIMethods121 {
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|Authentication is required if the view is not public.
|
||||
|""",
|
||||
TransactionNarrativeJSON("My new (old!) piano"),
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
transactionNarrativeJSON,
|
||||
successMessage,
|
||||
List(InvalidJsonFormat, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
|
||||
@ -1976,9 +1947,9 @@ trait APIMethods121 {
|
||||
"""Updates the description of the transaction TRANSACTION_ID.
|
||||
|
|
||||
|Authentication via OAuth is required if the view is not public.""",
|
||||
TransactionNarrativeJSON("My new (old!) piano"),
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
transactionNarrativeJSON,
|
||||
successMessage,
|
||||
List(InvalidJsonFormat, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
|
||||
@ -2040,7 +2011,7 @@ trait APIMethods121 {
|
||||
|
|
||||
|Authentication via OAuth is required if the view is not public.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
transactionCommentsJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
@ -2071,8 +2042,8 @@ trait APIMethods121 {
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|
|
||||
|Authentication is required since the comment is linked with the user.""",
|
||||
PostTransactionCommentJSON("Why did we spend money on this again?"),
|
||||
emptyObjectJson,
|
||||
postTransactionCommentJSON,
|
||||
transactionCommentJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
@ -2107,7 +2078,7 @@ trait APIMethods121 {
|
||||
|Authentication via OAuth is required. The user must either have owner privileges for this account, or must be the user that posted the comment.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
List(BankAccountNotFound, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
|
||||
@ -2116,7 +2087,7 @@ trait APIMethods121 {
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "transactions" :: TransactionId(transactionId) :: "metadata" :: "comments":: commentId :: Nil JsonDelete _ => {
|
||||
user =>
|
||||
for {
|
||||
account <- BankAccount(bankId, accountId)
|
||||
account <- BankAccount(bankId, accountId) ?~! BankAccountNotFound
|
||||
metadata <- moderatedTransactionMetadata(bankId, accountId, viewId, transactionId, user)
|
||||
delete <- metadata.deleteComment(commentId, user, account)
|
||||
} yield {
|
||||
@ -2133,11 +2104,10 @@ trait APIMethods121 {
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transactions/TRANSACTION_ID/metadata/tags",
|
||||
"Get tags.",
|
||||
"""Returns the transaction TRANSACTION_ID tags made on a [view](#1_2_1-getViewsForBankAccount) (VIEW_ID).
|
||||
|
||||
Authentication via OAuth is required if the view is not public.""",
|
||||
Authentication via OAuth is required if the view is not public.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
transactionTagJSON,
|
||||
List(UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
|
||||
@ -2167,8 +2137,8 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|Authentication is required as the tag is linked with the user.""",
|
||||
PostTransactionTagJSON("holiday"),
|
||||
emptyObjectJson,
|
||||
postTransactionTagJSON,
|
||||
transactionTagJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
@ -2204,7 +2174,7 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
Authentication via OAuth is required. The user must either have owner privileges for this account, or must be the user that posted the tag.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
List(UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
|
||||
@ -2231,10 +2201,9 @@ Authentication via OAuth is required. The user must either have owner privileges
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transactions/TRANSACTION_ID/metadata/images",
|
||||
"Get images.",
|
||||
"""Returns the transaction TRANSACTION_ID images made on a [view](#1_2_1-getViewsForBankAccount) (VIEW_ID).
|
||||
|
||||
Authentication via OAuth is required if the view is not public.""",
|
||||
emptyObjectJson,
|
||||
Authentication via OAuth is required if the view is not public.""",
|
||||
emptyObjectJson,
|
||||
transactionImagesJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
@ -2265,12 +2234,9 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
|${authenticationRequiredMessage(true) }
|
||||
|
|
||||
|The image is linked with the user.""",
|
||||
PostTransactionImageJSON(
|
||||
"The new printer",
|
||||
"www.example.com/images/printer.png"
|
||||
),
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
postTransactionImageJSON,
|
||||
transactionImageJSON,
|
||||
List(InvalidJsonFormat, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction)
|
||||
)
|
||||
@ -2281,7 +2247,7 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
user =>
|
||||
for {
|
||||
u <- user
|
||||
imageJson <- tryo{json.extract[PostTransactionImageJSON]}
|
||||
imageJson <- tryo{json.extract[PostTransactionImageJSON]} ?~! InvalidJsonFormat
|
||||
metadata <- moderatedTransactionMetadata(bankId, accountId, viewId, transactionId, Full(u))
|
||||
addImageFunc <- Box(metadata.addImage) ?~ {"view " + viewId + " does not authorize adding images"}
|
||||
url <- tryo{new URL(imageJson.URL)} ?~! "Could not parse url string as a valid URL"
|
||||
@ -2304,7 +2270,7 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
|Authentication via OAuth is required. The user must either have owner privileges for this account, or must be the user that posted the image.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
List(BankAccountNotFound, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
|
||||
@ -2314,7 +2280,7 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
user =>
|
||||
for {
|
||||
metadata <- moderatedTransactionMetadata(bankId, accountId, viewId, transactionId, user)
|
||||
bankAccount <- BankAccount(bankId, accountId)
|
||||
bankAccount <- BankAccount(bankId, accountId)?~! BankAccountNotFound
|
||||
deleted <- Box(metadata.deleteImage(imageId, user, bankAccount))
|
||||
} yield {
|
||||
noContentJsonResponse
|
||||
@ -2334,8 +2300,8 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
|
|
||||
|Authentication via OAuth is required if the view is not public.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
transactionWhereJSON,
|
||||
List(UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
|
||||
@ -2366,8 +2332,8 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|The geo tag is linked with the user.""",
|
||||
PostTransactionWhereJSON(JSONFactory.createLocationPlainJSON(52.5571573,13.3728025)),
|
||||
emptyObjectJson,
|
||||
postTransactionWhereJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
@ -2403,8 +2369,8 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|
|
||||
|The geo tag is linked with the user.""",
|
||||
PostTransactionWhereJSON(JSONFactory.createLocationPlainJSON(52.5571573,13.3728025)),
|
||||
emptyObjectJson,
|
||||
postTransactionWhereJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMetaData, apiTagTransaction))
|
||||
@ -2473,11 +2439,10 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
"Get Other Account of Transaction",
|
||||
"""Get other account of a transaction.
|
||||
|Returns details of the other party involved in the transaction, moderated by the [view](#1_2_1-getViewsForBankAccount) (VIEW_ID).
|
||||
|
||||
Authentication via OAuth is required if the view is not public.""",
|
||||
Authentication via OAuth is required if the view is not public.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
otherAccountJSON,
|
||||
List(BankAccountNotFound, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagTransaction, apiTagCounterparty))
|
||||
|
||||
@ -2486,7 +2451,7 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
case "banks" :: BankId(bankId) :: "accounts" :: AccountId(accountId) :: ViewId(viewId) :: "transactions":: TransactionId(transactionId) :: "other_account" :: Nil JsonGet json => {
|
||||
user =>
|
||||
for {
|
||||
account <- BankAccount(bankId, accountId)
|
||||
account <- BankAccount(bankId, accountId) ?~! BankAccountNotFound
|
||||
view <- View.fromUrl(viewId, account)
|
||||
transaction <- account.moderatedTransaction(transactionId, view, user)
|
||||
moderatedOtherBankAccount <- transaction.otherBankAccount
|
||||
@ -2498,7 +2463,7 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
}
|
||||
}
|
||||
|
||||
case class TransactionIdJson(transaction_id : String)
|
||||
|
||||
|
||||
resourceDocs += ResourceDoc(
|
||||
makePayment,
|
||||
@ -2513,8 +2478,8 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
|This will only work if account to pay exists at the bank specified in the json, and if that account has the same currency as that of the payee.
|
||||
|
|
||||
|There are no checks for 'sufficient funds' at the moment, so it is possible to go into unlimited overdraft.""",
|
||||
MakePaymentJson("To BANK_ID", "To ACCOUNT_ID", "12.45"),
|
||||
emptyObjectJson,
|
||||
makePaymentJson,
|
||||
transactionIdJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagTransactionRequest))
|
||||
@ -2524,7 +2489,7 @@ Authentication via OAuth is required if the view is not public.""",
|
||||
user =>
|
||||
if (Props.getBool("payments_enabled", false)) {
|
||||
for {
|
||||
u <- user ?~ "User not found"
|
||||
u <- user ?~ UserNotLoggedIn
|
||||
makeTransJson <- tryo{json.extract[MakePaymentJson]} ?~ {InvalidJsonFormat}
|
||||
rawAmt <- tryo {BigDecimal(makeTransJson.amount)} ?~! s"amount ${makeTransJson.amount} not convertible to number"
|
||||
toAccountUID = BankAccountUID(BankId(makeTransJson.bank_id), AccountId(makeTransJson.account_id))
|
||||
|
||||
@ -156,6 +156,7 @@ case class AccountJSON(
|
||||
views_available : List[ViewJSONV121],
|
||||
bank_id : String
|
||||
)
|
||||
case class TransactionIdJson(transaction_id : String)
|
||||
|
||||
case class UpdateAccountJSON(
|
||||
id : String,
|
||||
@ -341,6 +342,12 @@ case class ViewIdsJson(
|
||||
views : List[String]
|
||||
)
|
||||
|
||||
case class MakePaymentJson(
|
||||
bank_id : String,
|
||||
account_id : String,
|
||||
amount : String
|
||||
)
|
||||
|
||||
object JSONFactory{
|
||||
def stringOrNull(text : String) =
|
||||
if(text == null || text.isEmpty)
|
||||
|
||||
@ -10,8 +10,8 @@ import net.liftweb.json.Extraction
|
||||
import APIUtil._
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
import scala.collection.immutable.Nil
|
||||
import code.api.ResourceDocs1_4_0.SwaggerJSONFactory._
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
|
||||
trait APIMethods130 {
|
||||
//needs to be a RestHelper to get access to JsonGet, JsonPost, etc.
|
||||
@ -33,7 +33,7 @@ trait APIMethods130 {
|
||||
"Get cards for the current user",
|
||||
"Returns data about all the physical cards a user has been issued. These could be debit cards, credit cards, etc.",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
physicalCardsJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer))
|
||||
@ -68,8 +68,8 @@ trait APIMethods130 {
|
||||
"Get cards for the specified bank",
|
||||
"",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
physicalCardsJSON,
|
||||
List(UserNotLoggedIn,BankNotFound, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer))
|
||||
|
||||
|
||||
@ -46,8 +46,8 @@ import code.api.util.APIUtil.ResourceDoc
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
import code.api.util.APIUtil.authenticationRequiredMessage
|
||||
import code.api.ResourceDocs1_4_0.SwaggerJSONFactory._
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
|
||||
trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
//needs to be a RestHelper to get access to JsonGet, JsonPost, etc.
|
||||
@ -77,7 +77,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
|
|
||||
|Authentication via OAuth is required.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
customerJsonV140,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer))
|
||||
@ -113,7 +113,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
|
|
||||
|Authentication via OAuth is required.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
customerMessagesJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagPerson, apiTagCustomer))
|
||||
@ -144,8 +144,8 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
"Add Customer Message.",
|
||||
"Add a message for the customer specified by CUSTOMER_ID",
|
||||
// We use Extraction.decompose to convert to json
|
||||
AddCustomerMessageJson("message to send", "from department", "from person"),
|
||||
emptyObjectJson,
|
||||
addCustomerMessageJson,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagPerson, apiTagCustomer)
|
||||
@ -165,7 +165,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
user, bankId, postedData.message, postedData.from_department, postedData.from_person),
|
||||
"Server error: could not add message")
|
||||
} yield {
|
||||
successJsonResponse(JsRaw("""{"success":"Success"}"""), 201)
|
||||
successJsonResponse(Extraction.decompose(successMessage), 201)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -190,7 +190,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
|
|
||||
|${authenticationRequiredMessage(!getBranchesIsPublic)}""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
branchesJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, notPSD2, OBWG),
|
||||
List(apiTagBank)
|
||||
@ -234,7 +234,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
|
|
||||
|${authenticationRequiredMessage(!getAtmsIsPublic)}""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
atmsJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, notPSD2, OBWG),
|
||||
List(apiTagBank)
|
||||
@ -286,7 +286,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
|* License the data under this endpoint is released under
|
||||
|${authenticationRequiredMessage(!getProductsIsPublic)}""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
productsJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, notPSD2, OBWG),
|
||||
List(apiTagBank)
|
||||
@ -323,7 +323,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
"Get CRM Events for the logged in user",
|
||||
"",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
crmEventsJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer)
|
||||
@ -374,8 +374,8 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
|
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
transactionRequestTypesJsonV140,
|
||||
List(UserNotLoggedIn, BankNotFound, AccountNotFound, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagTransactionRequest))
|
||||
|
||||
@ -411,7 +411,7 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
"Get all Transaction Requests.",
|
||||
"",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
transactionRequest,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagTransactionRequest))
|
||||
@ -460,13 +460,8 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
|
|
||||
|Please see later versions of this call in 2.0.0 or 2.1.0.
|
||||
|""",
|
||||
TransactionRequestBodyJsonV140(
|
||||
TransactionRequestAccountJsonV140("BANK_ID", "ACCOUNT_ID"),
|
||||
AmountOfMoneyJsonV121("EUR", "100.53"),
|
||||
"A description for the transaction to be created",
|
||||
"one of the transaction types possible for the account"
|
||||
),
|
||||
emptyObjectJson,
|
||||
transactionRequestBodyJsonV140,
|
||||
transactionRequest,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagTransactionRequest))
|
||||
@ -513,8 +508,8 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/TRANSACTION_REQUEST_TYPE/transaction-requests/TRANSACTION_REQUEST_ID/challenge",
|
||||
"Answer Transaction Request Challenge.",
|
||||
"In Sandbox mode, any string that can be converted to a possitive integer will be accepted as an answer.",
|
||||
ChallengeAnswerJSON("89123812", "123345"),
|
||||
emptyObjectJson,
|
||||
challengeAnswerJSON,
|
||||
transactionRequest,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagTransactionRequest))
|
||||
@ -544,9 +539,6 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
resourceDocs += ResourceDoc(
|
||||
addCustomer,
|
||||
apiVersion,
|
||||
@ -562,24 +554,8 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
|${authenticationRequiredMessage(true) }
|
||||
|Note: This call is depreciated in favour of v.2.0.0 createCustomer
|
||||
|""",
|
||||
CreateCustomerJson(
|
||||
"user_id to attach this customer to e.g. 123213",
|
||||
"new customer number 687687678",
|
||||
"Joe David Bloggs",
|
||||
"+44 07972 444 876",
|
||||
"person@example.com",
|
||||
CustomerFaceImageJson("www.example.com/person/123/image.png",
|
||||
exampleDate
|
||||
),
|
||||
exampleDate, "Single",
|
||||
1,
|
||||
List(exampleDate),
|
||||
"Bachelor’s Degree",
|
||||
"Employed",
|
||||
true,
|
||||
exampleDate
|
||||
),
|
||||
emptyObjectJson,
|
||||
code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.createCustomerJson,
|
||||
customerJsonV140,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer))
|
||||
@ -658,8 +634,8 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
|There are (underscores_in_words_in_brackets)
|
||||
|
|
||||
|_etc_...""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
apiInfoJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
Nil)
|
||||
|
||||
@ -155,12 +155,7 @@ trait APIMethods200 {
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|""",
|
||||
emptyObjectJson,
|
||||
BasicAccountJSON(
|
||||
id = "8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0",
|
||||
label = "NoneLabel",
|
||||
bank_id = "gh.29.uk",
|
||||
views_available = List(basicViewJSON)
|
||||
),
|
||||
basicAccountsJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagPrivateData, apiTagPublicData))
|
||||
@ -188,7 +183,7 @@ trait APIMethods200 {
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
coreAccountsJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagAccount, apiTagPrivateData))
|
||||
@ -231,7 +226,7 @@ trait APIMethods200 {
|
||||
|${authenticationRequiredMessage(false)}
|
||||
|""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
basicAccountsJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagPublicData))
|
||||
@ -271,8 +266,8 @@ trait APIMethods200 {
|
||||
|${authenticationRequiredMessage(false)}
|
||||
""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
basicAccountsJSON,
|
||||
List(BankNotFound, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagPrivateData, apiTagPublicData)
|
||||
)
|
||||
@ -319,7 +314,7 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
coreAccountsJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagAccount, apiTagPrivateData))
|
||||
@ -384,8 +379,8 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
basicAccountsJSON,
|
||||
List(UserNotLoggedIn, BankNotFound, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
apiTagAccount :: Nil)
|
||||
|
||||
@ -419,7 +414,7 @@ trait APIMethods200 {
|
||||
|
|
||||
|Authentication via OAuth is not required.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
basicAccountsJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount, apiTagPublicData))
|
||||
@ -449,7 +444,7 @@ trait APIMethods200 {
|
||||
|Passport, driving licence etc.
|
||||
|${authenticationRequiredMessage(false)}""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
kycDocumentsJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer, apiTagKyc))
|
||||
@ -481,7 +476,7 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
kycMediasJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer, apiTagKyc))
|
||||
@ -513,7 +508,7 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
kycChecksJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer, apiTagKyc))
|
||||
@ -543,7 +538,7 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
kycStatusesJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer, apiTagKyc))
|
||||
@ -574,7 +569,7 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
socialMediasJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer, apiTagKyc))
|
||||
@ -608,7 +603,7 @@ trait APIMethods200 {
|
||||
"Add KYC Document.",
|
||||
"Add a KYC document for the customer specified by CUSTOMER_ID. KYC Documents contain the document type (e.g. passport), place of issue, expiry etc. ",
|
||||
PostKycDocumentJSON("1234", "passport", "123567", exampleDate, "London", exampleDate),
|
||||
emptyObjectJson,
|
||||
kycDocumentJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer, apiTagKyc)
|
||||
@ -662,7 +657,7 @@ trait APIMethods200 {
|
||||
"wuwjfuha234678",
|
||||
"98FRd987auhf87jab"
|
||||
),
|
||||
emptyObjectJson,
|
||||
kycMediaJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer, apiTagKyc)
|
||||
@ -705,7 +700,7 @@ trait APIMethods200 {
|
||||
"Add KYC Check",
|
||||
"Add a KYC check for the customer specified by CUSTOMER_ID. KYC Checks store details of checks on a customer made by the KYC team, their comments and a satisfied status.",
|
||||
PostKycCheckJSON("1239879", exampleDate, "online_meeting", "67876", "Simon Redfern", true, ""),
|
||||
emptyObjectJson,
|
||||
kycCheckJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer, apiTagKyc)
|
||||
@ -749,7 +744,7 @@ trait APIMethods200 {
|
||||
"Add KYC Status",
|
||||
"Add a kyc_status for the customer specified by CUSTOMER_ID. KYC Status is a timeline of the KYC status of the customer",
|
||||
PostKycStatusJSON("8762893876", true, exampleDate),
|
||||
emptyObjectJson,
|
||||
kycStatusJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer, apiTagKyc)
|
||||
@ -787,8 +782,8 @@ trait APIMethods200 {
|
||||
"/banks/BANK_ID/customers/CUSTOMER_ID/social_media_handles",
|
||||
"Add Social Media Handle",
|
||||
"Add a social media handle for the customer specified by CUSTOMER_ID.",
|
||||
SocialMediaJSON("8762893876", "twitter", "susan@example.com", exampleDate, exampleDate),
|
||||
emptyObjectJson,
|
||||
socialMediaJSON,
|
||||
successMessage,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer)
|
||||
@ -814,7 +809,7 @@ trait APIMethods200 {
|
||||
postedData.date_activated),
|
||||
"Server error: could not add")
|
||||
} yield {
|
||||
successJsonResponse(JsRaw("""{"success":"Success"}"""), 201)
|
||||
successJsonResponse(Extraction.decompose(successMessage), 201)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -840,8 +835,8 @@ trait APIMethods200 {
|
||||
|
|
||||
|OAuth authentication is required""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
moderatedCoreAccountJSON,
|
||||
List(BankAccountNotFound,UnKnownError),
|
||||
Catalogs(Core, PSD2, notOBWG),
|
||||
apiTagAccount :: Nil)
|
||||
|
||||
@ -853,7 +848,7 @@ trait APIMethods200 {
|
||||
// TODO return specific error if bankId == "BANK_ID" or accountID == "ACCOUNT_ID"
|
||||
// Should be a generic guard we can use for all calls (also for userId etc.)
|
||||
for {
|
||||
account <- BankAccount(bankId, accountId)
|
||||
account <- BankAccount(bankId, accountId) ?~! BankAccountNotFound
|
||||
availableviews <- Full(account.permittedViews(user))
|
||||
// Assume owner view was requested
|
||||
view <- View.fromUrl( ViewId("owner"), account)
|
||||
@ -891,8 +886,8 @@ trait APIMethods200 {
|
||||
|
|
||||
|**Date format parameter**: "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" (2014-07-01T00:00:00.000Z) ==> time zone is UTC.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
moderatedCoreAccountJSON,
|
||||
List(BankAccountNotFound, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagAccount, apiTagTransaction))
|
||||
|
||||
@ -905,7 +900,7 @@ trait APIMethods200 {
|
||||
|
||||
for {
|
||||
params <- APIMethods121.getTransactionParams(json)
|
||||
bankAccount <- BankAccount(bankId, accountId)
|
||||
bankAccount <- BankAccount(bankId, accountId) ?~! BankAccountNotFound
|
||||
// Assume owner view was requested
|
||||
view <- View.fromUrl( ViewId("owner"), bankAccount)
|
||||
transactions <- bankAccount.getModeratedTransactions(user, view, params : _*)
|
||||
@ -943,8 +938,8 @@ trait APIMethods200 {
|
||||
|OAuth authentication is required if the 'is_public' field in view (VIEW_ID) is not set to `true`.
|
||||
|""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
moderatedAccountJSON,
|
||||
List(BankNotFound,AccountNotFound,ViewNotFound, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
apiTagAccount :: Nil)
|
||||
|
||||
@ -967,10 +962,6 @@ trait APIMethods200 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////
|
||||
|
||||
|
||||
resourceDocs += ResourceDoc(
|
||||
getPermissionsForBankAccount,
|
||||
apiVersion,
|
||||
@ -982,8 +973,8 @@ trait APIMethods200 {
|
||||
|
|
||||
|OAuth authentication is required and the user needs to have access to the owner view.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
permissionsJSON,
|
||||
List(UserNotLoggedIn, BankNotFound, AccountNotFound ,UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagPerson, apiTagUser, apiTagAccount, apiTagView, apiTagEntitlement)
|
||||
)
|
||||
@ -1016,8 +1007,8 @@ trait APIMethods200 {
|
||||
|
|
||||
|OAuth authentication is required and the user needs to have access to the owner view.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
viewsJSONV121,
|
||||
List(UserNotLoggedIn,BankNotFound, AccountNotFound,UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagPerson, apiTagUser, apiTagAccount, apiTagView, apiTagEntitlement))
|
||||
|
||||
@ -1056,8 +1047,20 @@ trait APIMethods200 {
|
||||
|
|
||||
|Note: The Amount must be zero.""".stripMargin,
|
||||
CreateAccountJSON("A user_id","CURRENT", "Label", AmountOfMoneyJSON121("EUR", "0")),
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
coreAccountJSON,
|
||||
List(
|
||||
UserNotLoggedIn,
|
||||
InvalidJsonFormat,
|
||||
InvalidUserId,
|
||||
InvalidAccountIdFormat,
|
||||
InvalidBankIdFormat,
|
||||
UserNotFoundById,
|
||||
InvalidAccountBalanceAmount,
|
||||
InvalidAccountType,
|
||||
InvalidAccountInitialBalance,
|
||||
InvalidAccountBalanceCurrency,
|
||||
UnKnownError
|
||||
),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagAccount)
|
||||
)
|
||||
@ -1140,7 +1143,7 @@ trait APIMethods200 {
|
||||
|
|
||||
|${authenticationRequiredMessage(!getTransactionTypesIsPublic)}""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
transactionTypesJsonV200,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, PSD2, notOBWG),
|
||||
List(apiTagBank)
|
||||
@ -1283,7 +1286,7 @@ trait APIMethods200 {
|
||||
"Answer Transaction Request Challenge.",
|
||||
"In Sandbox mode, any string that can be converted to a positive integer will be accepted as an answer.",
|
||||
ChallengeAnswerJSON("89123812", "123345"),
|
||||
emptyObjectJson,
|
||||
transactionRequestWithChargeJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagTransactionRequest))
|
||||
@ -1368,7 +1371,7 @@ trait APIMethods200 {
|
||||
|
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
transactionRequestWithChargesJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagTransactionRequest))
|
||||
@ -1416,7 +1419,7 @@ trait APIMethods200 {
|
||||
|
|
||||
|""",
|
||||
CreateUserJson("someone@example.com", "my-username", "my-secure-password", "James", "Brown"),
|
||||
emptyObjectJson,
|
||||
userJSONV200,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, notPSD2, notOBWG),
|
||||
List(apiTagOnboarding, apiTagUser))
|
||||
@ -1483,7 +1486,7 @@ trait APIMethods200 {
|
||||
|This call is **experimental**. Currently staff_user_id is not set. Further calls will be needed to correctly set this.
|
||||
""".stripMargin,
|
||||
CreateMeetingJson("tokbox", "onboarding"),
|
||||
emptyObjectJson,
|
||||
meetingJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMeeting, apiTagKyc, apiTagCustomer, apiTagUser, apiTagExperimental))
|
||||
@ -1534,7 +1537,7 @@ trait APIMethods200 {
|
||||
|This call is **experimental** and will require further authorisation in the future.
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
meetingsJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMeeting, apiTagKyc, apiTagCustomer, apiTagUser, apiTagExperimental))
|
||||
@ -1584,7 +1587,7 @@ trait APIMethods200 {
|
||||
|This call is **experimental** and will require further authorisation in the future.
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
meetingJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagMeeting, apiTagKyc, apiTagCustomer, apiTagUser, apiTagExperimental))
|
||||
@ -1613,9 +1616,6 @@ trait APIMethods200 {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
resourceDocs += ResourceDoc(
|
||||
createCustomer,
|
||||
@ -1631,11 +1631,16 @@ trait APIMethods200 {
|
||||
|Dates need to be in the format 2013-01-21T23:08:00Z
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|""",
|
||||
CreateCustomerJson("user_id to attach this customer to e.g. 123213", "new customer number 687687678", "Joe David Bloggs",
|
||||
"+44 07972 444 876", "person@example.com", CustomerFaceImageJson("www.example.com/person/123/image.png", exampleDate),
|
||||
exampleDate, "Single", 1, List(exampleDate), "Bachelor’s Degree", "Employed", true, exampleDate),
|
||||
emptyObjectJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
createCustomerJson,
|
||||
customerJsonV140,
|
||||
List(
|
||||
InvalidBankIdFormat,
|
||||
UserNotLoggedIn,
|
||||
BankNotFound,
|
||||
CustomerNumberAlreadyExists,
|
||||
UserNotFoundById,
|
||||
UnKnownError
|
||||
),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagPerson, apiTagCustomer))
|
||||
|
||||
@ -1651,7 +1656,7 @@ trait APIMethods200 {
|
||||
case "banks" :: BankId(bankId) :: "customers" :: Nil JsonPost json -> _ => {
|
||||
user =>
|
||||
for {
|
||||
u <- user ?~! "User must be logged in to post Customer" // TODO. CHECK user has role to create a customer / create a customer for another user id.
|
||||
u <- user ?~! UserNotLoggedIn// TODO. CHECK user has role to create a customer / create a customer for another user id.
|
||||
isValidBankIdFormat <- tryo(assert(isValidID(bankId.value)))?~! ErrorMessages.InvalidBankIdFormat
|
||||
bank <- Bank(bankId) ?~! {ErrorMessages.BankNotFound}
|
||||
postedData <- tryo{json.extract[CreateCustomerJson]} ?~! ErrorMessages.InvalidJsonFormat
|
||||
@ -1703,7 +1708,7 @@ trait APIMethods200 {
|
||||
|Login is required.
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
userJSONV200,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, notPSD2, notOBWG),
|
||||
List(apiTagPerson, apiTagUser))
|
||||
@ -1738,7 +1743,7 @@ trait APIMethods200 {
|
||||
|
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
usersJSONV200,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, notPSD2, notOBWG),
|
||||
List(apiTagPerson, apiTagUser))
|
||||
@ -1774,8 +1779,8 @@ trait APIMethods200 {
|
||||
|For now the authenticated user can create at most one linked customer at any one bank.
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|""",
|
||||
CreateUserCustomerLinkJson("be106783-b4fa-48e6-b102-b178a11a8e9b", "02141bc6-0a69-4fba-b4db-a17e5fbbbdcc"),
|
||||
emptyObjectJson,
|
||||
createUserCustomerLinkJson,
|
||||
userCustomerLinkJson,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagPerson, apiTagUser, apiTagCustomer))
|
||||
@ -1822,8 +1827,8 @@ trait APIMethods200 {
|
||||
|For a Bank level Role (e.g. CanCreateAccount), set bank_id to a valid value e.g. "bank_id":"my-bank-id"
|
||||
|
|
||||
|Authentication is required and the user needs to be a Super Admin. Super Admins are listed in the Props file.""",
|
||||
CreateEntitlementJSON("obp-bank-x-gh", "CanQueryOtherUser"),
|
||||
emptyObjectJson,
|
||||
code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.createEntitlementJSON,
|
||||
entitlementJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagUser))
|
||||
@ -1868,7 +1873,7 @@ trait APIMethods200 {
|
||||
|
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
entitlementJSONs,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, notPSD2, notOBWG),
|
||||
List(apiTagUser, apiTagEntitlement))
|
||||
@ -1947,7 +1952,7 @@ trait APIMethods200 {
|
||||
|
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
entitlementJSONs,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(Core, notPSD2, notOBWG),
|
||||
List(apiTagUser, apiTagEntitlement))
|
||||
@ -2042,7 +2047,7 @@ trait APIMethods200 {
|
||||
|
|
||||
""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
emptyObjectJson, //TODO what is output here?
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List())
|
||||
@ -2160,7 +2165,7 @@ trait APIMethods200 {
|
||||
|
|
||||
|Authentication via OAuth is required.""",
|
||||
emptyObjectJson,
|
||||
emptyObjectJson,
|
||||
customersJsonV140,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagPerson, apiTagCustomer))
|
||||
@ -2179,18 +2184,7 @@ trait APIMethods200 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
object APIMethods200 {
|
||||
|
||||
@ -159,6 +159,8 @@ case class CoreAccountJSON(
|
||||
_links: JValue
|
||||
)
|
||||
|
||||
case class CoreAccountsJSON( accounts: List[CoreAccountJSON])
|
||||
|
||||
case class PostKycDocumentJSON(
|
||||
customer_number: String,
|
||||
`type`: String,
|
||||
|
||||
@ -120,7 +120,7 @@ trait APIMethods210 {
|
||||
importData <- tryo {json.extract[SandboxDataImport]} ?~! {ErrorMessages.InvalidJsonFormat}
|
||||
importWorked <- OBPDataImport.importer.vend.importData(importData)
|
||||
} yield {
|
||||
successJsonResponse(JsRaw("""{"success":"Success"}"""), 201)
|
||||
successJsonResponse(Extraction.decompose(successMessage), 201)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -290,7 +290,24 @@ trait APIMethods210 {
|
||||
""".stripMargin,
|
||||
transactionRequestBodySEPAJSON,
|
||||
transactionRequestWithChargeJSON210,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
List(
|
||||
UserNotLoggedIn,
|
||||
UserNotLoggedIn,
|
||||
InvalidBankIdFormat,
|
||||
InvalidAccountIdFormat,
|
||||
InvalidJsonFormat,
|
||||
BankNotFound,
|
||||
AccountNotFound,
|
||||
ViewNotFound,
|
||||
InsufficientAuthorisationToCreateTransactionRequest,
|
||||
UserNoPermissionAccessView,
|
||||
InvalidTransactionRequestType,
|
||||
InvalidJsonFormat,
|
||||
InvalidNumber,
|
||||
NotPositiveAmount,
|
||||
InvalidTransactionRequestCurrency,
|
||||
UnKnownError
|
||||
),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagTransactionRequest))
|
||||
|
||||
@ -473,8 +490,20 @@ trait APIMethods210 {
|
||||
"Answer Transaction Request Challenge.",
|
||||
"In Sandbox mode, any string that can be converted to a positive integer will be accepted as an answer.",
|
||||
challengeAnswerJSON,
|
||||
transactionRequestWithChargeJSON,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
transactionRequestWithChargeJson,
|
||||
List(
|
||||
UserNotLoggedIn,
|
||||
InvalidBankIdFormat,
|
||||
InvalidAccountIdFormat,
|
||||
InvalidJsonFormat,
|
||||
BankNotFound,
|
||||
UserNoPermissionAccessView,
|
||||
TransactionRequestStatusNotInitiated,
|
||||
TransactionRequestTypeHasChanged,
|
||||
InvalidTransactionRequesChallengeId,
|
||||
AllowedAttemptsUsedUp,
|
||||
UnKnownError
|
||||
),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagTransactionRequest))
|
||||
|
||||
@ -519,10 +548,10 @@ trait APIMethods210 {
|
||||
isSameChallengeId <- booleanToBox(existingTransactionRequest.challenge.id.equals(challengeAnswerJson.id),{ErrorMessages.InvalidTransactionRequesChallengeId})
|
||||
|
||||
//Check the allowed attemps, Note: not support yet, the default value is 3
|
||||
allowedAttempsOK <- booleanToBox((existingTransactionRequest.challenge.allowed_attempts > 0),ErrorMessages.allowedAttemptsUsedUp)
|
||||
allowedAttempsOK <- booleanToBox((existingTransactionRequest.challenge.allowed_attempts > 0),ErrorMessages.AllowedAttemptsUsedUp)
|
||||
|
||||
//Check the challenge type, Note: not support yet, the default value is SANDBOX_TAN
|
||||
challengeTypeOK <- booleanToBox((existingTransactionRequest.challenge.challenge_type == TransactionRequests.CHALLENGE_SANDBOX_TAN),ErrorMessages.allowedAttemptsUsedUp)
|
||||
challengeTypeOK <- booleanToBox((existingTransactionRequest.challenge.challenge_type == TransactionRequests.CHALLENGE_SANDBOX_TAN),ErrorMessages.AllowedAttemptsUsedUp)
|
||||
|
||||
challengeAnswerOk <- Connector.connector.vend.validateChallengeAnswer(challengeAnswerJson.id, challengeAnswerJson.answer)
|
||||
|
||||
@ -572,7 +601,7 @@ trait APIMethods210 {
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
transactionRequestWithChargeJSONs210,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
List(UserNotLoggedIn,BankNotFound,AccountNotFound, UnKnownError),
|
||||
Catalogs(Core, PSD2, OBWG),
|
||||
List(apiTagTransactionRequest))
|
||||
|
||||
@ -1153,7 +1182,17 @@ trait APIMethods210 {
|
||||
|""",
|
||||
postCounterpartyJSON,
|
||||
counterpartyJsonV220,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
List(
|
||||
UserNotLoggedIn,
|
||||
InvalidAccountIdFormat,
|
||||
InvalidBankIdFormat,
|
||||
BankNotFound,
|
||||
AccountNotFound,
|
||||
InvalidJsonFormat,
|
||||
ViewNotFound,
|
||||
CounterpartyAlreadyExists,
|
||||
UnKnownError
|
||||
),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List())
|
||||
|
||||
@ -1311,7 +1350,7 @@ trait APIMethods210 {
|
||||
|Authentication via OAuth is required.""",
|
||||
emptyObjectJson,
|
||||
customerJsonV210,
|
||||
List(UserNotLoggedIn, UnKnownError),
|
||||
List(UserNotLoggedIn, BankNotFound, CustomerDoNotExistsForUser, CustomerDoNotExistsForUser, CustomerNotFoundByCustomerId, UnKnownError),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
List(apiTagCustomer))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user