Open platform to collect and prioritize feedback
Billing status should be forced to string
Matt Robertsc2ba9fd6f91d
diff --git a/app/services/userlist/userlist.go b/app/services/userlist/userlist.goindex 89b7fbf8a..f70125277 100644--- a/app/services/userlist/userlist.go+++ b/app/services/userlist/userlist.go@@ -10,11 +10,13 @@ import ("strconv""github.com/getfider/fider/app/models/cmd"+ "github.com/getfider/fider/app/models/dto""github.com/getfider/fider/app/models/enum""github.com/getfider/fider/app/models/query""github.com/getfider/fider/app/pkg/bus""github.com/getfider/fider/app/pkg/env""github.com/getfider/fider/app/pkg/errors"+ "github.com/getfider/fider/app/pkg/log")// Company represents a company in UserList.com. It contains information about the company,@@ -143,7 +145,7 @@ func updateUserListCompany(ctx context.Context, c *cmd.UserListUpdateCompany) erif c.BillingStatus > 0 {company.Properties = map[string]interface{}{- "billing_status": c.BillingStatus,+ "billing_status": c.BillingStatus.String(),}}@@ -219,6 +221,10 @@ func pushUserListUpdate(obj interface{}, ctx context.Context) error {return errors.Wrap(err, "Failed to send userlist update")}+ log.Infof(ctx, "Userlist HTTP post complete with status @{status}. Header was @{ResponseHeader}. Body was @{ResponseBody}", dto.Props{+ "status": req.ResponseStatusCode, "ResponseHeader": req.ResponseHeader, "ResponseBody": string(req.ResponseBody),+ })+if req.ResponseStatusCode >= 300 {return errors.New("unexpected status code while updating userlist: %d", req.ResponseStatusCode)}diff --git a/app/services/userlist/userlist_test.go b/app/services/userlist/userlist_test.goindex 2e0d2f8cc..7875b7c12 100644--- a/app/services/userlist/userlist_test.go+++ b/app/services/userlist/userlist_test.go@@ -94,6 +94,9 @@ func TestUpdateTenant_BillingStatusUpdatedIfSet(t *testing.T) {containsBillingStatus := strings.Contains(string(body), "billing_status")Expect(containsBillingStatus).IsTrue()+ // Also check we're using the enum string, not the int value+ Expect(strings.Contains(string(body), "billing_status\":\"active\"")).IsTrue()+}func TestUpdateTenant_BillingStatusNotUpdatedIfNotSet(t *testing.T) {