Wallet-to-Wallet Service First Document flow - #102
Open
Tharun48 wants to merge 10 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an initial “first flow” design/approach document for the wallet-to-wallet transfer service, describing intended requirements, API contract examples, and strategies for idempotency, concurrency, and ledger integrity.
Changes:
- Introduces a new Markdown document capturing the proposed transfer flow and system expectations.
- Documents (at a high level) idempotency lifecycle, pessimistic locking rationale, and double-entry ledger rules.
- Provides example request/response payloads for wallet creation, transfers, balance lookup, and history.
Comment on lines
+20
to
+23
| -1.Build an application that transfers the amount | ||
| -from one wallet to another wallet | ||
| -2.api to fetch the balance(either from the ledger entry or the balance bucket) | ||
| -3.Transfer api history |
Comment on lines
+35
to
+40
| ### 1.Concurrency Control and Double-Deduction Prevention | ||
| ### 2. Absolute Idempotency Lifecycle | ||
| ### 3.Ledger Integrity | ||
| Inorder to make the system consistent going with the pessmistic locking and to implement pessimistic locking we have to aquire the lock for two wallets in the order to avoid deadlock. | ||
|
|
||
| ### 2. Absolute Idempotency Lifecycle |
Comment on lines
+41
to
+46
| -Must expose idempotency at the entry point of the service boundray and check if the key already exists in the table. | ||
| -if there is a key | ||
| Completed request then return the same resonse | ||
| PROCESSING request conflit, then return the request is already in progress(have to handle the server crash processing request) | ||
| FAILED request, then process the request and mark the status as processing | ||
| -no KEY process the request |
| } | ||
| ``` | ||
|
|
||
| GET /wallets/{walletId}/history?Month=APR&Category=MONEYSENT&paymentStatus=SUCCESSFULL |
Comment on lines
+137
to
+144
| ## idempotency behaviour | ||
| -Must expose idempotency at the entry point of the service boundray and check if the key already exists in the table. | ||
| -if there is a key | ||
| Completed request then return the same resonse | ||
| PROCESSING request conflit, then return the request is already in progress(have to handle the server crash processing request) | ||
| FAILED request, then process the request and mark the status as processing | ||
| -no KEY process the request | ||
|
|
|
|
||
| --- | ||
| ## retry behaviour | ||
| -In a distributed setup, your application servers talk to your database cluster over a network network. |
Comment on lines
+88
to
+107
| POST /transfer | ||
| request: | ||
| ``` json | ||
| { | ||
| "idempotencyKey": "abc012", | ||
| "fromWalletId": 1001, | ||
| "toWalletId": "acha12b", | ||
| "amount": 400.00 | ||
| } | ||
| ``` | ||
|
|
||
| ``` json | ||
| response: | ||
| { | ||
| "date":"2026 Jun 25 18:53", | ||
| "amount":400.00, | ||
| "toWallet":"akad901", | ||
| "transactionId":9001 | ||
| } | ||
| ``` |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Describe your solution briefly.
AI disclosure
Detail how you used AI to help with your submission (including the tools you used, how
you used them and what your prompts were).
Include these points in detail
Schema Design
Describe the tables, constraints, and indexes you introduced.
Idempotency Strategy
Explain how duplicate requests are handled safely.
Concurrency Strategy
Explain how you prevent race conditions and double spending.
How to Run
How to Test
Tradeoffs / Assumptions
Checklist