From 261bcf42343ab093d3565bf02d4499b9cbbb581a Mon Sep 17 00:00:00 2001 From: Matt Roberts Date: Thu, 26 Sep 2024 14:55:50 +0100 Subject: [PATCH] Fix: Can't access tenant from context in paddle webhook logic (but don't need to anyway) --- app/handlers/webhooks/paddle.go | 2 -- app/services/userlist/userlist.go | 1 + app/services/userlist/userlist_test.go | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/handlers/webhooks/paddle.go b/app/handlers/webhooks/paddle.go index f75c372b8..9469b6e56 100644 --- a/app/handlers/webhooks/paddle.go +++ b/app/handlers/webhooks/paddle.go @@ -73,7 +73,6 @@ func handlePaddleSubscriptionCreated(c *web.Context, params url.Values) error { c.Enqueue(tasks.UserListUpdateCompany(&dto.UserListUpdateCompany{ TenantID: passthrough.TenantID, BillingStatus: enum.BillingActive, - Name: c.Tenant().Name, })) } @@ -107,7 +106,6 @@ func handlePaddleSubscriptionCancelled(c *web.Context, params url.Values) error c.Enqueue(tasks.UserListUpdateCompany(&dto.UserListUpdateCompany{ TenantID: passthrough.TenantID, BillingStatus: enum.BillingCancelled, - Name: c.Tenant().Name, })) } diff --git a/app/services/userlist/userlist.go b/app/services/userlist/userlist.go index 46a34066e..89b7fbf8a 100644 --- a/app/services/userlist/userlist.go +++ b/app/services/userlist/userlist.go @@ -140,6 +140,7 @@ func updateUserListCompany(ctx context.Context, c *cmd.UserListUpdateCompany) er Identifier: strconv.Itoa(c.TenantId), Name: c.Name, } + if c.BillingStatus > 0 { company.Properties = map[string]interface{}{ "billing_status": c.BillingStatus, diff --git a/app/services/userlist/userlist_test.go b/app/services/userlist/userlist_test.go index 4937affd6..2e0d2f8cc 100644 --- a/app/services/userlist/userlist_test.go +++ b/app/services/userlist/userlist_test.go @@ -29,7 +29,7 @@ func reset() { bus.Init(userlist.Service{}, httpclientmock.Service{}, userlist_mock.Service{}) } -func TestCreatTenant_Success(t *testing.T) { +func TestCreateTenant_Success(t *testing.T) { RegisterT(t) env.Config.HostMode = "multi" reset()