Move funds from the sender’s digital-money account to any other registered account, identified by its CVU or human-readable alias. The entire operation — balance deduction, balance credit, transference record, and dual activity entries — executes inside a singleDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Gianluca-X/DigitalMoney/llms.txt
Use this file to discover all available pages before exploring further.
@Transactional block. Pessimistic write locking on the account rows ensures that concurrent transfers cannot produce inconsistent balances.
Endpoint
http://localhost:8085
Authentication
A valid Bearer JWT is required in the
Authorization header. The path accountId must correspond to the account that owns the token; any mismatch results in 403 Forbidden.Path Parameters
The numeric ID of the sender’s account. Funds are debited from this account.
Request Body
Send a JSON object mapped toTransferRequestOutDTO:
The CVU (22-digit string) or alias of the destination account. The service first searches by alias; if not found it falls back to CVU lookup.
The amount to transfer. Must be greater than
0 and must not exceed the sender’s current balance.Response
Returns201 Created with a plain-text confirmation on success.
Activity Records Created
TwoActivity entries are created atomically as part of every successful transfer:
| Entry | accountId | type | amount | description |
|---|---|---|---|---|
| Sender | accountId (sender) | transfer-out | Negative value of transferred amount | Recipient CVU or alias |
| Recipient | Recipient’s account ID | transfer-in | Positive value of transferred amount | Sender’s CVU |
Get Recent Recipients
Retrieve the last five accounts the sender has transferred money to:Transference objects ordered by date descending, limited to 5 entries. Each object includes the fields: id, accountId, cardId, amount, date, type, and recipient.
Business Rules
amountmust be strictly greater than0.- Self-transfers (sender and recipient resolve to the same account) are rejected with a
BadRequestException. - The sender’s balance must be greater than or equal to
amount; otherwiseInsufficientFundsExceptionis thrown. - Recipient lookup is performed first by alias, then by CVU. If neither resolves to a registered account, the transfer is rejected.
Concurrency
ThemakeTransferFromCash method is annotated with @Transactional. The database rows for both the sender and recipient accounts are locked for the duration of the operation, preventing race conditions when multiple concurrent transfers affect the same accounts.
Example Request
Example Response
Error Responses
| Status | Exception | Condition |
|---|---|---|
400 Bad Request | AccountNotFoundException | The recipient CVU/alias does not match any registered account, or a self-transfer was attempted. |
403 Forbidden | UnauthorizedException | The authenticated user does not have permission to debit the specified account. |
410 Gone | InsufficientFundsException | The sender’s balance is lower than the requested transfer amount. |
500 Internal Server Error | — | An unexpected error occurred while processing the transfer. |
