fix(billing): send org owner email on cloud trial start to backfill legacy billing email#2709
Merged
Merged
Conversation
…egacy billing email legacy cloud orgs created before billing email was synced have no billing email on the billing service, so customer creation fails during the trial mint. attach the org owner's email to the StartTrial request (overwriting any client value) so the billing service can backfill it before minting. best-effort: the billing service remains the single authority on whether an email is required and fails closed only when its own record is blank.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StartTrialnow attaches the org owner's email to the trial request, overwriting any client-supplied value. The billing service backfills its own blank record before minting.Notes
StartTrialRequestgains abilling_emailfield for this.Test plan
go build ./...andgo vet ./api/handlers/...pass (verified locally).Note
Medium Risk
Touches billing trial onboarding and forwards PII (owner email); behavior is narrow and aligned with existing
ensureOrganisationInBilling/updateBillingEmailIfEmptypatterns, with billing service as final gate.Overview
Cloud trial start now always includes the org owner’s email on the billing
StartTrialrequest so legacy orgs with a blank billing email can complete customer creation during the trial mint instead of failing with a stamped claim but no subscription.The handler sets
requestData.BillingEmailfromgetOwnerEmailafter decoding the body, which replaces any client-suppliedbilling_email. Lookup is best-effort (empty on miss does not block the request); the billing service remains authoritative on whether an email is required.StartTrialRequestgains an optionalbilling_emailJSON field and updated godoc. Swaggerdocs.gois regenerated only.Reviewed by Cursor Bugbot for commit 8bdbe23. Bugbot is set up for automated code reviews on this repo. Configure here.