Skip to content

Commit 89af800

Browse files
maebealeclaude
andcommitted
Remove "Other" payment method entirely
Rather than keeping "Other" in code and hiding it, drop it as a payment option altogether: remove it from the form builder's options, delete the view filters that hid it, and add a data migration to strip it from existing payment_method fields (the shared "Other" AnswerOption is left intact for other fields). Scholarship applicants previously used "Other" as their payment method. Since they are requesting assistance rather than choosing how to pay, the payment section is now hidden for scholarship requests, mirroring how it is already dropped for free events. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c23d060 commit 89af800

8 files changed

Lines changed: 53 additions & 21 deletions

File tree

app/controllers/events/public_registrations_controller.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def new
1818
return
1919
end
2020

21-
@form_fields = visible_form_fields
2221
@scholarship = scholarship_mode?
2322
@scholarship_form = @event.scholarship_form if @scholarship
23+
@form_fields = visible_form_fields
2424
@event = @event.decorate
2525
end
2626

@@ -271,7 +271,10 @@ def visible_form_fields
271271
end
272272
end
273273

274-
if @event.cost_cents.to_i <= 0
274+
# Free events have nothing to pay, and scholarship applicants are asking for
275+
# assistance rather than choosing a payment method, so the payment section is
276+
# dropped in both cases.
277+
if @event.cost_cents.to_i <= 0 || @scholarship
275278
payment_field_ids = @form.form_fields.where(field_identifier: "payment_method").ids
276279
if payment_field_ids.any?
277280
scope = scope.where.not(id: payment_field_ids)

app/services/form_builder_service.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ class FormBuilderService
33
# charge, so controllers match against PAYMENT_METHOD_PAY_NOW rather than
44
# repeating its label. Keep this the single source of truth for the label.
55
PAYMENT_METHOD_PAY_NOW = "Credit card (now)".freeze
6-
# "Other" is retained as a payment method in code and form data — the scholarship
7-
# flow stores it as the payment method — but it is intentionally hidden from the
8-
# options surfaced on public forms for now (see the public registration and bulk
9-
# payment views, which filter it out).
10-
PAYMENT_METHOD_OTHER = "Other".freeze
11-
PAYMENT_METHOD_OPTIONS = [ PAYMENT_METHOD_PAY_NOW, "Credit card (later)", "Check", PAYMENT_METHOD_OTHER ].freeze
6+
PAYMENT_METHOD_OPTIONS = [ PAYMENT_METHOD_PAY_NOW, "Credit card (later)", "Check" ].freeze
127

138
SECTIONS = {
149
person_identifier: { label: "Person identifier", method: :build_person_identifier_fields },

app/views/events/bulk_payments/new.html.erb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@
134134
<% if field.required %><span class="text-red-500">*</span><% end %>
135135
</label>
136136
<div class="flex flex-wrap gap-2 mt-1">
137-
<%# "Other" is kept in code/data but hidden on the form for now. %>
138-
<% field.form_field_answer_options.includes(:answer_option).reject { |ffao| ffao.answer_option.name == FormBuilderService::PAYMENT_METHOD_OTHER }.each do |ffao| %>
137+
<% field.form_field_answer_options.includes(:answer_option).each do |ffao| %>
139138
<label class="inline-flex items-center gap-2 rounded-lg border <%= error ? 'border-red-400' : 'border-gray-300' %> px-3 py-2.5 cursor-pointer hover:border-blue-400 has-[:checked]:border-blue-600 has-[:checked]:bg-blue-50 transition">
140139
<input type="radio"
141140
name="bulk_payment[form_fields][<%= field.id %>]"

app/views/events/public_registrations/_form_field.html.erb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@
7272
data and store none of their own, so fall back to those when present. %>
7373
<% radio_options = dynamic_form_field_options(field) ||
7474
field.form_field_answer_options.includes(:answer_option).map { |ffao| [ ffao.answer_option.name, ffao.answer_option.name ] } %>
75-
<%# "Other" is hidden on the payment method field for now (it stays in code/data
76-
for the scholarship flow). Keep it only when it's already the selected value
77-
so a preset/stored "Other" still renders checked. %>
78-
<% if field.field_identifier == "payment_method" %>
79-
<% radio_options = radio_options.reject { |_option_label, option_value| option_value == FormBuilderService::PAYMENT_METHOD_OTHER && value != FormBuilderService::PAYMENT_METHOD_OTHER } %>
80-
<% end %>
8175
<% has_specify = radio_options.any? { |option_label, _option_value| specify_placeholder(option_label).present? } %>
8276
<%= tag.div class: "flex flex-wrap gap-2.5 mt-1", data: (has_specify ? { controller: "specify-option", action: "change->specify-option#update" } : {}) do %>
8377
<% radio_options.each do |option_label, option_value, option_description| %>

