Commit Graph
6683 Commits
Author SHA1 Message Date
renovate[bot] 5fa83e5ee1 Update dependency rector/rector to v2.5.7 2026-07-13 17:48:54 +00:00
Adam Daley 1f0393c5ca Render support ticket edit history as Markdown instead of raw source (#3970)
* Render support ticket edit history as Markdown instead of raw source

Follow-up to #3906: the edit history modal for admin ticket replies
showed the stored Markdown source verbatim in a <pre> block, unlike
the live message body which renders it to HTML. getMessageHistory()
now converts each revision's content with the same Markdown converter
used by the markdown_to_html Twig filter, and the modal renders that
HTML in a .markdown-body article to match the rest of the thread.

* Render edit history Markdown with admin theme defaults

ADMIN_AREA is only set true for admin panel page loads, not for
api/admin/... requests, so FOSSBillingMarkdown was picking up the
client theme's markdown_attributes when converting ticket message
history from the admin API endpoint. Let callers pass isAdmin
explicitly to bypass that runtime check.

Addresses review feedback from https://github.com/FOSSBilling/FOSSBilling/pull/3970
2026-07-13 18:47:42 +01:00
Adam Daley 7d18160e5a Fix Stripe webhook routing across shared accounts (#3969)
* Pass gateway identity to payment adapters

* Route Stripe webhooks to their originating gateway

* Test Stripe webhook gateway ownership

* Use DBAL for Stripe gateway ownership lookups

* Test DBAL gateway ownership fallbacks
2026-07-13 18:11:09 +01:00
Adam Daley 03ba524f8c Fix cancellation of Stripe subscriptions (#3968)
* Fix Stripe subscription cancellation

* Address subscription cancellation review feedback

* Address cancellation integrity review

* Handle missing Stripe subscription updates
2026-07-13 17:13:01 +01:00
Adam Daley b04055a16d Limit daily batch invoice reminders and adjust cron job order (#3965)
* Limit batch invoice reminders to once daily

* Run invoice generation before reminders in cron

* Isolate cron batch failures and reminder logs

* Track reminders and run fallback reminder pass

* Optimise invoice reminder queries and fix ordering

* Bump install default last_patch to 88

* Prevent duplicate invoice reminders via DB claim

* Harden cron failures and invoice reminders

* Restore broad due-event dispatch and surface cron failures to CLI

Move the reminded_at claim from the batch-level SQL into the built-in
onEventBeforeInvoiceIsDue/onEventAfterInvoiceIsDue handlers, and stop
filtering the due-date candidate queries by reminder interval. Extensions
listening to these events previously received every unpaid/approved due
invoice regardless of the reminder-interval configuration; narrowing that
in this PR's earlier claim-based fix silently broke that contract.
Duplicate-reminder protection is preserved because the handlers still
atomically claim each invoice before sending.

Also make src/cron.php and the cron:run console command honor
runCrons()'s boolean result: a partial failure (an isolated cron task
that threw) now exits non-zero / returns Command::FAILURE instead of
always reporting success, so cron monitors can detect it.

* Release reminder claims on send failure, trim log noise

Both onEventBeforeInvoiceIsDue and onEventAfterInvoiceIsDue now release
their reminded_at claim (reset it to NULL) if the email is never confirmed
queued, so a transient failure gets retried on a later cron run instead of
silently losing the reminder for the day. Also drops the now-redundant
second store() in onEventAfterInvoiceIsDue since the claim UPDATE already
persists reminded_at/updated_at.

Cron task failure logging now records exception class/message/file:line
instead of the full stack trace, to avoid flooding logs on recurring
failures. cron.php's failure message gets a trailing newline so it doesn't
run into subsequent terminal/log output.

* Stop EmailService from silently swallowing queue-persist failures

_queue() caught its own persist/flush exception and only logged it via a
raw error_log() call, so sendMail()/sendTemplate() always returned as if
the email had been queued even when nothing was actually persisted. For
onEventAfterInvoiceIsDue, this meant a transient DB error during queueing
would still leave the invoice's reminded_at claim in place with no way to
retry it, since no exception reached the handler's catch block.

Every other sendTemplate() caller already wraps it in its own try/catch
and logs failures with better context, so removing the swallow here lets
those exceptions surface as intended instead of vanishing before they can
be handled.

Also drop an unused $service variable in two Invoice ServiceTest cases.
2026-07-13 16:58:05 +01:00
Adam Daley e0a9731e97 Fix GROUP BY issue in product category query (#3964)
* Fix GROUP BY issue in product category query

* Refactor product category query filters
2026-07-13 08:50:12 +01:00
renovate[bot] cad789ebe0 Update dependency rector/rector to v2.5.6 2026-07-13 07:04:07 +00:00
renovate[bot] 07657cffc7 Update dependency league/commonmark to v2.8.3 2026-07-13 06:47:03 +00:00
Adam Daley 1db804d740 Harden Stripe webhooks and server manager input (#3962)
* Harden Stripe webhooks and server manager input

* Add `whsec` to cspell dictionary

Updates `cspell.json` to include `whsec` in the custom words list, preventing it from being flagged as a spelling error.

* Require Stripe webhook secret by mode
0.8.4
2026-07-11 17:12:01 +01:00
FOSSBilling BotandFOSSBilling Bot 6f50f133c8 Apply PHP Code Styling & Quality Changes (#3961)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2026-07-11 16:37:02 +01:00
Adam Daley 03b0303f81 Add 'Brien' to cspell.json dictionary (#3960) 2026-07-11 16:29:26 +01:00
137a10dbf3 Apply autofixes and update CODEOWNERS for code quality (#3959)
* Apply suggested fix to tests/Unit/FOSSBilling/RateLimiterTest.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 tests/Unit/FOSSBilling/RateLimiterTest.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/library/Server/Manager/Directadmin.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 tests/Unit/FOSSBilling/Api/AbstractApiTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Remove tests path from CODEOWNERS

* Apply suggested fix to src/modules/Order/Service.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Fix uncancel emails and zero-credit payments

* Preserve orders when invoice generation fails

* Fix RateLimiterTest CI failures from prior autofix commits

- Add a public RateLimiter::getStatus() so tests can read the token
  limit for a policy without hardcoding it (getRateLimitState() now
  reuses it).
- Fix consumeOrThrow test's toThrow() call: Pest expects the assertion
  closure as the first argument (with the exception type-hinted), not
  as a second argument alongside the class string.

* Fix DirectAdmin apostrophe entity decoding to avoid trailing semicolon

str_replace('&#39', "'", $data) also matched the fully-terminated
&#39; entity, replacing just the &#39 part and leaving the semicolon
behind (e.g. "O&#39;Brien" became "O';Brien"). Replace the terminated
form first, then the legacy unterminated form, so both decode to a
plain apostrophe.

* Fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

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 <175728472+Copilot@users.noreply.github.com>
2026-07-11 16:20:59 +01:00
renovate[bot] e6de5d87ee Lock file maintenance 2026-07-11 14:24:35 +00:00
Adam Daley 342e6a7e25 Allow invoice generation for zero-price orders (#3958)
* Allow invoice generation for zero-price orders

* Handle zero and negative order invoices
2026-07-11 15:22:37 +01:00
Adam Daley 268473ae5a Refine PayPal IPN callback handling (#3957) 2026-07-11 14:40:18 +01:00
renovate[bot] c2742a0b49 Pin dependencies (#3955)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-11 14:17:26 +01:00
Adam Daley 329cd522d7 Enhance star history display and clean up README (#3956)
Updated star history chart with responsive images and removed third-party work section.
2026-07-11 14:09:47 +01:00
Adam Daleyandcoderabbitai[bot] 4035563b72 Simplify API Resolution and Product Accessors Across Modules (#3954)
* Simplify service implementation

* Inject test API containers explicitly

* Update src/modules/Staff/tests/Unit/Api/GuestTest.php

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-07-11 13:17:03 +01:00
Adam Daley 3f0e8bf5db Enhance IP-based rate limit management UI and API (#3953)
* Add IP-based rate limit management UI & API

* Add pagination to rate limit counters

* Only track and show rate-limited IP counters

* Clarify rate limits UI text and simplify table

* Update rate limits admin request handling

* Gate rate limit reset UI by permission

* Refactor security rate limit listing

* Lock rate limit IP index updates
2026-07-11 12:21:46 +01:00
Adam Daley ca3625202a Add shared price validation for orders (#3952)
* Add shared price validation for orders

* Fix quantity validation and item update behavior
2026-07-11 11:37:38 +01:00
Adam Daley 7cd38132f1 Add 'tablesort' to cspell.json dictionary (#3951) 2026-07-11 08:36:21 +01:00
Adam Daley 0ac0cdafe0 Migrate frontend JavaScript to TypeScript (#3950)
* Migrate frontend JavaScript to TypeScript

* Fix Docker frontend TypeScript checks

* Address TypeScript migration review feedback

* Avoid duplicate cron system admin during patches
2026-07-11 08:07:26 +01:00
renovate[bot] a47d36adcc Update dependency stripe/stripe-php to v20.3.1 2026-07-11 05:29:48 +00:00
renovate[bot] 061fbfc80d Update dependency friendsofphp/php-cs-fixer to v3.95.13 2026-07-11 02:11:57 +00:00
renovate[bot] 4f98fe9d0d Update dependency rector/rector to v2.5.5 2026-07-09 19:25:30 +00:00
Adam Daleyandcubic-dev-ai[bot] 60ef50108d Fix duplicate domain activation from stale order object during checkout (#3948)
* Fix duplicate domain activation caused by stale order object

Cart checkout can activate an order that was already activated
synchronously via an invoice paid with account credit, since the
in-memory order held by the checkout loop is never refreshed after
the credit-payment path activates it through its own freshly-loaded
copy. activateOrder() now re-fetches the order before checking its
status, closing the gap that let EPP domain registration run twice
and fail with "Domain is not available: In use".

* Treat already-active orders as a no-op in activateOrder

The reload alone turned the stale-order race into a thrown exception
for orders that were already correctly activated by another code
path in the same request. Cart::checkoutCart()'s catch block then
tried to record an 'error' order status, which isn't a valid status
and threw a second exception that broke the whole checkout. An
already-active order (without force) should just be a no-op success.

* Update src/modules/Order/Service.php

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-07-09 16:13:13 +01:00
Adam Daley 81ae63c820 Fix undefined method error in UpdatePatcher after Doctrine migration (#3949)
PR #3863 migrated the Extension module to Doctrine and removed
Service::findExtension(), but missed three call sites in
UpdatePatcher.php that still used it. Users upgrading from 0.6.x
hit "Call to undefined method ...findExtension()" when these
update patches ran.
2026-07-09 15:43:50 +01:00
Adam Daley a54d94f570 Refactor API and frontend helpers with improved testing (#3947)
* Fix GET fetch body and DRY DirectAdmin fields

* Remove unused bindings in Support module

* Gate dashboard invoice and order cards

* Extract and test data-fb-api parser

* Refactor API helpers and add unit tests

* Extract link action and loading state helpers

* Refactor icon checks into tested helpers

* Refactor frontend helpers and slim tests

* Harden API CSRF handling and icon checks
2026-07-09 11:47:34 +01:00
Adam Daley 372ca39aa3 Fix crash on Product Promotions page for promo rows with NULL flags (#3946)
* Fix crash on Product Promotions page for promo rows with NULL flags

The `promo` table's maxuses/used/freesetup/once_per_client/recurring/
active columns are nullable in the DB, but the Doctrine entity mapped
them as non-nullable typed properties. When a row (typically from a
legacy install) has NULL in one of these columns, Doctrine's
TypedNoDefaultPropertyAccessor unsets the property instead of applying
the PHP default, so any read throws "must not be accessed before
initialization" — crashing the admin Product Promotions page.

Align the entity mapping with the actual nullable schema and coalesce
null to the intended defaults in the getters and toApiArray().

Fixes #3942

* Coalesce NULL used counts in promo usage SQL

promoCanBeApplied() now treats a NULL used column as 0, but
PromoRepository's raw SQL for incrementing/decrementing usage did not:
`used + 1` and `GREATEST(used - ?, 0)` both propagate NULL in MySQL,
and `maxuses > used` is unknown (never true) when used IS NULL. That
let checkout accept a legacy promo with a NULL used count and then
immediately fail to reserve it, throwing "maximum number of uses
reached". Coalesce used to 0 in both the SET and WHERE clauses so
reservation matches what promoCanBeApplied() already allows.
2026-07-09 10:00:44 +01:00
Adam Daley 457f2e85ab Use zstd compression for Docker image artifacts (#3945) 2026-07-09 07:35:52 +01:00
Adam Daley c6e6ad0e09 Optimise CI workflows with ubuntu-slim and Docker caching (#3944)
* Use ubuntu-slim in GitHub workflows

* Optimize CI Docker caching and test startup
2026-07-09 06:44:36 +01:00
renovate[bot] 5e6ba4610d Update actions/labeler digest to b8dd2d9 2026-07-09 04:48:08 +00:00
0eb6610f5a Apply PHP Code Styling & Quality Changes (#3940)
* Apply PHP Code Styling & Quality Changes

* Fix fingerprint PHPStan error

---------

Co-authored-by: FOSSBilling Bot <fossbilling-bot>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2026-07-09 05:44:18 +01:00
renovate[bot] 052856a4fa Update github/codeql-action digest to 99df26d 2026-07-09 04:11:51 +00:00
Adam DaleyandCopilot Autofix powered by AI 5c65c7e191 Fix for 1 code quality finding in admin theme (#3943)
Apply suggested fix to src/themes/admin_default/html/mod_index_dashboard.html.twig from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-09 05:10:51 +01:00
renovate[bot] c36666f802 Update dependency friendsofphp/php-cs-fixer to v3.95.12 2026-07-08 05:45:22 +00:00
renovate[bot] af9f63d3f1 Update composer:2 Docker digest to 5946476 2026-07-08 01:33:01 +00:00
Adam DaleyandCopilot Autofix powered by AI bf607e3baf Fixes for 2 code quality findings in i18n tests (#3939)
* Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.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 tests/Unit/FOSSBilling/i18nTest.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>
2026-07-07 09:27:44 +01:00
Adam DaleyandCopilot Autofix powered by AI 76aebab95a Fixes for 2 code quality findings in admin_default theme (#3938)
* Apply suggested fix to src/themes/admin_default/html/mod_index_dashboard.html.twig 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/themes/admin_default/html/mod_index_dashboard.html.twig 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>
2026-07-07 08:23:48 +01:00
Adam Daley b1195d4b5d Remove legacy class header template (#3937)
* Remove legacy class header template

* Remove unused legacy class header template

* Revert "Remove unused legacy class header template"

This reverts commit 41c5bd9454.
2026-07-07 08:15:40 +01:00
Adam Daley ba988ecf04 Use ribbons for suspended status badges (#3936) 2026-07-07 07:40:40 +01:00
Adam DaleyandCopilot Autofix powered by AI 2d0e476ee2 Fix for 1 code quality finding in i18n tests (#3935)
Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 07:20:20 +01:00
Adam Daley fe7d293df4 Refactor to use Request object for locale and cookie handling (#3934)
* Use Request object instead of superglobals

* Use Request in locale resolution

* Queue cookies and remove direct header writes

* Fix flaky i18nTest: de_DE locale isn't installed in CI

CI builds with INSTALL_TRANSLATIONS=false, so only en_US exists on
disk and getLocales() never considers de_DE "enabled". Use en_US as
the cookie value (always installed) against a different config
default to still prove the cookie takes precedence.
2026-07-07 07:01:45 +01:00
Adam Daley 1f70144e71 Speed up CI: share Docker test image, dedupe PHPStan, fix cache contention (#3933)
* Speed up CI: share Docker test image, dedupe PHPStan, fix cache contention

live-tests and cypress-tests each independently rebuilt the same PHP 8.5
test image already built by the php-build-test matrix, paying for a
registry-cache pull each time. Build it once, export it as a workflow
artifact, and have live-tests/cypress-tests just docker load it.

PHPStan analyzes source, not runtime behavior, so running it identically
across all 3 PHP versions in the matrix was pure duplication. Now it runs
once, on PHP 8.3.

php-build-test-push and preview-build-push wrote to the shared GHCR
registry cache on every push to every branch, not just main. Concurrent
branch pushes (including frequent bot autofix branches) could stomp on
each other's cache entries, degrading hit rates for everyone. Cache
writes are now restricted to main; other branches read-only, same as the
existing PR path.

* Trim comment verbosity to match existing workflow style

The repo's existing workflow comments are single-line "why" notes; tighten
the multi-line ones added in the previous commit to match, and drop an
unused step id.
2026-07-07 06:34:37 +01:00
Adam DaleyandCopilot Autofix powered by AI 11fe0ca774 Fixes for 2 code quality findings in PayPalEmail adapter (#3932)
* Apply suggested fix to src/library/Payment/Adapter/PayPalEmail.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/library/Payment/Adapter/PayPalEmail.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>
2026-07-07 06:09:45 +01:00
Adam DaleyandCopilot Autofix powered by AI e2e9ff1125 Fixes for 2 code quality findings in RouterMatcherTest (#3930)
* Apply suggested fix to tests/Unit/FOSSBilling/RouteMatcherTest.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 tests/Unit/FOSSBilling/RouteMatcherTest.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>
2026-07-07 06:00:42 +01:00
Adam DaleyandCopilot Autofix powered by AI d6c21c4b4a Fixes for 2 code quality findings in PayPalEmail adapter (#3931)
* Apply suggested fix to src/library/Payment/Adapter/PayPalEmail.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/library/Payment/Adapter/PayPalEmail.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Fix syntax error from orphaned brace in PayPalEmail adapter

A prior autofix commit closed the `payment_status == 'Completed'` if-block
early with an else/break, but left the block's original closing brace in
place, breaking the rest of the switch statement.

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 05:53:20 +01:00
Adam DaleyandCopilot Autofix powered by AI 7c5699be80 Fixes for 4 code quality findings in PayPalEmail adapter (#3929)
* Apply suggested fix to src/library/Payment/Adapter/PayPalEmail.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/library/Payment/Adapter/PayPalEmail.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/library/Payment/Adapter/PayPalEmail.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/library/Payment/Adapter/PayPalEmail.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>
2026-07-07 05:28:07 +01:00
Adam Daley 85cd7aac2a Modernize HTTP response flow (#3928)
* Modernize HTTP response flow

* Fix route matcher test spelling
2026-07-07 05:15:39 +01:00
Adam Daley 50d315406b Prevent duplicate PayPal subscriptions on repeated subscr_signup IPNs (#3927)
PayPal can resend/duplicate the subscr_signup IPN for a subscription,
and the handler had no idempotency check before creating a new
Subscription row (unlike subscr_payment, which is well-guarded). This
could result in duplicate subscription records and duplicate renewal
notifications, matching reports on issue #3055.
2026-07-07 04:52:35 +01:00