Repository: TBD54566975/ssi-service
Pull request #234 (2023-01-03 23:33:17)

[OSE-300] Credential applications can be cancelled
# Overview
After a credential application is submitted, an operation is returned. This PR adds the ability to cancel the operation related to that application.

# Description
All operations can be cancelled, as long as they aren't marked as done.

# How Has This Been Tested?
Added a simple unit test to the service endpoint.

# Checklist

Before submitting this PR, please make sure:

- [x] I have read the CONTRIBUTING document.
- [x] My code is consistent with the rest of the project 
- [x] I have tagged the relevant reviewers and/or interested parties
- [x] I have updated the READMEs and other documentation of affected packages


codecov-commenter: # [Codecov](https://codecov.io/gh/TBD54566975/ssi-service/pull/234?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TBD54566975) Report
> Merging [#234](https://codecov.io/gh/TBD54566975/ssi-service/pull/234?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TBD54566975) (41c17e4) into [main](https://codecov.io/gh/TBD54566975/ssi-service/commit/a1383109922758031d97e843587b80fcbc40a08e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TBD54566975) (a138310) will **decrease** coverage by `1.12%`.
> The diff coverage is `70.37%`.

> :exclamation: Current head 41c17e4 differs from pull request most recent head ba5409b. Consider uploading reports for the commit ba5409b to get more accurate results

```diff
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
- Coverage   25.93%   24.80%   -1.13%     
==========================================
  Files          28       31       +3     
  Lines        2738     2919     +181     
==========================================
+ Hits          710      724      +14     
- Misses       1911     2076     +165     
- Partials      117      119       +2     
```


| [Impacted Files](https://codecov.io/gh/TBD54566975/ssi-service/pull/234?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TBD54566975) | Coverage Δ | |
|---|---|---|
| [pkg/service/operation/submission/submission.go](https://codecov.io/gh/TBD54566975/ssi-service/pull/234/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TBD54566975#diff-cGtnL3NlcnZpY2Uvb3BlcmF0aW9uL3N1Ym1pc3Npb24vc3VibWlzc2lvbi5nbw==) | `0.00% <ø> (-17.65%)` | :arrow_down: |
| [pkg/service/operation/storage.go](https://codecov.io/gh/TBD54566975/ssi-service/pull/234/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TBD54566975#diff-cGtnL3NlcnZpY2Uvb3BlcmF0aW9uL3N0b3JhZ2UuZ28=) | `21.27% <70.37%> (ø)` | |
| [pkg/service/operation/model.go](https://codecov.io/gh/TBD54566975/ssi-service/pull/234/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TBD54566975#diff-cGtnL3NlcnZpY2Uvb3BlcmF0aW9uL21vZGVsLmdv) | `0.00% <0.00%> (ø)` | |
| [pkg/service/operation/service.go](https://codecov.io/gh/TBD54566975/ssi-service/pull/234/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TBD54566975#diff-cGtnL3NlcnZpY2Uvb3BlcmF0aW9uL3NlcnZpY2UuZ28=) | `0.00% <0.00%> (ø)` | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TBD54566975). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TBD54566975)


Patch:
diff --git a/pkg/service/manifest/service.go b/pkg/service/manifest/service.go
index 378458f..c42d19d 100644
--- a/pkg/service/manifest/service.go
+++ b/pkg/service/manifest/service.go
@@ -271,6 +271,7 @@ func (s Service) ProcessApplicationSubmission(request model.SubmitApplicationReq
 	applicantDID := request.ApplicantDID
 	storageRequest := manifeststg.StoredApplication{
 		ID:             applicationID,
+		Status:         opcredential.StatusFulfilled,
 		ManifestID:     manifestID,
 		ApplicantDID:   applicantDID,
 		Application:    request.Application,
diff --git a/pkg/service/manifest/storage/storage.go b/pkg/service/manifest/storage/storage.go
index b28648d..2c0bfdb 100644
--- a/pkg/service/manifest/storage/storage.go
+++ b/pkg/service/manifest/storage/storage.go
@@ -6,6 +6,7 @@ import (
 	"github.com/goccy/go-json"
 	"github.com/pkg/errors"
 	"github.com/sirupsen/logrus"
+	"github.com/tbd54566975/ssi-service/pkg/service/operation/credential"
 
 	"github.com/TBD54566975/ssi-sdk/credential/manifest"
 
@@ -16,9 +17,9 @@ import (
 )
 
 const (
-	manifestNamespace    = "manifest"
-	applicationNamespace = "application"
-	responseNamespace    = "response"
+	manifestNamespace = "manifest"
+
+	responseNamespace = "response"
 )
 
 type StoredManifest struct {
@@ -30,6 +31,8 @@ type StoredManifest struct {
 
 type StoredApplication struct {
 	ID             string                         `json:"id"`
+	Status         credential.Status              `json:"status"`
+	Reason         string                         `json:"reason"`
 	ManifestID     string                         `json:"manifestId"`
 	ApplicantDID   string                         `json:"applicantDid"`
 	Application    manifest.CredentialApplication `json:"application"`
@@ -132,11 +135,11 @@ func (ms *Storage) StoreApplication(application StoredApplication) error {
 	if err != nil {
 		return util.LoggingErrorMsgf(err, "could not store application: %s", id)
 	}
-	return ms.db.Write(applicationNamespace, id, applicationBytes)
+	return ms.db.Write(credential.ApplicationNamespace, id, applicationBytes)
 }
 
 func (ms *Storage) GetApplication(id string) (*StoredApplication, error) {
-	applicationBytes, err := ms.db.Read(applicationNamespace, id)
+	applicationBytes, err := ms.db.Read(credential.ApplicationNamespace, id)
 	if err != nil {
 		return nil, util.LoggingErrorMsgf(err, "could not get application: %s", id)
 	}
@@ -152,7 +155,7 @@ func (ms *Storage) GetApplication(id string) (*StoredApplication, error) {
 
 // GetApplications attempts to get all stored applications. It will return those it can even if it has trouble with some.
 func (ms *Storage) GetApplications() ([]StoredApplication, error) {
-	gotApplications, err := ms.db.ReadAll(applicationNamespace)
+	gotApplications, err := ms.db.ReadAll(credential.ApplicationNamespace)
 	if err != nil {
 		return nil, util.LoggingErrorMsg(err, "could not get all applications")
 	}
@@ -173,7 +176,7 @@ func (ms *Storage) GetApplications() ([]StoredApplication, error) {
 }
 
 func (ms *Storage) DeleteApplication(id string) error {
-	if err := ms.db.Delete(applicationNamespace, id); err != nil {
+	if err := ms.db.Delete(credential.ApplicationNamespace, id); err != nil {
 		return util.LoggingErrorMsgf(err, "could not delete application: %s", id)
 	}
 	return nil
diff --git a/pkg/service/operation/credential/response.go b/pkg/service/operation/credential/response.go
index e1e1f4d..16b403c 100644
--- a/pkg/service/operation/credential/response.go
+++ b/pkg/service/operation/credential/response.go
@@ -22,6 +22,8 @@ func (s Status) String() string {
 		return "fulfilled"
 	case StatusRejected:
 		return "rejected"
+	case StatusCancelled:
+		return "cancelled"
 	default:
 		return "unknown"
 	}
@@ -32,4 +34,7 @@ const (
 	StatusPending
 	StatusFulfilled
 	StatusRejected
+	StatusCancelled
 )
+
+const ApplicationNamespace = "application"
diff --git a/pkg/service/operation/storage.go b/pkg/service/operation/storage.go
index 57c2a21..2462eea 100644
--- a/pkg/service/operation/storage.go
+++ b/pkg/service/operation/storage.go
@@ -7,6 +7,7 @@ import (
 	"github.com/pkg/errors"
 	"github.com/sirupsen/logrus"
 	"github.com/tbd54566975/ssi-service/internal/util"
+	"github.com/tbd54566975/ssi-service/pkg/service/operation/credential"
 	opstorage "github.com/tbd54566975/ssi-service/pkg/service/operation/storage"
 	"github.com/tbd54566975/ssi-service/pkg/service/operation/storage/namespace"
 	"github.com/tbd54566975/ssi-service/pkg/service/operation/submission"
@@ -23,9 +24,12 @@ type Storage struct {
 }
 
 func (b Storage) CancelOperation(id string) (*opstorage.StoredOperation, error) {
-	if strings.HasPrefix(id, submission.ParentResource) {
-		_, opData, err := b.db.UpdateValueAndOperation(
-			submission.Namespace, submission.ID(id), storage.NewUpdater(map[string]any{
+	var opData []byte
+	var err error
+	switch {
+	case strings.HasPrefix(id, submission.ParentResource):
+		_, opData, err = b.db.UpdateValueAndOperation(
+			submission.Namespace, opstorage.StatusObjectID(id), storage.NewUpdater(map[string]any{
 				"status": submission.StatusCancelled,
 				"reason": cancelledReason,
 			}),
@@ -34,16 +38,30 @@ func (b Storage) CancelOperation(id string) (*opstorage.StoredOperation, error)
 					"done": true,
 				}),
 			})
-		if err != nil {
-			return nil, errors.Wrap(err, "updating value and op")
-		}
-		var op opstorage.StoredOperation
-		if err = json.Unmarshal(opData, &op); err != nil {
-			return nil, errors.Wrap(err, "unmarshalling data")
-		}
-		return &op, nil
+	case strings.HasPrefix(id, credential.ParentResource):
+		_, opData, err = b.db.UpdateValueAndOperation(
+			credential.ApplicationNamespace, opstorage.StatusObjectID(id), storage.NewUpdater(map[string]any{
+				"status": credential.StatusCancelled,
+				"reason": cancelledReason,
+			}),
+			namespace.FromID(id), id, submission.OperationUpdater{
+				UpdaterWithMap: storage.NewUpdater(map[string]any{
+					"done": true,
+				}),
+			},
+		)
+	default:
+		return nil, errors.New("unrecognized id structure")
+	}
+
+	if err != nil {
+		return nil, errors.Wrap(err, "updating value and op")
+	}
+	var op opstorage.StoredOperation
+	if err = json.Unmarshal(opData, &op); err != nil {
+		return nil, errors.Wrap(err, "unmarshalling data")
 	}
-	return nil, errors.New("unrecognized id structure")
+	return &op, nil
 }
 
 func (b Storage) StoreOperation(op opstorage.StoredOperation) error {
diff --git a/pkg/service/operation/storage/storage.go b/pkg/service/operation/storage/storage.go
index d56f4d9..1ed006e 100644
--- a/pkg/service/operation/storage/storage.go
+++ b/pkg/service/operation/storage/storage.go
@@ -1,6 +1,8 @@
 package storage
 
 import (
+	"strings"
+
 	"go.einride.tech/aip/filtering"
 )
 
@@ -35,3 +37,13 @@ type Storage interface {
 	DeleteOperation(id string) error
 	CancelOperation(id string) (*StoredOperation, error)
 }
+
+// StatusObjectID attempts to parse the submission id from the ID of the operation. This is done by taking the last word
+// that results from splitting the id by "/". On failures, the empty string is returned.
+func StatusObjectID(opID string) string {
+	i := strings.LastIndex(opID, "/")
+	if i == -1 {
+		return ""
+	}
+	return opID[(i + 1):]
+}
diff --git a/pkg/service/operation/submission/submission.go b/pkg/service/operation/submission/submission.go
index e938b7e..e2c8536 100644
--- a/pkg/service/operation/submission/submission.go
+++ b/pkg/service/operation/submission/submission.go
@@ -2,7 +2,6 @@ package submission
 
 import (
 	"fmt"
-	"strings"
 
 	"github.com/goccy/go-json"
 	"github.com/pkg/errors"
@@ -15,16 +14,6 @@ func IDFromSubmissionID(id string) string {
 	return fmt.Sprintf("%s/%s", ParentResource, id)
 }
 
-// ID attempts to parse the submission id from the ID of the operation. This is done by taking the last word
-// that results from splitting the id by "/". On failures, the empty string is returned.
-func ID(opID string) string {
-	i := strings.LastIndex(opID, "/")
-	if i == -1 {
-		return ""
-	}
-	return opID[(i + 1):]
-}
-
 const (
 	// Namespace is the namespace to be used for storing submissions.
 	Namespace = "presentation_submission"


Test patch:
diff --git a/integration/presentation_exchange_integration_test.go b/integration/presentation_exchange_integration_test.go
index f290c8c..190d522 100644
--- a/integration/presentation_exchange_integration_test.go
+++ b/integration/presentation_exchange_integration_test.go
@@ -5,7 +5,7 @@ import (
 
 	"github.com/google/uuid"
 	"github.com/stretchr/testify/assert"
-	"github.com/tbd54566975/ssi-service/pkg/service/operation/submission"
+	"github.com/tbd54566975/ssi-service/pkg/service/operation/storage"
 )
 
 var presentationExchangeContext = NewTestContext("PresentationExchange")
@@ -109,7 +109,7 @@ func TestSubmissionFlow(t *testing.T) {
 	assert.NoError(t, err)
 	assert.Equal(t, "false", done)
 
-	reviewOutput, err := ReviewSubmission(submission.ID(opID))
+	reviewOutput, err := ReviewSubmission(storage.StatusObjectID(opID))
 	assert.NoError(t, err)
 	status, err := getJSONElement(reviewOutput, "$.status")
 	assert.NoError(t, err)
diff --git a/pkg/server/server_operation_test.go b/pkg/server/server_operation_test.go
index 2f91eca..647d171 100644
--- a/pkg/server/server_operation_test.go
+++ b/pkg/server/server_operation_test.go
@@ -15,7 +15,7 @@ import (
 	"github.com/stretchr/testify/require"
 	"github.com/tbd54566975/ssi-service/pkg/server/router"
 	"github.com/tbd54566975/ssi-service/pkg/service/operation"
-	"github.com/tbd54566975/ssi-service/pkg/service/operation/submission"
+	opstorage "github.com/tbd54566975/ssi-service/pkg/service/operation/storage"
 	"github.com/tbd54566975/ssi-service/pkg/storage"
 )
 
@@ -28,7 +28,7 @@ func TestOperationsAPI(t *testing.T) {
 		holderSigner, holderDID := getSigner(t)
 		definition := createPresentationDefinition(t, pRouter)
 		submissionOp := createSubmission(t, pRouter, definition.PresentationDefinition.ID, VerifiableCredential(), holderDID, holderSigner)
-		sub := reviewSubmission(t, pRouter, submission.ID(submissionOp.ID))
+		sub := reviewSubmission(t, pRouter, opstorage.StatusObjectID(submissionOp.ID))
 
 		createdID := submissionOp.ID
 		req := httptest.NewRequest(
@@ -257,7 +257,7 @@ func TestOperationsAPI(t *testing.T) {
 			holderSigner, holderDID := getSigner(t)
 			definition := createPresentationDefinition(t, pRouter)
 			submissionOp := createSubmission(t, pRouter, definition.PresentationDefinition.ID, VerifiableCredential(), holderDID, holderSigner)
-			_ = reviewSubmission(t, pRouter, submission.ID(submissionOp.ID))
+			_ = reviewSubmission(t, pRouter, opstorage.StatusObjectID(submissionOp.ID))
 
 			createdID := submissionOp.ID
 			req := httptest.NewRequest(
diff --git a/pkg/server/server_presentation_test.go b/pkg/server/server_presentation_test.go
index 3da290f..a86908b 100644
--- a/pkg/server/server_presentation_test.go
+++ b/pkg/server/server_presentation_test.go
@@ -20,7 +20,7 @@ import (
 	"github.com/tbd54566975/ssi-service/config"
 	"github.com/tbd54566975/ssi-service/internal/keyaccess"
 	"github.com/tbd54566975/ssi-service/pkg/server/router"
-	opsubmission "github.com/tbd54566975/ssi-service/pkg/service/operation/submission"
+	opstorage "github.com/tbd54566975/ssi-service/pkg/service/operation/storage"
 	"github.com/tbd54566975/ssi-service/pkg/service/presentation"
 	"github.com/tbd54566975/ssi-service/pkg/service/presentation/model"
 	"github.com/tbd54566975/ssi-service/pkg/storage"
@@ -163,14 +163,14 @@ func TestPresentationAPI(t *testing.T) {
 					"id":             "did:web:andresuribe.com",
 				})), holderDID, holderSigner)
 
-			req := httptest.NewRequest(http.MethodGet, fmt.Sprintf("https://ssi-service.com/v1/presentations/submissions/%s", opsubmission.ID(op.ID)), nil)
+			req := httptest.NewRequest(http.MethodGet, fmt.Sprintf("https://ssi-service.com/v1/presentations/submissions/%s", opstorage.StatusObjectID(op.ID)), nil)
 			w := httptest.NewRecorder()
 
-			assert.NoError(ttt, pRouter.GetSubmission(newRequestContextWithParams(map[string]string{"id": opsubmission.ID(op.ID)}), w, req))
+			assert.NoError(ttt, pRouter.GetSubmission(newRequestContextWithParams(map[string]string{"id": opstorage.StatusObjectID(op.ID)}), w, req))
 
 			var resp router.GetSubmissionResponse
 			assert.NoError(ttt, json.NewDecoder(w.Body).Decode(&resp))
-			assert.Equal(ttt, opsubmission.ID(op.ID), resp.Submission.ID)
+			assert.Equal(ttt, opstorage.StatusObjectID(op.ID), resp.Submission.ID)
 			assert.Equal(ttt, definition.PresentationDefinition.ID, resp.Submission.DefinitionID)
 			assert.Equal(ttt, "pending", resp.Submission.Status)
 		})
@@ -218,7 +218,7 @@ func TestPresentationAPI(t *testing.T) {
 			}
 
 			value := newRequestValue(ttt, request)
-			createdID := opsubmission.ID(submissionOp.ID)
+			createdID := opstorage.StatusObjectID(submissionOp.ID)
 			req := httptest.NewRequest(
 				http.MethodPut,
 				fmt.Sprintf("https://ssi-service.com/v1/presentations/submissions/%s/review", createdID),
@@ -243,7 +243,7 @@ func TestPresentationAPI(t *testing.T) {
 			holderSigner, holderDID := getSigner(ttt)
 			definition := createPresentationDefinition(ttt, pRouter)
 			submissionOp := createSubmission(t, pRouter, definition.PresentationDefinition.ID, VerifiableCredential(), holderDID, holderSigner)
-			createdID := opsubmission.ID(submissionOp.ID)
+			createdID := opstorage.StatusObjectID(submissionOp.ID)
 			_ = reviewSubmission(ttt, pRouter, createdID)
 
 			request := router.ReviewSubmissionRequest{
@@ -323,14 +323,14 @@ func TestPresentationAPI(t *testing.T) {
 				{
 					Status: "pending",
 					PresentationSubmission: &exchange.PresentationSubmission{
-						ID:           opsubmission.ID(op.ID),
+						ID:           opstorage.StatusObjectID(op.ID),
 						DefinitionID: definition.PresentationDefinition.ID,
 					},
 				},
 				{
 					Status: "pending",
 					PresentationSubmission: &exchange.PresentationSubmission{
-						ID:           opsubmission.ID(op2.ID),
+						ID:           opstorage.StatusObjectID(op2.ID),
 						DefinitionID: definition.PresentationDefinition.ID,
 					},
 				},
@@ -395,7 +395,7 @@ func TestPresentationAPI(t *testing.T) {
 				{
 					Status: "pending",
 					PresentationSubmission: &exchange.PresentationSubmission{
-						ID:           opsubmission.ID(op.ID),
+						ID:           opstorage.StatusObjectID(op.ID),
 						DefinitionID: definition.PresentationDefinition.ID,
 					},
 				},
diff --git a/pkg/service/operation/storage_test.go b/pkg/service/operation/storage_test.go
new file mode 100644
index 0000000..7d0dee4
--- /dev/null
+++ b/pkg/service/operation/storage_test.go
@@ -0,0 +1,110 @@
+package operation
+
+import (
+	"os"
+	"testing"
+
+	"github.com/goccy/go-json"
+	"github.com/google/go-cmp/cmp"
+	"github.com/google/go-cmp/cmp/cmpopts"
+	"github.com/stretchr/testify/require"
+	manifeststg "github.com/tbd54566975/ssi-service/pkg/service/manifest/storage"
+	"github.com/tbd54566975/ssi-service/pkg/service/operation/credential"
+	opstorage "github.com/tbd54566975/ssi-service/pkg/service/operation/storage"
+	"github.com/tbd54566975/ssi-service/pkg/service/operation/storage/namespace"
+	"github.com/tbd54566975/ssi-service/pkg/storage"
+)
+
+func setupTestDB(t *testing.T) storage.ServiceStorage {
+	file, err := os.CreateTemp("", "bolt")
+	require.NoError(t, err)
+	name := file.Name()
+	s, err := storage.NewStorage(storage.Bolt, name)
+	require.NoError(t, err)
+	t.Cleanup(func() {
+		_ = s.Close()
+		_ = file.Close()
+		_ = os.Remove(name)
+	})
+	return s
+}
+
+func TestStorage_CancelOperation(t *testing.T) {
+	s := setupTestDB(t)
+	data, err := json.Marshal(manifeststg.StoredApplication{})
+	require.NoError(t, err)
+	require.NoError(t, s.Write(credential.ApplicationNamespace, "hello", data))
+
+	type fields struct {
+		db storage.ServiceStorage
+	}
+	type args struct {
+		id string
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *opstorage.StoredOperation
+		wantErr bool
+		done    bool
+	}{
+		{
+			name: "bad id returns error",
+			fields: fields{
+				db: s,
+			},
+			args: args{
+				id: "hello",
+			},
+			wantErr: true,
+		},
+		{
+			name: "operation for application can be cancelled",
+			fields: fields{
+				db: s,
+			},
+			args: args{
+				id: "credentials/responses/hello",
+			},
+			want: &opstorage.StoredOperation{
+				ID:   "credentials/responses/hello",
+				Done: true,
+			},
+		},
+		{
+			name: "done operation returns error on cancellation",
+			done: true,
+			fields: fields{
+				db: s,
+			},
+			args: args{
+				id: "credentials/responses/hello",
+			},
+			wantErr: true,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+
+			opData, err := json.Marshal(opstorage.StoredOperation{
+				ID:   "credentials/responses/hello",
+				Done: tt.done,
+			})
+			require.NoError(t, err)
+			require.NoError(t, s.Write(namespace.FromParent("credentials/responses"), "credentials/responses/hello", opData))
+
+			b := Storage{
+				db: tt.fields.db,
+			}
+			got, err := b.CancelOperation(tt.args.id)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("CancelOperation() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if diff := cmp.Diff(got, tt.want, cmpopts.IgnoreFields(opstorage.StoredOperation{}, "Response")); diff != "" {
+				t.Errorf("CancelOperation() -got, +want:\n%s", diff)
+			}
+		})
+	}
+}
diff --git a/pkg/service/operation/submission/submission_test.go b/pkg/service/operation/submission/submission_test.go
index 14b43b1..27fb5e8 100644
--- a/pkg/service/operation/submission/submission_test.go
+++ b/pkg/service/operation/submission/submission_test.go
@@ -4,6 +4,7 @@ import (
 	"testing"
 
 	"github.com/stretchr/testify/assert"
+	"github.com/tbd54566975/ssi-service/pkg/service/operation/storage"
 )
 
 func TestSubmissionID(t *testing.T) {
@@ -30,7 +31,7 @@ func TestSubmissionID(t *testing.T) {
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			assert.Equal(t, tt.want, ID(tt.opID))
+			assert.Equal(t, tt.want, storage.StatusObjectID(tt.opID))
 		})
 	}
 }