Skip to content

Commit

Permalink
Merge pull request #70 from niscy-eudiw/main
Browse files Browse the repository at this point in the history
Fixed deferred issuance pending status
  • Loading branch information
stzouvaras authored Jul 30, 2024
2 parents 72fb632 + e951cde commit 5ecb1a0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Sources/Issuers/IssuanceRequester.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 5ecb1a0

Please sign in to comment.