Introduces comprehensive recurring payment support to the Stripe payment
gateway using Stripe Setup Intents, Subscriptions, and webhook events.
Key changes:
- Add supports_subscriptions capability and webhook_secret config fields
- Generate subscription forms using Setup Intents + Stripe Elements
- Process subscription setup via Setup Intent redirect callback
- Handle subscription lifecycle via webhooks (created/updated/deleted)
- Handle recurring payments via invoice.payment_succeeded webhook
- Verify webhook signatures using Stripe signing secret
- Generate renewal invoices for recurring subscription payments
- Support JSON webhook payloads in ipn.php (skip_validation)
Security:
- Webhook signature verification via Stripe\Webhook::constructEvent()
- XSS-safe escaping of buyer name/email in subscription form HTML
Follows existing patterns from PayPal adapter and incorporates all
recent Stripe improvements (claimForProcessing, invoice approval,
deposit-type checks, Model_Transaction status constants).
Ref: #2828
* Migrate the knowledge base to Doctrine
* Addressed code review comments
* Move incrementViews to the repo
* Knowledge base suggestions in support forms
* Improve the UI and make search actually search
* Make the knowledge base enabled on new installs by default
* Redid the kb index to list articles alongside categories
* Display articles in admin manage category
* Redirect authenticated users from guest ticket page to client ticket page
* Address code review comments
* Addressed code review comments
* Improved search accuracy by tokenizing queries
* Updated article layout and added CTAs
* Added a setting to toggle view count's visibility
* Removed contact button from the sidebar
* Migrate canned responses to Doctrine and improve admin UI
* Improved support settings canned dropdowns
* Added a flag to hide view count when serializing
* Improved search query matching
* Migrate SupportHelpdesk to Doctrine
* Fixed tests
* Update copyright headers
* Implemented suggestions (credit @admdly)
* Remove dead test
* fix(Servicedomain): require_once registrar adapter file before class_exists check
Third-party registrar adapters uploaded after installation are absent from
Composer's static class map (generated with --optimize-autoloader), causing
class_exists() to return false even when the file is present on disk.
Mirror the pattern used by Payment adapters in ServicePayGateway: require_once
the adapter file when the class is not yet loaded, then re-check class_exists
to keep a clear error for adapters that define no class.
Fixes#3828
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mCNdqXfyuD2n1bjFK5zsv
* fix: require_once adapter/manager files before class_exists checks
Payment adapters, server managers, and the server_manager DI factory all
relied on Composer's classmap for dynamic class resolution. With
--optimize-autoloader the classmap is static, so third-party files dropped
into src/library/ after installation are invisible to class_exists().
AntLoader (removed in #3776) previously discovered these files on the fly;
this commit restores equivalent behaviour by requiring files explicitly:
- ServicePayGateway::getAdapterClassName() now checks both nested-dir and
flat file formats before falling back, replacing the blind `include`
- Servicehosting/Service::getServerManagerConfig() require_onces the
manager file before calling is_callable() so the class is guaranteed
present; Server_ has no PSR-0 entry so this also fixes non-optimised builds
- di.php server_manager factory require_oncess the manager file when the
class is absent from the classmap (adds Path import accordingly)
Registrar adapter loading was fixed separately in the prior commit.
Related to #3828
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mCNdqXfyuD2n1bjFK5zsv
* fix: address code-review findings on adapter/manager class loading
- Servicehosting getServerManagerConfig: wrap require_once in try/catch
so a PHP parse error in a manager file returns [] instead of fataling
the entire manager-list API call (restores old is_callable() behaviour)
- di.php server_manager factory: replace file_exists() with Symfony
Filesystem::exists() per CLAUDE.md convention; extract the repeated
ucfirst((string) $manager) call to a local $managerName variable; add
Filesystem use-import alongside the existing Path import
- composer.json: add Server_ to the psr-0 autoload entries alongside
Payment_ and Registrar_, giving server managers the same architectural
treatment and making the require_once guards defensive fallbacks rather
than the only load path
- ServicePayGateway getAdapterConfig: remove the redundant filesystem
existence re-checks (lines 386-390) that duplicated what
getAdapterClassName() just did; collapse into a single class_exists()
guard with the user-facing :adapter placeholder message
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mCNdqXfyuD2n1bjFK5zsv
* fix(tests): update ServicePayGateway tests to match refactored getAdapterConfig
After refactoring getAdapterConfig() to delegate filesystem lookups to
getAdapterClassName(), the tests were failing because:
- Three tests had atLeast()->once() expectations on filesystem->exists()
that the method no longer calls directly
- One test expected an error message with the full class name, but the
refactored code uses $pg->gateway (the gateway code) in the message
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mCNdqXfyuD2n1bjFK5zsv
---------
Co-authored-by: Claude <noreply@anthropic.com>
* fix(support): preserve < and > in ticket/KB messages by using Markdown-safe sanitization
The WYSIWYG editor (CKEditor) uses the Markdown plugin, so ticket replies
and KB article bodies are stored as Markdown, not HTML. Calling the Symfony
HTML Sanitizer on Markdown content silently corrupts it: when a user types
text containing an unknown tag-like string such as `<World>`, the sanitizer
treats it as an unknown HTML element, drops it, and—because there is no
closing tag—also drops everything that follows, causing the rest of the
message to disappear.
Fix by introducing `Tools::sanitizeMarkdownContent()`, which only strips
null bytes and trims whitespace. XSS protection is already provided at
render time by the `|markdown_to_html` Twig filter, whose underlying
CommonMark converter is configured with `html_input: escape`—any raw HTML
inside the stored Markdown is therefore escaped before it reaches the
browser.
Affected endpoints (all now use the new helper):
- Admin: ticket_reply, ticket_create, kb_article_create, kb_article_update
- Client: ticket_create, ticket_reply
- Guest: ticket_create, ticket_reply
Fixes#3827
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBnxaZxj968uFFbgoSocLZ
* fix(spellcheck): use American English spelling "unrecognized"
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBnxaZxj968uFFbgoSocLZ
* fix(support): apply markdown-body styling to admin ticket and client KB article views
The admin ticket conversation and client KB article content were rendered
with |markdown_to_html but without the markdown.css stylesheet or the
markdown-body CSS class required by github-markdown-css. This caused
inline code, fenced code blocks, and other Markdown elements to appear
unstyled (admin) or miscontainerised in a list-group div (client KB).
- Admin ticket: load markdown.css in <head> and wrap message content in
<article class="markdown-body bg-transparent text-reset">
- Client KB article: load markdown.css in <head> and replace the
list-group wrapper with <article class="markdown-body bg-transparent
text-reset">
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBnxaZxj968uFFbgoSocLZ
---------
Co-authored-by: Claude <noreply@anthropic.com>
* Fix MySQL 8.0.22+ REGEXP charset conflict in patches 67 and 74
MySQL 8.0.22+ changed the REGEXP implementation to use ICU internals,
which rejects operands with mismatched character sets. Using `BINARY hash`
(producing binary charset) alongside a pattern literal with the session
charset (e.g. utf8mb3_general_ci) triggers:
SQLSTATE[HY000]: General error: 3995 Character set 'binary' cannot be
used in conjunction with 'utf8mb3_general_ci' in call to regexp_like.
Replace `BINARY hash NOT REGEXP '^[a-f0-9]+$'` in both patches with
`CAST(hash AS BINARY) NOT REGEXP _binary'^[a-f0-9]+$'`, making both
operands explicitly binary. This preserves the original case-sensitive
matching behaviour while being compatible with MySQL 8.0+ and MariaDB.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PNZCQ7v3gm6fc6t98TyZGP
* Fix invoice hash regexp charset handling
---------
Co-authored-by: Claude <noreply@anthropic.com>
* Apply suggested fix to src/modules/Invoice/tests/Unit/ServiceTest.php from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Apply suggested fix to src/modules/Invoice/tests/Unit/ServiceTest.php from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Apply suggested fix to src/modules/Invoice/tests/Unit/ServiceTest.php from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
---------
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Apply suggested fix to src/modules/Invoice/tests/Unit/ServiceTest.php from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Apply suggested fix to src/modules/Invoice/tests/Unit/ServiceTest.php from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
---------
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Merge public ticket logic into regular client tickets
* Unified email templates
* Unified events and listeners
* Remove passthrough service methods
* Corrected phpDocs
* Create a combined `author` array to replace `client`, `client_id`, `author_name`, `author_email`
* Switch to using "Author" instead of "Requester"
* Switch to using a single endpoint and single template for client and guest tickets
Also left a redirect behind to make sure previously sent emails still have a working link
* Add author_role parameter to onBeforeClientOpenTicket
* Adjusted rate limit ordering
* Update Twig templates and the update patcher
* "Public ticket" -> "Guest ticket"
* Addressed code review comments
* Address code review comments
* Also purge old pticket email templates
* Fix email sending
* Support: enforce auth, fix guest email links
* Migrate mod_support config key name
---------
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
* Migrate product models; add `promo_redemption`
* Add DomainPricing & ProductOrder repositories
* Use Promo entity typehints and update tests
* Use DI logger, validate order config, update tests
* Replace `error_log` with logger; use stubs in tests
* Use attachOrderConfig and tighten service checks
* Clarify domain defaults and remove deprecated doc tag
* Add missing indexes to `promo_redemption` table
* Enrich promo API arrays and add redemption filters
* Various UI/JS fixes and template cleanups
* Log invoice issues as warnings; expose form_id
* Normalize spelling in UpdatePatcher comment
* Remove checkLimits production method and clean up stale test mocks
* Use getConfig() and add promo permission
* Use container logger directly, remove helpers
* Use defaults for optional Twig settings
* Import macro_functions into admin template
* Compensate promo redemptions on checkout failure
* 🐛 Fix product category and add-on availability handling
* Apply suggested fix to src/modules/Invoice/tests/Unit/ServiceTest.php from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Apply suggested fix to src/modules/Invoice/tests/Unit/ServiceTest.php from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Apply suggested fix to src/modules/Invoice/tests/Unit/ServiceTest.php from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Apply suggested fix to src/modules/Invoice/tests/Unit/ServiceTest.php from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
---------
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* Replace hardcoded recurrent pricing rows with a loop
* Replace long if chain with a Twig map
* Remove unnecessary uninstall method for Branding
* Remove dead `createServicePlan` method in Plesk adapter
* Make setDi() disallow passing null
This would actually match what's expected in InjectionAwareInterface.
---------
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
* huraga: Automatically display linked tab
* huraga: Accept a `hash` value in pagination partial
* Use hash-based tab behavior rather than local workarounds
---------
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>