Full-codebase-audit 2026-05-30 outputs: - Audit report: 09 - Audits/Full Codebase Audit - 2026-05-30.md - 81 issue files ISSUE-055..135 (decisions + 1 skipped no-brainer). - Scanner docs from scratch (was zero): architecture, data model, API ref, payment flow, operations runbook + repo README. - Doc-sync updates across API reference, data models, flows, design system. - Secret Rotation Runbook (08 - Operations) for the exposed credentials. - Reusable workflow guide (07 - Development) + .claude/workflows/full-codebase-audit.js. Issues remain status:open intentionally — the code fixes are uncommitted-then-committed working-tree changes per repo and aren't "resolved" until merged/deployed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
39 lines
1.3 KiB
Markdown
39 lines
1.3 KiB
Markdown
---
|
|
issue: 067
|
|
title: "Backend: amount-mismatch check runs after payment saved and offers accepted"
|
|
severity: medium
|
|
domain: Payment
|
|
labels: [bug, backend, logic]
|
|
status: open
|
|
created: 2026-05-30
|
|
source: Full Codebase Audit 2026-05-30
|
|
---
|
|
|
|
# Backend: amount-mismatch check runs after payment saved and offers accepted
|
|
|
|
**Severity:** medium
|
|
**Domain:** Payment
|
|
**Labels:** bug, backend, logic
|
|
|
|
## Description
|
|
|
|
In `paymentController.ts:886-889`, the check comparing `storedAmount` vs `amount` is executed after the payment has already been saved and offers accepted. If there is a mismatch, those side-effects cannot be rolled back, potentially leaving the system in an inconsistent state.
|
|
|
|
## Options
|
|
|
|
1. Move the `storedAmount` vs `amount` check before saving/advancing/accepting offers.
|
|
2. Wrap the verify flow in a transaction and roll back on mismatch.
|
|
3. Validate amount at intent-creation and re-check before completion.
|
|
|
|
## Recommendation
|
|
|
|
Reorder so the amount-mismatch check (and ideally a transaction) gates all side-effects. This is a control-flow/business-logic change.
|
|
|
|
## Affected Files
|
|
|
|
- `backend/src/services/payment/paymentController.ts:886-889`
|
|
|
|
## References
|
|
|
|
- [Full Codebase Audit 2026-05-30](../09%20-%20Audits/Full%20Codebase%20Audit%20-%202026-05-30.md) — DEC-33
|