Skip to content

Commit

Permalink
bug: set credential to active after credential exists
Browse files Browse the repository at this point in the history
Refs: #285
  • Loading branch information
Phil91 committed Oct 22, 2024
1 parent 888e3b8 commit 9b90e2f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public async Task CreateSignedCredential(Guid companySsiDetailId, JsonDocument s
c.Credential = null;
}, c =>
{
c.CompanySsiDetailStatusId = CompanySsiDetailStatusId.ACTIVE;
c.ExternalCredentialId = credential.Id;
c.Credential = credential.Jwt;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,11 @@ public async Task ApproveCredential(Guid credentialId, CancellationToken cancell
UpdateIssuanceDate(credentialId, data, companySsiRepository);
companySsiRepository.AttachAndModifyCompanySsiDetails(credentialId, c =>
{
c.CompanySsiDetailStatusId = data.Status;
c.ExpiryDate = DateTimeOffset.MinValue;
c.ProcessId = null;
},
c =>
{
c.CompanySsiDetailStatusId = CompanySsiDetailStatusId.ACTIVE;
c.DateLastChanged = _dateTimeProvider.OffsetNow;
c.ExpiryDate = expiry;
c.ProcessId = processId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public async Task CreateCredential_CallsExpected()
var id = Guid.NewGuid();
var externalId = Guid.NewGuid();
var schema = JsonDocument.Parse("{}");
var ssiDetail = new CompanySsiDetail(id, null!, VerifiedCredentialTypeId.BUSINESS_PARTNER_NUMBER, CompanySsiDetailStatusId.ACTIVE, IssuerBpnl, Guid.NewGuid().ToString(), DateTimeOffset.UtcNow);
var ssiDetail = new CompanySsiDetail(id, null!, VerifiedCredentialTypeId.BUSINESS_PARTNER_NUMBER, CompanySsiDetailStatusId.PENDING, IssuerBpnl, Guid.NewGuid().ToString(), DateTimeOffset.UtcNow);
A.CallTo(() => _companySsiDetailRepository.AttachAndModifyCompanySsiDetails(A<Guid>._, A<Action<CompanySsiDetail>>._, A<Action<CompanySsiDetail>>._))
.Invokes((Guid _, Action<CompanySsiDetail>? initialize, Action<CompanySsiDetail> setupOptionalFields) =>
{
Expand All @@ -94,6 +94,7 @@ public async Task CreateCredential_CallsExpected()
.MustHaveHappenedOnceExactly();
ssiDetail.ExternalCredentialId.Should().Be(externalId);
ssiDetail.Credential.Should().Be("cred");
ssiDetail.CompanySsiDetailStatusId.Should().Be(CompanySsiDetailStatusId.ACTIVE);
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ public async Task ApproveCredential_WithValid_ReturnsExpected()
A.CallTo(() => _processStepRepository.CreateProcess(ProcessTypeId.CREATE_CREDENTIAL))
.MustHaveHappenedOnceExactly();

detail.CompanySsiDetailStatusId.Should().Be(CompanySsiDetailStatusId.ACTIVE);
detail.DateLastChanged.Should().Be(now);
processData.Schema.Deserialize<FrameworkCredential>()!.IssuanceDate.Should().Be(now);
}
Expand Down Expand Up @@ -465,7 +464,6 @@ public async Task ApproveCredential_WithValidWithoutCompanyUserRequester_DoesNot
A.CallTo(() => _processStepRepository.CreateProcess(ProcessTypeId.CREATE_CREDENTIAL))
.MustHaveHappenedOnceExactly();

detail.CompanySsiDetailStatusId.Should().Be(CompanySsiDetailStatusId.ACTIVE);
detail.DateLastChanged.Should().Be(now);
processData.Schema.Deserialize<FrameworkCredential>()!.IssuanceDate.Should().Be(now);
}
Expand Down

0 comments on commit 9b90e2f

Please sign in to comment.