Skip to content

Commit

Permalink
Fixes readability issues (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
babisRoutis committed Apr 8, 2024
1 parent 7e150c2 commit 40dafe1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class VerifierApi(
val input = req.awaitBody<InitTransactionTO>()
logger.info("Handling InitTransaction nonce=${input.nonce} ... ")
either { initTransaction(input) }.fold(
ifRight = { it ->
ifRight = {
logger.info("Initiated transaction ${it.transactionId}")
ok().json().bodyValueAndAwait(it)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import eu.europa.ec.eudi.prex.PresentationExchange
/**
* Nimbus library depends on Jackson for JSON parsing
* On the other hand, [PresentationDefinition] depends on [PresentationExchange.jsonParser]
* which is based on Kotlinx Serialization library.
* which is based on the Kotlinx Serialization library.
*
* This class offers two util methods for [mapping][PresentationDefinitionJackson.toJsonObject]
* a [PresentationDefinition] to a jackson compatible object
Expand All @@ -38,7 +38,7 @@ object PresentationDefinitionJackson {
return objectMapper.readValue<Any>(jsonStr)
}

fun fromJsonObject(o: MutableMap<String, Any?>): Result<PresentationDefinition> = runCatching {
fun fromJsonObject(o: Map<String, Any?>): Result<PresentationDefinition> = runCatching {
val jsonStr = objectMapper.writeValueAsString(o)
PresentationExchange.jsonParser.decodePresentationDefinition(jsonStr).getOrThrow()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ private fun WalletResponse.toTO(): WalletResponseTO {
}

/**
* Given a [PresentationId] and a [Nonce] returns the [WalletResponse]
* Given a [TransactionId] and a [Nonce] returns the [WalletResponse]
*/
interface GetWalletResponse {
suspend operator fun invoke(presentationId: TransactionId, responseCode: ResponseCode?): QueryResponse<WalletResponseTO>
fun interface GetWalletResponse {
suspend operator fun invoke(transactionId: TransactionId, responseCode: ResponseCode?): QueryResponse<WalletResponseTO>
}

class GetWalletResponseLive(
private val loadPresentationById: LoadPresentationById,
) : GetWalletResponse {
override suspend fun invoke(presentationId: TransactionId, responseCode: ResponseCode?): QueryResponse<WalletResponseTO> {
return when (val presentation = loadPresentationById(presentationId)) {
override suspend fun invoke(transactionId: TransactionId, responseCode: ResponseCode?): QueryResponse<WalletResponseTO> {
return when (val presentation = loadPresentationById(transactionId)) {
null -> NotFound
is Presentation.Submitted ->
when {
Expand Down

0 comments on commit 40dafe1

Please sign in to comment.