Skip to content

Release v0.1.18 — Phase 18: Billing Page#249

Merged
menvil merged 19 commits into
mainfrom
release/v0.1.18-phase18-billing-page
Jun 3, 2026
Merged

Release v0.1.18 — Phase 18: Billing Page#249
menvil merged 19 commits into
mainfrom
release/v0.1.18-phase18-billing-page

Conversation

@menvil

@menvil menvil commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Phase 18 — Billing Page

Adds the /billing page where authenticated users can manage their plan, credits, and payment details.

What's included

  • /billing route (auth-protected)
  • BillingPage Livewire component
  • Current plan summary card
  • Credits balance card (via CreditLedger)
  • Plan limits card (via FeatureAccessService)
  • Available plans section (Free/Pro/Max)
  • Current plan highlighted, upgrade CTA hidden for current plan
  • Subscription checkout via BillingPaymentService
  • Checkout result notices (success/cancelled)
  • Credit packs section (Small/Medium/Large)
  • Buy credit pack via BillingPaymentService
  • Credit transaction history table with readable labels and type badges
  • Customer portal / manage billing section (placeholder)
  • Empty and error states
  • Responsive layout

Architecture invariants

  • BillingPage does not mutate users.plan directly
  • BillingPage does not grant/spend credits directly
  • All checkout flows go through BillingPaymentService
  • Credits read via CreditLedger interface

Quality gate

  • 353 feature tests passing
  • composer lint passing
  • npm run build passing

🤖 Generated with Claude Code


Summary by cubic

Adds an auth-only Billing page at /billing so users can view their plan and credits, upgrade subscriptions, and buy credit packs. Fulfills Linear CONV-274–290 Billing Page scope.

  • New Features

    • New /billing route and Livewire BillingPage.
    • Current plan, credits balance, and plan limits (via FeatureAccessService).
    • Plan list with upgrade CTA; blocks checkout for Free or current plan.
    • Subscription checkout and success/cancel notices (via BillingPaymentService).
    • Credit packs with one-time purchase checkout (via BillingPaymentService).
    • Credit history table with pagination and readable labels.
    • Customer portal action (placeholder).
    • Empty/error states and responsive layout.
  • Refactors

    • Extracted checkout orchestration into StartSubscriptionCheckoutAction and BuyCreditPackAction.
    • Added getApiAccessProperty/getBatchConversionProperty to simplify Blade and remove direct app() calls.

Written for commit 260650f. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

Release Notes

  • New Features
    • Added a comprehensive Billing page for subscription and credit management.
    • Users can view current plan, available upgrades, credit balance, and transaction history.
    • Credit packs now available for purchase with checkout success/cancellation notifications.
    • Displays plan limits and feature availability across subscription tiers.

menvil and others added 17 commits June 3, 2026 14:50
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…age-route

CONV-274: Create Billing page route
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…age-livewire-component

CONV-275: Create Billing page Livewire component
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CONV-284: Add buy credit pack actions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CONV-286: Add credit transaction details
CONV-287: Add customer portal and invoice links

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix lint issues

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-summary-card

CONV-276–290: Billing Page Full Implementation
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces a complete billing page for subscription and credit management. A Livewire component provides checkout actions and data accessors, a Blade template renders plan selection, credits purchasing, transaction history, and billing management UI, and comprehensive tests validate checkout flows, page rendering, and user data isolation.

Changes

Billing Page with Subscription & Credit Flows

