From e532ba604c4e8e820345226d842d3b27813f5e66 Mon Sep 17 00:00:00 2001 From: patlo-iog Date: Thu, 26 Sep 2024 15:54:17 +0700 Subject: [PATCH] fix: return 404 when create credConfig on non-existing issuer (#1379) Signed-off-by: Pat Losoponkul --- .../core/service/OID4VCIIssuerMetadataService.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/OID4VCIIssuerMetadataService.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/OID4VCIIssuerMetadataService.scala index 9fe6e171fa..c0db44819d 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/OID4VCIIssuerMetadataService.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/OID4VCIIssuerMetadataService.scala @@ -67,7 +67,7 @@ trait OID4VCIIssuerMetadataService { format: CredentialFormat, configurationId: String, schemaId: String - ): ZIO[WalletAccessContext, InvalidSchemaId | UnsupportedCredentialFormat, CredentialConfiguration] + ): ZIO[WalletAccessContext, InvalidSchemaId | UnsupportedCredentialFormat | IssuerIdNotFound, CredentialConfiguration] def getCredentialConfigurations( issuerId: UUID ): IO[IssuerIdNotFound, Seq[CredentialConfiguration]] @@ -127,8 +127,13 @@ class OID4VCIIssuerMetadataServiceImpl(repository: OID4VCIIssuerMetadataReposito format: CredentialFormat, configurationId: String, schemaId: String - ): ZIO[WalletAccessContext, InvalidSchemaId | UnsupportedCredentialFormat, CredentialConfiguration] = { + ): ZIO[ + WalletAccessContext, + InvalidSchemaId | UnsupportedCredentialFormat | IssuerIdNotFound, + CredentialConfiguration + ] = { for { + _ <- getCredentialIssuer(issuerId) _ <- format match { case CredentialFormat.JWT => ZIO.unit case f => ZIO.fail(UnsupportedCredentialFormat(f))