Skip to content
This repository was archived by the owner on Apr 5, 2026. It is now read-only.
This repository was archived by the owner on Apr 5, 2026. It is now read-only.

User Story: Make balance check atomic in src/javascript/backend/api/payment.js #86

Description

@aliAljaffer

As a developer
I want to fix the balance check and update flow in src/javascript/backend/api/payment.js to avoid race conditions
So that concurrent payment requests cannot cause incorrect "Insufficient balance" errors or double-charging

Acceptance Criteria

  • Ensure balance retrieval and deduction are performed atomically (using DB transactions or row-level locking) instead of separate read-then-write steps.

Details
The code checks balance then later deducts it; comments indicate a race condition and the code throws Insufficient balance in a non-atomic flow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggy-fileFiles that are intentionally buggy or brokenneeds-reviewNeeds human review

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions