diff --git a/Sources/Issuers/IssuanceRequester.swift b/Sources/Issuers/IssuanceRequester.swift index d0ee1ba..947d8ed 100644 --- a/Sources/Issuers/IssuanceRequester.swift +++ b/Sources/Issuers/IssuanceRequester.swift @@ -199,7 +199,7 @@ public actor IssuanceRequester: IssuanceRequesterType { let encodedRequest: [JSON] = try request .map { try $0.toDictionary() } - + let merged = authorizationHeader.merging(["credential_requests": encodedRequest]) { (_, new) in new } let response: BatchIssuanceSuccessResponse = try await service.formPost( @@ -240,6 +240,16 @@ public actor IssuanceRequester: IssuanceRequesterType { ) return .success(response) + } catch PostError.response(let response) { + + let issuanceError = response.toIssuanceError() + + if case .deferredCredentialIssuancePending = issuanceError { + return .success(.issuancePending(transactionId: transactionId)) + } + + return .failure(issuanceError) + } catch PostError.cannotParse(let string) { if let responseEncryptionSpec = issuanceResponseEncryptionSpec {