# BCP — Development Status & Handoff Record

| Attribute | Value |
| :--- | :--- |
| **Project** | BCP (Bindu Control Panel) |
| **Active Phase** | **Phase 15: Per-product SaaS billing screens (COMPLETE)** |
| **Next Phase** | **Owner's choice — see section 19** |
| **Framework & Engine** | Laravel 12.67.0 / PHP 8.3.33 / PostgreSQL 17.11 |
| **Last Updated** | 2026-09-25 |

---

## 1. Phase Completion Matrix

| Phase | Description | Status | Verification |
| :--- | :--- | :--- | :--- |
| **Phase 1** | **Project Foundation & Setup** | ✅ **COMPLETE** | Laravel 12 initialized, PostgreSQL connected, base migrations run, layouts created. |
| **Phase 2** | **Multi-Tenant Core & Org Management** | ✅ **COMPLETE** | Tenant model, `TenantScope`, `BelongsToTenant`, domain/header resolver middleware, Super Admin CRUD, isolation verified. |
| **Phase 3** | **Products, Plans & Subscriptions** | ✅ **COMPLETE** | Products, Plans, Subscriptions, Invoices, Payments, Discount engine, Gateway abstraction, full lifecycle. |
| **Phase 4** | **Licensing Engine & REST API** | ✅ **COMPLETE** | Versioned REST API (`/api/v1/`), SHA-256 Bearer Token auth, License Verification, Webhook engine, Rate limiting, Audit logging. |
| **Phase 5** | **Super Admin & Customer Hub (360°)** | ✅ **COMPLETE** | Central Customer Account Profile, 360° View aggregating linked tenants, plans, invoices, licenses, and support tickets. |
| **Phase 6** | **Support Desk & Unified Inbox** | ✅ **COMPLETE** | Unified Inbox, `SupportTicket` models, `TicketMessage` thread, automatic department routing, SLA fields, staff assignment, internal notes, customer isolation. |
| **Phase 7** | Audit, Security Hardening & Alerts | ✅ **COMPLETE** | Chained immutable admin audits, API rate limits, security-event alerts, and review workflow verified. |
| **Phase 8** | Customer Self-Service Portal & Operational Reporting | ✅ **COMPLETE** | Customer authentication, customer-owned service/support views, tenant-safe access controls, and CSV reports verified. |
| **Phase 9** | Manual Bank Payment Workflow | ✅ **COMPLETE** | Customer bank-reference submission, pending review, audited approval/rejection, atomic settlement, and tenant isolation verified. |
| **Phase 10** | ShurjoPay Checkout & Reconciliation | ✅ **COMPLETE** | Hosted checkout, server-to-server verification, callback handling, gateway sweep, payment links. Live in production. |
| **Phase 11** | SMS Credit Control | ✅ **COMPLETE** | Packages, purchase orders, balances, message logs, admin review queue, POS-facing balance API. |
| **Phase 12** | BinduHost — Domains & Hosting | ✅ **COMPLETE** | Domain pricing, web hosting catalogue, cart, checkout, orders turned into service records, public catalogue deep links. |
| **Phase 13** | Admin UI Redesign & Dashboard | ✅ **COMPLETE** | Light workspace with a dark rail, brand palette, super-admin dashboard on real data, dashboard as the post-login landing page. See sections 14-16. |
| **Phase 14** | BMart SaaS Billing | ✅ **COMPLETE** | Entitlement API, signed webhooks with idempotency and retry, shop linking, plan entitlements, admin screens. See sections 17-18. |
| **Phase 15** | Per-Product SaaS Billing Screens | ✅ **COMPLETE** | Every product BCP bills for managed from the sidebar, driven by the Product table. See section 19. |

---

## 2. Completed in Phase 6
* **Support Ticket Infrastructure:**
  * Created Enums: `TicketDepartment`, `TicketPriority`, `TicketStatus`.
  * Updated `SupportTicket` model with SLA fields (`sla_due_at`, `first_responded_at`, `resolved_at`).
  * Migrated `ticket_messages` and `ticket_attachments` tables.
* **Unified Inbox & Departments:**
  * Auto-routing based on product or category string (`Hosting`, `Sales`, `Billing`, `Technical`, `General`).
  * Index view with filtering (by Status, Department, Assignee, Search).
  * Fast tracking of unassigned and urgent tickets.
* **Ticket Messaging & Collaboration:**
  * Conversation threads capturing staff and customer replies.
  * Internal staff notes feature (hidden from customers).
  * Status auto-transitions (e.g., `Waiting for Customer` $\rightarrow$ `In Progress` upon reply).
* **Super Admin UI:**
  * `SupportTicketController` handling assignment, replies, resolution, and inbox lists.
  * Responsive Blade views (`admin/tickets/index.blade.php`, `admin/tickets/show.blade.php`).
* **Automated Verification:**
  * Validated through `SupportDeskTest` testing routing, inbox filters, staff assignments, internal notes, and lifecycle resolution.

---

## 3. Database & Migration State
* **Database Driver:** `pgsql` (PostgreSQL 17.11, database `bcp_control_panel`)
* **Phase 8 Migration:** `2026_08_25_000019_add_customer_portal_access_to_users_table` adds the nullable customer-user relationship and portal-access flag. It passes in the automated SQLite migration suite.
* **PostgreSQL Verification:** `php artisan migrate:status` connected successfully to PostgreSQL 17.11. No migrations are pending; Phase 7 and Phase 8 migrations (`000018`, `000019`) are applied.

---

## 4. Tests & Verification Summary
* Tenant-scoped webhook idempotency verification: `13 passed (53 assertions)` covers same-tenant atomic duplicates, cross-tenant key reuse, HMAC ordering, token scopes, audit redaction, and `429` responses.
* Support reply attribution verification: `10 passed (44 assertions)` covers authenticated actor attribution, internal notes, audit logging, guest/staff denial, and ticket-bound tenant separation.
* Manual bank payment verification: `9 passed (48 assertions)` covers customer ownership, pending submissions, duplicate references, approved settlement, rejected payments, subscription reactivation, audit records, forged ownership input, and cross-invoice isolation.
* Complete suite: `89 passed (392 assertions)` in `3.51s`. Tenant isolation, API licensing/security, audit/security, Support Desk, lifecycle scheduling, portal, and manual bank payment tests all pass.

---

## 5. Post-Phase 8 Critical Authorization Remediation
* `/admin/*` now requires an authenticated, active user with the `super_admin` role before administrative audit middleware runs.
* `/tenant-app/profile` now requires an authenticated, active customer-portal user with an active customer account. Tenant resolution may use the request header, but authorization compares the resolved tenant's persisted `customer_id` with the authenticated user's `customer_id`.
* `AuthorizationBoundaryTest` covers both rejection and permitted access paths. Existing route tests now explicitly authenticate the appropriate super-admin or owning portal user.
* *(Historical note: written before Phase 9 shipped. Phase 9 and everything through Phase 15 are complete — see the matrix above.)*

## 6. Post-Phase 8 RBAC Hardening
* The centralized `access-admin` gate allows only active users whose persisted role is `super_admin`; request input never supplies authorization roles.
* The existing `super.admin` middleware enforces that gate before `admin.audit` for the complete `/admin/*` group, covering all administrative controllers and actions.
* Protected mutations include tenant lifecycle changes; product, plan, customer, license, and subscription changes; invoice payments; API-token creation, rotation, and revocation; support updates, assignment, replies, and resolution; and security-event resolution.
* Focused tests confirm guest, staff, and inactive super-admin requests are rejected without state or audit-log changes, while an active super-admin can execute an audited mutation. Tenant-isolation regression tests remain passing.
* *(Historical note: written before Phase 9 shipped. Phase 9 and everything through Phase 15 are complete — see the matrix above.)*

## 7. Post-Phase 8 Production Security Configuration
* `.env.production.example` supplies secret-free production settings: `APP_ENV=production`, `APP_DEBUG=false`, HTTPS `APP_URL`, encrypted Secure/HttpOnly/Lax session cookies, PostgreSQL, and `verify-full` database TLS.
* Application defaults enable session encryption and secure cookies only in production, force HTTPS URL generation only in production, and accept forwarding headers only from explicitly configured `TRUSTED_PROXIES`.
* PostgreSQL supports `DB_SSLMODE`, `DB_SSLROOTCERT`, `DB_SSLCERT`, and `DB_SSLKEY`; local development retains `prefer` TLS mode and does not force HTTPS.
* **Deployment requirements:** inject all secrets outside source control; terminate public TLS; set the real HTTPS URL; set only known reverse-proxy IPs/CIDRs in `TRUSTED_PROXIES`; use PostgreSQL `verify-full` with a trusted CA and a hostname matching the certificate; then run `php artisan config:cache`.
* **Deployment attestation:** the secret-free production template contains the required production, HTTPS, PostgreSQL TLS, session-cookie, and trusted-proxy placeholders. An isolated dummy production boot verified `APP_DEBUG=false`, HTTPS URL generation, encrypted Secure/HttpOnly/Lax sessions, PostgreSQL `verify-full`, and a configured CA path; a disposable `config:cache` build completed and was cleared without leaving an artifact. The local environment remains HTTP, PostgreSQL `prefer`, non-secure/non-encrypted sessions, and no trusted proxies; `migrate:status` connected successfully with no pending migrations.
* **Release procedure:** after injecting the real deployment values, run `php artisan config:clear`, then `php artisan config:cache`, then restart the application workers/processes through the normal deployment mechanism. Required operator-supplied inputs remain the HTTPS origin/TLS terminator, exact proxy CIDRs/IPs, PostgreSQL CA path and hostname, and secret-manager/injection mechanism. Existing API rate-limit responses remain minimal JSON without traces; no secrets were printed during attestation.
* *(Historical note: written before Phase 9 shipped. Phase 9 and everything through Phase 15 are complete — see the matrix above.)*

## 8. Post-Phase 8 Subscription Lifecycle Scheduler
* `subscriptions:evaluate` evaluates trial, active, past-due, and grace subscriptions using `SubscriptionManager`; it generates recurring invoices and transitions expired grace deadlines to suspension without invoking payment gateways.
* The scheduler runs the command every five minutes with `withoutOverlapping(10)` and `onOneServer()` safeguards. Per-subscription database transactions and row locks make repeated/concurrent evaluations idempotent; a status transition occurs before any recurring invoice is created.
* The optional `--tenant=<id>` command argument supports scoped recovery runs without evaluating other tenants. The command processes failures independently, logs them, and exits non-zero if any evaluation fails.
* **Queue:** no queue worker is required for this synchronous lifecycle evaluation because it does not dispatch jobs, retry payments, or charge gateways. The existing database queue remains available for unrelated work.
* **Deployment requirement:** run Laravel's scheduler continuously (`php artisan schedule:work`) or invoke `php artisan schedule:run` every minute from the platform scheduler. Multi-server deployments require a shared cache store that supports locks for `onOneServer()`; the configured shared PostgreSQL database cache satisfies this when used by all nodes.
* **Operational verification:** `php artisan schedule:list` registered `subscriptions:evaluate` every five minutes, and `php artisan subscriptions:evaluate --help` confirmed only `--tenant` plus standard Artisan options; no safe `--dry-run` option exists, so the lifecycle command was not executed against current data. The effective cache and lock store is the existing `cache` table on PostgreSQL (`CACHE_STORE=database`, `pgsql`); it is suitable for `onOneServer()` only when every scheduler node uses that same shared database/cache store.
* **Runtime operation:** run `php artisan schedule:work` under a supervised service with restart-on-failure, or invoke `php artisan schedule:run` once per minute from the platform scheduler. Confirm one execution from supervisor/platform output and the `Evaluated {n} subscriptions; transitioned {n}; failed {n}.` summary; alert on a stopped/restarting scheduler, missed five-minute windows, a non-zero failed count, or `Subscription lifecycle evaluation failed.` log entries.
* *(Historical note: written before Phase 9 shipped. Phase 9 and everything through Phase 15 are complete — see the matrix above.)*

## 9. Backup and Disaster Recovery Readiness
* [Backup and Disaster Recovery Runbook](docs/BACKUP_AND_DISASTER_RECOVERY.md) defines PostgreSQL 17.11 logical backup, isolated restore-drill, and production recovery procedures for `bcp_control_panel`.
* Current recovery scope is PostgreSQL data, the matching immutable application release, and versioned secret-manager/certificate material. No customer uploads are currently persisted; add the active application disk or object-store bucket before enabling uploads.
* Recommended targets are encrypted four-hour backups, seven daily/eight weekly/twelve monthly retention, immutable off-site storage, quarterly restore drills, $RPO \leq 4$ hours, and $RTO \leq 4$ hours.
* **Restore drill verified:** PostgreSQL 17.11 `pg_dump` created a non-zero `116,048`-byte custom-format, zstd-compressed, no-owner/no-privileges archive of `bcp_control_panel`. `pg_restore --list` read the archive and confirmed Laravel migrations plus all required tenant, billing, licensing, webhook, audit, support, and security tables.
* The archive restored with `--exit-on-error` only to `bcp_control_panel_restore_drill`; it never restored over the live database. Source and restored schema table counts matched at $33$, migration counts matched at $23$, and safe key-row-count summaries matched. Laravel connected to the isolated restore with a process-only `DB_DATABASE` override and `php artisan migrate:status` reported no pending migrations.
* **Cleanup:** the guarded process dropped only `bcp_control_panel_restore_drill` and removed only the temporary archive. Post-cleanup verification confirms the live connection remains `bcp_control_panel`, the drill database and artifact are absent, and migrations remain complete. The measured restore, validation, and cleanup phase took $2.37$ seconds; retain the $RPO \leq 4$ hours and $RTO \leq 4$ hours targets until a production-like timed recovery, encryption, transfer, and file-recovery exercise validates them.
* *(Historical note: written before Phase 9 shipped. Phase 9 and everything through Phase 15 are complete — see the matrix above.)*

## 10. API and Webhook Operational Resilience
* Webhooks require a valid HMAC-SHA256 signature over the raw request body before idempotency handling. Timing-safe comparison is retained; missing and invalid signatures return `401` and produce security events without recording secrets.
* `X-Idempotency-Key` is required and atomically enforced by the tenant-scoped `webhook_events(tenant_id, idempotency_key)` database uniqueness constraint. Duplicate-key conflicts return `duplicate_skipped` only for the owning resolved endpoint tenant, including concurrent delivery races, without creating a second event or business effect.
* Webhook records retain only payload hash, byte count, and content type; raw signatures and payload bodies are not persisted. API audit logs retain endpoint/response metadata but no query or request payload values.
* API limits remain `60/minute` per bearer-token hash or IP, and webhook limits remain `120/minute` per IP. Throttling now occurs before authentication/signature work, so changing tenant identifiers or invalid credentials cannot choose a different limiter bucket. API `429` responses are minimal JSON without traces.
* Revoked and expired tokens remain rejected; scopes are enforced server-side. Existing tenant context comes exclusively from the token, and cross-tenant license requests remain denied.
* **Queue/retry:** inbound webhooks currently persist a durable intake record only and dispatch no jobs. Sender retries/replays must use the same signed idempotency key. No queue worker was added; introduce a durable job and supervised worker only when an asynchronous webhook business-effect handler is implemented.
* *(Historical note: written before Phase 9 shipped. Phase 9 and everything through Phase 15 are complete — see the matrix above.)*

## 11. Tenant-Scoped Webhook Idempotency
* Migration `2026_08_25_000020_scope_webhook_idempotency_keys_to_tenants` replaces the global `idempotency_key` unique constraint with `UNIQUE (tenant_id, idempotency_key)` without deleting webhook events.
* **Preflight:** the configured PostgreSQL database had `0` duplicate `(tenant_id, idempotency_key)` pairs before migration. The migration ran successfully; `php artisan migrate:status` reports no pending migrations.
* The atomic duplicate conflict lookup uses the tenant from the HMAC-verified `WebhookEndpoint`, not a request-supplied tenant value. Two tenants may use the same key; a repeat within one tenant skips safely and creates no second event.
* HMAC validation, rate limiting, API audit redaction, token scopes, and token-derived tenant isolation remain unchanged.
* *(Historical note: written before Phase 9 shipped. Phase 9 and everything through Phase 15 are complete — see the matrix above.)*

## 12. Support Reply Actor Attribution
* `SupportTicketController::reply()` now derives the author exclusively from `$request->user()` and records that authenticated user's ID. Request `user_id` input is ignored for attribution.
* The existing `super.admin` middleware rejects guests and users who do not satisfy the active `super_admin` Gate. The controller repeats the same check before creating a message, so a missing or unauthorized actor cannot create a reply through this action.
* Staff replies and internal notes retain the acting administrator ID. The surrounding `admin.audit` middleware continues to record the same authenticated actor for successful mutations.
* The reply remains bound to the routed ticket; submitted tenant data cannot direct a message to another tenant's ticket. Department routing, SLA updates, customer reply behavior, and internal-note privacy are unchanged.
* *(Historical note: written before Phase 9 shipped. Phase 9 and everything through Phase 15 are complete — see the matrix above.)*

## 13. Handoff Notes for Next AI Model / Session
* **PostgreSQL Engine:** PostgreSQL 17.11 remains the official database (`DB_CONNECTION=pgsql`).
* **Manual bank payments:** customer submission creates a pending `manual` payment only. An active super-admin must approve it before the invoice and subscription settle; rejection marks the payment failed.
* **Provider boundary:** bKash, Nagad, SurjoPay, and all other external provider integrations remain unimplemented.

---

## 14. Admin Panel UI/UX Redesign — 2026-09-09

**Status: COMPLETE for the layout, the design system, the dashboard and the
tenant directory. Not a functional change — no migration, no dependency, no
business rule, no permission and no route was removed.**

> ⚠️ Sections 1–13 above were last written on 2026-08-25 and have not been
> maintained since. They still describe ShurjoPay, BinduHost and two-factor
> authentication as unimplemented; all three have shipped and ShurjoPay is
> live in production. Treat the phase matrix as historical, not current, until
> somebody reconciles it against the git log. That reconciliation is a separate
> task and was deliberately not attempted here.

### What was wrong

The panel was dark-first: a near-black workspace where a dark card sat on a
darker ground. Everything was legible but nothing was prominent, and it read as
a developer console rather than as a control plane somebody runs a business
from. There was also **no dashboard at all** — signing in dropped an
administrator into the tenant table, which answers "who are my customers" and
nothing else.

### Audit before implementation

| Area | Classification | Finding |
| :--- | :--- | :--- |
| Layout shell, sidebar, topbar | **Partial** | Structurally sound. The sidebar was already declared as data in one array, which is why re-styling it touched no route. |
| Colour system | **Partial** | One palette already existed in `resources/css/app.css` and already re-mapped slate/indigo across the panel. The dark end was the problem, not the mechanism. |
| Shared admin components | **Missing** | 66 admin views, and not one shared card, table or badge component between them. Every page styles itself with raw utilities. |
| Super admin dashboard | **Missing** | No route, no controller, no view. `/admin` returned 404. |
| Tenant directory | **Complete (functionally)** | Search, status filter, metrics and actions all worked; only presentation was changed. |
| Flipping the panel to a light theme | **Risky** | ~2,200 hard-coded dark-assuming utilities across those 66 views. Editing them page by page would have been the actual rewrite this task forbids. |