Layer / File(s) Summary
Component & Routing Setup
app/Livewire/Billing/BillingPage.php, routes/web.php
BillingPage component initializes checkout status from query params, exposes computed properties for authenticated user, credits balance, plan limits, available plans, credit packs, and paginated transactions. Public actions validate and execute subscription checkout (startSubscriptionCheckout), credit pack purchase (buyCreditPack), and portal access (openCustomerPortal). Authenticated /billing route registered to render the component.
Billing UI Template
resources/views/livewire/billing/billing-page.blade.php
Template renders billing page with checkout status notices (success/cancelled), validation errors, summary cards for current plan, credits balance and plan limits with feature badges, "Buy credits" section iterating credit packs with purchase actions, "Available plans" section with current plan highlighting and upgrade buttons, "Credit history" table with empty state and pagination, and "Manage billing" section with portal button.
Subscription & Credit Purchase Tests
tests/Feature/Livewire/Billing/BillingPageCheckoutTest.php, tests/Feature/Livewire/Billing/BillingPageCreditPacksTest.php
Tests validate subscription checkout rejects free/current plans and redirects to Stripe session for paid plans; tests validate credit pack availability, successful checkout redirect, and rejection of invalid packs.
Page Display & Integration Tests
tests/Feature/Billing/BillingCheckoutNoticeTest.php, tests/Feature/Billing/BillingPageRouteTest.php, tests/Feature/Livewire/Billing/BillingPageErrorStateTest.php, tests/Feature/Livewire/Billing/BillingPageSmokeTest.php, tests/Feature/Livewire/Billing/BillingPageTest.php, tests/Feature/Livewire/Billing/BillingPageCreditHistoryTest.php
Tests cover route access control, checkout status notice display, plan and credits balance rendering, plan limits with feature badges, available plans listing with current plan highlighting, credit history display with empty state and pagination, validation error rendering, portal error state, and data isolation ensuring users see only their own transactions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • menvil/FileConverter#243: The buyCreditPack action and billing UI depend directly on credit-pack checkout flow, gateway abstractions, and Stripe price configuration introduced in this PR.
  • menvil/FileConverter#183: The billing page's credits balance display and credit history table depend on the CreditLedger contract and credit transaction types defined in this PR.
  • menvil/FileConverter#182: The page's plan limits cards and feature availability badges use FeatureAccessService::allows() and plan limit data structures introduced in this PR.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a complete billing page feature (BillingPage component, routes, UI, payment flows) as part of a release version.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch release/v0.1.18-phase18-billing-page

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the release Triggers AI code review (CodeRabbit, Cubic) label Jun 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/Livewire/Billing/BillingPage.php`:
- Around line 81-125: Extract the plan/pack validation and checkout
orchestration out of the Livewire component into two action classes (e.g.,
StartSubscriptionCheckoutAction and BuyCreditPackAction) in app/Actions: move
Plan::from validation, Plan::Free check, current-plan check,
BillingPlanRepository lookup, and call to
BillingPaymentService::createSubscriptionCheckout into
StartSubscriptionCheckoutAction (accept user and planKey, throw the same
ValidationException messages on error, and return the checkout session or
session->url); similarly move CreditPackRepository lookup and
BillingPaymentService::createCreditPackCheckout into BuyCreditPackAction (accept
user and packKey, throw the same ValidationException if missing, and return the
session or url). Then change BillingPage::startSubscriptionCheckout and
::buyCreditPack to simply dispatch the corresponding action (inject/resolve the
action), pass $this->authUser and key, receive the session/url, and call
$this->redirect(...) — preserve the same error types/messages and use the same
BillingPaymentService methods.

In `@resources/views/livewire/billing/billing-page.blade.php`:
- Around line 58-87: Add computed accessors on the Livewire component (e.g., in
class BillingPage add getApiAccessProperty() and getBatchConversionProperty())
that call app(FeatureAccessService::class)->allows($this->authUser,
'api_access') and 'batch_conversion' respectively, and then update the Blade
view to stop resolving FeatureAccessService and instead read the precomputed
booleans (use $apiAccess and $batchConversion) to decide which <x-badge> to
render; keep planLimits/authUser usage unchanged.

In `@tests/Feature/Livewire/Billing/BillingPageCreditPacksTest.php`:
- Line 30: The test currently uses a broad ->assertRedirect() which permits any
redirect; replace it with an exact-URL assertion using the fake gateway's
expected checkout URL so the test verifies the payment flow redirects to the
intended target. Locate the assertion in BillingPageCreditPacksTest and change
the broad assertRedirect() to assertRedirect($expectedUrl) (or the appropriate
exact-redirect assertion) using the fake gateway's provided checkout URL value
(e.g., from the fake gateway instance or helper) so the test asserts the
concrete checkout redirect.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 764c9b5e-189f-499e-a3cd-bf069f6e8b8f

📥 Commits

Reviewing files that changed from the base of the PR and between edd22a0 and 5b0ad09.

📒 Files selected for processing (11)
  • app/Livewire/Billing/BillingPage.php
  • resources/views/livewire/billing/billing-page.blade.php
  • routes/web.php
  • tests/Feature/Billing/BillingCheckoutNoticeTest.php
  • tests/Feature/Billing/BillingPageRouteTest.php
  • tests/Feature/Livewire/Billing/BillingPageCheckoutTest.php
  • tests/Feature/Livewire/Billing/BillingPageCreditHistoryTest.php
  • tests/Feature/Livewire/Billing/BillingPageCreditPacksTest.php
  • tests/Feature/Livewire/Billing/BillingPageErrorStateTest.php
  • tests/Feature/Livewire/Billing/BillingPageSmokeTest.php
  • tests/Feature/Livewire/Billing/BillingPageTest.php

Comment thread app/Livewire/Billing/BillingPage.php
Comment thread resources/views/livewire/billing/billing-page.blade.php Outdated
Comment thread tests/Feature/Livewire/Billing/BillingPageCreditPacksTest.php Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 11 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread resources/views/livewire/billing/billing-page.blade.php Outdated
menvil and others added 2 commits June 3, 2026 15:43
- Extract checkout orchestration into StartSubscriptionCheckoutAction and BuyCreditPackAction
- Add getApiAccessProperty/getBatchConversionProperty computed properties to remove app() calls from Blade
- Tighten assertRedirect to exact URL in BillingPageCreditPacksTest

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix billing page inline review issues
@menvil menvil merged commit 72f71d5 into main Jun 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Triggers AI code review (CodeRabbit, Cubic)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant