Fix merchant payment filtering and implement a refund extension

Quick Overview

Fix a full-stack merchant payment leak caused by a missing userId, then implement a refund extension under explicit policies. Preserve role-based access, connect the UI and API, and verify duplicate handling and decision states.

Fix merchant payment filtering and implement a refund extension

Company: Capital One

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

A full-stack payments application has payer, merchant, and admin roles. Merchants should see payments made to them, but currently can see all payers' payments because `userId` is removed before the relevant role request reaches the API. Fix the bug and add a refund feature, using the available coding assistant while checking its output. ### Clarifying Questions - How is the authenticated user's identity passed to backend authorization? - Who may request a refund, who may decide it, and which payment states qualify? - Are refunds full or partial, and does approval only record a decision or move money? - What should retries, duplicate requests, and concurrent refund decisions do? ### Part 1: Correct payment visibility Reproduce the merchant leak, preserve the intended user identity through the request path, and ensure the backend enforces role-specific access. Add a regression for the missing-identity edge case and verify payer and admin behavior. ```hint Test a modified request A user can omit or replace a browser parameter. Check whether the server still restricts the returned payments to the authenticated role. ``` #### What This Part Should Cover - The deleted `userId` and the frontend/API request path - Authoritative role and ownership checks - Regression coverage for all three roles ### Part 2: Add refunds Agree on the refund policy, then implement the necessary model, API, and UI changes. Show how you would direct the assistant, review its changes, and test the full workflow. ```hint Separate request from completion A stored refund request, an administrative approval, and a completed money movement may need different states. ``` #### What This Part Should Cover - Explicit refund eligibility and state transitions - Compatible frontend and backend operations - Duplicate handling, authorization, and verification ### What a Strong Answer Covers - A narrow visibility fix that preserves existing role behavior - A concrete refund implementation under clearly stated assumptions - Review of assistant-generated changes and new regression cases ### Follow-up Questions - How would partial refunds change the data model and concurrency checks? - How would you handle an uncertain response from a real refund provider?

Overview: Fix a full-stack merchant payment leak caused by a missing userId, then implement a refund extension under explicit policies. Preserve role-based access, connect the UI and API, and verify duplicate handling and decision states.

Read the full Capital One Software Engineer interview experience this question came from

Capital One logo
Capital One
Nov 22, 2026
mediumSoftware EngineerOnsiteSoftware Engineering Fundamentals
2
0

A full-stack payments application has payer, merchant, and admin roles. Merchants should see payments made to them, but currently can see all payers' payments because userId is removed before the relevant role request reaches the API. Fix the bug and add a refund feature, using the available coding assistant while checking its output.

Clarifying Questions Guidance

  • How is the authenticated user's identity passed to backend authorization?
  • Who may request a refund, who may decide it, and which payment states qualify?
  • Are refunds full or partial, and does approval only record a decision or move money?
  • What should retries, duplicate requests, and concurrent refund decisions do?

Part 1: Correct payment visibility

Reproduce the merchant leak, preserve the intended user identity through the request path, and ensure the backend enforces role-specific access. Add a regression for the missing-identity edge case and verify payer and admin behavior.

What This Part Should Cover Guidance

  • The deleted userId and the frontend/API request path
  • Authoritative role and ownership checks
  • Regression coverage for all three roles

Part 2: Add refunds

Agree on the refund policy, then implement the necessary model, API, and UI changes. Show how you would direct the assistant, review its changes, and test the full workflow.

What This Part Should Cover Guidance

  • Explicit refund eligibility and state transitions
  • Compatible frontend and backend operations
  • Duplicate handling, authorization, and verification

What a Strong Answer Covers Guidance

  • A narrow visibility fix that preserves existing role behavior
  • A concrete refund implementation under clearly stated assumptions
  • Review of assistant-generated changes and new regression cases

Follow-up Questions Guidance

  • How would partial refunds change the data model and concurrency checks?
  • How would you handle an uncertain response from a real refund provider?