### How the light workspace was done without editing 66 views

`resources/css/app.css` gained two theme scopes. Utilities resolve their colour
through a variable at the point of use, so redefining the variables on an
ancestor re-themes everything below it:

* `.theme-bcp-light` on the admin `<html>` turns the neutral ramp over —
  `bg-slate-900` now paints a white card, `bg-slate-950` the pale ground it
  sits on, `text-white` near-black ink, `text-slate-400` readable grey.
* `.theme-bcp-dark` on the sidebar `<aside>` puts the original dark ramp back
  for that subtree, so the navigation rail stays deep purple.

The one thing this breaks is `text-white`, which had two jobs — a heading on a
dark card, and a label on a purple button. The 69 label cases were changed to a
literal `text-[#fff]` so they no longer read the variable. Search the views for
that token to find them.

Contrast was measured, not assumed: secondary text reads 6.7:1 and metadata
5.0:1 on a white card, both past WCAG AA.

### Files changed

| File | Change |
| :--- | :--- |
| `resources/css/app.css` | The two theme scopes, and the larger sidebar section headers |
| `resources/views/components/layouts/admin.blade.php` | Light scope on `<html>`; top bar regrouped into three zones with an account chip showing the signed-in role |
| `resources/views/partials/bcp-sidebar.blade.php` | Dark scope on the rail; Dashboard added as the first item |
| `app/Http/Controllers/Admin/DashboardController.php` | **New.** Counts only; changes nothing |
| `resources/views/admin/dashboard.blade.php` | **New.** KPI row, subscription lifecycle bars, tenant donut, settled billing per currency, recent tenants, recent tickets |
| `routes/web.php` | One route: `GET admin` → `admin.dashboard`, inside the existing super-admin group |
| 56 admin views | Mechanical `text-white` → `text-[#fff]` on accent backgrounds only |

### The dashboard's data

Every figure is counted from BCP's own tables. There is no seeded number and no
placeholder series; an empty section says it is empty. Two rules were applied
deliberately:

* **Tickets are read through `visibleTo($user)`**, exactly as
  `SupportDashboardController` reads them, so brand scoping is enforced by the
  same code path rather than by a second copy of the rule.
* **Paid invoices are summed per currency and never added together.** BCP
  stores a currency per invoice, and one total across two of them is not a
  number.

The two charts are inline SVG drawn from those counts. No charting library was
added.

### Tests

Full suite after the change: **1022 passed, 1 skipped, 5278 assertions,
exit 0**. No existing test was modified. Five new tests cover the new
route: it opens for a super admin, it counts real rows, it says so when
there is nothing to show, it totals paid invoices per currency without
ever adding two together, and it returns 401 to a guest and 403 to a
non-super-admin — the same codes `super.admin` returns everywhere else. The
post-login landing page was deliberately left pointing at the tenant directory:
moving it to the new dashboard is a one-line change to
`AdminAuthController::homeFor()` plus about ten test updates, and that is a
behaviour change rather than a visual one.

### Known issues / not done

* **Sidebar "Active" badges.** Every item carries the same decorative *Active*
  badge, twenty times over. It is existing behaviour and carries no
  information, so it was left alone rather than removed without being asked.
* **Per-page polish.** The design system re-themed all 66 views at once and
  they are consistent and readable, but only the dashboard and the tenant
  directory were composed for the new look. The rest inherit it.
* **No shared component library yet.** The absence noted in the audit is still
  there; this change did not introduce one.

### Next recommended step

Extract `<x-bcp.card>`, `<x-bcp.table>`, `<x-bcp.badge>` and
`<x-bcp.page-header>` from the dashboard, which is where the intended patterns
now live, and adopt them page by page starting with the highest-traffic
screens — subscriptions, invoices, the unified inbox. That converts the
re-theme into an actual design system instead of a consistent coat of paint.

---

## 15. Super Admin Landing Page → Dashboard — 2026-09-09

**Status: COMPLETE. One line of application code and eleven test assertions.**

Now that section 14's dashboard exists, signing in as a super admin lands on it
rather than on the tenant table. The tenant table was never chosen as the home
screen; it was simply the least wrong page to open on when there was no other.

### The change

`AdminAuthController::homeFor()` — the `access-admin` branch returns
`route('admin.dashboard')` instead of `route('admin.tenants.index')`. The other
two branches are untouched: a forced password change still outranks everything,
and an account without `access-admin` still lands on the support desk.

Because the site root and the two-factor step both call `homeFor()`, all three
entry points moved together. That is why the method is public and why there is
only one line to change.

### Tests updated, and the ones deliberately left alone

`route('admin.tenants.index')` appears in 24 test lines. Only **11** of them
assert where a login lands; the other 13 assert that the tenant screen is
reachable, or forbidden, or where a CRUD action returns to. Those 13 were not
touched — rewriting them would have quietly weakened authorization tests into
tests of a different route.

The 11 that moved, all `assertRedirect(...)` after a sign-in, a second factor,
or a visit to `/`:

