Skip to content

Commit

Permalink
Merge pull request #2368 from constantine2nd/develop
Browse files Browse the repository at this point in the history
Signing Basket
  • Loading branch information
simonredfern committed Mar 14, 2024
2 parents 82b6eb9 + 8791129 commit 851d5f5
Show file tree
Hide file tree
Showing 41 changed files with 1,555 additions and 386 deletions.
4 changes: 4 additions & 0 deletions obp-api/src/main/scala/bootstrap/liftweb/Boot.scala
Expand Up @@ -110,6 +110,7 @@ import code.regulatedentities.MappedRegulatedEntity
import code.remotedata.RemotedataActors
import code.scheduler.{DataBaseCleanerScheduler, DatabaseDriverScheduler, JobScheduler, MetricsArchiveScheduler}
import code.scope.{MappedScope, MappedUserScope}
import code.signingbaskets.{MappedSigningBasket, MappedSigningBasketConsent, MappedSigningBasketPayment}
import code.snippet.{OAuthAuthorisation, OAuthWorkedThanks}
import code.socialmedia.MappedSocialMedia
import code.standingorders.StandingOrder
Expand Down Expand Up @@ -1040,6 +1041,9 @@ object ToSchemify {
AuthUser,
JobScheduler,
MappedETag,
MappedSigningBasket,
MappedSigningBasketPayment,
MappedSigningBasketConsent,
MappedRegulatedEntity,
AtmAttribute,
Admin,
Expand Down
14 changes: 14 additions & 0 deletions obp-api/src/main/scala/code/api/berlin/group/ConstantsBG.scala
@@ -0,0 +1,14 @@
package code.api.berlin.group

object ConstantsBG {
object SigningBasketsStatus extends Enumeration {
type SigningBasketsStatus = Value
// Only the codes
// 1) RCVD (Received),
// 2) PATC (PartiallyAcceptedTechnical Correct) The payment initiation needs multiple authentications, where some but not yet all have been performed. Syntactical and semantical validations are successful.,
// 3) ACTC (AcceptedTechnicalValidation) ,
// 4) CANC (Cancelled) and
// 5) RJCT (Rejected) are supported for signing baskets.
val RCVD, PATC, ACTC, CANC, RJCT = Value
}
}
Expand Up @@ -1090,7 +1090,7 @@ using the extended forms as indicated above.
}
(challenges, callContext) <- NewStyle.function.createChallengesC2(
List(u.userId),
ChallengeType.BERLINGROUP_CONSENT_CHALLENGE,
ChallengeType.BERLIN_GROUP_CONSENT_CHALLENGE,
None,
getSuggestedDefaultScaMethod(),
Some(StrongCustomerAuthenticationStatus.received),
Expand Down Expand Up @@ -1260,7 +1260,7 @@ Maybe in a later version the access path will change.
challenges.filter(_.challengeId == authorisationId).size == 1
}
(challenge, callContext) <- NewStyle.function.validateChallengeAnswerC2(
ChallengeType.BERLINGROUP_CONSENT_CHALLENGE,
ChallengeType.BERLIN_GROUP_CONSENT_CHALLENGE,
None,
Some(consentId),
challenges.filter(_.challengeId == authorisationId).head.challengeId,
Expand Down
Expand Up @@ -21,7 +21,28 @@ case class JvalueCaseClass(jvalueToCaseclass: JValue)

object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats {


case class ErrorMessageBG(category: String, code: Int, path: String, text: String)
case class ErrorMessagesBG(tppMessages: List[ErrorMessageBG])

case class PostSigningBasketJsonV13(
paymentIds: Option[List[String]],
consentIds: Option[List[String]]
)

case class SigningBasketLinksV13(
self: LinkHrefJson,
status: LinkHrefJson,
startAuthorisation: LinkHrefJson
)
case class SigningBasketResponseJson(
transactionStatus: String,
basketId: String,
_links: SigningBasketLinksV13)
case class SigningBasketGetResponseJson(
transactionStatus: String,
payments: Option[List[String]],
consents: Option[List[String]]
)
case class LinkHrefJson(
href: String
)
Expand Down Expand Up @@ -637,7 +658,7 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats {
)
)
}

def createStartPaymentInitiationCancellationAuthorisation(
challenge: ChallengeTrait,
paymentService: String,
Expand All @@ -654,6 +675,44 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats {
)
}


def createStartSigningBasketAuthorisationJson(basketId: String, challenge: ChallengeTrait): StartPaymentAuthorisationJson = {
StartPaymentAuthorisationJson(
scaStatus = challenge.scaStatus.map(_.toString).getOrElse(""),
authorisationId = challenge.challengeId,
psuMessage = "Please check your SMS at a mobile device.",
_links = ScaStatusJsonV13(s"/v1.3/signing-baskets/${basketId}/authorisations/${challenge.challengeId}")
)
}

def createSigningBasketResponseJson(basket: SigningBasketTrait): SigningBasketResponseJson = {
SigningBasketResponseJson(
basketId = basket.basketId,
transactionStatus = basket.status.toLowerCase(),
_links = SigningBasketLinksV13(
self = LinkHrefJson(s"/v1.3/signing-baskets/${basket.basketId}"),
status = LinkHrefJson(s"/v1.3/signing-baskets/${basket.basketId}/status"),
startAuthorisation = LinkHrefJson(s"/v1.3/signing-baskets/${basket.basketId}/authorisations")
)
)
}

def getSigningBasketResponseJson(basket: SigningBasketContent): SigningBasketGetResponseJson = {
SigningBasketGetResponseJson(
transactionStatus = basket.basket.status.toLowerCase(),
payments = basket.payments,
consents = basket.consents,
)
}

def getSigningBasketStatusResponseJson(basket: SigningBasketContent): SigningBasketGetResponseJson = {
SigningBasketGetResponseJson(
transactionStatus = basket.basket.status.toLowerCase(),
payments = None,
consents = None,
)
}

def checkTransactionAuthorisation(JsonPost: JValue) = tryo {
JsonPost.extract[TransactionAuthorisation]
}.isDefined
Expand Down

0 comments on commit 851d5f5

Please sign in to comment.