Skip to content

[Card Grant] Say when a card was frozen by one time use - #14696

Open
Acidicts wants to merge 7 commits into
hackclub:mainfrom
Acidicts:grant-one-time-message
Open

[Card Grant] Say when a card was frozen by one time use#14696
Acidicts wants to merge 7 commits into
hackclub:mainfrom
Acidicts:grant-one-time-message

Conversation

@Acidicts

@Acidicts Acidicts commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary of the problem

When someone spends on a one time use grant card, the card freezes automatically (StripeAuthorizationService::CreateFromWebhook freezes it as the system user). The grant page just says "Frozen" with no reason, so recipients assume something broke and message #hcb when they should be going to the org that issued the grant.

Describe your changes

Added CardGrant#frozen_by_one_time_use?, which is true when the grant is one time use and its card was frozen by the system user. When that's the case:

  • the header banner says the card was frozen by one time use instead of a bare "Frozen", with an info tooltip pointing the recipient at the issuing org
  • the card details section shows the freeze reason instead of omitting the "Frozen by" row (it's skipped today, since there's no real user to mention)

Specs cover the system user case, a freeze by a regular user, a freeze with no last_frozen_by, and a card that's inactive without being one time use.

…which happens when spending on a `one_time_use card` it will say "Frozen by one time use, contact the org for any inquiries"

With rspec tests
@Acidicts
Acidicts requested a review from a team August 20, 2026 21:36
@Acidicts Acidicts changed the title Grant One Time Use Frozen Message Grant One Time Use - Frozen Message Aug 20, 2026

@anishanne anishanne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thanks for contributing to HCB :)

Image Can we find a different place to show a frozen reason? This makes the UI look pretty bad.

@Acidicts

Acidicts commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

How does this look?
Screenshot 2026-08-21 at 16 52 41
Screenshot 2026-08-21 at 16 57 03

@Acidicts
Acidicts requested a review from anishanne August 21, 2026 16:09
Comment thread app/models/card_grant.rb Outdated
Comment thread app/models/card_grant.rb Outdated
Comment thread app/views/card_grants/_header_banner.html.erb Outdated
Comment thread app/views/card_grants/_header_banner.html.erb Outdated
Comment thread app/views/card_grants/_header_banner.html.erb Outdated
Comment thread app/views/card_grants/_card_details.html.erb Outdated
…ages

The method now checks the `one_time_use` flag and returns `false` early when no `stripe_card` is present. UI templates use the new condition, display clearer “Frozen by One Time Use” text, and update the tooltip to reference the organization name.
Changed tooltip label to include event name and removed unnecessary transform from icon style.
@Acidicts

Acidicts commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-08-21 at 23 21 53 Screenshot 2026-08-21 at 23 23 24

@Acidicts
Acidicts requested a review from anishanne August 21, 2026 22:57
<% elsif stripe_card.frozen? && stripe_card.last_frozen_by && card_grant.frozen_by_one_time_use? %>
<div class="fs-mask">
<strong>Frozen by</strong>
<span title="Contact <%= card_grant.event.name %> for any issues with this"><%= "One Time Use" %></span>

@anishanne anishanne Aug 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads as if the grant was frozen by a user that is called One Time Use.

Maybe "Frozen" and "Automatically after your first purchase"?
Or, "Automatically by {orgname} after your first purchase"?

<%= status_badge card_grant.status_badge_type %>
<%= card_grant.state_text %>
<% if card_grant.frozen_by_one_time_use? %>
Frozen by One Time Use

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Let's lowercase one time use

Suggested change
Frozen by One Time Use
Frozen by one time use

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually see above re "Frozen by one time use" language - we should swap to something more accurate like Frozen by orgname after first purchase.

<%= card_grant.state_text %>
<% if card_grant.frozen_by_one_time_use? %>
Frozen by One Time Use
<span class="info tooltipped tooltipped--e inline-flex items-center" aria-label="For help with your grant, please reach out to <%= card_grant.event.name %>.">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For admins/managers maybe swap this to something helpful? ie that defrosting clears the one time use? You can branch on organizer_signed_in for this

@anishanne anishanne changed the title Grant One Time Use - Frozen Message [Card Grant] Say when a card was frozen by one time use Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants