Skip to content

Commit

Permalink
Merge pull request #2238 from hongwei1/develop
Browse files Browse the repository at this point in the history
bugfix/fixed `Future.filter predicate is not satisfied` for some endp…
  • Loading branch information
simonredfern authored Jun 30, 2023
2 parents c364ff9 + 97d2ebf commit dcfecfa
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
23 changes: 23 additions & 0 deletions obp-api/src/main/scala/code/api/util/NewStyle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3911,6 +3911,29 @@ object NewStyle extends MdcLoggable{
i => (connectorEmptyResponse(i._1, callContext), i._2)
}
}

def sendCustomerNotification(
scaMethod: StrongCustomerAuthentication,
recipient: String,
subject: Option[String], //Only for EMAIL, SMS do not need it, so here it is Option
message: String,
callContext: Option[CallContext]
): OBPReturnType[String] = {
Connector.connector.vend.sendCustomerNotification(
scaMethod: StrongCustomerAuthentication,
recipient: String,
subject: Option[String], //Only for EMAIL, SMS do not need it, so here it is Option
message: String,
callContext: Option[CallContext]
) map {
i =>
(unboxFullOrFail(
i._1,
callContext,
s"$InvalidConnectorResponse sendCustomerNotification does not return proper response from backend"),
i._2)
}
}

def createCustomerAccountLink(customerId: String, bankId: String, accountId: String, relationshipType: String, callContext: Option[CallContext]): OBPReturnType[CustomerAccountLinkTrait] =
Connector.connector.vend.createCustomerAccountLink(customerId: String, bankId, accountId: String, relationshipType: String, callContext: Option[CallContext]) map {
Expand Down
8 changes: 4 additions & 4 deletions obp-api/src/main/scala/code/api/v3_1_0/APIMethods310.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3541,7 +3541,7 @@ trait APIMethods310 {
postConsentEmailJson <- NewStyle.function.tryons(failMsg, 400, callContext) {
json.extract[PostConsentEmailJsonV310]
}
(Full(status), callContext) <- Connector.connector.vend.sendCustomerNotification(
(status, callContext) <- NewStyle.function.sendCustomerNotification(
StrongCustomerAuthentication.EMAIL,
postConsentEmailJson.email,
Some("OBP Consent Challenge"),
Expand All @@ -3558,7 +3558,7 @@ trait APIMethods310 {
json.extract[PostConsentPhoneJsonV310]
}
phoneNumber = postConsentPhoneJson.phone_number
(Full(status), callContext) <- Connector.connector.vend.sendCustomerNotification(
(status, callContext) <- NewStyle.function.sendCustomerNotification(
StrongCustomerAuthentication.SMS,
phoneNumber,
None,
Expand All @@ -3571,15 +3571,15 @@ trait APIMethods310 {
(consentImplicitSCA, callContext) <- NewStyle.function.getConsentImplicitSCA(user, callContext)
status <- consentImplicitSCA.scaMethod match {
case v if v == StrongCustomerAuthentication.EMAIL => // Send the email
Connector.connector.vend.sendCustomerNotification (
NewStyle.function.sendCustomerNotification (
StrongCustomerAuthentication.EMAIL,
consentImplicitSCA.recipient,
Some ("OBP Consent Challenge"),
challengeText,
callContext
)
case v if v == StrongCustomerAuthentication.SMS =>
Connector.connector.vend.sendCustomerNotification(
NewStyle.function.sendCustomerNotification(
StrongCustomerAuthentication.SMS,
consentImplicitSCA.recipient,
None,
Expand Down
4 changes: 2 additions & 2 deletions obp-api/src/main/scala/code/api/v5_0_0/APIMethods500.scala
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ trait APIMethods500 {
consentScaEmail <- NewStyle.function.tryons(failMsg, 400, callContext) {
consentRequestJson.email.head
}
(Full(status), callContext) <- Connector.connector.vend.sendCustomerNotification(
(status, callContext) <- NewStyle.function.sendCustomerNotification(
StrongCustomerAuthentication.EMAIL,
consentScaEmail,
Some("OBP Consent Challenge"),
Expand All @@ -864,7 +864,7 @@ trait APIMethods500 {
consentScaPhoneNumber <- NewStyle.function.tryons(failMsg, 400, callContext) {
consentRequestJson.phone_number.head
}
(Full(status), callContext) <- Connector.connector.vend.sendCustomerNotification(
(status, callContext) <- NewStyle.function.sendCustomerNotification(
StrongCustomerAuthentication.SMS,
consentScaPhoneNumber,
None,
Expand Down

0 comments on commit dcfecfa

Please sign in to comment.