Skip to content

feat(debit_routing): Implement frontend changes#259

Merged
prajjwalkumar17 merged 5 commits intomainfrom
feat/debit-routing
Apr 25, 2026
Merged

feat(debit_routing): Implement frontend changes#259
prajjwalkumar17 merged 5 commits intomainfrom
feat/debit-routing

Conversation

@prajjwalkumar17
Copy link
Copy Markdown
Member

This pull request introduces significant improvements to the documentation and end-to-end (E2E) test coverage for the Decision Engine project, with a particular focus on the new merchant debit routing feature. The changes include expanded API documentation, new and updated Cypress tests for debit routing and authentication flows, as well as UI terminology updates for analytics. Additionally, the Docker Compose setup instructions in the README.md have been clarified for different development scenarios.

Documentation Enhancements:

  • Major expansion and reorganization of the API reference documentation, including new endpoints for merchant debit routing, analytics, configuration, and authentication. Added OpenAPI-backed endpoint pages and curl example references for improved developer experience. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

  • Updated README.md to clarify Docker Compose profiles for running the API, dashboard, and docs, and improved links to API documentation and examples. [1] [2]

E2E Test Coverage (Cypress):

  • Added new Cypress test suite for the Debit Routing UI, covering enabling/disabling debit routing and ensuring unsupported config options are hidden.

  • Expanded Decision Explorer UI tests to verify the debit routing surface, backend defaults, and integration with the gateway when debit routing is enabled.

  • Added new API commands and tests for merchant debit routing feature flag, including negative cases for missing merchants. [1] [2]

  • Improved authentication UI tests to cover sign-up tab persistence, duplicate sign-up handling, and updated welcome messaging.

UI and Terminology Updates:

  • Updated analytics UI test assertions and button labels to reflect new terminology: "Auth-rate based" and "Rule based / Volume based" analytics, and improved refresh messaging. [1] [2] [3]

These changes collectively improve the usability, reliability, and clarity of both the developer documentation and the product's user interface.

Add debit-routing flag APIs, dashboard toggle, explorer tab, and Cypress coverage. Restore the merged analytics/login UI surfaces after the later Cypress PR regression.
@prajjwalkumar17 prajjwalkumar17 self-assigned this Apr 25, 2026
Copilot AI review requested due to automatic review settings April 25, 2026 22:22
return route
.replace(/_/g, '-')
.replace(/^\/routing-evaluate$/, '/routing/evaluate')
.replace(/^\/decide-gateway$/, '/decide-gateway')
.replace(/_/g, '-')
.replace(/^\/routing-evaluate$/, '/routing/evaluate')
.replace(/^\/decide-gateway$/, '/decide-gateway')
.replace(/^\/update-gateway$/, '/update-gateway')
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Decision Engine dashboard and supporting backend/docs to better support the new merchant debit-routing feature (flag + UI surfaces), improves analytics/audit filtering and terminology, and expands API documentation + Cypress E2E coverage.

Changes:

  • Add merchant debit-routing flag support end-to-end (new API route + dashboard surfaces + Cypress coverage).
  • Improve auth/onboarding UX (signup route, session hydration, merchant switching) and analytics UI terminology/refresh behavior.
  • Expand/reorganize docs (OpenAPI endpoint pages + curl examples + setup guidance).

Reviewed changes

