mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 15:27:01 +00:00
Merge pull request #2136 from constantine2nd/develop
docfix/Customer Overview Endpoints
This commit is contained in:
commit
c3721e6c48
@ -1,6 +1,7 @@
|
||||
package code.api.ResourceDocs1_4_0
|
||||
|
||||
import java.util.Date
|
||||
|
||||
import code.api.Constant._
|
||||
import code.api.Constant
|
||||
import code.api.UKOpenBanking.v2_0_0.JSONFactory_UKOpenBanking_200
|
||||
@ -18,7 +19,7 @@ import code.api.v3_0_0.{LobbyJsonV330, _}
|
||||
import code.api.v3_1_0.{AccountBalanceV310, AccountsBalancesV310Json, BadLoginStatusJson, ContactDetailsJson, CustomerWithAttributesJsonV310, InviteeJson, ObpApiLoopbackJson, PhysicalCardWithAttributesJsonV310, PutUpdateCustomerEmailJsonV310, _}
|
||||
import code.api.v4_0_0.{AccountMinimalJson400, BankAttributeBankResponseJsonV400, CardJsonV400, CustomerMinimalJsonV400, FastFirehoseAccountsJsonV400, PostHistoricalTransactionAtBankJson, _}
|
||||
import code.api.v3_1_0.{AccountBalanceV310, AccountsBalancesV310Json, BadLoginStatusJson, ContactDetailsJson, InviteeJson, ObpApiLoopbackJson, PhysicalCardWithAttributesJsonV310, PutUpdateCustomerEmailJsonV310, _}
|
||||
import code.api.v5_0_0._
|
||||
import code.api.v5_0_0.{AccountResponseJson500, CustomerOverviewFlatJsonV500, _}
|
||||
import code.branches.Branches.{Branch, DriveUpString, LobbyString}
|
||||
import code.consent.ConsentStatus
|
||||
import code.connectormethod.{JsonConnectorMethod, JsonConnectorMethodMethodBody}
|
||||
@ -33,8 +34,8 @@ import com.openbankproject.commons.model.enums.{AttributeCategory, CardAttribute
|
||||
import com.openbankproject.commons.model.{UserAuthContextUpdateStatus, ViewBasic, _}
|
||||
import com.openbankproject.commons.util.{ApiVersion, FieldNameApiVersions, ReflectUtils, RequiredArgs, RequiredInfo}
|
||||
import net.liftweb.json
|
||||
|
||||
import java.net.URLEncoder
|
||||
|
||||
import code.endpointMapping.EndpointMappingCommons
|
||||
|
||||
import scala.collection.immutable.List
|
||||
@ -2282,6 +2283,78 @@ object SwaggerDefinitionsJSON {
|
||||
`type` = customerAttributeTypeExample.value,
|
||||
value = customerAttributeValueExample.value
|
||||
)
|
||||
|
||||
val accountAttributeResponseJson500 = AccountAttributeResponseJson500(
|
||||
product_code = productCodeExample.value,
|
||||
account_attribute_id = "613c83ea-80f9-4560-8404-b9cd4ec42a7f",
|
||||
name = "OVERDRAFT_START_DATE",
|
||||
`type` = "DATE_WITH_DAY",
|
||||
value = "2012-04-23",
|
||||
contract_code = Some("LKJL98769F"),
|
||||
)
|
||||
|
||||
val customerOverviewFlatJsonV500 = CustomerOverviewFlatJsonV500(
|
||||
bank_id = bankIdExample.value,
|
||||
customer_id = ExampleValue.customerIdExample.value,
|
||||
customer_number = ExampleValue.customerNumberExample.value,
|
||||
legal_name = ExampleValue.legalNameExample.value,
|
||||
mobile_phone_number = ExampleValue.mobileNumberExample.value,
|
||||
email = ExampleValue.emailExample.value,
|
||||
date_of_birth = DateWithDayExampleObject,
|
||||
title = ExampleValue.titleExample.value,
|
||||
branch_id = ExampleValue.branchIdExample.value,
|
||||
name_suffix = ExampleValue.nameSuffixExample.value,
|
||||
customer_attributes = List(customerAttributeResponseJson),
|
||||
accounts = List(
|
||||
AccountResponseJson500(
|
||||
account_id = accountIdExample.value,
|
||||
label = labelExample.value,
|
||||
product_code = parentProductCodeExample.value,
|
||||
balance = amountOfMoneyJsonV121,
|
||||
branch_id = branchIdExample.value,
|
||||
contracts = Some(List(
|
||||
ContractJsonV500(product_code = parentProductCodeExample.value, contract_code = "LKJL98769F", payment_method = Some("cache")))
|
||||
),
|
||||
account_routings = List(accountRoutingJsonV121),
|
||||
account_attributes = List(accountAttributeResponseJson500)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
val accountResponseJson500 = AccountResponseJson500(
|
||||
account_id = accountIdExample.value,
|
||||
label = labelExample.value,
|
||||
product_code = parentProductCodeExample.value,
|
||||
balance = amountOfMoneyJsonV121,
|
||||
branch_id = branchIdExample.value,
|
||||
contracts = None,
|
||||
account_routings = List(accountRoutingJsonV121),
|
||||
account_attributes = List(accountAttributeResponseJson500)
|
||||
)
|
||||
val customerOverviewJsonV500 = CustomerOverviewJsonV500(
|
||||
bank_id = bankIdExample.value,
|
||||
customer_id = ExampleValue.customerIdExample.value,
|
||||
customer_number = ExampleValue.customerNumberExample.value,
|
||||
legal_name = ExampleValue.legalNameExample.value,
|
||||
mobile_phone_number = ExampleValue.mobileNumberExample.value,
|
||||
email = ExampleValue.emailExample.value,
|
||||
face_image = customerFaceImageJson,
|
||||
date_of_birth = DateWithDayExampleObject,
|
||||
relationship_status = ExampleValue.relationshipStatusExample.value,
|
||||
dependants = ExampleValue.dependentsExample.value.toInt,
|
||||
dob_of_dependants = List(DateWithDayExampleObject),
|
||||
credit_rating = Option(customerCreditRatingJSON),
|
||||
credit_limit = Option(amountOfMoneyJsonV121),
|
||||
highest_education_attained = ExampleValue.highestEducationAttainedExample.value,
|
||||
employment_status = ExampleValue.employmentStatusExample.value,
|
||||
kyc_status = ExampleValue.kycStatusExample.value.toBoolean,
|
||||
last_ok_date = oneYearAgoDate,
|
||||
title = ExampleValue.titleExample.value,
|
||||
branch_id = ExampleValue.branchIdExample.value,
|
||||
name_suffix = ExampleValue.nameSuffixExample.value,
|
||||
customer_attributes = List(customerAttributeResponseJson),
|
||||
accounts = List(accountResponseJson500)
|
||||
)
|
||||
|
||||
val customerWithAttributesJsonV310 = CustomerWithAttributesJsonV310(
|
||||
bank_id = bankIdExample.value,
|
||||
|
||||
@ -1033,7 +1033,7 @@ trait APIMethods500 {
|
||||
|
|
||||
|""",
|
||||
postCustomerOverviewJsonV500,
|
||||
customerWithAttributesJsonV310,
|
||||
customerOverviewJsonV500,
|
||||
List(
|
||||
UserNotLoggedIn,
|
||||
UserCustomerLinksNotFoundForUser,
|
||||
@ -1086,7 +1086,7 @@ trait APIMethods500 {
|
||||
|
|
||||
|""",
|
||||
postCustomerOverviewJsonV500,
|
||||
customerWithAttributesJsonV310,
|
||||
customerOverviewFlatJsonV500,
|
||||
List(
|
||||
UserNotLoggedIn,
|
||||
UserCustomerLinksNotFoundForUser,
|
||||
|
||||
@ -97,7 +97,7 @@ case class PostCustomerJsonV500(
|
||||
|
||||
case class PostCustomerOverviewJsonV500(customer_number: String)
|
||||
|
||||
case class CustomerWithAttributesJsonV500(
|
||||
case class CustomerOverviewJsonV500(
|
||||
bank_id: String,
|
||||
customer_id: String,
|
||||
customer_number : String,
|
||||
@ -146,21 +146,21 @@ case class AccountAttributeResponseJson500(
|
||||
|
||||
case class ContractJsonV500(product_code: String,
|
||||
contract_code: String,
|
||||
product_description: Option[String],
|
||||
issuance_amount: Option[String],
|
||||
interest_rate: Option[String],
|
||||
term: Option[String],
|
||||
form_of_payment: Option[String],
|
||||
interest_amount: Option[String],
|
||||
branch_code: Option[String],
|
||||
payment_method: Option[String],
|
||||
opening_date: Option[String],
|
||||
maturity_date: Option[String],
|
||||
renewal_date: Option[String],
|
||||
cancellation_date: Option[String],
|
||||
instrument_status_code: Option[String],
|
||||
instrument_status_definition: Option[String],
|
||||
is_substituted: Option[String]
|
||||
product_description: Option[String] = None,
|
||||
issuance_amount: Option[String] = None,
|
||||
interest_rate: Option[String] = None,
|
||||
term: Option[String] = None,
|
||||
form_of_payment: Option[String] = None,
|
||||
interest_amount: Option[String] = None,
|
||||
branch_code: Option[String] = None,
|
||||
payment_method: Option[String] = None,
|
||||
opening_date: Option[String] = None,
|
||||
maturity_date: Option[String] = None,
|
||||
renewal_date: Option[String] = None,
|
||||
cancellation_date: Option[String] = None,
|
||||
instrument_status_code: Option[String] = None,
|
||||
instrument_status_definition: Option[String] = None,
|
||||
is_substituted: Option[String] = None
|
||||
)
|
||||
case class AccountResponseJson500(account_id: String,
|
||||
label: String,
|
||||
@ -168,7 +168,7 @@ case class AccountResponseJson500(account_id: String,
|
||||
balance : AmountOfMoneyJsonV121,
|
||||
branch_id: String,
|
||||
contracts: Option[List[ContractJsonV500]] = None,
|
||||
account_routings: List[AccountRouting],
|
||||
account_routings: List[AccountRoutingJsonV121],
|
||||
account_attributes: List[AccountAttributeResponseJson500]
|
||||
)
|
||||
|
||||
@ -403,8 +403,8 @@ object JSONFactory500 {
|
||||
|
||||
def createCustomerWithAttributesJson(cInfo : Customer,
|
||||
customerAttributes: List[CustomerAttribute],
|
||||
accounts: List[(BankAccount, List[AccountAttribute])]) : CustomerWithAttributesJsonV500 = {
|
||||
CustomerWithAttributesJsonV500(
|
||||
accounts: List[(BankAccount, List[AccountAttribute])]) : CustomerOverviewJsonV500 = {
|
||||
CustomerOverviewJsonV500(
|
||||
bank_id = cInfo.bankId.toString,
|
||||
customer_id = cInfo.customerId,
|
||||
customer_number = cInfo.number,
|
||||
@ -487,7 +487,7 @@ object JSONFactory500 {
|
||||
balance = AmountOfMoneyJsonV121(account._1.balance.toString(), account._1.currency),
|
||||
branch_id = account._1.branchId,
|
||||
contracts = createContracts(account._2),
|
||||
account_routings = account._1.accountRoutings,
|
||||
account_routings = account._1.accountRoutings.map(i => AccountRoutingJsonV121(scheme = i.scheme, address = i.address)),
|
||||
account_attributes = account._2.map{ attribute =>
|
||||
AccountAttributeResponseJson500(
|
||||
contract_code = attribute.productInstanceCode,
|
||||
|
||||
@ -112,7 +112,7 @@ class CustomerOverviewTest extends V500ServerSetup {
|
||||
val response = makePostRequest(request, write(PostCustomerOverviewJsonV500(customer.customer_number)))
|
||||
Then("We should get a 200")
|
||||
response.code should equal(200)
|
||||
val infoPost = response.body.extract[CustomerWithAttributesJsonV500]
|
||||
val infoPost = response.body.extract[CustomerOverviewJsonV500]
|
||||
infoPost.legal_name should equal(legalName)
|
||||
infoPost.mobile_phone_number should equal(mobileNumber)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user