Skip to content

Commit

Permalink
feature/V5.1.0 added CounterpartyLimit endpoint -step5
Browse files Browse the repository at this point in the history
  • Loading branch information
hongwei1 committed Jun 25, 2024
1 parent d3b091b commit dde9558
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5397,24 +5397,24 @@ object SwaggerDefinitionsJSON {
)

val postCounterpartyLimitV510 = PostCounterpartyLimitV510(
max_single_amount = 200,
max_monthly_amount = 1000,
max_number_of_monthly_transactions = 10,
max_yearly_amount = 100,
max_number_of_yearly_transactions = 200
max_single_amount = maxSingleAmountExample.value.toInt,
max_monthly_amount = maxMonthlyAmountExample.value.toInt,
max_number_of_monthly_transactions = maxNumberOfMonthlyTransactionsExample.value.toInt,
max_yearly_amount = maxYearlyAmountExample.value.toInt,
max_number_of_yearly_transactions = maxNumberOfYearlyTransactionsExample.value.toInt
)

val counterpartyLimitV510 = CounterpartyLimitV510(
counterparty_limit_id = "",
bank_id = "",
account_id = "",
view_id = "",
counterparty_id = "",
max_single_amount = 0,
max_monthly_amount = 0,
max_number_of_monthly_transactions = 0,
max_yearly_amount = 0,
max_number_of_yearly_transactions = 0
counterparty_limit_id = counterpartyLimitIdExample.value,
bank_id = bankIdExample.value,
account_id = accountIdExample.value,
view_id = viewIdExample.value,
counterparty_id = counterpartyIdExample.value,
max_single_amount = maxSingleAmountExample.value.toInt,
max_monthly_amount = maxMonthlyAmountExample.value.toInt,
max_number_of_monthly_transactions = maxNumberOfMonthlyTransactionsExample.value.toInt,
max_yearly_amount = maxYearlyAmountExample.value.toInt,
max_number_of_yearly_transactions = maxNumberOfYearlyTransactionsExample.value.toInt
)

