Skip to content

Commit

Permalink
Merge pull request #2477 from constantine2nd/develop
Browse files Browse the repository at this point in the history
Few tweaks
  • Loading branch information
simonredfern authored Jan 8, 2025
2 parents 612ba17 + c7be9a8 commit d82575f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions obp-api/src/main/scala/code/api/util/ConsentUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ object Consent extends MdcLoggable {
val consentBox = Consents.consentProvider.vend.getConsentByConsentId(consent.jti)
logger.debug(s"code.api.util.Consent.checkConsent.getConsentByConsentId: consentBox($consentBox)")
val result = consentBox match {
case Full(c) if c.mStatus == ConsentStatus.ACCEPTED.toString | c.mStatus == ConsentStatus.VALID.toString =>
case Full(c) if c.mStatus.toString().toUpperCase == ConsentStatus.ACCEPTED.toString | c.mStatus.toString().toUpperCase() == ConsentStatus.VALID.toString =>
verifyHmacSignedJwt(consentIdAsJwt, c) match {
case true =>
(System.currentTimeMillis / 1000) match {
Expand All @@ -216,7 +216,7 @@ object Consent extends MdcLoggable {
case false =>
Failure(ErrorMessages.ConsentVerificationIssue)
}
case Full(c) if c.mStatus != ConsentStatus.ACCEPTED.toString =>
case Full(c) if c.mStatus.toString().toUpperCase() != ConsentStatus.ACCEPTED.toString =>
Failure(s"${ErrorMessages.ConsentStatusIssue}${ConsentStatus.ACCEPTED.toString}.")
case _ =>
Failure(ErrorMessages.ConsentNotFound)
Expand Down Expand Up @@ -917,7 +917,7 @@ object Consent extends MdcLoggable {
}

boxedConsent match {
case Full(c) if c.mStatus == ConsentStatus.AUTHORISED.toString =>
case Full(c) if c.mStatus.toString().toUpperCase() == ConsentStatus.AUTHORISED.toString =>
System.currentTimeMillis match {
case currentTimeMillis if currentTimeMillis < c.creationDateTime.getTime =>
Failure(ErrorMessages.ConsentNotBeforeIssue)
Expand All @@ -931,7 +931,7 @@ object Consent extends MdcLoggable {
consumerIdOfLoggedInUser
)
}
case Full(c) if c.mStatus != ConsentStatus.AUTHORISED.toString =>
case Full(c) if c.mStatus.toString().toUpperCase() != ConsentStatus.AUTHORISED.toString =>
Failure(s"${ErrorMessages.ConsentStatusIssue}${ConsentStatus.AUTHORISED.toString}.")
case _ =>
Failure(ErrorMessages.ConsentNotFound)
Expand Down
2 changes: 1 addition & 1 deletion obp-api/src/main/scala/code/api/v2_0_0/APIMethods200.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ trait APIMethods200 {
.username(postedData.username)
.email(postedData.email)
.password(postedData.password)
.validated(APIUtil.getPropsAsBoolValue("user_account_validated", false))
.validated(APIUtil.getPropsAsBoolValue("authUser.skipEmailValidation", defaultValue = false))
}
_ <- Helper.booleanToFuture(userCreated.validate.map(_.msg).mkString(";"), 400, cc.callContext) {
userCreated.validate.size == 0
Expand Down
2 changes: 2 additions & 0 deletions obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12434,11 +12434,13 @@ object APIMethods400 extends RestHelper with APIMethods400 {
}
case COUNTERPARTY => {
for {
_ <- Future { logger.debug(s"Before extracting counterparty id") }
//For COUNTERPARTY, Use the counterpartyId to find the toCounterparty and set up the toAccount
transactionRequestBodyCounterparty <- NewStyle.function.tryons(s"${InvalidJsonFormat}, it should be $COUNTERPARTY json format", 400, callContext) {
json.extract[TransactionRequestBodyCounterpartyJSON]
}
toCounterpartyId = transactionRequestBodyCounterparty.to.counterparty_id
_ <- Future { logger.debug(s"After extracting counterparty id: $toCounterpartyId") }
(toCounterparty, callContext) <- NewStyle.function.getCounterpartyByCounterpartyId(CounterpartyId(toCounterpartyId), callContext)

transactionRequestAttributes <- if(transactionRequestBodyCounterparty.attributes.isDefined && transactionRequestBodyCounterparty.attributes.head.length > 0 ) {
Expand Down
4 changes: 2 additions & 2 deletions obp-api/src/test/scala/code/api/v2_0_0/CreateUserTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ class CreateUserTest extends V200ServerSetup with BeforeAndAfter {

override def beforeEach() = {
super.beforeEach()
setPropsValues("user_account_validated" -> "true")
setPropsValues("authUser.skipEmailValidation" -> "true")
}

override def afterEach() = {
super.afterEach()
setPropsValues("user_account_validated" -> "false")
setPropsValues("authUser.skipEmailValidation" -> "false")
}

object CreateUser extends Tag("createUser")
Expand Down

0 comments on commit d82575f

Please sign in to comment.