Add one-time Stripe contribution link to payment settings and upgrade flow#1372
Conversation
Agent-Logs-Url: https://github.com/we-promise/sure/sessions/b2581b3a-0e39-4226-bbaa-6fd6dd69e8a6 Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
Agent-Logs-Url: https://github.com/we-promise/sure/sessions/b2581b3a-0e39-4226-bbaa-6fd6dd69e8a6 Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
Agent-Logs-Url: https://github.com/we-promise/sure/sessions/b2581b3a-0e39-4226-bbaa-6fd6dd69e8a6 Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
Agent-Logs-Url: https://github.com/we-promise/sure/sessions/b2581b3a-0e39-4226-bbaa-6fd6dd69e8a6 Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
|
@copilot: Use STRIPE_PAYMENT_LINK_ID instead of STRIPE_ONE_TIME_CONTRIBUTION_URL and construct the URL using the Striple library similar to how STRIPE_MONTHLY_PRICE_ID is used. |
Agent-Logs-Url: https://github.com/we-promise/sure/sessions/efba0c75-5f82-41a1-b618-532d38e222da Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
Agent-Logs-Url: https://github.com/we-promise/sure/sessions/efba0c75-5f82-41a1-b618-532d38e222da Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
Agent-Logs-Url: https://github.com/we-promise/sure/sessions/efba0c75-5f82-41a1-b618-532d38e222da Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
Agent-Logs-Url: https://github.com/we-promise/sure/sessions/efba0c75-5f82-41a1-b618-532d38e222da Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
Updated in 2a3e95e to use |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR introduces Stripe payment link support to the payments settings page. The controller initializes a Changes
Sequence DiagramsequenceDiagram
participant User as User/Browser
participant Controller as PaymentsController
participant Stripe as Provider::Stripe
participant StripeAPI as Stripe API
participant View as View/Template
User->>Controller: GET /settings/payments
Controller->>Controller: Read STRIPE_PAYMENT_LINK_ID from ENV
alt Payment Link ID present
Controller->>Stripe: stripe.payment_link_url(payment_link_id)
Stripe->>StripeAPI: client.v1.payment_links.retrieve(id)
StripeAPI-->>Stripe: return payment_link object
Stripe-->>Controller: return url (or nil on error)
Controller->>Controller: Assign `@one_time_contribution_url`
else Payment Link ID missing
Controller->>Controller: `@one_time_contribution_url` remains nil
end
Controller->>View: Render with `@one_time_contribution_url`
alt URL present
View->>View: Render link_to with contribution URL
else URL nil/missing
View->>View: Render fallback text
end
View-->>User: HTML response
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/views/settings/payments/show.html.erb (1)
63-75: Optional: move contribution-link composition to a helper for cleaner ERB.The block is correct, but extracting the link/text composition would keep the template slimmer and easier to scan.
As per coding guidelines "app/**/*.erb: Avoid heavy logic in ERB view files; prefer helpers and components instead."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/views/settings/payments/show.html.erb` around lines 63 - 75, Extract the link-building logic from the view into a helper method (e.g., one_time_contribution_link(url) or contribution_link_for_one_time_contribution) that accepts `@one_time_contribution_url` and returns the fully composed link (class, target, rel, and translated text), then replace the inline block in the view with a call that assigns contribution_link = helper_method(`@one_time_contribution_url`) and passes it into t(".payment_via_stripe_html", contribution_link: contribution_link); ensure the helper returns an HTML-safe string suitable for the translation interpolation and keep the helper name referenced where `@one_time_contribution_url` and payment_via_stripe_html are used.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/views/settings/payments/show.html.erb`:
- Around line 63-75: Extract the link-building logic from the view into a helper
method (e.g., one_time_contribution_link(url) or
contribution_link_for_one_time_contribution) that accepts
`@one_time_contribution_url` and returns the fully composed link (class, target,
rel, and translated text), then replace the inline block in the view with a call
that assigns contribution_link = helper_method(`@one_time_contribution_url`) and
passes it into t(".payment_via_stripe_html", contribution_link:
contribution_link); ensure the helper returns an HTML-safe string suitable for
the translation interpolation and keep the helper name referenced where
`@one_time_contribution_url` and payment_via_stripe_html are used.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 203afdb2-5dc8-491f-80f4-7a473351ad37
📒 Files selected for processing (6)
app/controllers/settings/payments_controller.rbapp/models/provider/stripe.rbapp/views/settings/payments/show.html.erbconfig/locales/views/settings/en.ymltest/controllers/settings/payments_controller_test.rbtest/models/provider/stripe_test.rb
|
@copilot: fix the CI test failures |
Agent-Logs-Url: https://github.com/we-promise/sure/sessions/9463e7ff-98f1-44dd-a64b-d578c486e07b Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
Fixed in 88b130e. The failing CI tests were caused by stubbing |
|
@copilot: Make sure you add the same text in |
Agent-Logs-Url: https://github.com/we-promise/sure/sessions/38c25233-f774-4eb1-a88a-bca97d95d848 Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
Updated in f82e203. I added the same Stripe contribution copy above the button on |
Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
|
Periodic PR sweep status check: CI was green as of the last commit run (May 12), and the requested Generated by Claude Code |
|
Automated review sweep: this PR was formally approved months ago and has sat idle since (only a trivial merge/whitespace commit since approval). Flagging as ready to merge — no outstanding blockers. Generated by Claude Code |
The payment settings page showed Stripe as the payment provider, but it did not expose the new one-time contribution flow for users who want to support the project directly. This updates
/settings/paymentto surface the Stripe-hosted contribution link inline in the existing copy, and adds the same Stripe contribution text to/subscription/upgradeabove the existing “Contribute and support Sure” button.UI
Payment via Stripetext with localized copy that renders:Payment via Stripe (one-time contribution here)one-time contribution herephrase to the Stripe contribution URLtext-primarystyling so the link remains readable in both light and dark themesnoopener noreferrerPayment via Stripetext when no payment link can be resolved/subscription/upgradedirectly above the “Contribute and support Sure” buttonStripe integration
STRIPE_PAYMENT_LINK_IDinsteadProvider::Stripe, similar to how Stripe pricing is already configureddebug, and returningnilLocalization
config/locales/views/settings/en.ymlRefactor
/settings/paymentand/subscription/upgradestay in syncCoverage
Summary by CodeRabbit
Release Notes
New Features
Tests