| File | Assertions |
| :--- | :--- |
| `tests/Feature/Admin/AdminAuthenticationTest.php` | 3 |
| `tests/Feature/Admin/TwoFactorAuthenticationTest.php` | 3 |
| `tests/Feature/Admin/LoginHumanCheckTest.php` | 2 |
| `tests/Feature/Admin/AdminLoginThrottleTest.php` | 1 |
| `tests/Feature/Support/AuditAndLogoutTest.php` | 1 (the super-admin line only; the agent's support-desk line is unchanged) |
| `tests/Feature/Support/BrandStaffAccessTest.php` | 1 |

`tests/Feature/Tenant/TenantManagementTest.php` keeps its
`assertRedirect(route('admin.tenants.index'))` — that one follows creating a
tenant and has nothing to do with signing in.

### New regression test

`tests/Feature/Admin/AdminLandingPageTest.php` — five tests. Every existing
login test asserted a destination in passing while proving something else
(throttling, the second factor, an audit row), so none of them was named after
the landing page and none explained it. This file is that statement:

* a super admin signing in lands on the dashboard, and the dashboard opens
* the site root sends an already-signed-in super admin to the same place
* a forced password change still outranks the dashboard
* the customer portal login still lands on `portal.dashboard`, and a portal
  customer still gets 403 from `/admin`
* a guest gets 401 and a non-super-admin 403, exactly as before

### Result

Full suite: **1030 passed, 1 skipped, 5319 assertions, exit 0.** No migration,
no dependency, no schema change, no middleware or RBAC change, no portal change.

The arithmetic, since two sessions were working in this tree: 1022 before this
change, plus 5 from `AdminLandingPageTest`, plus 3 added to
`CataloguePurchaseAffordanceTest` by the concurrent BinduHost work — 1030.

### Remaining concern

The sidebar's **System Status** item points at `/`, which redirects through
`homeFor()`. It now lands on the dashboard, so that item and the new
**Dashboard** item go to the same screen. The duplication is not new — the item
pointed at the tenant table before, duplicating **Tenants Directory** — but it
is now sitting directly beneath the item it duplicates, which makes it obvious.
Either give it a real system-status screen or remove it; both are decisions for
the product owner, so neither was taken here.

---

## 16. Brand Palette and Reference-Match Pass — 2026-09-09

**Status: COMPLETE. Presentation only — no route, controller, query, migration
or dependency changed in this pass.**

### The palette

The product owner supplied a five-swatch purple palette. It is more magenta
than the violet the panel had been using, and it matches the brighter half of
the BCP logo gradient, so it was adopted as the brand ramp rather than kept
alongside it:

| Supplied | Position | Note |
| :--- | :--- | :--- |
| `#E8BEF8` | `brand-200` | card tints |
| `#D08CFA` | `brand-300` | |
| `#B92AE0` | `brand-500` | accents |
| `#8B0A8B` | `brand-700` | hover |
| `#660066` | `brand-900` | |

The intermediate steps were filled in and **`brand-600` is `#A312C7`**, which
is what buttons and links use. That value was chosen rather than the supplied
`#B92AE0` because white text on `#B92AE0` measures 4.7:1 — it passes AA, but
only just, and this ramp carries every primary button in the panel. `#A312C7`
measures 6.1:1.

The indigo, blue and sky remaps moved with it, so the whole panel changed
colour from one place. The orchid ramp (mapped from cyan, used for
informational states) was left alone; it is now closer to the brand than it
was, and separating the two again is worth a look if informational badges
start reading as brand accents.

### Matching the reference layout

* **Sidebar** — active item is a solid brand pill instead of a tint with a
  rail; rows are larger; section headings are a quiet caption while their
  section is open and a full-size row once it is folded away, which is the
  arrangement in the reference.
* **The twenty-one decorative "Active" badges were removed.** Every one said
  the same word next to a different item, which is not information. The four
  badges that carry something — the pending SMS order count, and the Phase
  4/5/6 markers on modules that are not built — remain.
* **Top bar** — one toggle that collapses the rail on a desktop and opens the
  drawer on a phone, the menu search beside it, then the phase badge, a link
  to Security & Alerts, and the account chip.
* **Dashboard** — greeting, date card, four KPI cards each ending in a link to
  the screen that can act on it, a growth chart beside the status ring, and
  two recent-activity tables with real empty states.

### Two things in the reference that were not built

Both because the feature behind them does not exist:

* **A notifications tray with a count.** A bell reading "3" when nothing has
  produced three of anything is an invented number in the most trusted corner
  of the screen. The bell is there and opens Security & Alerts; it carries no
  badge.
* **A global search across tenants, domains, invoices and tickets.** There is
  no endpoint behind that. The search in the top bar filters the menu, which
  is wired up, and the placeholder says so.

### Fixed along the way

* The dashboard's Domain column read `domain`, which is not a column on
  `Tenant`. It now reads `custom_domain`, falling back to the subdomain, which
  is what the tenant directory has always shown.
* The Recent Tenants table scrolled sideways inside its own card. The
  recent-activity row is split three-to-two rather than evenly.

### Tests

Full suite: **1030 passed, 1 skipped, 5320 assertions, exit 0.** Two
assertions in `DashboardTest` were updated to the headings the redesigned page
actually uses; no other test changed.

### Known issue

The sidebar's group headings still carry their phase suffix — "MULTI-TENANT
CORE (PHASE 2)" — and truncate in the rail, where the reference shows a short
"MULTI-TENANT CORE". Dropping the suffix is a one-line change per group, but
it removes information the team may be using, so it was left for the product
owner to decide.

---

## 17. BMart Entitlement Integration — 2026-09-10

**Status: COMPLETE and verified end to end on a development machine. Not yet
configured in production.**

### What was needed

BMart (Bindu Mart) is a multi-tenant commerce platform whose SaaS billing BCP
owns. It holds no plan, price or invoice of its own: it asks BCP what each shop
may do, and needs to hear when that changes. Nothing in BCP could serve it. The
only entitlement endpoint, `GET /api/v1/saas/entitlement`, answers for the
token's own tenant with no way to name a shop, was built for POS shadow sync,
emits `+00:00` timestamps that BMart's schema rejects, and uses `0` for
unlimited where BMart uses `null`. BCP sent no webhook to anybody.

### What was built

| Piece | Where |
| :--- | :--- |
| `GET /api/v1/bmart/entitlements/{shopId}`, in BMart's exact contract | `BmartEntitlementController` |
| Additive migration: `plans.entitlements` (JSON) and `subscriptions.product_account_id` (indexed) | `2026_09_10_000001_let_a_plan_carry_product_entitlements` |
| Signed notification to BMart, queued after the commit | `NotifyBmartOfEntitlementChange`, `BmartEntitlementObserver` |
| A `bmart:entitlements` token is refused on every other endpoint | `AuthenticateApiToken` (`EXCLUSIVE_SCOPES`) |
| Its own rate limiter, 600 a minute, instead of the per-POS 60 | `AppServiceProvider`, `config/bmart.php` |
| BMart plans kept out of the self-serve catalogue | `Plan::scopePurchasable` |
| Operator commands | `bmart:connect`, `bmart:plan`, `bmart:link` |

### Decisions worth knowing before changing any of it

* **The response is BMart's shape, not BCP's.** A translation on the receiving side is where "0 means unlimited" becomes "0 means none". Timestamps are UTC with a `Z`, an empty limits map is `{}`, and a shop with no subscription is a 404 whose body says `no_subscription` — because a bare 404 is also what a wrong URL produces, and BMart has to tell the two apart.
* **`plans.entitlements`, not `features`.** The admin plan form rewrites `features` as marketing lines on every save.
* **`product_account_id`, not `external_id`.** The POS entitlement endpoint answers with any subscription that has an `external_id`, so a BMart shop id stored there would be handed to a POS as its own.
* **Notifications carry no entitlement.** They name the shop and BMart re-reads, so there is one description of a plan rather than two. Sent after the commit; the event id is fixed when the job is made, so a retry is a duplicate; a 4xx stops, while a 429, a 5xx or a network failure is retried.
* **`acrossTenants()`, never `withoutGlobalScopes()`.** Only the tenant scope is lifted, so deleted subscriptions stay excluded. A retired (soft-deleted) plan keeps serving the shops already on it.
* **A suspended or archived BCP account is answered as `SUSPENDED`.**

### Verification

* `tests/Feature/Bmart/` — **32 tests**: the exact contract shape, `{}` for empty limits, the 404 marker, non-BMart plans never answered, deleted, retired and cancelled subscriptions, a suspended account, token scope and confinement, the catalogue exclusion, the signature against a vector BMart's own suite also verifies, notifications only for changes that matter, both shops told when a link moves, nothing sent for a rolled-back change, the retry policy, and the refusals of all three commands.
* Full suite: **1062 passed, 1 skipped, 0 failed.**
* End to end on this machine, against the local database: BMart's real driver read a linked shop's plan through this endpoint, an unlinked shop came back as "no subscription", and a wrong base URL came back as unavailable. A real `markPastDue()` produced a signed notification that BMart verified and recorded as `APPLIED` under the same event id.

### Local state left behind

`bmart:connect` issued a token named "BMart (local development)" under a new `bmart-integration` account. For the round trip the local database also has BMart plan `local-growth` (#24), account `bmart-local-roundtrip`, and subscription #4 linked to BMart shop `cmtslu3mm0001cwtvbte0azb6`, now `past_due`. `.env` gained `BMART_WEBHOOK_URL` and `BMART_WEBHOOK_SECRET`; the file as it was is in `.env.backup-bmart-*`. The three support-ticket notifications already waiting in the local queue were not run.

### Not done

* **Production.** Run the migration and `bmart:connect`, and set `BMART_WEBHOOK_URL` and `BMART_WEBHOOK_SECRET`, on the production BCP. `docs/BCP_DEPLOYMENT.md` was not edited, because it already had uncommitted changes that were not part of this work; the settings are documented in `.env.production.example`.
* **Buying BMart through the portal.** A BMart subscription has to be created in the admin panel and linked with `bmart:link`, because purchase cannot yet say which shop it is for. BMart plans stay out of the catalogue until it can.
* **No admin UI** for plan entitlements or shop links; the commands are the interface.
* **No per-shop feature override.** A shop gets exactly its plan's features.

---

## 17. BMart SaaS Billing — Admin Screens — 2026-09-13

**Status: COMPLETE. No migration, no dependency, no change to the BMart
repository, and no BMart platform administration added to BCP.**

### What the audit found

Against the BMart Master Blueprint §15 — "Plans, subscriptions, usage limits,
feature flags, trials, invoices, tenant lifecycle and Super Admin controls" —
BCP already owned almost all of it. Eleven of the twelve audited areas were
already complete:

| Area | Verdict |
| :--- | :--- |
| Plans, with a per-product entitlement set | Complete (`plans.entitlements`) |
| Subscriptions, six statuses, trial/period/grace dates | Complete |
| Invoices and payments | Complete |
| Trial, renewal, cancellation lifecycle | Complete (`SubscriptionManager`, `subscriptions:evaluate`) |
| Usage limits and feature flags | Complete (keys declared in `config/bmart.php`) |
| Super admin permissions | Complete (`super.admin`) |
| Shop ↔ subscription link | Complete (`subscriptions.product_account_id`, indexed) |
| Entitlement API | Complete (`GET /api/v1/bmart/entitlements/{shopId}`) |
| Webhook signature, idempotency, retry | Complete (`NotifyBmartOfEntitlementChange`) |
| Rate limiting and token scoping | Complete (`throttle:bmart`, `bmart:entitlements`) |
| Migrations and constraints | Complete; nothing further needed |
| **Admin UI for any of it** | **Missing** |

Everything BMart-specific could only be done from a terminal —
`bmart:connect`, `bmart:link`, `bmart:plan`. A billing administrator who does
not use a terminal could not see which shops were paying for what, and could
not tell whether the integration was configured at all. That was the gap, and
it is the only thing this change fills.

Baseline before the work: the 32 existing BMart tests passed.

### What was built

* **`App\Services\Saas\BmartBilling`** — which plans and subscriptions are
  BMart's, and the three rules for linking a subscription to a shop: it must
  be on a BMart plan, the shop id must be a shop id, and no other subscription
  still in force may already claim that shop. The read and the write happen in
  one transaction with a row lock, so two administrators linking the same shop
  at the same moment cannot both pass the check.
* **`bmart:link` now delegates to that service.** The rules used to live in the
  command; the screen needed the same ones, and two implementations of "may
  this shop be linked" is how a console and a web form end up disagreeing about
  who is paying. The command's eight tests pass unmodified.
* **Three screens** under Subscriptions & Billing → BMart SaaS: Plans (with the
  entitlement editor), Subscriptions (with the shop link), and Integration.
* **Ten tests**, covering product isolation, the entitlement rules, the linking
  rules through the form, and authorization.

### Deliberately not built

* **No second lifecycle.** Activating, suspending, cancelling, renewing and
  invoicing a BMart subscription stay on the ordinary subscription screens,
  which already work and are already audited. Each row links through to them.
* **No BMart platform administration.** Shops, merchants, products, orders,
  couriers and themes belong to BMart's own Super Admin. Nothing in this change
  can write a single row of BMart's commerce data.
* **No migration.** The entitlement column and the shop-link column already
  existed.

### Security

Every route sits in the existing admin group: `web`, `super.admin`,
`password.current`, `admin.audit` — the same stack as every other admin page,
verified with `route:list -v`. The screens only ever query plans under the
BMart product, so a subscription on another product is not merely refused but
invisible (404). The entitlement form cannot introduce a key BMart does not
understand, because the form is built from the config list rather than from the
request. The integration screen reports whether each credential is set and
never what it is, which is asserted by a test.

### Tests

Full suite: **1130 passed, 1 skipped, 6271 assertions, exit 0.** No existing
test was modified — `git status tests/` shows only the new file.

### Next recommended step

Nothing in BCP blocks BMart billing integration testing. The remaining work is
external: BMart must hold the token from `bmart:connect` as
`BCP_BILLING_TOKEN`, and `BMART_WEBHOOK_URL`/`BMART_WEBHOOK_SECRET` must be set
in BCP for change notifications to be pushed at all. The Integration screen
reports which of those four are still missing.

---

## 18. BMart Subscription Detail — Consolidating Lifecycle Access — 2026-09-13

**Status: COMPLETE. One backend change, no migration, no dependency, and no
second lifecycle.**

Section 17 deliberately kept the lifecycle actions on the generic subscription
screen and had the BMart list link through to it. **That decision was wrong,
and it was wrong on a fact that had not been checked.**

### What the audit found

Six of the seven lifecycle actions in `SubscriptionController` already end in
`redirect()->back()` — activate, markPastDue, enterGrace, suspend, reactivate
and cancel. They were written to return the administrator to wherever the
action was taken from. The seventh, `generateInvoice`, redirects to the invoice
it just raised, which is right and is not a bounce.

So consolidating cost nothing. The same buttons posting to the same routes from
a BMart screen leave the administrator on the BMart screen, with no backend
change and no duplicated behaviour. The earlier justification for two screens
does not survive that fact.

### What changed

* **`<x-subscription.lifecycle-actions>`** — the button bar lifted out of
  `admin/subscriptions/show.blade.php` unchanged: same status conditions, same
  routes, same labels. Both screens render it now, so there is one definition
  rather than two that can drift. Cancel stays absent, as it always was in this
  bar; adding it would have been a new decision dressed as a refactor.
* **`admin/bmart/subscription.blade.php`** — one BMart subscription: the shared
  lifecycle bar, period and trial dates, invoices, the shop link, and the
  entitlement BMart is being handed right now.
* **`BmartBilling::entitlementFor()`** — the payload builder moved out of
  `BmartEntitlementController` into the service. **This is the only backend
  change, and it is the one thing that was genuinely required:** a preview
  built separately would eventually disagree with what BMart receives, and this
  is the screen somebody would open to find out why a shop is not getting what
  it paid for. The API's existing tests pass unmodified, which is what proves
  the contract is intact.

### What did not change

No new route for any lifecycle action. No new service, model method or
transition. No migration. The generic subscription screen behaves exactly as it
did — asserted, not assumed: the same action taken there still returns there.

### Tests

Full suite: **1135 passed, 1 skipped, 6287 assertions, exit 0.** Five new tests
cover the consolidation specifically — an action taken on the BMart screen
returns to it, the same action on the generic screen still returns there, the
preview is byte-for-byte the API's answer, another product's subscription has
no BMart detail screen at all (404), and the screen refuses a guest with 401
and a non-super-admin with 403.

---

## 19. Per-Product SaaS Billing Screens — 2026-09-25

**Status: COMPLETE. No migration, no dependency, and no second lifecycle.**

### What the owner asked for

Every Bindu SaaS product — BinduHost, BMart, POS, BinduAI, Bindu Drive, and
then BDIV and Bvid — in the sidebar, manageable from there.

### What the audit found first

Of the products named, BCP held **three**: POS (6 plans, 2 subscriptions), Web
Hosting (16 plans) and BMart (1 plan, 1 subscription). BinduAI, Bindu Drive,
BDIV and Bvid had no Product row, no plans and no prices anywhere in BCP.

That shaped the whole design. Hard-coding seven product areas would have meant
seven copies of the same three queries and a deployment every time the owner
starts selling something new.

### What was built

* **`App\Services\Saas\SaasProducts`** — the common commercial shape (plans,
  subscriptions, summary) parameterised by Product instead of by a slug in the
  code. `BmartBilling` keeps only what is genuinely BMart's: entitlements, the
  shop link and the webhook.
* **`SaasProductController`** and four screens — Overview, Plans,
  Subscriptions, and one subscription — resolved by `{product:slug}`.
* **A "SaaS Products" sidebar group read from the Product table**, bound by the
  same view composer that already feeds the SMS badge. The menu and the screens
  read one table, so they cannot fall out of step.
* **`BinduProductSeeder`** — catalogue rows for BinduAI, Bindu Drive, BDIV and
  Bvid. **Rows only, no plans**: a plan carries a price, an interval and a
  trial length, which are the owner's commercial terms and nobody else's to
  invent. Each product's screens say "no plans yet" until those are set.

### The boundary, unchanged

BCP owns each product's **billing**. It does not own the product. Nothing in
these screens reaches a POS order, a BMart shop's inventory, a BinduHost DNS
record, a BinduAI workspace or a vault entry, and nothing here should grow to.
A subscription on another product is not refused on a product's screen — it is
invisible (404), so the screen cannot become a way round the product named at
the top of it.

There is also no product-scoped lifecycle. Activating, suspending, renewing and
invoicing run through the shared `<x-subscription.lifecycle-actions>` component
on the ordinary subscription routes, which already return the administrator to
where they pressed the button.

### Tests

Full suite: **1143 passed, 1 skipped, 6316 assertions, exit 0.** Ten new tests,
including the one that matters most — a product created during the test
(BinduAI, which exists nowhere in this codebase) is listed in the sidebar and
fully manageable, with no code change and nothing deployed.

### The duplicate menu rows, resolved

Section 15 left a question open: **System Status** pointed at `/`, which after
the landing-page change redirected to the dashboard, so it and the **Dashboard**
row led to one screen. It was left alone because removing a menu item is the
product owner's call.

The owner made it — remove both. That was only safe once the sidebar had
another way home, and it did not have one: the brand mark at the top was a
plain image, not a link. So the brand became the link and the two rows went.

It points at the site root rather than at the dashboard directly, because the
root asks `homeFor()` where the signed-in account belongs. A super admin lands
on the dashboard; a support agent lands on the support desk. A hard link to the
dashboard would have sent the agent to a screen that refuses them — the same
trap the landing-page work avoided in section 15.

### One product, one place in the menu

BMart and BinduHost were still top-level sidebar groups as well as rows under
SaaS Products, so each appeared twice — the same duplication the Dashboard and
System Status rows had. Both groups were removed.

Nothing was lost with them, which mattered: BMart's own screens carry the
entitlement editor and the shop a subscription pays for, and the generic ones
do not. They are tabs on the product now, named for what they answer rather
than repeating a generic tab's name — **Plans** is the price list,
**Entitlements** is what a plan grants a shop, **Shops** is which shop pays for
which subscription.

**BinduHost is a deliberate exception to the boundary this section keeps.** Its
Domain pricing, Orders, Domains and Hosting services are operations, not
billing, and they hang off its product anyway — because BCP has no separate
BinduHost admin to hand them to. BCP sells the hosting itself through its own
portal, so those orders and services are genuinely BCP's to run. The same does
not hold for BMart or POS, and neither of them has an operational screen here.

A product with no extras is offered none, rather than an empty tab implying a
feature that does not exist. There is a test for that.

### Next recommended step

Two things are outstanding and both are the owner's to decide:

1. **Prices.** BinduAI, Bindu Drive, BDIV and Bvid have no plans. Until they
   do, they can be seen but not sold.
2. **The unbuilt roadmap.** The BCP Development Guide's future roadmap still
   lists a knowledge base, a notification centre, reseller/partner accounts,
   advanced analytics and automated SSL provisioning — none of which exists.
   Of those, a notification centre is the one whose absence is felt today:
   nothing tells anybody about an overdue invoice or a breached SLA.

---

## 20. Notification Centre — 2026-09-25

**Status: COMPLETE for parts 1-3 of the agreed scope (storage, panel,
automatic raising). Part 4 — an API other products send through — is
deliberately not built yet.**

### Why it was the next thing

The owner set a standing direction: BCP is the single place where payment,
notifications and support tickets are handled for every Bindu IT website and
SaaS product. Two of those three already existed — BCP has owned payment since
Phase 10, and the Support Desk has been brand-scoped since Phase 6 precisely so
one inbox can serve several products.

Notifications were the gap, and a total one. There was no `notifications` table
at all. BCP knew about every overdue invoice, every subscription in grace and
every breached SLA, recorded all of it, and told nobody: somebody had to open
the right screen on the right day to find out.

### What was built

* **`notifications` table** — Laravel's own, unchanged in shape. `User` already
  used `Notifiable` and the four existing notification classes already spoke
  Laravel's interface, so a hand-rolled table would have meant reimplementing
  routing, serialisation and read state. The recipient is polymorphic, which is
  what makes customers a later notification class rather than a later migration.
* **`App\Services\Notifications\NotificationCentre`** — who is told, and the
  guarantee that they are told once.
* **`notifications:scan`**, hourly — overdue invoices, subscriptions past due
  or in grace, and tickets past their SLA. It reads and announces; it sets no
  status and settles no invoice. If it never ran, BCP would behave exactly as
  it does today, quieter but correct.
* **The centre itself** at `/admin/notifications`, and the top bar bell, which
  carries a real count for the first time. The bell was built without a badge
  in section 14 on the grounds that a bell reading "3" when nothing had
  produced three of anything is an invented number in the most trusted corner
  of the screen. Something produces it now.
* **A sidebar entry**, because the bell is hidden below the `sm` breakpoint and
  a phone would otherwise have no way in.

### The problem that decides whether anybody keeps reading these

The scan runs hourly and an invoice overdue now is still overdue in an hour.
Announced naively, an administrator returns to twenty-four copies of one
warning and stops reading any of them.

So every notification is raised under a key naming what it is about **and the
day it is about it** — `invoice-overdue:1402:2026-09-25` — and that key becomes
the row's id by way of a derived UUID. Raising it again writes nothing. An
invoice still overdue tomorrow is worth saying again tomorrow; it is not worth
saying again in an hour.

Verified against real data as well as in tests: three consecutive scans over
the local database left two rows, not six.

### Security

* **One administrator cannot clear another's warning.** The id is a UUID
  somebody could post at, so the scope is enforced in the service, not trusted
  in the controller. Marking a colleague's warning read would hide it from the
  person who had to act on it — a silent failure, since the row still exists.
* **No screen can create a notification.** There is no create route. News an
  administrator typed for their colleagues is not news.
* **Failing to announce never breaks what was being observed.** The same rule
  `SecurityEvent` already followed, for the same reason.
* Audience is active super admins only. Support agents are excluded on purpose:
  none of this is theirs to act on, and it would be noise they cannot clear.

### Tests

Full suite: **1159 passed, 1 skipped, 6375 assertions, exit 0.** Ten new tests,
the two load-bearing ones being that a repeated condition is announced once and
that one administrator cannot clear another's warnings.

### Deploying this one needs a migration

Unlike every change since section 14, this adds a table. The deployment needs
`php artisan migrate --force` between the pull and the cache rebuild.

### Not built, and why

**Part 4, the API other products raise notifications through.** Storing and
showing had to be proven first; designing the endpoint before any product has
sent through it would be designing against an imagined caller. It should follow
the BMart entitlement API's shape when it comes — scoped token, signature,
idempotency — and the fingerprint key this already uses is what its idempotency
would hang on.

**Customer-facing notifications.** The table takes them without a migration.
The owner was asked whether the first audience was staff or staff and
customers, and answered the scope question rather than that one, so staff was
assumed and said so.

---

## 21. Notification Centre, Part 4 — The Product API — 2026-09-25

**Status: COMPLETE. No migration — it writes to the table section 20 created.**

Section 20 built the centre and deliberately left this out, on the grounds that
designing an endpoint before any product had sent through it would be designing
against an imagined caller. With storage and display proven, the owner asked for
it.

### The endpoint

    POST /api/v1/notifications
    Authorization: Bearer <token scoped notifications:raise>

    { "key": "...", "title": "...", "body": "...", "tone": "amber" }

    202 { "status": "accepted" }

The same shape as the BMart entitlement API: `api.audit`, a dedicated limiter
(60 a minute per token), and an **exclusive** scope, so a token issued for this
can do nothing else — it cannot read entitlements or push SMS orders under the
account it belongs to.

202 rather than 201: the notice is recorded for whoever should see it, but it
is not a resource the caller can then fetch, and a repeat of the same key
creates nothing at all.

### Three things the caller does not get to decide

These are the substance of the design, and two of them fail silently if wrong —
the caller gets a 202 either way and the administrator simply never sees the
message.

1. **Who it is from.** Stamped by BCP from the API token's name, which an
   administrator set when issuing it. A body naming a different product is
   ignored. A warning attributed to the wrong system sends somebody to the
   wrong place to fix it.

2. **Whether it collides with another product.** The caller's key is namespaced
   by the token before it becomes the row id. Without that, BMart and the POS
   both sending the obvious `daily-summary` would resolve to one row, and the
   second would be discarded while still answering 202.

3. **Where to go.** No `url` is accepted at all. A link written by a caller,
   rendered in BCP's admin panel and clicked by somebody who trusts BCP is a
   phishing vector wearing a convenience's clothes. Doing it safely needs a
   registered base URL per product so BCP builds the link itself from a path —
   where that base is stored, who may set it and what happens when it changes
   is real design, and not a field. Until then the notice says what happened
   and the administrator opens the product themselves.

### Tests

Full suite: **1167 passed, 1 skipped, 6400 assertions, exit 0.** Eight new
tests, one per claim above, plus retry idempotency, token refusal, scope
exclusivity and payload validation.

### What a product needs in order to use it

A token issued from **Licensing Engine & API → API Bearer Tokens** with the
`notifications:raise` scope, named for the product — the name is what the
centre shows as the source. Nothing else: no configuration, no migration, no
code in BCP.

### Next recommended step

Wire the first real caller. BMart already talks to BCP and would be the natural
first; the POS already pushes SMS orders and would be the second. The endpoint
has been tested against every failure mode it can see from here, but the first
real product will be what shows whether `title`/`body`/`tone` is the right
shape — which is exactly why this was built after the centre rather than with
it.

---

## 22. Production 500 on the Admin Invoice List — 2026-10-02

**Status: FIXED and pushed to the production branch as `6ca8121`. No
migration, no dependency, no business rule changed.**

> ⚠️ Thirty commits landed between section 21 and this one — BEMS, Bindu
> Medicare, factory reset, Visit as customer, per-student pricing, account
> deletion — and none of them is recorded in this file. This section covers
> only the fix below. Those features still need their own entries, written by
> whoever built them; guessing at another session's intent is what this
> document exists to prevent.

### What happened

`/admin/invoices` answered 500 in production.

The list printed `$invoice->tenant->name` for every row. An invoice owned
directly by a customer has no tenant — BinduHost orders are billed to the
customer, not to a tenant — so the first such invoice to appear raised
"Attempt to read property name on null" and took down the whole list, not just
its own row.

### Why it was latent rather than new

* Those two lines had not changed since the initial commit.
* `HasSingleBillingOwner` already had the answer, `billingOwnerName()`, and its
  docblock describes this exact failure. The **portal** views were moved onto
  it when customer-owned billing was introduced; the **admin** views were
  missed.
* Every existing invoice test built its invoice on a tenant, so nothing had
  ever asked the admin screens the question.

It was not caused by the notification centre or the dashboard; both already
used `tenant?->name`.

### The fix

Six admin views moved onto the helper the model already had. No new logic.

| View | Was |
| :--- | :--- |
| `admin/invoices/index` | the page that was down |
| `admin/invoices/show` | would have failed one click further in |
| `admin/customers/show` | invoice and subscription rows |
| `admin/subscriptions/index`, `show` | `Subscription` carries the same trait |
| `admin/licenses/create` | subscription picker |

Fixing the list alone would only have moved the 500. Views over models whose
`tenant_id` is NOT NULL — licences, API tokens, SMS orders — were left as they
are; `?->` there would hide a data-integrity fault rather than fix one.

### Proof

Reproduced locally against real data before changing anything. The regression
test fails without the fix with exactly the production symptom — "Expected
response status code [200] but received 500" — and passes with it.

Full suite: **1433 passed, 1 skipped, 7804 assertions, exit 0.**

### A second defect found on the way, NOT fixed

**The Customer 360° page does not list what a customer bought directly.**
`CustomerController@show` gathers invoices, subscriptions and payments through
the customer's tenants only — `whereIn('tenant_id', $tenantIds)` — so a record
the customer owns directly is absent from their own page. It does not crash,
which is why nobody had noticed.

Same root cause, different symptom. It was left alone deliberately: widening
that query changes which rows and which totals the page shows, and that
deserves its own decision rather than riding in on a production fix. The
regression test carries a comment naming the assertion to add when it is done.

### Next recommended step

Deploy this, then decide on the Customer 360° gap above.

---

## 23. Product Integration Work Merged onto the Production Branch — 2026-10-02

**Status: DEPLOYED 2026-10-02 and confirmed on the server — `e6bf27f`, nothing
pending, both migrations ran. Two additive migrations. No new dependency. One
rebuilt stylesheet.**

### What this is

The pull command the owner has been given for earlier deploys names
`feature/saas-billing-api`. The product integration work was built on a branch
of its own, `feature/product-integration-api`, forked at `13aedbb`, and had
never been merged back into it. The owner asked for all of it to be deployed.

> **Corrected after the deploy.** This section first said that none of the
> work had reached the server. That was assumed from the branch names, without
> looking at the server, and it was wrong. `migrate:status` there shows the two
> migrations below in different batches, 8 and 9, and one `migrate` run
> (without `--step`) puts everything it runs in a single batch. The first
> migration exists on this branch only, so the server had already been given
> part of this branch before the merge existed. What the merge settled is
> which branch carries the work — not what the server was running that
> morning, which nobody had checked. Ask the server (`git log -1`) before
> saying what is on it.

Merge commit `2762934`. The invoice fix of section 22 existed on both sides as
the same change (`6ca8121` here, `150f186` there), so the merge had nothing to
resolve, and the merged tree is byte-for-byte the feature tip `e66ea3d`.

Both branch names now point at the same commit. Whichever one the next piece
of work is committed on, production's branch is a fast-forward away.

### What arrives

> The warning in section 22 still stands. These features have no entries of
> their own, and this is not one: it is what a deploy has to know, read from
> the code and from `tests/Feature/Products/` by somebody who did not build
> them. The design record is still owed by whoever did.

* **Generic product integration API** — `/api/v1/{product}/...` for every entry
  in `config/product_integrations.php` that is not `legacy`. Today that is
  `medi` (Bindu Medicare) and `bems`; BMart keeps its own routes. Nineteen
  routes per product, every one behind `api.audit`,
  `throttle:product-integration` and `api.token:{product}:entitlements` or
  `{product}:billing`. Both scopes are exclusive, so a product's token reaches
  nothing but its own prefix.
* **SMS credit per account**, bought through that API. Price bands are in
  `config/sms_pricing.php`.
* **Pricing by the unit** for BEMS (`ProductUnits`): an invoice is the price of
  one student times the count BEMS last reported.
* **Factory reset, deactivate and delete requests.** BCP records the request
  and tells the product; the product does the work and reports back. BCP erases
  nothing itself. Table `product_reset_requests`.
* **Visit as customer** — a signed pass that lasts a minute and works once.
  The button exists only where the product has a `visit_url` and a webhook
  secret.

Five new admin routes, all inside the existing admin group, so
`web, super.admin, password.current, admin.audit` — checked with `route:list`,
not assumed from the comment above them.

### What it changes for what is already live

These files are on the payment path, so each was read before the merge:

| File | Change | POS, BinduHost and BMart |
| :--- | :--- | :--- |
| `SubscriptionManager::generateInvoice` | asks `ProductUnits::for()` first | null unless the subscription pays for an account of a per-unit product; unchanged |
| `SubscriptionManager::evaluateSubscriptionStatus` | the trial-only rule is `ProductSelfServe::isTrialOnly` | matches any registered `{key}_trial` origin, `bmart_trial` among them; unchanged |
| `ShurjopayGateway::markSmsOrderPaid` | may credit a paid SMS order at once | only where the tenant's `origin` names a product whose config sets `sms_auto_credit`; a POS order still waits for an administrator |
| `Plan::scopePurchasable` | hides every integrated product's plans from the portal catalogue | was BMart only; POS and BinduHost plans unaffected |
| `AuthenticateApiToken` | each product's scope pair joins the exclusive list | BMart's and the notification token's confinement unchanged |
| `BmartEntitlementObserver` | says nothing to BMart about a subscription on another product's plan | unchanged for BMart shops |
| `BmartBilling`, `BmartSelfServe` | now thin subclasses of `ProductBilling` and `ProductSelfServe` | same public surface; covered by the existing BMart tests |
| `AppServiceProvider` | `ProductEntitlementObserver` on `Subscription` and `Tenant` | returns before any query unless some generic product has a webhook URL and secret |

### Migrations

| Migration | What it does |
| :--- | :--- |
| `2026_10_02_000001_create_product_reset_requests_table` | a new table |
| `2026_10_02_000002_add_kind_to_product_reset_requests_table` | a `kind` column, default `reset` |

Both additive. No existing table is altered and no row is rewritten.

### Configuration

Every new key is optional, and unset means the feature is off: no webhook is
sent, no Visit button is drawn. A product's API cannot be called at all until
`php artisan product:connect {key}` has issued it a token, and it has nothing
to sell until `php artisan product:plan {key} {slug} ...` has made a plan.
Whether the server already has any of this in place was not checked: its
`.env` and its tokens cannot be seen from here.

`.env.example` lists the `BEMS_*` keys. **The `MEDI_*` keys that
`config/medi.php` reads are missing from it** — the same six names with the
other prefix.

Three defaults are ON once a product is connected, and are worth knowing
because none of them needs an administrator's approval at the time:

* `bems.sms_auto_credit` — a school's paid SMS order is credited with the
  payment. The reasoning is in `config/bems.php`. The POS rule is untouched.
* `medi.factory_reset`, `medi.account_delete` — an administrator may ask Medi
  to wipe or remove a hospital.
* `bems.account_deactivate`, `bems.account_delete` — the same for a school.

### The committed stylesheet was stale

Production has no Node, so `public/build` is what it serves. Building the
merged code afresh and comparing class names found nine the committed file did
not have:

| Class | Used by | Since |
| :--- | :--- | :--- |
| `bg-amber-500`, `text-slate-950`, `hover:bg-amber-400` | `admin/saas/subscription` — "Request deactivation", a submit button with no background | this branch |
| `hover:bg-amber-50`, `hover:bg-rose-50` | `admin/saas/subscription` — the three shortcut buttons | this branch |
| `focus-visible:ring-indigo-300` | `pay/show` | earlier |
| `max-h-64`, `overflow-auto` | `admin/failed-work/index` — a payload that should scroll and did not | earlier |
| `sm:w-1/2` | `admin/binduhost/hosting/show` | earlier |

Rebuilt in the main checkout, where the earlier builds were made. The new file
keeps all 869 class names the old one had and adds exactly those nine.

The comparison was by class name, not by file hash, because a build cannot be
reproduced from the repository alone. `app.css` also reads
`storage/framework/views/*.php`, which is not tracked: a clean checkout builds
a file 13 kB smaller and 176 class names short, almost all of which trace to
compiled views sitting in the main checkout's `storage/`. Pagination is not
among the losses — every class the two pagination views use is styled either
way. Whether anything still needs those 176 was not established. They were
kept, because dropping them is a change this deploy has no reason to make.

**Known and NOT fixed: the label on "Request deactivation" is hard to read.**
It is written `bg-amber-500 text-slate-950`, dark ink on amber. The admin theme
inverts the slate ramp, so `slate-950` is `#f7f5fc` there and the label comes
out near-white on amber, about 2:1. Before the rebuild it was worse in a
different way — no background at all. One class to change, left for whoever
owns that screen; it shows only for a product that supports deactivation,
which today is BEMS.

### Proof

* Merged tree identical to the feature tip — the same tree hash, `06310b4`.
* Full suite on the merge commit, in a clean checkout of exactly that commit:
  **1434 passed, 1 skipped, 7816 assertions, exit 0.**
* Middleware of every new route read from `route:list`.
* The commit that was deployed, `e6bf27f`, differs from the merge only in
  `public/build` and this file. The suite was run again on it, in the same
  clean checkout, with the same result; `route:cache` and `view:cache` both
  succeeded there, the second compiling every Blade view.

Not verified: nothing here was exercised against a real Bindu Medicare or BEMS
installation, and the new screens were rendered by tests, not looked at in a
browser.

### Confirmed after the pull

On the server: `HEAD` is `e6bf27f`, nothing on the branch is missing, and
`migrate:status` shows both migrations as Ran.

From outside, with no credentials:

| Asked | Answer | What it shows |
| :--- | :--- | :--- |
| `/` | 302 to `/admin/login` | the application boots |
| the login page | references `app-BD3euWN6.css` | the new manifest is the one in use |
| `build/assets/app-BD3euWN6.css` | 200, and carries `.bg-amber-500`, `.max-h-64`, `.overflow-auto` | the rebuilt stylesheet is served |
| `build/assets/app-HKzmMjIZ.css` | 404 | the old one is gone |
| `/api/v1/medi/catalogue`, `/api/v1/bems/catalogue` and two account routes | 401 | the product routes are in the cached route table, and guarded |
| `/api/v1/nosuchproduct/catalogue` | 404 | only registered products have routes |
| `/admin/invoices`, `/admin/saas/bems`, `/admin/saas/medi` | 401 | a guest is refused, not shown an error |

Not confirmed from outside: what a signed-in administrator sees on
`/admin/invoices`. A guest never reaches the view that was failing, so only
somebody who is signed in can say the 500 of section 22 is gone.

### Next recommended step

In no particular order: the entries these features are owed; the `MEDI_*` keys
in `.env.example`; the label on "Request deactivation"; the Customer 360° gap
from section 22.

---

## 24. Two Leftovers: the Customer 360° Gap and Labels Nobody Could Read — 2026-10-03

**Status: DEPLOYED 2026-10-03 — on the server, caches rebuilt. No migration, no
dependency, no stylesheet rebuild.**

The two items that sections 22 and 23 left open.

### 1. Customer 360° did not show what a customer bought directly

`CustomerController@show` gathered subscriptions, invoices and payments with
`whereIn('tenant_id', $tenantIds)`. A record sold to the customer directly —
every BinduHost one — has no tenant, so it was missing from the customer's own
page: no row, and nothing in "total spent" or "active subscriptions". A
customer who had bought hosting and nothing else was shown an empty billing
tab and a total of zero.

The answer already existed. `Invoice::scopeOwnedByCustomer()` asks for both
routes at once, and its own comment describes this failure: "any screen that
counts only one of them silently under-reports". It was on `Invoice` alone,
and this page did not use it even there.

* The scope moved, unchanged, from `Invoice` into `HasSingleBillingOwner`, so
  a subscription and a payment answer the same question the same way. One
  definition, not three.
* The three queries on the page use it. A licence is issued to a tenant and to
  nothing else, so that query is as it was.
* The "Tenant" column of a direct row reads **Customer account**, the wording
  the invoice and subscription lists already use. `billingOwnerName()` would
  have printed the customer's own name there, which on the customer's own
  page invents a tenant that does not exist.

For a customer who has tenants and no direct billing — every customer this
page worked for before — nothing changes: the same rows, the same totals.

Left as it was, deliberately: the page still reads with
`withoutGlobalScopes()`, which lifts the soft-delete filter along with the
tenant one, so a deleted invoice still shows here and still counts.
`BelongsToTenant` says `acrossTenants()` is the tool for this. Switching would
change which rows an existing customer's page shows, and that is a different
fix from the one that was asked for.

### 2. Labels the admin theme turned the wrong colour

"Request deactivation" was written as the darkest slate on amber-500 — dark
ink on amber. The admin theme inverts the neutral ramp, so the darkest slate
is `#f7f5fc` there, and the label came out near-white on amber.

| Label | Was | Is |
| :--- | :--- | :--- |
| "Request deactivation" | 1.98:1 | 3.19:1 |
| the account name to type, above it | 2.15:1 | 5.05:1 |
| "Record as registered", "Record as set up" | 3.05:1 | 6.05:1 |

The button now has the shape of its two neighbours on the same page and of
"Deactivate Brand": the 600 shade as the ground, a literal white label, the
500 shade on hover. 3.19:1 is what "Deactivate Brand" has always had; it is
still short of the rose buttons beside it (4.51:1), because white on amber is
simply weaker than white on rose. A darker amber would close that and would
make this the one amber button unlike the other. The name to type went from
the 500 shade to the 700 shade, which is what the two rose forms beside it
use.

Looking for the same mistake elsewhere found the last row of the table: two
BinduHost buttons, on `admin/binduhost/domains/show` and
`admin/binduhost/hosting/show`, written `text-white` on a purple ground —
which is dark ink under this theme. Both now use the literal white.

`app.css` has said since the theme was written that a label on an accent
ground must be a literal white. Nothing enforced it, and three views written
afterwards got it wrong. `AccentLabelColourTest` now reads every view under
`views/admin` and fails, naming the file and the line, when one class list
pairs a solid accent ground with a colour from the neutral ramp. It is shown
the real mistakes and has to catch them, and the shapes it has to let through:
an active tab and an idle tab chosen by a ternary are two lists and are never
on the element together.

Every class used was already in the committed stylesheet. A fresh build asks
for nothing it lacks, so `public/build` is untouched. One thing learnt doing
that check: the build scans `tests/` too, so a class that exists only in a
test fixture is given a rule. The fixtures in that test use only classes the
views already use, and say why.

### Proof

* The three page tests fail against the old query and pass against the new
  one.
* The label check fails, naming the line, when each of the three old labels is
  put back.
* Both screens were rendered and looked at in a browser: the direct invoice
  and subscription rows, the 3,700.00 total made of 2,500 through a tenant and
  1,200 direct, and the deactivate form.
* Full suite: **1442 passed, 1 skipped, 7843 assertions, exit 0.** Eight more
  than section 23, all of them new here.

Not looked at in a browser: the two BinduHost buttons. Their change is one
class, to the class the label check now requires.

### Found on the way, NOT fixed

**Removing a plan that somebody is subscribed to takes down three admin
screens.** `PlanController@destroy` soft-deletes without looking, and
`Subscription::plan()` does not include a removed plan, so `$sub->plan->name`
reads a property of null. Reproduced with the ordinary admin action: before
it, `/admin/subscriptions`, the customer page and the subscription page all
answer 200; after it, all three answer 500. The per-product subscription list
and the dashboard survive.

`SubscriptionManager::generateInvoice()` reads `$plan->price` the same way, so
the renewal of such a subscription would fail too. That one was read, not run.

It needs a decision, not a patch. Either a plan that is in use cannot be
removed, or a subscriber keeps a removed plan and every screen and the
invoicing must read it `withTrashed()`. The code already leans to the second —
the entitlement observers load the plan `withTrashed()` — but which it is, is
the owner's to say.

### Next recommended step

Pull on production; there is nothing to migrate. Then decide the removed-plan
question above: it is one click away from a production 500.

---

## 25. BinduHost Customers Could Not Pay With ShurjoPay — 2026-10-03

**Status: FIXED and pushed, awaiting the pull on production. No migration, no
dependency, no stylesheet rebuild.**

### What the owner saw

"ShurjoPay is not working", on a BinduHost order placed that day: the order
page said "Awaiting payment" and offered nothing to press.

### Not the configuration

ShurjoPay is set up and on in production. That was read on the server through
the application's own configuration, not assumed: enabled, live, the base URL,
username, password and prefix all present, and Pay Now offered. The secrets
themselves were never printed.

### What was wrong — two things

1. **The order page had no way to pay.** Paying happens on the invoice page,
   and the only way there was the invoice card at the bottom of the order,
   which reads as a record rather than a button. Nobody had pressed Pay for
   that invoice: production had no ShurjoPay transaction for it.
2. **ShurjoPay refuses a payer without a phone, an address and a city**, and
   portal sign-up asks for a mobile number but no address and no city. The
   live gateway answers such a request with an HTTP 200 whose body is only the
   missing field names, and BCP told the customer "The payment gateway is not
   responding". Production's log on 2026-10-01 shows that exact answer, keyed
   by `customer_address` and `customer_city`, on the payment-link page. The
   payment-link page falls back to the tenant's address for this reason; the
   portal's pay action sent the customer's own details with no fallback, and a
   BinduHost customer has no tenant to fall back to. So a customer who signed
   up in the portal would hit it the moment they pressed Pay, unless they had
   since filled in an address and a city on their profile.

### The fix

* `ShurjopayGateway::REQUIRED_PAYER_DETAILS` and `missingPayerDetails()`: what
  ShurjoPay will not take a payment without, and which of it a customer's
  profile lacks. The gateway is where that knowledge belongs.
* The invoice page asks for exactly those, inside the Pay Now form, and says
  they will be saved to the profile. The pay action validates them, saves
  them, and only then goes to ShurjoPay. Nothing the profile already holds is
  overwritten. Refused, nobody is sent to ShurjoPay and no transaction is made.
* The order page has a **Pay now** button while its invoice is neither paid
  nor cancelled. It leads to the invoice, where both ShurjoPay and the bank
  transfer are.

### Why the tests had not seen it

The five existing ShurjoPay suites fake a gateway that takes any payer, and
their customers had no phone, address or city — the production shape exactly,
passing only because the fake was kinder than the gateway. Those customers now
have the three details, with a comment saying why; nothing else in those files
changed, and all 135 of their tests pass.

`ShurjopayPayerDetailsTest` fakes the gateway the way it really answers. It
proves the premise first — handed a customer as portal sign-up leaves them,
the gateway refuses — then covers being asked, being refused without anything
sent, saving, not overwriting, asking nothing of a complete profile, and the
order page button. Three of its tests fail against the old pay action.

Every class used was already in the committed stylesheet.

Full suite: **1449 passed, 1 skipped, 7884 assertions, exit 0** — the seven
new tests on top of section 24's count.

### Not done

* The payment-link page can still send an empty address or city when neither
  the customer nor the tenant has one, and would fail the same way. It was not
  part of this.
* Existing customers are not back-filled. Each is asked once, the first time
  they pay.
* Not looked at in a browser; the forms were rendered by tests only.

### Next recommended step

Pull on production; there is nothing to migrate. Until then, a BinduHost
customer can be unblocked by hand: admin → Customers → the customer → Edit,
and fill in the address and city.

---

## 26. Buying Hosting in Four Steps, With Its Domain — 2026-10-03

**Status: DEPLOYED 2026-10-03 — step two seen live on production by the owner.
No migration, no dependency, no stylesheet rebuild.**

### What the owner asked

On the BinduHost cart: a way to give the hosting a new or an existing domain,
a progress bar across the top of the whole process, and fewer steps — "like
Lagom or WHMCS".

### Before

A plan card's Add to cart put hosting in the cart with no domain at all, then:
the cart, a separate review screen showing the same lines again, the order
screen, its invoice, and only then a way to pay. The domain was asked for
nowhere; whoever set the account up had to find it out from the customer after
they had paid.

### Now — four steps, with the bar on each

1. **Choose plan** — the catalogue. A plan card's button is **Order now**.
2. **Domain** — new page, `portal/binduhost/shop/hosting/{plan slug}`:
   register a new domain, or use one the customer already owns. For a new one
   the price is worked out in the page as the name is typed, from the
   published prices; it is display only and the order is priced without it.
   Continue puts in the cart the hosting for that domain, and the registration
   when it is new.
3. **Review & order** — the cart, which now places the order itself.
4. **Payment** — placing the order lands on the invoice, shown in the
   BinduHost client area under the same bar. Paid, the bar shows every step
   done.

The bar is `x-binduhost.order-steps`. Nothing on it is a link.

### How the domain travels

* **Cart.** A hosting line may carry `domain`; with one it is a single
  account, so it has no quantity control. `holdsDomain()` now counts domain
  lines only — hosting for a name and the registration of that name belong in
  one cart together — and hosting for the same name twice is refused.
* **Adding.** `addHosting()` checks the name; for a new domain it asks
  `OrderManager::quote()` first, so an extension that is not on sale, or a name
  already registered here, is refused on step two rather than turning up two
  screens later as a line that cannot be ordered. Hosting and its registration
  go in together or not at all.
* **The order.** `OrderManager::priceHosting()` keeps the name on the hosting
  line, in `order_items.domain_name`, which already existed. No migration.
* **Settlement.** `ServiceRecorder` links each hosting account to the domain its
  line names, when BinduHost holds that domain for this customer — bought on
  this order, or held already. Its old guess, "one domain and one hosting on an
  order belong together", now applies only to hosting that named no domain. A
  customer with their own domain and an unrelated registration on the same
  order would have had the two joined; a test shows the old code doing exactly
  that.
* **Afterwards.** A domain the customer owns elsewhere has no domain row.
  `HostingService::orderedDomainName()` reads it from the order line, and the
  admin hosting page, the admin order page and the customer's hosting pages
  show it.

### What did not change

* `POST portal/binduhost/shop/hosting` still takes a plan alone and adds
  hosting without a domain, as before, so every existing caller still works.
  Only the catalogue stopped offering that.
* The review screen still answers at `portal/binduhost/checkout`, with the bar
  on it; nothing links there any more.
* The domain list on the catalogue — registering, renewing or transferring a
  domain on its own — is as it was.

Changed in existing tests, because the flow changed: placing an order now
lands on the invoice (two concurrency tests and their worker), and the plan
card says Order now instead of Add to cart (the catalogue affordance and
registration tests, which also gained checks that a guest, staff and a
suspended customer are not offered it and that staff cannot open step two).

### Proof

* `HostingDomainStepTest`, 14 tests: the step and its 404s, both options into
  the cart and onto the right totals, an extension not on sale and a malformed
  name refused with nothing left in the cart, a second hosting for one name
  refused, the step without any prices, the cart placing the order and landing
  on the invoice, an ordinary invoice untouched, the domain on the order line
  and the account, a new domain linked, an own domain never paired with an
  unrelated registration, and the administrator seeing the domain.
* Looked at in a browser at 1534×734 and at phone width, all four steps. At
  1534×734 nothing on the domain step or the cart needs scrolling; the running
  total followed the name as it was typed and followed the switch between the
  two options.
* Every class used was already in the committed stylesheet. A fresh build
  names five more, but they come from compiled views in `storage/` left by this
  work's own test renders; none of them is in a source file.
* Full suite: **1463 passed, 1 skipped, 7965 assertions, exit 0** — the 14 new
  tests on top of section 25's count.

### Not done

* No availability check. BCP has no registrar integration, so "register a new
  domain" records the request, and the page says availability is confirmed
  when the domain is registered.
* Transfer-in is not offered on step two; it stays on the catalogue's domain
  list.
* If no extension has a price, step two shows "register a new domain"
  disabled and offers only the customer's own domain.

### Next recommended step

Pull on production; there is nothing to migrate. Then check admin → BinduHost
→ Domain pricing has the extensions to be sold, or step two can only take a
domain the customer already owns.

---

## 27. Is the Domain Free? A Search Before a New Registration — 2026-10-03

**Status: DEPLOYED. The owner's production screenshots of 2026-10-03 show step
two with its Search button. No migration, no dependency, no stylesheet rebuild.
One new config file, one new optional `.env` key.**

### What the owner saw

On production, step two took "register a new domain: binduhost.com" — a name
BinduHost itself already owns — priced it at BDT 999 and offered Continue.
Nothing asked whether the name was free; section 26 said so under "Not done".
The owner asked for a Search that checks availability before going on, and
pointed at a competitor's step two to show the shape.

### Now

* Step two looks like that reference: **Register new / I already have one** as
  a pair of tabs, the name box with a **Search** button joined to it, a line of
  help under it, "Register for N years", and Continue on the right.
* For a new domain, Continue is grey until Search has said the name, exactly
  as typed now, can be had. Search answers in one line: free and what it costs
  a year; taken, with "or, if it is yours, choose I already have one"; not on
  sale or not a domain name; or "could not check just now", which lets the
  customer continue. Enter in the box searches rather than submitting.
* "I already have one" asks nothing: a registered name is what it expects.

### How a name is checked

`App\Services\Domains\DomainAvailability`, in this order:

1. **RDAP** — the registry itself over HTTPS, the successor to WHOIS. IANA's
   list (fetched once a day) says which server answers for an extension; 404
   is free, 200 is registered. Covers .com, .net and most others.
2. **DNS over HTTPS** — for an extension with no RDAP service (.bd has none),
   or a registry that did not answer. NOERROR is registered, NXDOMAIN is free,
   anything else is "could not ask". The first version used PHP's own
   resolver, and found the flaw on its first real run: `btcl.com.bd` came back
   "available", because a slow .bd lookup and a missing name look the same to
   it. Over HTTPS they are different answers, and `btcl.com.bd` is "taken".
3. Neither answered: **unknown**, which refuses nothing.

An answer is kept ten minutes, so Search and Continue are one lookup; a
failure is not kept, so it is asked again next time.

Checked from this PC against the real registries before committing:
binduhost.com and btcl.com.bd taken, daraz.com.bd taken, random new .com and
.com.bd names free, binduit.com.bd free.

### Where it is enforced

Not only on the page. `GET portal/binduhost/shop/domain-check` answers the
Search button (JSON, signed-in customers, 30 a minute), and the same check
runs again when step two's form arrives and when the catalogue's domain list
adds a registration. A taken name is refused in all three, so a browser that
skips the button or has no JavaScript gets nobody a name that is taken.

### Configuration

`config/binduhost.php`, new:

| Key | Env | Default |
| :--- | :--- | :--- |
| `domain_lookups` | `BINDUHOST_DOMAIN_LOOKUPS` | true |
| `rdap_bootstrap_url` | `BINDUHOST_RDAP_BOOTSTRAP_URL` | IANA's list |
| `dns_over_https_url` | `BINDUHOST_DNS_OVER_HTTPS_URL` | Cloudflare's JSON resolver |
| `lookup_timeout` | `BINDUHOST_LOOKUP_TIMEOUT` | 5 seconds |

Nothing needs setting on the server. `BINDUHOST_DOMAIN_LOOKUPS=false` is the
switch to turn the questions off if a registry ever misbehaves; the test suite
runs with it off (phpunit.xml), because no test may reach the network.

Every name a customer searches is sent to its registry, or to Cloudflare's
resolver for .bd. Both are public lookups of a public name, the same thing any
resolver does, but it is said here because it leaves the building.

### Proof

* `DomainAvailabilityTest`, 15 tests, every registry and DNS answer faked:
  RDAP free and taken, HTTPS only, IANA's list fetched once; DNS for .bd; a
  registry that does not answer handing over to DNS; DNS that cannot be asked
  not taken for a free name; answers kept and failures not; switched off asks
  nothing; Search's four answers; Search for signed-in customers only and rate
  limited; a taken name refused on step two without any Search, and by the
  catalogue's domain list; a free name through; "I already have one" not asked;
  an unanswerable name let through.
* Step two looked at in a browser at 1534×734: grey Continue before Search,
  the free and taken answers, and "could not check" when the endpoint could
  not be reached.
* Every class used was already in the committed stylesheet. **Corrected in
  section 28: one was not** — `border-l`, the line between the name box and
  the Search button, so on production that line never drew. Section 28's
  rebuild adds it, and a test now catches the whole class of mistake.
* Full suite: **1478 passed, 1 skipped, 8009 assertions, exit 0** — the 15 new
  tests on top of section 26's count.

### Not done

* Availability is still not a reservation. BCP has no registrar integration;
  a name free now can be taken before it is registered, and a registered name
  that was never put in DNS still looks free on .bd. The page says a free name
  is confirmed when it is registered.
* No suggestions of similar free names.

### Next recommended step

Pull on production — `config:cache` picks up the new config file; there is
nothing to migrate — then search binduhost.com on step two: it should say
taken.

---

## 28. Pay Now From the Cart, and BinduHost in the Owner's Purple — 2026-10-03

**Status: DEPLOYED, commits `1b7460d` and `62b55d1`. Confirmed from outside on
2026-10-03: production serves `app-DGxPdlLh.css`, and the owner's screenshots
show the purple client area. No migration, no config, no new `.env` key. The
all-purple page described below was changed to a bright one the same day —
see section 29.**

### What the owner asked

Three things, in one go:

1. On the cart, no "Place order": a **Pay Now** that goes straight to
   ShurjoPay.
2. The client area's background built from a palette they sent — five purple
   swatches — using whichever shade looks right wherever.
3. The menus made more beautiful.

### Pay Now

Where ShurjoPay is switched on, the cart's button is now **Pay Now**. One
press places the order — the same order, invoice and email as before — and
sends the customer to ShurjoPay's checkout. Coming back from ShurjoPay lands
on the invoice, as it always did.

* **Payer details first.** ShurjoPay refuses a payer without a mobile number,
  an address and a city (section 25), so whatever the profile lacks is asked
  for on the cart, beside the button, and saved to the profile. It is checked
  before any order exists: a refusal leaves no order, the cart untouched, and
  nothing sent to ShurjoPay.
* **If ShurjoPay will not start**, the order still stands — placed, invoiced,
  cart emptied — and the customer lands on the invoice with "Order … is
  placed, but ShurjoPay did not respond. Try Pay with ShurjoPay below in a
  moment, or pay by bank." Nothing is lost and nothing is ordered twice.
* **Paying by bank** is one link under the button, "Pay by bank transfer
  instead": the old Place order, ending on the invoice page.
* **ShurjoPay switched off**: the cart shows Place order as before, and the
  Pay Now address falls back to placing the order.
* Pay Now holds the same ten-second lock as Place order, so a double press
  makes one order. The emptied cart is saved before ShurjoPay is called, so a
  slow gateway cannot leave a full cart behind a placed order.

Code: `BinduhostShopController::payNow()`, posted to
`POST portal/binduhost/checkout/pay` (`portal.binduhost.checkout.pay`).
`ShurjopayGateway::payerDetailRules()` and `payerFor()` are new and shared:
the invoice page's own Pay with ShurjoPay button now uses them too, so the
two ways in ask for the same details by the same rules.

### The purple

Sampled from the image the owner sent, and where each went:

| Swatch | | Used for |
| :--- | :--- | :--- |
| `#EFD4FF` | lavender | the menu's "you are here" pill, the lightest accent |
| `#C791E0` | orchid | links, focus rings, the glow at the corner of the page |
| `#66308B` | purple | the glow behind the top of the page, the active icon tile |
| `#48166B` | deep | borders and dividers |
| `#21013E` | deepest | the frame (menu rail and top bar), the floor the page fades to |

How: the layout's `<html>` now carries `theme-binduhost` instead of
`theme-stock`. Like the old scope it re-points the two colour families every
BinduHost screen is written in, slate and indigo — so every screen follows and
no view was edited for colour. The page ground is the palette's gradient, its
darker half, with the purple and orchid glows at the top; the frame sits a
shade deeper with an orchid hairline. Green, red and amber are untouched and
still mean done, wrong and waiting.

Readable by measurement, not by eye: metadata 5.4:1 on a card, secondary text
7.5:1, links 8.8:1, a white label on a button 6.0:1 (4.8:1 on hover), the
active menu label 10.6:1 or better. The input edge and the disabled button
share the least saturated step on purpose, so a disabled button does not pass
for a purple one you can press. The shared rules that are not utilities — the
input focus ring, text selection, the paginator — follow the palette through
the `--bcp-*` variables inside the scope.

### The menu

* The Bindu mark instead of a letter in a box.
* Every item has an outline icon on its own small tile — the admin sidebar's
  icon style, so the two halves of BCP look like one product.
* The page you are on: a lavender pill, its icon on a purple tile.
* At the foot: the customer's initials in a ring, their name and email, and
  Sign out as an icon beside them. The words "Sign out" are still there for a
  screen reader and as the tooltip, and it is still withheld while
  impersonating.
* Compact: all ten items, the four captions, the logo and the account strip
  fit 1534×734 without the menu scrolling (measured: 604 of 604 px).
* On a computer the rail now stays put while the page scrolls, so the menu
  and Sign out never scroll away. The phone drawer behaves as before.
* Labels, order, groups and links are unchanged.

### The stylesheet

Rebuilt in the main checkout: `app-DGxPdlLh.css` replaces `app-BD3euWN6.css`.
Against the committed build, by class name: added the `bh-*` rules,
`theme-binduhost`, the three `lg:` classes that keep the rail in place,
`space-y-0.5`, and `border-l`; removed `theme-stock`, six classes only the
old menu used, and one that only a stale compiled view still mentioned.
Nothing still in use was dropped — each removed name was searched for across
the repository first.

`border-l` is section 27's miss: the line between the domain box and its
Search button. It was written in the view but never compiled, because that
section did not rebuild. It draws now.

### Proof

* `PayNowTest`, 10 tests, ShurjoPay faked: Pay Now offered when ShurjoPay is
  on and Place order when it is off; only the missing payer details asked
  for; one press places the order and lands on ShurjoPay's checkout with the
  right amount; missing details refused before any order exists, cart intact,
  nothing sent; details given on the cart kept and sent; ShurjoPay refusing
  to start leaves the order standing and the invoice offering both ways to
  pay; switched off it only places the order; an empty cart orders nothing;
  bank still lands on the invoice; the same lock against a double press.
* `ClientAreaThemeTest`, 4 tests:
  * every class a BinduHost screen uses is in the committed build. Proven
    both ways: a made-up class written into a view fails it, and run against
    the previous build it names all 19 classes that build lacks — `border-l`
    among them;
  * the layout wears the palette, deepest swatch on the frame and lightest
    on the active item;
  * contrast computed from the compiled build for six jobs (metadata,
    secondary text, placeholder, link, button label, hover label), all at
    least 4.5:1 — a fainter grey put into the build fails it;
  * the menu marks exactly one page — the one you are on — and all ten rows
    carry their icon.
* Looked at in a browser at 1534×734 and 375×812: cart with Pay Now and the
  payer fields, dashboard, catalogue, step two, invoice, order, the visitor's
  catalogue, and the phone drawer open.
* Full suite: **1492 passed, 1 skipped, 8110 assertions, exit 0**.

### Not done

* BinduHost stays a dark client area; the palette's light end is used as
  accent, not as a light theme.
* ShurjoPay on production is live: Pay Now takes real money. Try it with a
  small order, or cancel on ShurjoPay's page — cancelling leaves the order
  awaiting payment and the invoice unpaid, payable later from the invoice.
* Still open from earlier sections: the public payment-link page can still
  send ShurjoPay an empty address and city.

### Next recommended step

Commit and pull on production, then open BinduHost with something in the
cart: the background and menu should be purple, and Pay Now should go to
ShurjoPay.

---

## 29. Choose Plan Opens the Plan, BCP Holds the Price, and a Bright Page — 2026-10-03

**Status: DEPLOYED on BCP, commit `cbaaf7f`. Checked from outside on
2026-10-03: the price feed answers with 36 plans (12 Web, 12 WordPress, 12
Reseller) at the confirmed prices, production serves `app-MVFRFz5B.css`, and a
visitor opens a reseller plan's step two. The website's half (`eafd5f1` in the
binduhost repository) is live too, after the `binduhost` cPanel account was
updated from its remote — it does not do that by itself: the live pricing
cards fetch BCP's feed, and all 36 Choose Plan links open a step two.**

### What the owner asked

Three requests in one sitting, each with a decision of theirs behind it:

1. A Choose Plan button on binduhost.com led to BCP's catalogue, where the
   visitor had to find the package they had just picked and pick it again. It
   should open on that plan's step two.
2. A price changed in one place should change in the other by itself.
   **Decision: BCP is the place.** The owner changes it in Admin → Plan Tiers
   and the website follows.
3. The purple client area of section 28: keep the sidebar, make the body
   white — a whole screen of deep purple was hard on the eyes.

And two more decisions, asked for because they set real prices: the WordPress
and Reseller prices on the website are confirmed as the ones to sell at, and
the Shared Hosting page stays unconnected for now.

### 1. Choose Plan opens the plan

Step two — `GET portal/binduhost/shop/hosting/{plan}`, the domain the hosting
is for — is now public, like the catalogue beside it.

* **A customer who can order** gets the form, unchanged.
* **A visitor** gets the plan, its price, and "Sign in to continue" or "Create
  an account". The page is remembered for them the way the catalogue remembers
  its own — for guests only — so signing in or registering comes straight back
  to the same step with the plan still chosen. Before this, a visitor sent to
  step two was bounced to sign in and then dropped on a dashboard.
* **A signed-in account that cannot order** (staff, a suspended customer) gets
  "This account cannot place orders" and Sign out, as on the catalogue; not
  while impersonating.
* **A plan no longer sold** is not a dead end: the catalogue opens with "That
  plan is not on sale any more." It used to be a 404, and the website's links
  outlive the plans they name.

Nothing that spends money moved: the form's POST, the domain Search, the cart
and checkout are all still inside `customer.portal`.

The blunt fix would have been to make the portal's own guard remember where
every visitor was going. It was not done: staff sign-in reads the same
remembered address, so a staff member who had once opened a customer link
would be sent to a customer page after signing in at /admin.

### 2. WordPress and Reseller hosting on sale

BinduHost's WordPress and reseller pages had Choose Plan buttons and no plan
in BCP to open. Two seeders now create them, modelled exactly as Web Hosting
is — a term is part of the plan, and the price is the whole term's:

| Product | Plans | One year | Two years | Three years |
| :--- | :--- | :--- | :--- | :--- |
| WordPress Hosting | WPSH-5GB | 3,360 | 6,720 | 10,080 |
| | WPSH-10GB | 5,040 | 10,080 | 15,120 |
| | WPSH-100GB | 6,720 | 13,440 | 20,160 |
| | WPSH-UN | 8,400 | 16,800 | 25,200 |
| Reseller Hosting | RESELLER 50GB | 24,000 | 43,200 | 57,600 |
| | RESELLER 100GB | 42,000 | 75,600 | 100,800 |
| | RESELLER 170GB | 78,000 | 140,400 | 187,200 |
| | RESELLER 300GB | 102,000 | 183,600 | 244,800 |

The website's own data file warns that the reseller tiers follow another
host's structure and should be confirmed first. They were: the owner was shown
all twenty-four figures and confirmed them on 2026-10-03. Every price and every
feature line was then compared by a script against the website's data — 24
plans, nothing missing, nothing added, nothing repeated.

Slugs carry the package name (`reseller-50gb-1y`, `wpsh-un-3y`) because step
two finds a plan by slug alone, across products.

With thirty-six plans the catalogue lists each kind of hosting under its own
name, with jump links at the top. Each card works its monthly figure out from
the price as it stands. In the admin panel the two new products carry the same
BinduHost screens as Web Hosting.

### 3. BCP is where a price lives

* **Seeders no longer write a price back.** A seeder's figure is an opening
  price, set when the plan is created. Running one again keeps a price the
  owner changed and keeps a plan the owner withdrew, and still refreshes the
  name, summary and feature lines (`PublishesHostingPlans`). Without this the
  next seeder run would have silently undone every price change.
* **No plan stores a sentence with a price in it.** Web Hosting descriptions
  used to end "billed BDT 1,200 up front — 50% off the regular…", which would
  go on saying it after the price changed. They are the summary alone now.
* **A public price feed.** `GET /api/v1/binduhost/plans` lists what is on sale
  — slug, product, name, price, currency, months — by the catalogue's own
  rule, so it says nothing the catalogue page does not already show without
  signing in. Read-only, 120 a minute, cacheable for five minutes. BCP's API
  already answered cross-origin reads; that was checked against production.
* **The website reads it.** Its pricing cards ask BCP in the visitor's browser
  and show that price, with the monthly figure and the percentage off worked
  out from it. The figures built into the site are what shows until BCP
  answers, and if it cannot be reached.

So: change a price in Plan Tiers, and within five minutes the homepage, the
WordPress page and the Reseller page show it, and it is what is charged.

### 4. A bright page inside the purple frame

The client area is now the shape the admin panel has: a dark rail and top bar
around a bright page, built the same way with two scopes rather than edited
views. `theme-binduhost` turns the page's neutrals over, so cards are white
and headings are the palette's deepest purple as ink; `theme-binduhost-frame`
on the rail and the top bar puts the purple back.

Three things a turned-over ramp gets wrong, each handled:

* **A label on a purple button** was `text-white`, which is dark ink on the
  bright page. Sixteen such labels are a literal white now, and
  `AccentLabelColourTest` holds BinduHost's screens to that as it holds the
  admin panel's.
* **Status words** were written in tints for a dark surface — a pale green
  word cannot be read on white. Inside the page the text steps of green, red
  and amber are the same hue, dark enough to read. Green still means done.
* **The drawer's scrim** would have been a white veil; it has its own dark one.

Checked by measurement, not by eye: every visible piece of text on nineteen
screens, at computer and phone width — 2,927 of them — was measured against
the background actually behind it. None is below 4.5:1.

The top bar was kept purple with the rail, as the owner's marked-up screenshot
left it. It is one class to make it white instead.

### The stylesheet

Rebuilt: `app-MVFRFz5B.css` replaces `app-DGxPdlLh.css`. By class name, four
added — `theme-binduhost-frame`, `bh-scrim`, `scroll-mt-20` and the skip link's
literal white — and two removed that only the old scrim and skip link used.
`ClientAreaThemeTest` failed on `scroll-mt-20` until the rebuild, which is what
it is for.

### Proof

* `ChoosePlanLinkTest`, 6: a visitor lands on the plan; signing in comes back
  to it; so does creating an account; a plan no longer sold shows the
  catalogue; a visitor still cannot put anything in a cart; staff keep their
  own destination. Without the remembered address, three of them fail.
* `HostingCatalogueFamiliesTest`, 12: both families at their exact prices; no
  slug shared; each opens its own step two; a reseller plan ordered and
  invoiced at 75,600; the catalogue grouped; a re-run keeps a changed price,
  keeps a withdrawn plan, still refreshes a name; no description quotes a
  price; the monthly figure follows the price; the admin tabs.
* `PlanPriceFeedTest`, 7: thirty-six plans at BCP's prices; a changed price
  is in the feed; what is not on sale is not; the feed equals the catalogue;
  six fields and no more; readable cross-origin and cacheable; refuses a write.
* `ClientAreaThemeTest` rewritten for the bright page: the frame on rail and
  top bar, a bright ground, seventeen text jobs at 4.5:1 or better.
  `CataloguePurchaseAffordanceTest` and `HostingDomainStepTest` updated where
  step two's 403 and 404 became a page and a redirect.
* The website: type-check, lint and static build pass in a clean copy holding
  only these changes; in a browser against a test feed the cards followed a
  changed price, hid the discount badge for a price above the regular rate,
  kept built-in figures for a plan the feed lacked and when the feed was
  unreachable, and moved prices and links with the term switch.
* Full suite: **1518 passed, 1 skipped, 8498 assertions, exit 0**.

### To put it live

1. Pull, then the usual caches — `route:cache` matters here: step two moved
   and the feed is new.
2. Run the three seeders once:
   `db:seed --class=WebHostingPlanSeeder --force` (refreshes descriptions and
   keeps every price), then `WordPressHostingPlanSeeder`, then
   `ResellerHostingPlanSeeder`.
3. Only then deploy the website. In the other order its new links would reach
   a BCP that still bounces a visitor to a dashboard.

### Not done

* **The Shared Hosting page is not connected**, on the owner's decision: it
  sells the same four prices under different names and specifications. Its
  buttons still open the catalogue and its prices will NOT follow BCP.
* The website's header ticker, domain prices and "from ৳…" lines are still
  its own figures. Only the plan cards on the homepage, the WordPress page
  and the Reseller page follow BCP.
* A crawler, and the first instant of a page load, see the figure built into
  the website. After a lasting price change the website should be rebuilt so
  that figure is the new one too.
* Renewal pricing is still undecided, as section 28 and the seeders say.

### Next recommended step

Commit, pull, run the three seeders, then deploy the website. After that,
change one price in Plan Tiers and watch the website's card follow it.

---

## 30. Login as Customer, From a Subscription's Own Page — 2026-10-03

**Status: DEPLOYED, commit `908bef5` — the owner's production screenshot of
2026-10-03 shows it on a POS subscription. No migration, no config, no
stylesheet rebuild. For a POS shop it could only ever say "No customer
linked", which was not what the owner meant; section 31 is the answer to
that, and moves "Visit as customer" up beside this button.**

### What the owner asked

On a product's subscription page (`admin/saas/pos/subscriptions/9`), a marked
empty space beside the status badge, and "add login as a customer".

### What it is

The **Login as Customer** button that already existed on a customer's page,
now also on the subscription, beside the status badge where it was asked for.
It enters BCP's customer portal as the customer behind that subscription: the
one it belongs to directly, or the one its account is linked to.

It is the same button, not a second way in. The form posts to the customer
page's own route, `POST admin/customers/{customer}/impersonate`, so nothing
about who may do it, as whom, or for how long is decided on this page:

* the super-admin group, the current-password check, CSRF and the admin audit
  middleware are the route's, and the subscription page sits in the same group,
  so everyone who can see the button could already use the route;
* the refusals are the route's — no active portal login, a customer who is not
  active, a session already impersonating;
* the audit row and the thirty-minute window are the route's.

`ImpersonationController` is not touched.

Two things the page itself had to do:

* **Say a refusal.** The route refuses by sending back an error, and this page
  showed success and error flashes but not that. A refusal would have looked
  like a button that does nothing; it is shown above the subscription now.
* **Say why there is no button.** An account nobody has been linked to has no
  customer to enter as. It shows "No customer linked" instead of nothing, with
  the reason on hover.

### What it is not

It does not sign in to the product. "Visit as customer", lower on the same
page, is that, and it appears only for a product whose integration can take an
administrator in — Medi and BEMS today. **POS was not one of them** when this
was written, so on a POS subscription the only way in was BCP's own portal,
which is what this button is. Entering the POS software itself as a shop's
owner needed the POS to implement the visit contract. The owner then asked
for exactly that: see section 31.

### Proof

* `SubscriptionLoginAsCustomerTest`, 7: the page names the account's customer;
  following the page's own form signs in as that customer's portal user, with
  the impersonation noted and one audit row under the admin's name; a
  subscription a customer owns directly names that customer; two subscriptions
  name their own customers and not each other's; an unlinked account has no
  form at all and says why; a refusal comes back to this page and is shown on
  it; staff who are not super admins reach neither the page nor the route.
  Proven both ways: with the customer left out, three fail; with the error
  outlet removed, the refusal test fails.
* `CustomerImpersonationTest` is unchanged and passes: the route it guards is
  the one this posts to.
* Looked at in a browser at 1534×734: the button sits left of the status badge
  on the same row; the refusal banner; the "No customer linked" note.
* Full suite: **1525 passed, 1 skipped, 8536 assertions, exit 0**.

### Next recommended step

Commit and pull — the usual caches, nothing else — then open a POS
subscription and press Login as Customer.

---

## 31. Into the POS as a Shop's Owner, and the POS's Shops Listed Here — 2026-10-03

**Status: DEPLOYED and WORKING on production, 2026-10-03 — BCP `5e83241`,
POS `bd6a7d7`, with the secret set. The owner pressed Visit as customer on
Smart Gadget's subscription and landed in the POS as that shop's owner, with
the notice and End the visit (their screenshot). The first build (BCP
`fde4f84`, POS `0c62bc8`) had been refused there with "This shop is not known
to this POS"; the cause and the correction are under "What production
showed" below. No migration on either side and no stylesheet rebuild.**

### What the owner asked

1. Section 30's button, on a POS shop's subscription, said "No customer
   linked". Asked where they wanted to land, the owner chose **the POS
   software itself**, as the shop's owner — what BEMS and Medi already have.
2. Then: *demo shops are not needed; only the real customers show in BCP*,
   with a screenshot of BCP's POS overview: Smart Gadget, eight times, and
   nothing else.
3. And to ask the POS's own session what exists there. It was asked; its
   answers are the facts below.

### What was found

* A POS shop reaches BCP only when its billing is connected by hand — an
  account made here, a token issued for it, the token put in the POS's
  environment, the shop pointed at the account. Production's POS has thirteen
  shops: its operator's own, four demonstration shops, and eight others,
  among them Bangladesh Elevator Ltd, Jalal Telecom, Bondhu Telecom, JKS
  Electronics and Baby Town. **One** of them, Smart Gadget, is connected. So
  "the real customers show in BCP" was not true, and could not be made true
  from BCP's own records.
* No demonstration shop is in BCP. There was nothing to remove.
* The POS had nothing that lets BCP in: only its superadmin's own
  "Login as User".

### What it is

**1. "Visit as customer" for a POS shop, on its subscription's page.** The
same button Medi and BEMS have, now beside the status badge — where the owner
marked the gap — for every product. For a POS shop it is the only way in, so
"No customer linked" is no longer shown when the visit is offered; it is said
only when there is no way in at all.

**2. A Shops tab on the POS's screens** (`admin/pos/shops`). BCP's server asks
the POS for its shops and lists every real one — name, owner, phone, package
and its end date, active or not, whether BCP bills it yet (with a link to the
subscription when it does) — and offers the same visit for each that may be
entered. The list is read when the screen is opened and stored nowhere: no
account, subscription or plan is made by looking at it.

**3. The POS's half**, which did not exist: checking the pass, signing the
owner in for thirty minutes, saying so in the header with "End the visit",
ending it when the time is up, keeping the owner's own keys out of reach, and
writing the visit and everything done in it to the shop's activity log.

The POS is **not** registered in `config/product_integrations.php`. That would
give it an entitlement, billing and webhook API it does not speak. What BCP
needs to know lives in `config/pos.php`: the POS's address and one secret.

### The contract

The pass is the one Medi and BEMS are sent — base64url JSON, a dot, and
HMAC-SHA256 over `visit.` plus the body; one minute; single use; posted in a
form, never in an address — with two additions for the POS only:

* `aud: "pos"`. A pass says which product it is for, and the POS refuses one
  that does not say so. Medi's and BEMS's passes are byte-for-byte what they
  were; a test holds their key list.
* **The account is typed**, three ways, and the POS finds each one way only:
  * `bcp_subscription:<id>` — from the page of a subscription the POS
    mirrored here. BCP's own id for that subscription, found in the POS
    through `subscriptions.bcp_subscription_id`, which the POS writes when
    BCP acknowledges a push. It must name exactly one shop.
  * `tenant:<id>` — from the page of a POS subscription that was never
    mirrored (made by hand here). The BCP account, found through
    `business.bcp_tenant_id`.
  * `business:<id>` — from the Shops screen. The shop's own id in the POS.

  None is ever tried as another, so a number that happens to be some other
  kind of id opens nothing.

The list of shops is a signed request from BCP's server, never from a
browser: `GET /api/bcp/shops` with a timestamp and HMAC-SHA256 over `shops.`
plus the timestamp, good for a minute either way. The prefix is its own, so a
pass signature is not a list signature and neither is a webhook's.

Both are signed with a secret kept for this alone (`POS_VISIT_SECRET` here,
`BCP_VISIT_SECRET` in the POS), not one of the per-shop API tokens: a pass
opens any shop, and a shop's token must never be able to make one. Under 32
characters it counts as unset. In production BCP will not send a pass, or
fetch the list, over anything but https.

### What production showed

The first press of the button, on Smart Gadget's subscription, landed on the
POS's refusal page: *This shop is not known to this POS.* Everything else had
worked — the pass was signed, in time, for the POS, and the POS read it.

As first built, a subscription's page named the shop by its BCP account
(`tenant:<id>`), which the POS finds through `business.bcp_tenant_id`. That
column was assumed to be set for every shop that mirrors here. It is not: a
shop's subscriptions are pushed with its own API token, and BCP takes the
account from the token, so nothing in the mirror needs the column and on
production nobody had written it for the one shop that is connected. The
development machine's two test shops both have it, which is why every local
run passed.

The POS did the right thing with a pass it could not place: it refused, and
tried nothing else. The mistake was in what BCP put in the pass.

**The correction:** a mirrored subscription's page now names the shop by the
subscription itself — BCP's id for it — and the POS looks that up in the
column where it recorded the id BCP gave back. That pair is the one thing
both sides are certain to hold for anything that was mirrored. `tenant:<id>`
is kept only for a POS subscription that was never mirrored.

The same assumption was behind the Shops screen's "Billing in BCP" column,
which would have said "Not connected" for Smart Gadget. The POS now tells BCP,
per shop, the newest subscription BCP acknowledged, and the column reads
that first.

`business.bcp_tenant_id` itself was left as it is. Whether production's
connected shop should have it set is the POS session's question — other
things there read it (`bcp:saas-backfill`, the plan map) — and it was told.

### Who is never entered

Decided by the POS, when the pass arrives — BCP cannot see into it:

* **A demonstration shop.** Never listed to BCP, never entered from it. The
  four owner usernames are written out in the POS's `config/bcp.php` rather
  than read off its seeder, because the seeder is left out of the packages
  customer installations are updated from; a test keeps the two lists equal
  where the seeder exists.
* **The operator's own shop.** Its owner is a POS superadmin, and signing in
  as that account would turn a shop visit into superadmin over every business
  on the installation. Refused for both kinds of account, and refused again
  at the point of sign-in, so no caller can start a visit this rule forbids.
  It is listed, marked, with no button.
* A shop that is deactivated, or whose owner could not sign in themselves. A
  visit does what the owner could do and no more.

### During a visit

* The header says who is signed in, as whose owner, and until when, with
  **End the visit**. Leaving, or the half hour running out, signs out, clears
  the session and goes back to the BCP screen the administrator came from.
* The owner's password, profile (the address a password is reset through)
  and second sign-in step cannot be opened or changed, by the profile page or
  by the owner's own row on the Users screen. Other users of the shop can
  still be helped.
* The session carries no superadmin right, and neither of the superadmin's
  impersonation doors opens from inside it.
* Whatever the browser was signed in to before is discarded first.
* The start and the end are lines in the shop's own activity log, and every
  line written meanwhile carries the administrator's name, shown in the
  report's Note column. BCP's audit trail has its own row for each pass.
* The way in is the only path the POS excuses from CSRF — a form posted from
  another site cannot carry its token, and the signed pass is what proves the
  request. The way out keeps its token.

### What it does not do

* It does not connect a shop's **billing**. A shop on the Shops screen that
  says "Not connected" has no subscription, invoice or payment here, and
  connecting one is still the by-hand step it was. That is the POS session's
  ground and a decision about who bills whom, so it was left alone.
* The Subscriptions tab still shows one row per mirrored POS subscription,
  which is why Smart Gadget appears eight times there. The Shops tab shows
  each shop once.
* There is no per-shop switch to refuse visits, as Medi has. The POS's own
  superadmin can already enter any shop; this adds no power that did not
  exist, only a second place to use it from.
* The notice is in the ordinary header. The till screen has a header of its
  own and does not show it, exactly as it does not show the superadmin's
  impersonation notice.
* A visit replaces whatever that browser was signed in to on the POS,
  including the owner's own superadmin session. Sign in again afterwards.
* It does not ask for the shop owner's second sign-in step. The signed pass
  is the proof, as it is for the POS superadmin's own "Login as User"; an
  owner's two-step protection guards their password, not this door, which is
  why the secret behind it is kept apart from every other credential.

### Files

BCP — new: `config/pos.php`, `app/Services/Pos/PosConnection.php`,
`app/Services/Pos/PosShops.php`, `app/Services/Saas/Products/VisitTarget.php`,
`app/Http/Controllers/Admin/PosShopController.php`,
`app/Http/Controllers/Admin/Concerns/HandsOverVisit.php`,
`resources/views/admin/pos/shops.blade.php`, and the two test files. Changed:
`ProductVisitController` (asks `VisitTarget`), `SaasProductController` (the
button, the Shops tab), `admin/saas/subscription.blade.php` (the button moved
up), `components/saas/nav.blade.php` (an extra tab can be the current one),
`routes/web.php` (two routes, in the super-admin group), `.env.example`,
`phpunit.xml` (the POS settings pinned empty, so the suite never reaches a
developer's own POS).

POS (`C:\xampp\htdocs\pos`, branch `main`) — new:
`app/Services/Bcp/BcpSupportVisit.php`,
`app/Http/Controllers/BcpVisitController.php`,
`app/Http/Middleware/BcpSupportVisitGuard.php`,
`resources/views/bcp/visit_refused.blade.php`,
`tests/Feature/BcpSupportVisitTest.php`. Changed: `routes/web.php` (two
routes), `routes/api.php` (one), `app/Http/Kernel.php` (the guard, in the web
group), `VerifyCsrfToken` (one exception), the header partial, `Util`
(activity is marked during a visit), `ReportController` (the mark is shown),
`config/bcp.php`, the English and Bangla `lang_v1`, `.env.example`,
`phpunit.xml`.

### Proof

* BCP: `PosVisitTest` 9 and `PosShopsTest` 11. Full suite **1545 passed, 1
  skipped, 8730 assertions, exit 0**. Every class the new screen uses was
  checked against the committed stylesheet; none is missing.
* POS: `BcpSupportVisitTest` **34 tests, 291 assertions**. Fourteen
  protections were then removed one at a time — the operator and
  demonstration refusals, the one-way lookup, the audience, single use, the
  pass's lifetime, discarding the old session, the guard, the activity mark,
  both checks on the list request, leaving demonstration shops off the list,
  escaping the name, the secret's minimum length — and the suite failed every
  time. With its neighbours, 319 tests pass. `TranslationKeyTest` was failing
  on the POS's `main` before this work, on a key built by concatenation in
  the landing page; the POS session fixed it in its own commit, `6dcd208`,
  and it passes with these keys in place.
* **End to end, between the two real applications on the development
  machine**, over HTTP with CSRF and sessions as they are in production: BCP's
  own code made the pass and fetched the list. The way in with no token
  signed in and landed on the shop's dashboard with the notice; the same pass
  again was refused; leaving without a token was refused (419) and the
  session survived; leaving with it signed out and went back to BCP. A
  demonstration shop, the operator's shop by both kinds of account, and a
  shop that does not exist were each refused with their own sentence and left
  nobody signed in. The owner's two-step page and password change were
  refused during the visit; the superadmin screen answered 403. The list
  left the four demonstration shops out, and an unsigned request for it got
  403.
* Looked at in a browser: the Shops screen and the subscription page at
  1534×734 and at phone width (the button sits immediately left of the status
  badge, on its row); the POS's notice and End the visit in a real visit.
* **None of that caught what production did**, because the development
  machine's shops have the tenant column set and every test set it too. The
  correction's tests start from production's state instead — a shop that
  mirrors and has no tenant written — and hold that it is refused by tenant
  and entered by its subscription; that the lookup is by BCP's id and not the
  POS's own, a shop's or a tenant's; that one id recorded against two shops
  opens neither; that a demonstration shop and the operator's are refused by
  this kind as by the others. Five ways of breaking the lookup were tried and
  each failed the suite. POS: `BcpSupportVisitTest` **37 tests, 343
  assertions**; BCP: `PosVisitTest` 11, `PosShopsTest` 12, and the full
  suite **1554 passed, 1 skipped, 8772 assertions, exit 0**, on top of the
  BinduHost session's `b9a61a5`. A real visit between the two local
  applications, named this way, signed in and came back.

### Deployment

All in cPanel → Terminal on **server57** as `binduit`. Each command prints
`hostname` first and stops on the old server, which still has a stale copy of
the POS that answers without complaint.

Done on 2026-10-03, and each checked from outside without signing in:

1. The POS, its usual pull in `~/pos` — it also brought the custom-domain
   commit. After it, a GET on `/bcp/visit` answered 405 where it had answered
   404: the route was there.
2. One command that made a secret and wrote it to both `.env` files without
   showing it: `BCP_VISIT_SECRET` in the POS, `POS_URL` and
   `POS_VISIT_SECRET` here. After it, an unsigned request for the POS's list
   answered 403 where it had answered 404: the POS had the secret.
3. BCP, the usual pull of `feature/saas-billing-api` and the four cache
   commands. The button appeared on Smart Gadget's subscription.

4. The correction: the same pull on the POS, then the same pull and caches
   on BCP. No secret, no migration. After it the button worked.

### Next recommended step

Nothing is owed on this. The owner has since opened the Shops tab on
production: all eight real shops are listed, the four demonstration shops are
not, and two show as Connected. Their next question — how the others become
connected — is section 32.

---

## 32. Connecting a POS Shop's Billing: BCP's Half — 2026-10-03

**Status: DEPLOYED on 2026-10-03 — BCP `59531db`, POS `83a62c0` — and first
used on Baby Town; see "What the first real use showed". BCP's half is here;
the POS's half is a command the POS session wrote (`bcp:connect-business`).
The wording that first use corrected ("Not finished") is committed with
section 33 and awaits the pull. No migration and no stylesheet rebuild.
Nothing is connected by itself: that happens one shop at a time, when the
owner presses Connect.**

### What the owner asked

With the Shops tab open on production, the "Not connected" cells marked:
*how do I make these connected?*

### What "connected" is, and why it is not a click

A shop's billing is in BCP once the POS mirrors that shop's subscriptions
here. The POS does that for a shop only when it holds an API token issued
against that shop's own BCP account, and it keeps its tokens in its
environment file, on its own server. The two shops connected so far were done
by hand: an account made here, a token issued here, the token typed into the
POS's `.env` at a hidden prompt. One step of that procedure was skipped for
one of them, which is what section 31 tripped over.

So connecting has two halves on two systems, and both are now one step each.

### What connecting changes for a shop

Confirmed with the POS session from the POS's code; none of it is new, all of
it starts the moment the shop has a token:

* Its subscriptions are mirrored here, and its invoices and payments are
  kept here.
* Its next package purchase or renewal is paid on BCP's payment page.
* **Its SMS is counted against the credit it holds here, and with none the
  POS refuses every message.** A shop with no token is never asked about
  credit and sends freely; a shop with a token and a new, empty account
  would stop sending at once.

That last one is why the credit is released in the same action as the token
and before the POS can have it, and why connecting is done per shop by the
administrator and never because a shop registered.

### What it is

**On the Shops screen**, each shop's "Billing in BCP" cell now says one of:

* **Connected →** — a subscription of the shop is mirrored here (links to it);
* **Connected, no subscription yet** — the POS holds the token and names this
  account, and the shop has had nothing to mirror;
* **Not finished — Finish →** — BCP's half is done, the command on the
  POS's server has not been run. (First worded "Waiting for the POS"; see
  "What the first real use showed" below.)
* **Not connected — Connect →**. Never offered for the operator's own shop.

**Connect** opens a screen for that one shop which says what connecting
changes, shows what the shop has here now, and asks one thing: the opening
SMS credit. Zero is allowed and the screen says what zero does. The button
then, in one transaction:

1. makes the shop's account (`pos-<business id>`, named and addressed as the
   POS has it) — or reuses the one it has, including one made by hand that
   the POS already names;
2. releases the credit typed, through `SmsCreditManager::adjust`, with a
   ledger line saying why and who;
3. issues one API token for the account, scope `saas:billing` only.

and shows, once, the token and the line to run on the POS's server:

    cd ~/pos && php artisan bcp:connect-business <business id> --tenant=<account id>

The line carries nothing secret and comes from `config/pos.php`
(`connect_command`). The token is flashed to that one response, is never in
the audit trail, and BCP keeps only its hash. Pressing the button again for
the same shop issues another token and releases credit only if an amount is
typed again.

The shop is read from the POS again when the button is pressed, not taken
from the form: only a shop the POS lists now can be connected, by the name
the POS gives it.

### What BCP deliberately does not do

It does not reach into the POS. A token is a credential, the POS keeps its
credentials in its own environment, and something written there is written
by somebody standing at that server. A test holds that the only request BCP
makes is the read of the list.

It does not connect shops by itself, in bulk, or at registration.

### The POS's half (theirs, described here so the pair is in one place)

`bcp:connect-business {business} --tenant=` reads the token at a hidden
prompt; asks BCP whose token it is (`GET /api/v1/saas/entitlement`) and
requires the answer to be the tenant on the command line **before** writing
anything; refuses a demonstration shop, the operator's shop, a tenant that
is another shop's and a shop that is another tenant's; writes
`BCP_API_TOKEN_BUSINESS_<id>` into `.env` replacing only that line; sets
`business.bcp_tenant_id` (the step that was skipped by hand); refreshes the
configuration; and pushes that shop's subscriptions at once, so the shop
turns Connected here without waiting for the hourly run.

### Files

New: `app/Services/Pos/PosShopAccount.php`,
`resources/views/admin/pos/connect.blade.php`,
`tests/Feature/Products/PosShopConnectTest.php`. Changed:
`PosShopController` (the two actions, and the list's states),
`admin/pos/shops.blade.php`, `routes/web.php` (two routes in the super-admin
group), `config/pos.php` (`connect_command`).

### Proof

* `PosShopConnectTest`, 16: the list offers Connect for a customer's shop
  and never for the operator's; the screen says what changes before anything
  is done, and looking makes nothing; one action makes the account, the
  ledger line and the token, and the token works on the two endpoints the
  POS's command and SMS gate use; the token is shown once with the command
  and is gone on the next look; the command follows config; the token is in
  neither the audit trail nor the tokens table; zero credit releases none;
  doing it again keeps one account and adds only what is typed; a shop the
  POS already names an account for gets that account; a shop with no usable
  address still gets one; the three states of the list; only a shop the POS
  lists now can be connected, and a POS that cannot be asked connects
  nobody; the amount must be a whole number that is not negative; BCP makes
  no request to the POS but the list; closed to everybody but a super admin.
  Full suite: **1570 passed, 1 skipped, 8919 assertions, exit 0**.
* **The two halves against each other, on the development machine, over
  HTTP:** a token issued by BCP's own code was given to the POS's own client.
  It has the shape the POS's command accepts, BCP answered the entitlement
  question with the tenant's id as a top-level integer, the SMS balance read
  back as 0 for it (which is the gate the opening credit exists for), and a
  subscription pushed with it came back with BCP's id. A wrong tenant on the
  command line would not have matched. **Not run:** the command's own hidden
  prompt and its write to `.env` — on Windows a hidden prompt cannot be fed
  from a script. Those are covered by the POS session's nine tests, and will
  first run for real on the server.
* Looked at in a browser at 1534×734 and at phone width: the Connect screen
  before and after, and the list with its links. The "Step 1 is done" notice
  first borrowed the token screen's panel, whose light text is hard to read
  on the ground that panel has now; it uses the success notice's colours
  instead, measured at 5.1:1, with the token and the command at 14.8:1, and
  both wrap inside their boxes on a phone.

### What the first real use showed

Deployed on 2026-10-03 (BCP `59531db`, POS `83a62c0`) and the owner started
on Baby Town (#13): account #16 made, 5 SMS credit released, token issued.
Two things went wrong, neither in the mechanism:

* **The token was sent to the chat in a screenshot**, although the reply
  before had said not to. A credential that has been seen is replaced, not
  used: the owner was asked to press Issue another token and use that one,
  and the first is to be revoked on the tokens screen once the shop is
  connected. The screen showed a secret in plain sight and said only "copy
  the token now"; it now also says the token is a password and is not to be
  photographed or sent to anyone.
* **The owner then stopped, and reported "Waiting for the POS".** That was
  the screen's own wording for "BCP's half is done", and it reads as
  something in progress. Nothing is: the command on the POS's server is the
  administrator's to run, and the screen that said so (the green notice) is
  gone as soon as the page is left. Corrected, in the same commit as section
  33: the state is called **Not finished**; a shop in it always shows, on its Connect
  screen, that one step is left and will not happen by itself, with the line
  to run and how to get a token for it; and the green notice says nothing
  more happens by itself. A test holds that neither screen says "Waiting
  for" again.

### Deployment

Done on 2026-10-03: the POS's pull in `~/pos`, then BCP's pull of
`feature/saas-billing-api` and the four cache commands.

Then, per shop the owner chooses: Shops → Connect → type the opening SMS
credit → Connect; run the printed line in cPanel → Terminal on server57;
paste the token at the prompt.

### For the owner to decide, per shop

* Which shops are customers. `Bindu IT` (#8) is owned by the same person as
  the operator's own shop and may not be one. Four shops are on the
  ten-year "Internal Owner Package".
* The opening SMS credit for each.

### Next recommended step

Connect one shop first and watch it turn Connected before doing the rest.

---

## 33. A Connected Shop Could Not Pay: "The Payment Gateway Is Not Responding" — 2026-10-05

**Status: FIXED and tested in both repositories. BCP's half (`ad6d298`) was
DEPLOYED on 2026-10-06, with section 34's. The POS's half (`53d9d75`) is
pushed and awaits its own pull; BCP does not need it to take a payment. No
migration and no stylesheet rebuild.**

### What the owner saw

Baby Town, the first shop connected through section 32's button, ordered
2,001 SMS in the POS. BCP raised the invoice and the payment link, and on
pressing **Pay 700.35 BDT** the page answered: *The payment gateway is not
responding. Please try again in a moment.*

### The gateway was fine

ShurjoPay takes no payment from a payer without a phone, an address and a
city, and answers one with an HTTP 200 whose body is only the missing field
names. BCP reports that as the gateway not responding. This is section 25's
failure again, and section 25 said so under "Not done": *the payment-link
page can still send an empty address or city when neither the customer nor
the tenant has one.*

What made it happen now is section 32. The account Connect made for the shop
took its name, e-mail, phone and city from the POS's list, and **no
address** — the list did not carry one and the account was never given one.
Connect produced accounts that could not pay, and its tests did not look.

### The fix, in three places

1. **The payment page asks.** Whatever of phone, address and city is on
   record for nobody behind the link — neither a named customer nor the
   account — is asked for beside the Pay button, with the portal invoice
   page's wording and the gateway's own rules
   (`ShurjopayGateway::REQUIRED_PAYER_DETAILS`, `payerDetailRules()`). The
   answer is kept with the payer, so it is asked once. Refused, nobody is
   sent to ShurjoPay and no transaction is made — and the page no longer says
   the gateway is not responding when the gateway was never asked.

   The page is public and the link's token is its only credential, so it
   **fills gaps and nothing else**: only fields that are empty for everybody
   behind the link are in the validation rules, so a posted phone, name or
   e-mail for an account that has one is ignored. A test posts all of them
   and holds that nothing on record moved.
2. **Connect makes an account that can pay.** The POS's list now carries the
   street line and post code of the shop's first location (POS, in
   `BcpSupportVisit::shops()`), BCP reads them, and `PosShopAccount` stores
   phone, address, city and post code. For an account that already exists it
   fills only the gaps, so an address an administrator typed here is never
   replaced by the POS's. Pressing Connect again for a shop repairs an
   account made before this.
3. **A shop the POS has no address for still connects.** Many small shops
   have none on record. Connecting does not wait on it; the payment page
   asks the payer.

### Tests

* `PaymentLinkPayerDetailsTest`, 9 (three were there): an account with no
  address is asked for it and for nothing it already has; a complete account
  is asked for nothing; without the missing detail nobody is sent on and
  nothing is started, four ways; given it, it is kept, sent and the payment
  starts; nothing on record is overwritten from the public page; a link with
  a named customer keeps the answer with that customer. The old third test
  asserted that an empty address was *sent* — it described the bug as the
  behaviour — and now asserts that it is asked for.
* `PaymentLinkTest`'s two accounts were given a phone, an address and a
  city. Twenty of its tests had been passing only because the faked gateway
  takes any payer, exactly as section 25 found for the portal's suites.
* `PosShopConnectTest`, 20 (three new): the account is made with where the
  shop is; an existing account has its gaps filled and nothing it says
  replaced; a shop with no address is connected all the same.
* POS: `BcpSupportVisitTest` holds that the list carries the address and the
  post code.

Looked at in a browser on 2026-10-06, at 1534 × 734 and at phone width, in
four states: one detail missing, all three missing, a refused attempt with
its messages, and nothing missing. The amount, the fields and the Pay button
are in view without scrolling at both sizes, and nothing overflows sideways.
The three boxes are set in full-size type: a phone zooms the whole page in on
a smaller field, and most payers are on one.

### Not done

* The other accounts already in BCP are not back-filled. Each payer is asked
  once, the first time they pay; or an administrator fills the account in.
* The page still titles itself "Payment request from" followed by the
  account's own name, which reads oddly when the account is the one paying.
  It was not what stopped the payment and was left alone.

### Next recommended step

Deploy both. Then press Pay on Baby Town's link again: with the address
filled by hand it goes straight to ShurjoPay, without it the page asks for
the address first.

---

## 34. BinduAI, Bindu Drive, BDIV and Bvid as SaaS Products: BCP's Half — 2026-10-06

**Status: BCP's half is WRITTEN, TESTED and DEPLOYED on 2026-10-06 (commit
`e4083d4`; the owner ran the pull and the cache rebuild, and from outside
each of the four new addresses answers 401 where it answered 404). No
migration and no stylesheet rebuild. Nothing is sold by it: none of the four
has a plan or a price, and those are the owner's to set. Each
product's own half is a separate piece of work in its own repository — Bindu
Drive's is written (its session: three local commits on its `main`,
`ec2b6fe`, `c1e6f2c`, `6481cb8`, not pushed, and its production still has BCP
switched off); the other three are not started.**

### What the owner asked

On 2026-10-05, before going to sleep: *"next task: BinduAI, Bindu Drive, BDIV,
Bvid er jonno saas product hisebe ja ja kora dorkar coding kore takho"* — do
whatever coding is needed for the four as SaaS products, and keep a note of
whatever needs their help.

### What was found

BCP already had the four as catalogue rows (`BinduProductSeeder`) with no
plans, and a way for a product to be billed here that three products use:
the registry in `config/product_integrations.php` (BMart, Medi, BEMS). None
of the four was in it. Each product was then read for what it has today:

| Product | Where it stands | What it has for billing |
|---|---|---|
| **BinduAI** | Live. Workspaces, numbered. | A client for the **POS's per-shop mirror** (`/api/v1/saas/subscriptions` and its invoice), a BCP token typed in by each workspace's owner, and its own price table (`billing_plans`). On `main` since 2026-09-08. |
| **Bindu Drive** | Live at `bdrive.binduit.com`, one real user. Workspaces, by ULID. | A complete client for the same per-shop mirror, a webhook receiver, six enforced ceilings, a proposed price list nobody approved. |
| **BDIV** | The hosted copy does not work yet; its own plan puts BCP after hosting and an independent security review. | Nothing. Its design: "billing/admin privilege is not decrypt privilege". |
| **Bvid** | One person's tool on one computer: no accounts, no sign-in, not hosted, not in git. | Nothing, and nobody to bill. |

Two findings matter more than the rest.

**The per-shop mirror cannot sell a product to the public.** On it one token
*is* one BCP account, so every customer needs an account and a token made by
hand in this panel before they can pay, and every mirrored plan is filed
under the POS product. That is right for a POS shop, connected one at a time
(section 32), and wrong for a product people sign up to by themselves. The
registry is the answer BCP already had: one token for the whole product, an
account named by the product's own id, plans and prices held here.

**BinduAI's client has never met BCP, and would be refused by it.** It sends
`status: "active"` and a flat plan; `SaasIngestController::storeSubscription`
takes `waiting|approved|declined` and a nested `plan`. It looks for
`checkout_url` and a paid `status` at the top of the reply; BCP answers
`checkout.url` and `invoice.status`. Its own commit says it was verified
"with the billing system unconfigured". So nothing live depends on it.

### What it is

**1. The four are registered.** An entry each in the registry and a config
file each (`config/binduai.php`, `bdrive.php`, `bdiv.php`, `bvid.php`). From
that alone each gets what Medi and BEMS have: its own address
(`/api/v1/<key>/...`, 19 routes), its own pair of scopes that reach nothing
else, its own limiter, signed notifications under its own header, the way
back from the payment page, its plans kept out of BinduHost's catalogue, and
`product:connect <key>` / `product:plan <key>`.

What each file decides, and why:

* **No trial and nothing on sale.** `<KEY>_TRIAL_PLAN` is empty and
  `<KEY>_TRIAL_DAYS` is 0, so `POST .../trial` answers `trial_unavailable`,
  and with no plan the catalogue is empty. Nobody decided a plan, a price or
  a trial, so none is written anywhere.
* **What a plan can grant is what the product already enforces**, under the
  names its own code uses. BinduAI: `agent_runs`, `tokens`, `cost` (its
  `entitlements()` and `enforce_quota()`). Bindu Drive: `storage_bytes`,
  `file_count`, `max_file_bytes`, `member_count`, `ai_tasks_per_month`,
  `sync_devices` (its `LimitKey` enum). BDIV and Bvid: nothing — neither has
  a switch or a ceiling that differs by plan, so a plan of theirs grants a
  period of use and no more. No product has a feature switch yet.
* **No SMS credit on sale** to any of the four (`'sms_tiers' => []`): none
  of them sends SMS, and the default would have put the POS's price list in
  front of their customers without anybody deciding to.
* **No reset, removal, deactivation or visit.** For BinduAI, Drive and Bvid
  each is off behind its own environment line, to be switched on the day the
  product can carry it out. **For the vault they are fixed off in the file**
  and no environment line turns them on: nobody enters somebody's password
  vault to help them, erasing one destroys keys nobody can give back, and a
  lapsed payment may never block somebody reading what they stored.

**2. A token that can only read** — `product:connect <key> --read-only`
issues one with `<key>:entitlements` alone. Drive keeps the part of itself
that asks "what may this workspace do?" apart from the part that opens
purchases; this lets it go on doing so.

**3. An Integration tab for every registered product** (Medi and BEMS too):
how far the product is from being sold through BCP, a step at a time —
a product row, a plan on sale, a token, **the product actually asking**,
then the three it can do without (being told at once, a trial, a way back
after paying). "Asking" is read off the token's own last use, because
registered here and sold through here are not the same thing: a token nobody
has used is not a connection, and the page says so. It shows whether each
setting is in place and never the setting.

**4. What a plan grants, as a form.** The Plans tab of a registered product
has a **Grants** column and a **What it grants** link. The form is built
from the product's own list of keys, so a plan cannot claim a ceiling the
product will ignore. A ceiling has three states and they are three different
answers to the product: a number (0 is none at all), **No limit** (a tick of
its own), and empty — BCP says nothing and the product applies its own
floor. BMart's older form reads an empty box as unlimited; this one never
does, because a storage plan left half filled in must not grant everything.
A size is typed as a size — `100 GB` — stored as exactly its bytes in binary
multiples (`ByteSize`), and shown back with the bytes beside it. Saving
tells the product to re-read every account on the plan.

**5. The ordinary plan form is safe to use for these.** The owner will not
price Bindu Drive from a terminal, so the form now refuses what
`product:plan` always refused: for a product that reads its plans here, a
code must be one the product can ask for (lower-case, digits, hyphens). A
code typed as `Personal_Plus` used to be listed to the product and then
refused when a customer tried to buy it. A code the product already has —
a retired plan keeps its code — comes back as a sentence instead of an error
page. And **+ Add plan** on a product's page opens the form on that product.

**6. The payment page names where it sends a customer back to.** It said
"Back to BMart" to every product's customer, a hospital's and a school's
included.

### The contract, for whoever builds a product's half

Base `{BCP}/api/v1/<key>`, `Authorization: Bearer <token>`. `{id}` is the
product's own account id, `[A-Za-z0-9_-]{1,64}`. Every answer is
`Cache-Control: no-store`. The first call needs the `<key>:entitlements`
scope; every other one, the price list included, needs `<key>:billing`.

| Call | Answers |
|---|---|
| `GET /entitlements/{id}` | `{planCode, planName, status, features[], limits{}, trialEndsAt, currentPeriodEnd, graceUntil, reference}`; **404 `no_subscription`** when the account has no plan |
| `GET /catalogue` | `{trialDays, plans[{code, tier, name, description, interval, priceMinor, currency, features, limits, trialPlan, unit}]}` — active plans with a price only; `interval` is `daily`, `monthly`, `yearly` or `lifetime` |
| `POST /accounts/{id}/trial` | `{reference, status}`; once per account, ever |
| `POST /accounts/{id}/checkout` | body `{owner{name, email, phone?, address?, city?}, accountName, plan}` → `{payUrl, invoiceNumber, amountMinor, currency, planCode}` |
| `POST /accounts/{id}/pay` | the same, for the oldest unpaid invoice |
| `GET /accounts/{id}/billing` | `{pending, due, trialUsed, unit, invoices[]}` |

What a product must get right, each learned from a product that had it wrong:

* **`limits`: null is no limit, 0 is none, an absent key is "BCP did not
  say".** Drive read 0 as unlimited, as the POS mirror does; on this contract
  that turns a plan that grants nothing into one that grants everything. It
  had the same slip a second time on its pricing page, where
  `limit || 'Unlimited'` prints Unlimited for 0. And an absent key falls back
  to the product's own floor, so a plan must state every ceiling it means to
  raise, not only the ones that differ from the plan below.
* **`status` is upper-case**: `TRIALING`, `ACTIVE`, `PAST_DUE`, `GRACE` are
  in force; `SUSPENDED`, `CANCELLED` are not. A purchase waiting for its
  first payment is never answered. Drive matched lower-case and would have
  put every paying workspace on its free tier.
* **A 404 `no_subscription` is the ordinary answer for a free account. Do
  not retry it.** Drive retried it twice, tripling its reads for nothing.
* **A free tier is not a plan here.** The catalogue lists priced plans only;
  what a free account may do stays in the product.
* **A browser coming back from the payment page proves nothing.** Re-read
  the entitlement.
* **BCP tells, it does not describe.** `POST {webhook}` with header
  `<Product>-Signature: t=<unix>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">`
  and body `{"id","kind","accountId"}`. Apply an `id` once; on any kind,
  re-read. Kinds: `subscription.updated`, `subscription.cancelled`,
  `subscription.deleted`, `account.updated`.
* **Refusals are a code and nothing else**: 422 `{"error":"<code>"}` —
  `trial_unavailable`, `unknown_plan`, `plan_change_unsupported`,
  `already_on_plan`, `nothing_to_pay`, `invalid_request` (+ `fields`),
  `invalid_account_id`. The product words each in its own language. 401 and
  403 carry BCP's older body, where `error` is a sentence and not a code;
  branch on the status.
* **`plan_change_unsupported` will be met often.** BCP has no proration, so
  moving from one paid plan to another is refused for every product. See
  "For the owner to decide".
* **Name, e-mail and account name are enough to check out.** The payment
  page asks the payer for whatever of phone, address and city is missing
  (section 33).

### Files

* `config/binduai.php`, `config/bdrive.php`, `config/bdiv.php`,
  `config/bvid.php` — new. `config/product_integrations.php` — four entries.
* `app/Console/Commands/ProductConnect.php` — `--read-only`.
* `app/Services/Saas/ProductBilling.php` — `checklist()`, `tokens()`.
* `app/Services/Saas/Products/ByteSize.php` — new.
* `app/Http/Controllers/Admin/ProductEntitlementController.php` — new.
  `SaasProductController` — `integration()`, `genericIntegration()`, the tab.
  `PlanController` — `codeRules()`. `Pay/PaymentLinkController` —
  `returnName()`.
* `resources/views/admin/saas/integration.blade.php`,
  `entitlements.blade.php` — new. `admin/saas/plans.blade.php`,
  `components/saas/nav.blade.php`, `pay/show.blade.php` — changed.
* `routes/web.php` — three routes. `.env.example` — the new lines.
* Tests: `NewProductIntegrationsTest`, `ProductEntitlementScreensTest`,
  `ProductPlanCodeTest`, `Unit/ByteSizeTest` — new.

### Proof

* **`NewProductIntegrationsTest`, 60**, most of them once per product: it is
  registered under the row the seeder makes; one command issues its token
  and the token works; a read-only token reads and reaches nothing else; its
  token reaches no other product, no POS endpoint and no licence endpoint;
  nothing is on sale and no trial is given until configured, and a refused
  request writes no account; a purchase with only a name and an e-mail
  grants nothing until paid; a ceiling's three states survive to the answer
  and a terabyte arrives as digits; two products may number their accounts
  alike; no reset, removal or deactivation is answered; no SMS is on sale;
  **no environment line can open a vault** — and the same lines *do* switch
  Drive, so that is the vault's file and not the test; each is told under
  its own header and only about its own accounts; `product:plan` takes the
  product's own ceilings and refuses any other.
* **`ProductEntitlementScreensTest`, 17**: closed to guests and staff; only
  a registered product has the screens (the POS and BMart do not, Medi
  does); a token nobody has used is not a connection, and one used is; a
  read-only, revoked, expired, deleted, wildcard or other product's token
  does not count; a plan is on sale only when it can be bought; a trial
  naming a plan that is not on sale is a fault, not an option left off; no
  secret and no address is printed; saving keeps the three states apart; an
  empty form grants nothing and above all not everything; ten refused
  inputs store nothing, the good half of a bad save included; unknown keys
  are never saved; another product's plan cannot be reached; every account
  in force on the plan is told, and nobody when notifications are off.
* **`ProductPlanCodeTest`, 5**: a plan made on the form is bought through
  the API; five codes a product could not ask for are refused; a product
  that does not read its plans here keeps its codes; a taken code, a retired
  plan's included, is a sentence; the button opens the form on its product.
* **`ByteSizeTest`, 45**: twenty sizes to the byte, Drive's own among them;
  thirteen things refused rather than rounded; eleven shown, and typed back
  to the same number.
* **Over real HTTP on this PC** (Apache and PostgreSQL, not the in-memory
  test database), playing Drive with a local token: catalogue, no
  subscription, trial unavailable, checkout, still nothing while unpaid,
  billing, and after the invoice was settled the entitlement — `ACTIVE`,
  `{"storage_bytes":1073741824,"file_count":null,"sync_devices":0}` — then
  `nothing_to_pay`, `plan_change_unsupported`, `already_on_plan`; the
  read-only token refused the catalogue; the token refused another product.
* **Then Bindu Drive's own client against it**, run by Drive's session with
  the same local tokens: catalogue, no subscription resolving to Drive's
  free floor, trial unavailable, checkout, billing, still free while unpaid.
  The two sides had never met, and the meeting found four faults on
  Drive's side that its 487 tests against a fake had not: it asked for the
  price list with the read-only token, it read a 403's sentence as a code,
  it printed "monthl" for `monthly`, and it would have priced a `lifetime`
  plan as so much "per lifetime". All four are mended there.
* **And the paid state, in Drive itself.** With the local invoice settled,
  Drive read `ACTIVE` on `zz-test-a` and enforced it: exactly 1 GB allowed
  and one byte over refused, `file_count: null` allowing anything,
  **`sync_devices: 0` refusing a single device** — the plan that under
  Drive's old reading granted unlimited devices — and the absent
  `member_count` falling back to Drive's own floor. Then the four refusals,
  each reaching a sentence a person can act on.
* **And BCP's sender meeting Drive's receiver.** Four real deliveries from
  BCP's own job to Drive's local receiver: `subscription.updated` answered
  200 and applied; the same event again, as a retry sends it (same id, fresh
  signature), answered 200 "Already processed"; `account.updated` answered
  200 and applied; one signed with the wrong secret answered 401.
* Looked at in a browser at 1534 × 734 and at phone width: the Integration
  tab in both states, the Plans tab, the form for Drive (all of it in view
  without scrolling, Save at the top), for Medi (23 features, Save at both
  ends), refused with its messages, and for the vault (nothing to set); the
  paid payment page reading "Back to Bindu Drive". No text under 4.5:1, no
  sideways overflow. Every class is in the built stylesheet.
* Full suite: **1,707 passed, 1 skipped, 9,811 assertions** (1,580 before
  this section; the 127 more are the four files above).

### Found while reading, and left alone

* BMart's own entitlement form says "Every shop on it will be told" when it
  saves. Nothing does that: no observer watches a plan, so a shop sees the
  change at BMart's next re-read. The new form tells them itself.
* `ProductBilling::integrationStatus()` (BMart's Integration screen) counts a
  deleted token as a live one. `tokens()` does not.
* `ProductBilling::link()` looks for a clash of account ids across every
  product. Harmless while only BMart's form calls it and BMart's ids are
  long random strings; it would refuse a BMart shop called "7" once BinduAI
  has a workspace 7.
* The price list needs the billing scope, so a read-only token cannot show a
  pricing page. That is how BMart's contract was drawn and it is not a
  secret; letting the read-only token read it means changing the token
  middleware every product shares, which was not done unattended.

### Left in this PC's own database by the test

A `bdrive-integration` account with two tokens named "ZZ LOCAL TEST …"
(revoked at the end of the session), plans `zz-test-a` and `zz-test-b` under
Bindu Drive (named "ZZ TEST … (local only)", retired at the end of the
session), and one account "Bindu Drive · ZZ LOCAL TEST workspace" with a
settled 10.00 BDT invoice. None of it is on the server.

### Deployment

1. Pull in cPanel → Terminal, then `optimize:clear`, `config:cache`,
   `route:cache`, `view:cache`. No `migrate`.
2. `php artisan db:seed --class=BinduProductSeeder --force` — only if the
   four are missing from the sidebar's SaaS Products. It adds rows, never a
   plan or a price, and changes nothing when run twice.
3. Nothing else is needed for the four to be *ready*. A product is *sold*
   when its Integration tab says so.

The outside check that needs no login: `/api/v1/bdrive/catalogue` answers
401 rather than 404.

### For the owner to decide

**Per product: its plans.** Name, price, monthly or yearly, and what each
grants. Then a trial or none, and for how long. Recorded, not decided:

* Bindu Drive's session wrote a proposal into Drive's own code and marks it
  unapproved: Free 2 GB, Personal ৳300 for 100 GB, Business ৳1,200 for 1 TB,
  14 days' trial. The free allowance matters most, because it is what every
  ceiling a plan leaves empty falls back to.
* BinduAI's own table has Starter ৳1,500, Team ৳4,500, Business ৳12,000 a
  month, yearly at ten months' price, 7 days' trial. Whether those were the
  owner's figures is not something this repository can tell.

**BinduAI: where its prices live.** BinduAI's commit of 2026-09-08 records
the owner settling that BinduAI's own table is the pricing authority, with
BCP only collecting. The registry is the other way round: prices live here,
as BinduHost's have since 2026-10-03. Both cannot be true for one product.
Recommended: prices here, for the reason the per-shop mirror cannot sell to
the public, and so that every Bindu price is changed on one screen. Until
this is settled BinduAI stays registered and unsold.

**Changing plan.** Today a customer on one paid plan cannot move to another
until the first runs out. For a storage product that is the main thing a
customer does. What it should cost is a rule nobody has given: pay the
difference for the days left (recommended), pay the new plan in full from
today, or change at the next renewal.

**A plan for one customer.** The owner asked Drive for a custom package for
whoever needs more storage. Here a plan is on sale to everybody or to
nobody: a plan made for one workspace would show in every workspace's price
list. It needs a plan that is offered to named accounts only.

**BDIV and Bvid: whether and when.** The vault's own rule is no real
passwords before an independent security review. Bvid would first need
accounts, a server that can run FFmpeg and yt-dlp, and a key that is not the
owner's own paying for every customer's video.

### Not done

* The products' own halves, except Drive's.
* Proration, and a plan for one account — both above, both waiting on a rule.
* Support and notices. This is billing only: the Support Desk knows three
  brands and none of the four, and none of them raises a notice here yet.

### Next recommended step

Read Bindu Drive's Integration tab after the deploy: it is the furthest
along and the tab says exactly what is left. Then decide Drive's plans, type
them in under Plans, and let its session point Drive at the server.

---

## 35. BDIX Hosting on Sale: Nine Plans — 2026-10-06

**Status: WRITTEN by the BinduHost session, reviewed, tested and committed
here (`db7e3f3`), and the code DEPLOYED on 2026-10-06. No migration and no
stylesheet rebuild. The seeder has NOT been run, so nothing is on sale yet:
six of the nine prices are to be confirmed by the owner first (see "The
prices").**

### What the owner asked

To the BinduHost session, on 2026-10-06: *"bcp te bdix plan bosiye dao"* —
put the BDIX plans in BCP — then that this session should do BCP's half, and
then *"2 r 3 bochorer dam bosiye dao"*: put in the two- and three-year
prices. `binduhost.com/bdix-hosting/` sells three packages and its buy
buttons had nowhere to go: they pointed at `my.binduhost.com`, the WHMCS the
site left behind, and BCP's catalogue had no BDIX product at all.

### What it is

A fourth hosting family beside Web, WordPress and Reseller: product
`bdix-hosting` ("BDIX Hosting"), three packages on three terms.

| Package | 1 year | 2 years | 3 years |
|---|---|---|---|
| BDIX STARTER (`bdix-starter-1y`, `-2y`, `-3y`) | 1,200.00 | 2,160.00 | 2,880.00 |
| BDIX BASIC (`bdix-basic-…`) | 1,800.00 | 3,240.00 | 4,320.00 |
| BDIX STANDARD (`bdix-standard-…`) | 2,400.00 | 4,320.00 | 5,760.00 |

* **The codes carry the family's name.** Step two of the shop finds a plan by
  its code alone, and Web Hosting already sells a `starter-1y`.
* `SaasProductController::BINDUHOST_PRODUCTS` gains `bdix-hosting`, so its
  product page carries the same BinduHost tabs as the other three. Nothing
  else in BCP lists the families by name.
* They are opening prices (`PublishesHostingPlans`): from here on a price is
  changed in Plan Tiers, and running the seeder again never writes it back.

### The prices

**The three yearly prices are the page's own**, read off
`src/data/pages/bdix-hosting.ts` in the binduhost repository and checked
against it here line by line, sizes and feature lines included: ৳100, ৳150
and ৳200 a month, billed yearly.

**The six two- and three-year prices were worked out, not given.** The owner
asked for those terms without naming figures. The BinduHost session applied
the ladder Web Hosting and Reseller already sell on — two years at 10% off
the yearly rate, three years at 20% off — and showed the owner all nine
figures afterwards. Checked here: every one of the six is exactly that
ladder, and the three packages come to the same nine figures as Web
Hosting's first three (STARTER, and the two above it). The owner has seen
them and has not yet said yes to them. That yes is asked for before the
seeder command is handed over, because running it is what puts them on sale.

### Proof

* `HostingCatalogueFamiliesTest`, 15 (three new): the nine plans are on sale
  at these prices; a BDIX plan opens its own step two and not Web Hosting's
  Starter; every BDIX plan says which network it is on. The counts of plans
  on sale moved from 36 to 45, and the family check now counts what it is
  given instead of assuming twelve.
* Full suite: **1,710 passed, 1 skipped, 9,903 assertions.**

### What went wrong on the way

The first version, three plans, was reviewed and tested here and committed
locally. Between the review and the `git add`, the BinduHost session changed
the same files in this working tree to nine plans, so the commit held a
seeder nobody here had read, under a message saying three. It had not been
pushed. It was undone, the nine-plan version was read and run through the
whole suite, and this is that commit. Two sessions writing in one tree need
to say so before they write.

### Deployment

Pull and rebuild the caches as usual. Then, once the owner has confirmed the
six prices: `php artisan db:seed --class=BdixHostingPlanSeeder --force`.

The website's half is committed in the binduhost repository (`4a8135e`): its
three buttons open the one-year plans. It is pushed only after the seeder
has run here, or the buttons would open a plan that does not exist yet.

### Not done

* The website offers the yearly price only. The two- and three-year plans
  are sold through BCP's own catalogue until that page has a term switch.

### Next recommended step

After the seeder has run and the site is pushed, press Choose Starter on
`binduhost.com/bdix-hosting/`: it should land on BCP's step two for BDIX
STARTER at BDT 1,200.00.

---

## 36. BinduHost's Buttons in the Frame's Own Purple — 2026-10-06

**Status: DONE, looked at and committed on 2026-10-06, NOT deployed. The
stylesheet was rebuilt: `public/build` changes with it. No migration.**

### What the owner asked

With a screenshot of the shop (`/portal/binduhost/shop`), the Sign in to
order buttons and a patch of the rail marked: *"button color ta sidebar er
moto deep koro"*, and then *"sob button"* — make the buttons as deep as the
sidebar, all of them.

### What it is

Every filled button in the BinduHost client area takes its colour from one
variable, `--color-indigo-600` in the `.theme-binduhost` scope, with
`--color-indigo-500` for its hover. They were a mid purple, `#8a3cc4` lifting
to `#9a4ed4`. They are now the palette's deepest shade, `#21013e` — the
colour the rail and the top bar are painted in — lifting to `#48166b`.

That is two values in `resources/css/app.css`, and it reaches all thirteen
places the client area draws such a button: Sign in to order, Order now, Add
to cart, Continue, Place order, Pay Now, the skip link, and the current step
in the order steps. No view was edited.

The frame puts the old pair back for itself (`.theme-binduhost-frame`). No
button sits on the rail today, but one painted the rail's own colour would
vanish on it.

White buttons with an edge — View cart, the family pills — are not filled
buttons and were left as they are. So was everything outside this client
area: the sign-in page and the admin panel keep the Bindu house colour.

### Proof

* A white label on the new button measures 18.4:1, and 13.1:1 on its hover
  (6.0:1 and 4.8:1 before).
* Rendered and read back in a browser at 1534 × 734: on the shop as a
  visitor and as a customer, the plan's step two, the cart and the review
  page, every filled button resolves to `rgb(33, 1, 62)` with a white label;
  inside the frame the two variables still read `#8a3cc4` and `#9a4ed4`.
* The rebuilt stylesheet against the one it replaces, class by class: none
  lost. The only rules that differ are the two theme blocks, plus one class
  gained, `order-1` — Tailwind reads the whole repository, and found it in a
  test's reference string. The script did not change.
* Full suite: **1,710 passed, 1 skipped, 9,903 assertions.**

### Deployment

Pull and rebuild the caches. `public/build` is committed, so the server needs
no Node: the new stylesheet arrives with the pull.

### Next recommended step

Look at the shop after the deploy with a hard refresh (Ctrl+F5): the browser
keeps the old stylesheet's name until the page is fetched again.
