Tier changes shows a payment-provider event's raw reason string instead of words #157

Open
opened 2026-10-01 04:43:20 +00:00 by cgalo5758 · 1 comment
Owner

The organization page's Tier changes table names why each tier change happened. Most reasons the console writes itself are mapped to words (humanizeTransitionReason in internal/server/operator_enrollment.go: "Revoked by an operator", "Grant resumed after a subscription ended", "Tier added to the ladder", and so on). A change caused by a payment-provider webhook is not mapped. Its row shows the stored reason as it is, for example stripe:checkout.session.completed:evt_… or stripe:customer.subscription.updated:evt_…, under "By: webhook".

An operator reading that row learns the provider's event type only by decoding an identifier, and the event id means nothing on this page.

The fix: keep a mapping from each provider event type the console acts on to a readable reason, the way the console's own reasons are mapped.

Done when:

  • Every transition reason a payment-provider webhook writes renders as words in Tier changes. Examples: a checkout completed, a subscription changed at the provider, a subscription ended.
  • The event id is still reachable for someone who needs it, as the raw reason already is through the cell's title, but no row shows it as its reason text.
  • An event type the mapping does not know renders a generic readable reason rather than the raw string. A test fails when a webhook path starts writing a reason the mapping does not cover.
The organization page's Tier changes table names why each tier change happened. Most reasons the console writes itself are mapped to words (`humanizeTransitionReason` in `internal/server/operator_enrollment.go`: "Revoked by an operator", "Grant resumed after a subscription ended", "Tier added to the ladder", and so on). A change caused by a payment-provider webhook is not mapped. Its row shows the stored reason as it is, for example `stripe:checkout.session.completed:evt_…` or `stripe:customer.subscription.updated:evt_…`, under "By: webhook". An operator reading that row learns the provider's event type only by decoding an identifier, and the event id means nothing on this page. The fix: keep a mapping from each provider event type the console acts on to a readable reason, the way the console's own reasons are mapped. Done when: - Every transition reason a payment-provider webhook writes renders as words in Tier changes. Examples: a checkout completed, a subscription changed at the provider, a subscription ended. - The event id is still reachable for someone who needs it, as the raw reason already is through the cell's title, but no row shows it as its reason text. - An event type the mapping does not know renders a generic readable reason rather than the raw string. A test fails when a webhook path starts writing a reason the mapping does not cover.
cgalo5758 added the
kind
bug
area/billingarea/operator-ui
labels 2026-10-01 04:43:20 +00:00
Author
Owner

#179 proposes storing each tier change's cause as a value from a closed list, with the operator's note in its own column and an id shared by the rows one act writes. If it lands, a webhook's cause becomes one of those values with the event id kept beside it, and the words this issue asks for come from the same mapping as the console's own causes instead of from parsing the stored string.

#179 proposes storing each tier change's cause as a value from a closed list, with the operator's note in its own column and an id shared by the rows one act writes. If it lands, a webhook's cause becomes one of those values with the event id kept beside it, and the words this issue asks for come from the same mapping as the console's own causes instead of from parsing the stored string.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wiki-cafe/member-console#157