Skip to content

fix(wallet): send idempotency key for top-ups#155

Merged
0-sayed merged 2 commits intomainfrom
fix/wallet-topup-idempotency
Apr 18, 2026
Merged

fix(wallet): send idempotency key for top-ups#155
0-sayed merged 2 commits intomainfrom
fix/wallet-topup-idempotency

Conversation

@0-sayed
Copy link
Copy Markdown
Owner

@0-sayed 0-sayed commented Apr 18, 2026

Summary

  • send an idempotency_key with wallet top-up requests from the web app
  • update the wallet API client to post the full top-up payload shape expected by the identity service
  • add a regression test covering the top-up request contract

Verification

  • pnpm --filter @hena-wadeena/web test -- src/lib/__tests__/wallet-store.spec.ts
  • pnpm --filter @hena-wadeena/web typecheck

Context

The identity service requires amount and idempotency_key for /api/v1/wallet/topup. The web app was only sending amount, which caused wallet top-up failures.

Copy link
Copy Markdown

@propel-code-bot propel-code-bot Bot left a comment

Choose a reason for hiding this comment

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

Review found no issues; changes correctly address top-up contract requirements with added regression coverage.

Status: No Issues Found | Risk: Low

Review Details

📁 5 files reviewed | 💬 0 comments

Instruction Files
├── AGENTS.md
└── CLAUDE.md

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces idempotency keys for wallet top-up operations to prevent duplicate transactions. The changes include updating the paymentsAPI service, the topUpWallet store function, and adding unit tests. A review comment highlights that generating the idempotency key inside the topUpWallet function may lead to double-charging during retries, as a new key would be generated for each attempt; it is recommended to generate the key in the UI layer instead to ensure it remains stable across retries.

Comment thread apps/web/src/lib/wallet-store.ts
devin-ai-integration[bot]

This comment was marked as resolved.

@0-sayed 0-sayed merged commit 75111f9 into main Apr 18, 2026
13 checks passed
@0-sayed 0-sayed deleted the fix/wallet-topup-idempotency branch April 18, 2026 19:15
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.

1 participant