mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 13:07:02 +00:00
Merge pull request #2499 from hongwei1/develop
refactor/removed helper_info in create consent endpoints.
This commit is contained in:
commit
1d36591c1a
@ -4238,7 +4238,7 @@ object SwaggerDefinitionsJSON {
|
||||
|
||||
val postConsentEmailJsonV310 = PostConsentEmailJsonV310(
|
||||
everything = false,
|
||||
views = List(PostConsentViewJsonV310(bankIdExample.value, accountIdExample.value, viewIdExample.value, None)),
|
||||
views = List(PostConsentViewJsonV310(bankIdExample.value, accountIdExample.value, viewIdExample.value)),
|
||||
entitlements = List(PostConsentEntitlementJsonV310(bankIdExample.value, "CanGetCustomer")),
|
||||
consumer_id = Some(consumerIdExample.value),
|
||||
email = emailExample.value,
|
||||
@ -4248,7 +4248,7 @@ object SwaggerDefinitionsJSON {
|
||||
|
||||
val postConsentPhoneJsonV310 = PostConsentPhoneJsonV310(
|
||||
everything = false,
|
||||
views = List(PostConsentViewJsonV310(bankIdExample.value, accountIdExample.value, viewIdExample.value, None)),
|
||||
views = List(PostConsentViewJsonV310(bankIdExample.value, accountIdExample.value, viewIdExample.value)),
|
||||
entitlements = List(PostConsentEntitlementJsonV310(bankIdExample.value, "CanGetCustomer")),
|
||||
consumer_id = Some(consumerIdExample.value),
|
||||
phone_number = mobileNumberExample.value,
|
||||
@ -4258,7 +4258,7 @@ object SwaggerDefinitionsJSON {
|
||||
|
||||
val postConsentImplicitJsonV310 = PostConsentImplicitJsonV310(
|
||||
everything = false,
|
||||
views = List(PostConsentViewJsonV310(bankIdExample.value, accountIdExample.value, viewIdExample.value, None)),
|
||||
views = List(PostConsentViewJsonV310(bankIdExample.value, accountIdExample.value, viewIdExample.value)),
|
||||
entitlements = List(PostConsentEntitlementJsonV310(bankIdExample.value, "CanGetCustomer")),
|
||||
consumer_id = Some(consumerIdExample.value),
|
||||
valid_from = Some(new Date()),
|
||||
|
||||
@ -73,7 +73,7 @@ case class Role(role_name: String,
|
||||
case class ConsentView(bank_id: String,
|
||||
account_id: String,
|
||||
view_id : String,
|
||||
helper_info: Option[HelperInfoJson]
|
||||
helper_info: Option[HelperInfoJson]//this is only for VRP consent.
|
||||
)
|
||||
|
||||
case class Consent(createdByUserId: String,
|
||||
@ -596,7 +596,7 @@ object Consent extends MdcLoggable {
|
||||
consumerId: Option[String],
|
||||
validFrom: Option[Date],
|
||||
timeToLive: Long,
|
||||
helperInfo: Option[HelperInfoJson]
|
||||
helperInfo: Option[HelperInfoJson] //this is only used for VRP consent, all the others are NONE.
|
||||
): String = {
|
||||
|
||||
lazy val currentConsumerId = Consumer.findAll(By(Consumer.createdByUserId, user.userId)).map(_.consumerId.get).headOption.getOrElse("")
|
||||
@ -625,7 +625,7 @@ object Consent extends MdcLoggable {
|
||||
val viewsToAdd: Seq[ConsentView] =
|
||||
for {
|
||||
view <- views
|
||||
if consent.everything || consent.views.exists(_ == PostConsentViewJsonV310(view.bankId.value,view.accountId.value, view.viewId.value, helperInfo))
|
||||
if consent.everything || consent.views.exists(_ == PostConsentViewJsonV310(view.bankId.value,view.accountId.value, view.viewId.value))
|
||||
} yield {
|
||||
ConsentView(
|
||||
bank_id = view.bankId.value,
|
||||
|
||||
@ -518,7 +518,7 @@ case class MeetingsJsonV310(
|
||||
meetings: List[MeetingJsonV310]
|
||||
)
|
||||
case class PostConsentEntitlementJsonV310(bank_id: String, role_name: String)
|
||||
case class PostConsentViewJsonV310(bank_id: String, account_id: String, view_id: String, helper_info: Option[HelperInfoJson])
|
||||
case class PostConsentViewJsonV310(bank_id: String, account_id: String, view_id: String)
|
||||
trait PostConsentCommonBody{
|
||||
val everything: Boolean
|
||||
val views: List[PostConsentViewJsonV310]
|
||||
|
||||
@ -1154,25 +1154,23 @@ trait APIMethods500 {
|
||||
)
|
||||
}
|
||||
postConsentViewJsons <- if(isVrpConsent) {
|
||||
Future.successful(List(PostConsentViewJsonV310(
|
||||
bankId.value,
|
||||
accountId.value,
|
||||
viewId.value,
|
||||
Some(HelperInfoJson(List(counterpartyId.value)))
|
||||
)))
|
||||
}else{
|
||||
Future.sequence(
|
||||
consentRequestJson.account_access.map(
|
||||
access =>
|
||||
NewStyle.function.getBankAccountByRouting(consentRequestJson.bank_id.map(BankId(_)),access.account_routing.scheme, access.account_routing.address, cc.callContext)
|
||||
.map(result =>PostConsentViewJsonV310(
|
||||
result._1.bankId.value,
|
||||
result._1.accountId.value,
|
||||
access.view_id,
|
||||
None,
|
||||
))
|
||||
Future.successful(List(PostConsentViewJsonV310(
|
||||
bankId.value,
|
||||
accountId.value,
|
||||
viewId.value
|
||||
)))
|
||||
}else{
|
||||
Future.sequence(
|
||||
consentRequestJson.account_access.map(
|
||||
access =>
|
||||
NewStyle.function.getBankAccountByRouting(consentRequestJson.bank_id.map(BankId(_)),access.account_routing.scheme, access.account_routing.address, cc.callContext)
|
||||
.map(result =>PostConsentViewJsonV310(
|
||||
result._1.bankId.value,
|
||||
result._1.accountId.value,
|
||||
access.view_id
|
||||
))
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
(_, assignedViews) <- Future(Views.views.vend.privateViewsUserCanAccess(user))
|
||||
|
||||
Binary file not shown.
@ -60,7 +60,7 @@ class ConsentTest extends V310ServerSetup {
|
||||
lazy val bankId = randomBankId
|
||||
lazy val bankAccount = randomPrivateAccount(bankId)
|
||||
lazy val entitlements = List(PostConsentEntitlementJsonV310("", CanGetAnyUser.toString()))
|
||||
lazy val views = List(PostConsentViewJsonV310(bankId, bankAccount.id, Constant.SYSTEM_OWNER_VIEW_ID, None))
|
||||
lazy val views = List(PostConsentViewJsonV310(bankId, bankAccount.id, Constant.SYSTEM_OWNER_VIEW_ID))
|
||||
lazy val postConsentEmailJsonV310 = SwaggerDefinitionsJSON.postConsentEmailJsonV310
|
||||
.copy(entitlements=entitlements)
|
||||
.copy(consumer_id=Some(testConsumer.consumerId.get))
|
||||
@ -198,7 +198,7 @@ class ConsentTest extends V310ServerSetup {
|
||||
|
||||
// Check we have all views from the consent
|
||||
val assignedViews = user.views.map(_.list).toSeq.flatten
|
||||
assignedViews.map(e => PostConsentViewJsonV310(e.bank_id, e.account_id, e.view_id, None)).distinct should equal(views)
|
||||
assignedViews.map(e => PostConsentViewJsonV310(e.bank_id, e.account_id, e.view_id)).distinct should equal(views)
|
||||
|
||||
case false =>
|
||||
// Due to missing props at the instance the request must fail
|
||||
@ -277,7 +277,7 @@ class ConsentTest extends V310ServerSetup {
|
||||
|
||||
// Check we have all views from the consent
|
||||
val assignedViews = user.views.map(_.list).toSeq.flatten
|
||||
assignedViews.map(e => PostConsentViewJsonV310(e.bank_id, e.account_id, e.view_id, None)).distinct should equal(views)
|
||||
assignedViews.map(e => PostConsentViewJsonV310(e.bank_id, e.account_id, e.view_id)).distinct should equal(views)
|
||||
|
||||
case false =>
|
||||
// Due to missing props at the instance the request must fail
|
||||
|
||||
@ -61,7 +61,7 @@ class ConsentObpTest extends V510ServerSetup {
|
||||
lazy val bankId = randomBankId
|
||||
lazy val bankAccount = randomPrivateAccount(bankId)
|
||||
lazy val entitlements = List(PostConsentEntitlementJsonV310("", CanGetAnyUser.toString()))
|
||||
lazy val views = List(PostConsentViewJsonV310(bankId, bankAccount.id, Constant.SYSTEM_OWNER_VIEW_ID, None))
|
||||
lazy val views = List(PostConsentViewJsonV310(bankId, bankAccount.id, Constant.SYSTEM_OWNER_VIEW_ID))
|
||||
lazy val postConsentEmailJsonV310 = SwaggerDefinitionsJSON.postConsentEmailJsonV310
|
||||
.copy(entitlements=entitlements)
|
||||
.copy(consumer_id=Some(testConsumer.consumerId.get))
|
||||
@ -169,7 +169,7 @@ class ConsentObpTest extends V510ServerSetup {
|
||||
|
||||
// Check we have all views from the consent
|
||||
val assignedViews = user.views.map(_.list).toSeq.flatten
|
||||
assignedViews.map(e => PostConsentViewJsonV310(e.bank_id, e.account_id, e.view_id, None)).distinct should equal(views)
|
||||
assignedViews.map(e => PostConsentViewJsonV310(e.bank_id, e.account_id, e.view_id)).distinct should equal(views)
|
||||
|
||||
case false =>
|
||||
// Due to missing props at the instance the request must fail
|
||||
|
||||
Loading…
Reference in New Issue
Block a user