app/views/events/public_registrations/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
<% else %>
123123
<% submitted_value = params.dig(:public_registration, :form_fields, field.id.to_s) %>
124124
<% if submitted_value.blank? && field.field_identifier == "payment_method" %>
125-
<% submitted_value = @scholarship ? FormBuilderService::PAYMENT_METHOD_OTHER : FormBuilderService::PAYMENT_METHOD_PAY_NOW %>
125+
<% submitted_value = FormBuilderService::PAYMENT_METHOD_PAY_NOW %>
126126
<% end %>
127127
<div class="<%= field.grid_span_class %>">
128128
<%= render "events/public_registrations/form_field", field: field, value: submitted_value, label: email_label_overrides[field.field_identifier] %>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
class RemoveOtherPaymentMethodOption < ActiveRecord::Migration[8.0]
2+
# The "Other" payment method has been removed from the form builder's options.
3+
# Existing payment_method fields still carry it as a stored answer option, so
4+
# drop those join rows. The "Other" AnswerOption record is shared across many
5+
# fields (sectors, colors, etc.), so it is left intact — only the payment
6+
# associations are removed.
7+
def up
8+
execute(<<~SQL.squish)
9+
DELETE FROM form_field_answer_options
10+
WHERE answer_option_id IN (SELECT id FROM answer_options WHERE name = 'Other')
11+
AND form_field_id IN (SELECT id FROM form_fields WHERE field_identifier = 'payment_method')
12+
SQL
13+
end
14+
15+
def down
16+
# Re-attach "Other" to every payment_method field that no longer has it,
17+
# reusing the shared AnswerOption (creating it only if it is missing).
18+
execute(<<~SQL.squish)
19+
INSERT INTO answer_options (name, created_at, updated_at)
20+
SELECT 'Other', NOW(), NOW()
21+
WHERE NOT EXISTS (SELECT 1 FROM answer_options WHERE name = 'Other')
22+
SQL
23+
24+
execute(<<~SQL.squish)
25+
INSERT INTO form_field_answer_options (form_field_id, answer_option_id, created_at, updated_at)
26+
SELECT ff.id, ao.id, NOW(), NOW()
27+
FROM form_fields ff
28+
CROSS JOIN (SELECT id FROM answer_options WHERE name = 'Other' LIMIT 1) ao
29+
WHERE ff.field_identifier = 'payment_method'
30+
AND NOT EXISTS (
31+
SELECT 1 FROM form_field_answer_options ffao
32+
WHERE ffao.form_field_id = ff.id AND ffao.answer_option_id = ao.id
33+
)
34+
SQL
35+
end
36+
end

db/schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[8.1].define(version: 2026_06_16_130000) do
13+
ActiveRecord::Schema[8.1].define(version: 2026_06_17_120000) do
1414
create_table "action_text_mentions", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
1515
t.bigint "action_text_rich_text_id", null: false
1616
t.datetime "created_at", null: false

spec/requests/events/public_registrations_spec.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,17 +455,22 @@ def post_with_scholarship(scholarship_answer)
455455
field
456456
end
457457

458-
it "hides the 'Other' payment method from a normal registrant" do
458+
it "does not offer 'Other' as a payment method" do
459+
expect(FormBuilderService::PAYMENT_METHOD_OPTIONS).not_to include("Other")
460+
end
461+
462+
it "renders the remaining payment methods without 'Other'" do
459463
get new_event_public_registration_path(event)
460464

461465
expect(response.body).to include(%(value="Check"))
462466
expect(response.body).not_to include(%(value="Other"))
463467
end
464468

465-
it "keeps 'Other' as the preselected payment method for a scholarship registrant" do
469+
it "hides the payment method entirely for a scholarship registrant" do
466470
get new_event_public_registration_path(event, scholarship_requested: "true")
467471

468-
expect(response.body).to match(/value="Other"[^>]*\bchecked\b/)
472+
expect(response.body).not_to include("Payment method")
473+
expect(response.body).not_to include(%(value="Check"))
469474
end
470475
end
471476

0 commit comments

Comments
 (0)