[BUG] User journeys bugs
1. Successful staff authentication redirects to a forbidden onboarding page
With onboarding incomplete, successful 2FA verification redirects the active staff account to /admin/setup-wizard, which responds 403. Navigating directly to Staff succeeds.
Reproduction steps
- Install a fresh instance and leave onboarding incomplete.
- Create an active staff account, enable 2FA, and sign in with its password and a valid authenticator code.
- Observe the landing page.
Expected behavior
A successful sign-in opens an administration page available to the account.
Actual behavior
The default redirect lands on a 403 Forbidden onboarding page; /admin/staff is accessible when requested directly.
Repository: OwnPay Branch: dev Environment: Testing
2. Logout is forbidden and leaves the staff session active
The 2FA-enabled staff account can access Staff after verification, but the account menu Logout submits to /admin/logout and receives 403. A subsequent request to the same protected page still shows the signed-in account.
Reproduction steps
- Sign in as the active staff account with 2FA and enter a valid authenticator code.
- Open /admin/staff, open the user menu and select Logout.
- Request /admin/staff again.
Expected behavior
Logout ends the session and the protected page requires authentication.
Actual behavior
Logout returns 403 and the protected staff page remains accessible under the same account.
Repository: OwnPay Branch: dev Environment: Testing
3. Invoice print view shows zero for nonzero line amounts
The print endpoint rendered an HTML invoice with both line amounts as 0.00 even though the invoice contains 50.00 and 25.00 items and totals 75.00.
Reproduction steps
- Create an invoice with two items priced 50.00 and 25.00.
- From Invoices, select Print and inspect the line item amounts.
Expected behavior
The printed invoice shows the saved line amounts.
Actual behavior
Both line amounts display 0.00 while the invoice total displays 75.00 BDT.
Repository: OwnPay Branch: dev Environment: Testing
4. Invoice forms lack tax and discount inputs
The creation and editing forms provide no tax or discount controls, preventing an administrator from issuing the requested invoice with those amounts.
Reproduction steps
- Sign in as the brand administrator and open Invoices → Create Invoice.
- Inspect the invoice details and line item fields, then open an existing invoice for editing.
Expected behavior
The administrator can specify tax and discount when issuing the invoice.
Actual behavior
Neither form exposes tax or discount fields.
Repository: OwnPay Branch: dev Environment: Testing
5. Manual checkout submission does not auto-complete a matching SMS claim
A checkout with a unique, pending parsed SMS for the same brand, reference and exact amount remained awaiting verification. The SMS remained unlinked. The checkout submission stores payment details and leaves the transaction awaiting verification instead of invoking the review verification path.
Reproduction steps
- Create a pending 100.00 manual payment and a unique pending parsed SMS for the owning brand with the same reference and amount inside the match window.
- Open the checkout, choose the manual gateway, enter sender details and that reference, and select Verify Payment.
- Inspect the customer status and the transaction and SMS records.
Expected behavior
The eligible matching SMS completes the owning brand payment.
Actual behavior
The customer sees Awaiting Verification; the transaction remains awaiting_verification and the SMS remains pending and unlinked.
Repository: OwnPay Branch: dev Environment: Testing
6. Installer-generated reset link omits the local server port
On the documented PHP built-in server at port 8000, the installer generated APP_URL without the port. The password reset email consequently pointed at port 80 and could not be opened.
Reproduction steps
- Start a fresh installation with php -S 127.0.0.1:8000 -t public and complete the installer.
- Request a reset for the installed active account and open the captured email link.
Expected behavior
The received link reaches the application at its configured public address, including the non-default port.
Actual behavior
The message linked to http://127.0.0.1/reset-password without port 8000; the browser reported ERR_CONNECTION_REFUSED.
Repository: OwnPay Branch: dev Environment: Testing
7. Brand list displays the wrong currency
The first brand was submitted with USD. Its edit form shows USD, but the Brands list displays BDT for the same brand, making its configured currency misleading.
Reproduction steps
- Install a fresh instance and sign in.
- Complete the first-brand step with USD as the brand currency.
- Open People → Brands, then open the first brand for editing.
Expected behavior
The list displays the saved USD currency for the brand.
Actual behavior
The list displays BDT while the edit form displays USD.
Repository: OwnPay Branch: dev Environment: Testing
Triage
Duplicates: checked via similarity search — no confirmed duplicate. The closest matches (#681, #656, #40, #21) are different reports, so none is linked as a duplicate.
Related context: #606 (closed) documented that manual verification performed no server-side reconciliation; the fix landed on dev as ManualPaymentVerificationService, which is directly relevant to sub-bug 5 below.
All seven sub-bugs reproduce in the dev code and have concrete root causes. Findings and a concise implementation plan follow.
Plan (target branch: dev)
1. Staff 2FA lands on a 403 onboarding page
Cause: twoFactorVerify() hardcodes Response::redirect('/admin') (src/Controller/Admin/AuthController.php:299) instead of using resolvePostLoginPath() as login() does (:162). /admin then redirects to /admin/setup-wizard while onboarding is incomplete (src/Controller/Admin/DashboardController.php:120-122), and PermissionMiddleware::resolvePermission() default-denies unmapped /admin/* paths as the system.unmapped canary (src/Middleware/PermissionMiddleware.php:354-357), which no non-superadmin role holds → 403.
Fix: (a) use resolvePostLoginPath() in twoFactorVerify(); (b) in DashboardController::index(), redirect to the wizard only for superadmins, otherwise render the dashboard; (c) explicitly map /admin/setup-wizard in resolvePermission() instead of relying on the canary. Update tests/Integration/OnboardingRouteRedirectTest.php, which asserts the unguarded redirect.
2. Logout returns 403 and the session survives
Cause: /admin/logout (config/routes/web.php:61) is also unmapped, so POST resolves to system.unmapped → PermissionMiddleware returns 403 before AuthController::logout() ever runs. Only superadmins (bypass at PermissionMiddleware.php:172) can log out; the CSRF token is present, so this is not a CSRF failure.
Fix: special-case $path === '/admin/logout' to return null in resolvePermission() — logout must be available to every authenticated account. Add a unit test asserting the middleware calls $next for a non-superadmin staff POST.
3. Printed invoice shows 0.00 line amounts (total correct)
Cause: PdfService::generateInvoice() reads $item['amount'] ?? '0.00' (src/Service/System/PdfService.php:79), but op_invoice_items rows carry unit_price and total — the key never exists, so every line falls back to 0.00. The header total renders from invoice.total, which is why 75.00 shows correctly.
Fix: prefer $item['total'] ?? $item['unit_price'] ?? '0.00' for the Amount column. InvoiceService::generatePdf() is the only caller of generateInvoice().
4. Invoice forms lack tax and discount inputs
Cause: the backend already accepts them — InvoiceService::create()/update() normalize tax/discount and apply them to the total (src/Service/Payment/InvoiceService.php:179-182, 259-262) — but templates/admin/invoices/edit.twig (used for both create and edit) exposes no such fields, so they are always 0.00.
Fix: add tax and discount number inputs (op-input, step="0.01") to the Invoice Details card with {{ invoice.tax ?? '' }} / {{ invoice.discount ?? '' }} value binding; totals already recalculate server-side.
5. Manual checkout never auto-completes a matching SMS claim
Cause: the checkout "Verify Payment" popup posts to /checkout/{token}/pay with payment_details[...] (public/assets/js/checkout.js:511-528). The manual branch of CheckoutController::pay() claims the transaction as awaiting_verification, stores the details, and returns without firing checkout.manual_verify.submitted (src/Controller/Checkout/CheckoutController.php:716-740). The listener is wired (config/services.php:793-794) but only manualVerify() fires the event — and attemptVerification() additionally rejects any status other than pending_review (src/Service/Payment/ManualPaymentVerificationService.php:178), which pay() never sets. Result: SMS stays pending and unlinked.
Fix: in pay()'s manual branch, after persisting payment_details: build verifyData (sender_number, transaction_id, submitted_at), transition the transaction to pending_review, fire checkout.manual_verify.submitted, then redirect to the status page (a successful match completes the payment synchronously; otherwise it stays queued for admin review). Mirror in PaymentIntentCheckoutController::pay()'s manual branch (:756) for parity. Extend tests/Integration/ManualPaymentAutoVerifyTest.php (needs MySQL; runs in CI).
6. Installer reset link omits the port
Cause: InstallerController builds APP_URL preferring SERVER_NAME (src/Controller/Install/InstallerController.php:734-738). Under php -S 127.0.0.1:8000, SERVER_NAME is 127.0.0.1 without the port (HTTP_HOST has it but is deliberately not trusted — audit INST-10), so the reset email links to port 80.
Fix: append SERVER_PORT when it is not the scheme default (80/443), e.g. $port = (int) $req->server('SERVER_PORT'); — server-set, so the host-poisoning hardening stays intact.
7. Brands list shows BDT instead of the saved currency
Cause: MerchantRepository::listWithDomains() selects an explicit column list without default_currency (src/Repository/MerchantRepository.php:100-104), so {{ m.default_currency ?? 'BDT' }} in templates/admin/brands/index.twig:21 always falls back to BDT. The edit form reads the full row (find()), which is why it shows USD.
Fix: add m.default_currency to the SELECT.
Verification: composer test, composer analyse (PHPStan level 9), composer lint; note MySQL-dependent suites skip without a DB locally but run in CI. No code was changed and no PR was opened in this run.
Task list (4/4 completed)
- [x] Check duplicates for #688
- [x] Surface related issues
- [x] Investigate 7 sub-bugs in code (dev branch)
- [x] Post one concise enrichment response with plan

mimo-v2.6-flash-free (free) | 𝕏