val atmsJsonV510 = AtmsJsonV510(
Expand Down
2 changes: 1 addition & 1 deletion obp-api/src/main/scala/code/api/util/APIUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
private val isNeedCheckView = errorResponseBodies.contains($UserNoPermissionAccessView) &&
requestUrlPartPath.contains("BANK_ID") && requestUrlPartPath.contains("ACCOUNT_ID") && requestUrlPartPath.contains("VIEW_ID")

private val isNeedCheckCounterparty = errorResponseBodies.contains(CounterpartyNotFoundByCounterpartyId) && requestUrlPartPath.contains("COUNTERPARTY_ID")
private val isNeedCheckCounterparty = errorResponseBodies.contains($CounterpartyNotFoundByCounterpartyId) && requestUrlPartPath.contains("COUNTERPARTY_ID")

private val reversedRequestUrl = requestUrlPartPath.reverse
def getPathParams(url: List[String]): Map[String, String] =
Expand Down
5 changes: 5 additions & 0 deletions obp-api/src/main/scala/code/api/util/ErrorMessages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,11 @@ object ErrorMessages {
* validate method: NewStyle.function.checkViewAccessAndReturnView
*/
def $UserNoPermissionAccessView = UserNoPermissionAccessView

/**
* validate method: NewStyle.function.getCounterpartyByCounterpartyId
*/
def $CounterpartyNotFoundByCounterpartyId = CounterpartyNotFoundByCounterpartyId


def getDuplicatedMessageNumbers = {
Expand Down
18 changes: 18 additions & 0 deletions obp-api/src/main/scala/code/api/util/ExampleValue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2147,6 +2147,24 @@ object ExampleValue {
lazy val transactionRequestTypesExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
glossaryItems += makeGlossaryItem("transaction_request_types", transactionRequestTypesExample)

lazy val counterpartyLimitIdExample = ConnectorField("abc9a7e4-6d02-40e3-a129-0b2bf89de9b1","A string that MUST uniquely identify the Counterparty Limit on this OBP instance.")
glossaryItems += makeGlossaryItem("counterparty_limit_id", counterpartyLimitIdExample)

lazy val maxSingleAmountExample = ConnectorField("1000",NoDescriptionProvided)
glossaryItems += makeGlossaryItem("max_single_amount", maxSingleAmountExample)

lazy val maxMonthlyAmountExample = ConnectorField("10000",NoDescriptionProvided)
glossaryItems += makeGlossaryItem("max_monthly_amount", maxMonthlyAmountExample)

lazy val maxNumberOfMonthlyTransactionsExample = ConnectorField("10",NoDescriptionProvided)
glossaryItems += makeGlossaryItem("max_number_of_monthly_transactions", maxNumberOfMonthlyTransactionsExample)

lazy val maxYearlyAmountExample = ConnectorField("12000",NoDescriptionProvided)
glossaryItems += makeGlossaryItem("max_yearly_amount", maxYearlyAmountExample)

lazy val maxNumberOfYearlyTransactionsExample = ConnectorField("100",NoDescriptionProvided)
glossaryItems += makeGlossaryItem("max_number_of_yearly_transactions", maxNumberOfYearlyTransactionsExample)

lazy val canAddImageUrlExample = ConnectorField(booleanTrue,NoDescriptionProvided)
glossaryItems += makeGlossaryItem("can_add_image_url", canAddImageUrlExample)

Expand Down
19 changes: 11 additions & 8 deletions obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package code.api.v5_1_0


import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
import code.api.{Constant, UserNotFound}
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
import code.api.util.APIUtil._
Expand All @@ -15,7 +16,9 @@ import code.api.util._
import code.api.util.newstyle.BalanceNewStyle
import code.api.util.newstyle.Consumer.createConsumerNewStyle
import code.api.util.newstyle.RegulatedEntityNewStyle.{createRegulatedEntityNewStyle, deleteRegulatedEntityNewStyle, getRegulatedEntitiesNewStyle, getRegulatedEntityByEntityIdNewStyle}
import code.api.v1_2_1.CreateViewJsonV121
import code.api.v2_1_0.{ConsumerRedirectUrlJSON, JSONFactory210}
import code.api.v2_2_0.JSONFactory220
import code.api.v3_0_0.JSONFactory300
import code.api.v3_0_0.JSONFactory300.createAggregateMetricJson
import code.api.v3_1_0.ConsentJsonV310
Expand All @@ -28,14 +31,14 @@ import code.bankconnectors.Connector
import code.consent.Consents
import code.loginattempts.LoginAttempt
import code.metrics.APIMetrics
import code.model.AppType
import code.model.{AppType, BankAccountX}
import code.model.dataAccess.MappedBankAccount
import code.regulatedentities.MappedRegulatedEntityProvider
import code.transactionrequests.TransactionRequests.TransactionRequestTypes.{apply => _}
import code.userlocks.UserLocksProvider
import code.users.Users
import code.util.Helper
import code.util.Helper.ObpS
import code.util.Helper.{ObpS, booleanToBox}
import code.views.Views
import code.views.system.{AccountAccess, ViewDefinition}
import com.github.dwickern.macros.NameOf.nameOf
Expand All @@ -45,9 +48,9 @@ import com.openbankproject.commons.model._
import com.openbankproject.commons.util.{ApiVersion, ScannedApiVersion}
import net.liftweb.common.Full
import net.liftweb.http.rest.RestHelper
import net.liftweb.json.{compactRender, parse, prettyRender}
import net.liftweb.json.{Extraction, compactRender, parse, prettyRender}
import net.liftweb.mapper.By
import net.liftweb.util.Helpers
import net.liftweb.util.{Helpers, StringHelpers}
import net.liftweb.util.Helpers.tryo

import scala.collection.immutable.{List, Nil}
Expand Down Expand Up @@ -2302,7 +2305,7 @@ trait APIMethods510 {
$BankNotFound,
$BankAccountNotFound,
$UserNoPermissionAccessView,
CounterpartyNotFoundByCounterpartyId,
$CounterpartyNotFoundByCounterpartyId,
InvalidJsonFormat,
UnknownError
),
Expand Down Expand Up @@ -2360,7 +2363,7 @@ trait APIMethods510 {
$BankNotFound,
$BankAccountNotFound,
$UserNoPermissionAccessView,
CounterpartyNotFoundByCounterpartyId,
$CounterpartyNotFoundByCounterpartyId,
InvalidJsonFormat,
UnknownError
),
Expand Down Expand Up @@ -2406,7 +2409,7 @@ trait APIMethods510 {
$BankNotFound,
$BankAccountNotFound,
$UserNoPermissionAccessView,
CounterpartyNotFoundByCounterpartyId,
$CounterpartyNotFoundByCounterpartyId,
InvalidJsonFormat,
UnknownError
),
Expand Down Expand Up @@ -2444,7 +2447,7 @@ trait APIMethods510 {
$BankNotFound,
$BankAccountNotFound,
$UserNoPermissionAccessView,
CounterpartyNotFoundByCounterpartyId,
$CounterpartyNotFoundByCounterpartyId,
InvalidJsonFormat,
UnknownError
),
Expand Down

0 comments on commit dde9558

Please sign in to comment.