Copilot reviewed 108 out of 115 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
website/vite.config.ts Adjusts Vite base path and dev proxy routing (incl. new API prefix).
website/src/vite-env.d.ts Adds typed Vite env vars for tenant/api base/feature header.
website/src/types/api.ts Extends API types for debit routing output + audit routing_approach.
website/src/store/authStore.ts Adds hydration tracking and merchant list support in auth state.
website/src/pages/AuthPage.tsx Reworks login/signup UX and adds merchant onboarding flow.
website/src/main.tsx Dev-only redirect from 127.0.0.1 to localhost.
website/src/lib/api.ts Adds API base path resolution + richer API error messages/headers.
website/src/hooks/useDebitRoutingFlag.ts Introduces SWR hook to read/update merchant debit-routing flag.
website/src/components/pages/RoutingHubPage.tsx Revamps routing hub UI; surfaces debit routing readiness.
website/src/components/pages/OverviewPage.tsx Updates overview metrics and includes debit routing readiness + traffic path.
website/src/components/pages/DebitRoutingPage.tsx Switches debit page from config editing to merchant flag toggle.
website/src/components/pages/AnalyticsPage.tsx Updates terminology, refresh strategy, filters UI, and custom date inputs.
website/src/components/layout/TopBar.tsx Adds merchant switcher dropdown and removes theme toggle from top bar.
website/src/components/layout/Sidebar.tsx Adds theme toggle to sidebar footer.
website/src/components/layout/AuthGuard.tsx Adds hydration-aware guard and avoids logout on transient failures.
website/src/components/layout/AppShell.tsx Updates main layout padding/container width.
website/src/App.tsx Adds /signup and /onboarding routes.
website/dist/index.html Updates built asset paths to new base prefix.
src/routes/merchant_account_config.rs Adds GET endpoint for debit-routing flag + shared config-name helper.
src/routes/decide_gateway.rs Improves routing_approach analytics recording (fallback to ranking algorithm).
src/routes/analytics.rs Adds routing_approach filters to analytics query params.
src/decider/gatewaydecider/types.rs Adds Display impl for RankingAlgorithm string values.
src/app.rs Wires new GET route for merchant debit-routing flag.
src/analytics/models.rs Adds routing_approach include/exclude fields to payment audit query/response.
src/analytics/clickhouse/metrics/audit_summaries.rs Uses raw fragments when routing_approach filtering is required; improves exact lookup logic/tests.
src/analytics/clickhouse/filters.rs Adds ClickHouse filters for routing_approach and debit-routing detail matching (+ tests).
src/analytics/clickhouse/endpoints/payment_audit.rs Includes routing_approach in response; tweaks selected lookup selection.
nginx/nginx.conf Expands explicit Mintlify docs route allowlist.
helm-charts/README.md Documents analytics (Kafka/ClickHouse) Helm values.
docs/setup-guide-postgres.md Updates compose command for postgres-ghcr profile.
docs/mint.json Reorganizes docs nav; adds API examples + ops + new endpoints.
docs/local-setup.md Updates dashboard dev URL and links (incl. API examples).
docs/introduction.mdx Updates endpoint list + dashboard routes + doc links.
docs/dual-protocol-layer.md Updates references to new API overview/examples docs.
docs/dashboard-guide.mdx Updates dashboard guide location and route list; notes production base/proxy guidance.
docs/configuration.md Fixes API reference links and adds API examples link.
docs/clickhouse-analytics.mdx Adds local compose version details for analytics stack.
docs/api-refs/update-score-legacy.mdx Adds legacy /update-score curl example page.
docs/api-refs/update-gateway-score.mdx Updates curl example and guidance (incl auth header).
docs/api-refs/success-rate-config-update.mdx Updates SR update example and response shape.
docs/api-refs/success-rate-config-get.mdx Updates SR get example and response shape.
docs/api-refs/success-rate-config-delete.mdx Updates SR delete example and response shape.
docs/api-refs/success-rate-config-create.mdx Updates SR create example and payload shape.
docs/api-refs/routing-volume-split-example.mdx Updates volume-split example payload + auth header.
docs/api-refs/routing-single-connector-example.mdx Updates single-connector example payload + auth header.
docs/api-refs/routing-priority-example.mdx Updates priority-list example payload + auth header.
docs/api-refs/routing-hybrid.mdx Adds /routing/hybrid curl example page.
docs/api-refs/routing-algorithm-list.mdx Updates list example + adds sample response.
docs/api-refs/routing-algorithm-list-active.mdx Updates active list example + adds sample response.
docs/api-refs/routing-algorithm-evaluate.mdx Updates evaluate example payload/response + auth header.
docs/api-refs/routing-algorithm-create.mdx Updates create example(s) and sample response timestamps.
docs/api-refs/routing-algorithm-activate.mdx Updates activate example + adds sample response.
docs/api-refs/routing-advanced-example.mdx Adds advanced routing example page.
docs/api-refs/merchant-debit-routing.mdx Adds merchant debit-routing flag curl examples.
docs/api-refs/merchant-account-get.mdx Updates merchant get example + auth header.
docs/api-refs/merchant-account-delete.mdx Updates delete example + response shape.
docs/api-refs/merchant-account-create.mdx Updates create example + admin secret note + response shape.
docs/api-refs/health-check.mdx Expands to liveness/readiness/diagnostics examples.
docs/api-refs/elimination-config-update.mdx Updates elimination update example + response shape.
docs/api-refs/elimination-config-get.mdx Updates elimination get example + response shape.
docs/api-refs/elimination-config-delete.mdx Updates elimination delete example + response shape.
docs/api-refs/elimination-config-create.mdx Updates elimination create example + response shape.
docs/api-refs/decision-gateway-legacy.mdx Adds legacy /decision_gateway curl example page.
docs/api-refs/decide-gateway-sr-based.mdx Updates SR decide-gateway example and response fields.
docs/api-refs/decide-gateway-pl-based.mdx Adds PL-based decide-gateway example page.
docs/api-refs/decide-gateway-hybrid-routing.mdx Adds hybrid decide-gateway example page.
docs/api-refs/decide-gateway-debit-routing.mdx Updates debit decide-gateway example and response fields.
docs/api-refs/config-endpoints.mdx Adds routing keys + SR dimension config examples.
docs/api-refs/auth-and-onboarding.mdx Adds auth, merchant switching, onboarding curl examples.
docs/api-refs/api-ref.mdx Reworks API examples landing page and adds routing algorithm value map.
docs/api-refs/api-keys.mdx Adds API key management curl examples.
docs/api-refs/analytics-endpoints.mdx Adds analytics endpoint curl examples + debit audit filter example.
docs/api-reference1.md Converts legacy API reference page into a “moved” stub linking to new pages.
docs/api-reference/endpoint/updateMerchantDebitRouting.mdx Adds OpenAPI-backed endpoint page for update debit routing.
docs/api-reference/endpoint/switchMerchant.mdx Adds OpenAPI-backed endpoint page for switching merchants.
docs/api-reference/endpoint/signup.mdx Adds OpenAPI-backed endpoint page for signup.
docs/api-reference/endpoint/revokeApiKey.mdx Adds OpenAPI-backed endpoint page for API key revoke.
docs/api-reference/endpoint/onboardMerchant.mdx Adds OpenAPI-backed endpoint page for merchant onboarding.
docs/api-reference/endpoint/me.mdx Adds OpenAPI-backed endpoint page for auth/me.
docs/api-reference/endpoint/logout.mdx Adds OpenAPI-backed endpoint page for logout.
docs/api-reference/endpoint/login.mdx Adds OpenAPI-backed endpoint page for login.
docs/api-reference/endpoint/listUserMerchants.mdx Adds OpenAPI-backed endpoint page for listing user merchants.
docs/api-reference/endpoint/listRoutingRules.mdx Fixes OpenAPI param name for list routing rules.
docs/api-reference/endpoint/listApiKeys.mdx Adds OpenAPI-backed endpoint page for listing API keys.
docs/api-reference/endpoint/legacyUpdateScore.mdx Adds OpenAPI-backed endpoint page for legacy update score.
docs/api-reference/endpoint/legacyDecisionGateway.mdx Adds OpenAPI-backed endpoint page for legacy decision gateway.
docs/api-reference/endpoint/hybridRouting.mdx Adds OpenAPI-backed endpoint page for hybrid routing.
docs/api-reference/endpoint/healthReady.mdx Adds OpenAPI-backed endpoint page for health readiness.
docs/api-reference/endpoint/healthDiagnostics.mdx Adds OpenAPI-backed endpoint page for health diagnostics.
docs/api-reference/endpoint/getRoutingConfig.mdx Adds OpenAPI-backed endpoint page for routing keys.
docs/api-reference/endpoint/getMerchantDebitRouting.mdx Adds OpenAPI-backed endpoint page for get debit routing.
docs/api-reference/endpoint/createApiKey.mdx Adds OpenAPI-backed endpoint page for create API key.
docs/api-reference/endpoint/configSrDimension.mdx Adds OpenAPI-backed endpoint page for SR dimensions config.
docs/api-reference/endpoint/analyticsRoutingStats.mdx Adds OpenAPI-backed endpoint page for routing stats.
docs/api-reference/endpoint/analyticsPreviewTrace.mdx Adds OpenAPI-backed endpoint page for preview trace.
docs/api-reference/endpoint/analyticsPaymentAudit.mdx Adds OpenAPI-backed endpoint page for payment audit.
docs/api-reference/endpoint/analyticsOverview.mdx Adds OpenAPI-backed endpoint page for analytics overview.
docs/api-reference/endpoint/analyticsLogSummaries.mdx Adds OpenAPI-backed endpoint page for log summaries.
docs/api-reference/endpoint/analyticsGatewayScores.mdx Adds OpenAPI-backed endpoint page for gateway scores.
docs/api-reference/endpoint/analyticsDecisions.mdx Adds OpenAPI-backed endpoint page for analytics decisions.
docs/api-reference.md Expands API overview navigation to include new endpoint families.
cypress/support/commands.js Adds commands for reading/updating debit-routing flag.
cypress/e2e/ui/decision-explorer.cy.js Adds Decision Explorer debit routing surface coverage.
cypress/e2e/ui/debit-routing-page.cy.js Adds debit routing page toggle test suite.
cypress/e2e/ui/auth-page.cy.js Expands auth UI coverage (signup persistence + duplicate signup flow).
cypress/e2e/ui/analytics-page.cy.js Updates analytics UI assertions for new terminology (needs further fixes).
cypress/e2e/api/merchant-crud.cy.js Adds API coverage for debit-routing flag lifecycle and missing merchant case.
README.md Updates compose profile instructions and links to new API reference/examples docs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread website/vite.config.ts
Comment on lines +6 to +8
const publicBaseUrl = isDevServer ? '/' : '/decision-engine/'
const backendTarget = 'http://localhost:8080'
const apiProxyPrefix = '/decision-engine-api'
Comment thread website/src/lib/api.ts
Comment on lines +5 to +16
const DEFAULT_TENANT_ID = import.meta.env.VITE_DEFAULT_TENANT_ID ?? 'public'
const API_BASE_PATH = (import.meta.env.VITE_API_BASE_PATH ?? '/decision-engine-api').replace(/\/$/, '')
const FEATURE_HEADER = import.meta.env.VITE_FEATURE_HEADER ?? 'decision-engine'

function resolveApiPath(path: string) {
if (/^https?:\/\//.test(path)) return path
const normalizedPath = path.startsWith('/') ? path : `/${path}`
if (normalizedPath.startsWith(`${API_BASE_PATH}/`) || normalizedPath === API_BASE_PATH) {
return normalizedPath
}
return `${API_BASE_PATH}${normalizedPath}`
}
Comment on lines 92 to 95
cy.get('select').first().select('Last 1 week')
cy.contains('button', 'Refresh').click()
cy.contains(/Refreshing transaction analytics for/i).should('be.visible')
cy.contains(/Refreshing auth-rate based analytics for/i).should('be.visible')
cy.wait('@overviewRefresh')
@prajjwalkumar17 prajjwalkumar17 merged commit 3cfba67 into main Apr 25, 2026
10 checks passed
@prajjwalkumar17 prajjwalkumar17 deleted the feat/debit-routing branch April 25, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants