diff --git a/openmeter/app/stripe/adapter/stripe.go b/openmeter/app/stripe/adapter/stripe.go index 5bf552477..5b7c960b6 100644 --- a/openmeter/app/stripe/adapter/stripe.go +++ b/openmeter/app/stripe/adapter/stripe.go @@ -134,9 +134,10 @@ func (a adapter) UpdateAPIKey(ctx context.Context, input appstripeentity.UpdateA // Update the API key err = a.secretService.UpdateAppSecret(ctx, secretentity.UpdateAppSecretInput{ - ID: appData.APIKey, - Key: appstripeentity.APIKeySecretKey, - Value: input.APIKey, + AppID: input.AppID, + SecretID: appData.APIKey, + Key: appstripeentity.APIKeySecretKey, + Value: input.APIKey, }) if err != nil { return fmt.Errorf("failed to update api key: %w", err) diff --git a/openmeter/secret/entity/input.go b/openmeter/secret/entity/input.go index b37001249..eb9e43e6a 100644 --- a/openmeter/secret/entity/input.go +++ b/openmeter/secret/entity/input.go @@ -35,13 +35,18 @@ func (i CreateAppSecretInput) Validate() error { } type UpdateAppSecretInput struct { - ID SecretID - Key string - Value string + AppID appentitybase.AppID + SecretID SecretID + Key string + Value string } func (i UpdateAppSecretInput) Validate() error { - if err := i.ID.Validate(); err != nil { + if err := i.AppID.Validate(); err != nil { + return err + } + + if err := i.SecretID.Validate(); err != nil { return err } diff --git a/test/app/stripe/appstripe.go b/test/app/stripe/appstripe.go index a1fea924e..8344bacb5 100644 --- a/test/app/stripe/appstripe.go +++ b/test/app/stripe/appstripe.go @@ -421,9 +421,10 @@ func (s *AppHandlerTestSuite) TestUpdateAPIKey(ctx context.Context, t *testing.T s.Env.Secret(). On("UpdateAppSecret", secretentity.UpdateAppSecretInput{ - ID: stripeApp.APIKey, - Key: appstripeentity.APIKeySecretKey, - Value: newAPIKey, + AppID: app.GetID(), + SecretID: stripeApp.APIKey, + Key: appstripeentity.APIKeySecretKey, + Value: newAPIKey, }). Return(nil)