Skip to content

Surface charged-back payments as admin navbar notifications - #7

Merged
acirtautas merged 1 commit into
mainfrom
chargeback-notification
Aug 5, 2026
Merged

Surface charged-back payments as admin navbar notifications#7
acirtautas merged 1 commit into
mainfrom
chargeback-notification

Conversation

@acirtautas

Copy link
Copy Markdown
Contributor

Problem

A chargeback deliberately never transitions the Sylius payment (the dispute is handled in the EveryPay merchant portal), but the only trace was a warning log entry from the synchronizer - invisible to shop staff. A charged-back order could go unnoticed until the accounting did not add up.

Change

  • New ChargedBackPaymentNotificationProvider (Sylius admin notification pipeline, tag sylius_admin.notification): every payment whose stored EveryPay state is charged_back appears in the admin navbar bell, newest first, capped at 10. The notification carries the order number and - for live payments - a link to the merchant portal (the configured white-label address, or the standard EveryPay portal). It stays visible until the dispute resolution callback updates the stored state.
  • The message is translated in the provider, so it renders complete under any notifications template.
  • The sylius_admin:navbar:notifications component template is swapped (via the existing twig-hooks file) for one with identical stock markup plus an optional link per notification; message-only notifications from other providers render exactly as before. If another plugin swaps the template again, only the link degrades away.
  • Wiring mirrors the shop-bundle seam: src/Notification/ is excluded from the service prototype and config/services/integrations/sylius_admin.php loads only when SyliusAdminBundle is registered - shopless/adminless containers keep compiling.
  • Portal-address resolution is extracted to EveryPayGateway::merchantPortalUrlFrom() (unit-tested); the state mapping and synchronizer are untouched.

Tests

  • 5 functional tests on the admin dashboard: live chargeback with default portal link, configured white-label address wins, demo payment gets the message without a link, no notification without chargebacks, a charged-back payment of another gateway is ignored.
  • Unit coverage for merchantPortalUrlFrom().

Translations

All four locales updated (en, lt, et, lv). Estonian and Latvian are machine-assisted: the chargeback phrasing ("makse vaidlustati" / "maksājums tika apstrīdēts") deserves a native check - the intent is "the payment was disputed/charged back".

Gates

phpunit (both suites), phpstan level 9, ecs, behat --strict - all green, also under composer update --prefer-lowest --prefer-stable.

A chargeback deliberately never transitions the Sylius payment - the
dispute is handled in the EveryPay merchant portal - but the only trace
so far was a log warning that shop staff never see.

Every payment whose stored EveryPay state is charged_back now appears
in the admin navbar bell, with a link to the merchant portal for live
payments (the configured white-label address, or the standard EveryPay
portal). The notification provider is registered only when
SyliusAdminBundle is present, mirroring the shop-bundle seam, and the
notifications component template is swapped for one that can render an
optional link per notification - message-only notifications from other
providers render exactly as before.

The state mapping and the synchronizer stay untouched.
@acirtautas
acirtautas force-pushed the chargeback-notification branch from 41d5c8e to e670890 Compare August 5, 2026 13:19
@acirtautas
acirtautas merged commit c3fe7b9 into main Aug 5, 2026
8 checks passed
@acirtautas
acirtautas deleted the chargeback-notification branch August 5, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant