Documentation 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.
The Accounts Service is the financial core of Digital Money House. It manages every monetary operation: account balances, linked payment cards, peer-to-peer transfers, card-funded deposits, and a complete activity log with downloadable PDF receipts. All four domains are exposed through dedicated controllers under the /accounts base path and are protected by the shared JWT validated at the gateway.
Responsibilities
- Account lifecycle: create, retrieve, update, and delete digital wallet accounts
- Balance queries: expose current balance and last transaction summary per account
- Card management: link and remove debit or credit cards associated with an account
- Money transfers: deposit funds from a linked card (
/transferences/cards) or transfer between accounts (/transferences/money)
- Activity log: record and retrieve all transactions (transfer-in, transfer-out, deposit) with filtering support
- PDF receipt generation: produce a downloadable PDF receipt for any individual activity entry
- Internal account creation: accept service-to-service calls from the User Service using a shared
internal.token
Controllers
1. Accounts — AccountsController
Handles account lifecycle operations and balance queries. Base path: /accounts.
| Method | Path | Description |
|---|
POST | /accounts/create | Create a new account. Accepts internal token or user JWT. |
GET | /accounts | List all accounts (admin use). |
GET | /accounts/{id} | Get account details by ID. |
GET | /accounts/{id}/balance | Get account balance summary. |
GET | /accounts/{id}/transactions | Get the last transactions for an account. |
PATCH | /accounts/{id} | Update account fields. |
PATCH | /accounts/update/alias/{id} | Update the account’s alias string. |
DELETE | /accounts/{id} | Delete an account. Owner or admin only. |
POST /accounts/create is called internally by the User Service during registration. It
accepts either a standard user JWT or the internal.token value in the Authorization
header (Bearer super-secret-internal-token-123).
Get balance — GET /accounts/{id}/balance
// 200 OK
{
"id": 5,
"balance": 15000.00
}
Create account — POST /accounts/create
// Request body (sent by User Service)
{
"userId": 3,
"email": "val@example.com",
"alias": "tigre.nube.rio",
"cvu": "4521870093412867001234",
"initialBalance": 0
}
// 200 OK response
{
"id": 5,
"balance": 0.00
}
2. Cards — CardController
Manages debit and credit cards linked to an account. Base path: /accounts/{accountId}/cards.
| Method | Path | Description |
|---|
GET | /accounts/{accountId}/cards | List all cards for the account. |
GET | /accounts/{accountId}/cards/{cardId} | Get a single card by ID. |
POST | /accounts/{accountId}/cards | Link a new card to the account. |
DELETE | /accounts/{accountId}/cards/{cardId} | Remove a card from the account. |
Link a card — POST /accounts/{accountId}/cards
// Request body
{
"number": "4111111111111111",
"name": "VALENTINA GARCIA",
"expiry": "12/27",
"cvc": "123"
}
// 201 Created response
{
"id": 12,
"accountId": 5,
"number": "4111111111111111",
"name": "VALENTINA GARCIA",
"expiry": "12/27",
"cvc": "123"
}
Attempting to add a card that already exists for the account returns 409 Conflict.
A valid Authorization: Bearer <token> header is required for POST.
3. Transfers — TransferenceController
Handles two types of money movement. Base path: /accounts/{accountId}/transferences.
| Method | Path | Description |
|---|
POST | /accounts/{accountId}/transferences/cards | Deposit money from a linked card into the account. |
POST | /accounts/{accountId}/transferences/money | Transfer money from this account to another account. |
GET | /accounts/{accountId}/transferences/last-transferred-accounts | Get the list of recently contacted recipient accounts. |
Deposit from card — POST /accounts/{accountId}/transferences/cards
// Request body
{
"cardId": 12,
"amount": 5000.00
}
// 201 Created response
"Ingreso registrado con éxito"
Transfer between accounts — POST /accounts/{accountId}/transferences/money
// Request body
{
"recipient": "1234567890123456789012",
"amount": 2500.00
}
// 201 Created response
"Transferencia realizada con éxito"
The recipient field accepts either a 22-digit CVU or a dot-separated alias (e.g. tigre.nube.rio).
Transfers return 410 Gone when the source account has insufficient funds. Both the source
and destination account balances are updated atomically to prevent race conditions.
4. Activity — ActivityController
Provides a full chronological log of all account transactions with filtering and PDF export. Base path: /accounts/{accountId}/activity.
| Method | Path | Description |
|---|
GET | /accounts/{accountId}/activity | List all activities for the account. |
GET | /accounts/{accountId}/activity/{activityId} | Get detail of a single activity entry. |
POST | /accounts/{accountId}/activity/filter | Filter activities by date range, type, or amount. |
GET | /accounts/{accountId}/activity/{activityId}/receipt | Download a PDF receipt for the activity. |
All activity endpoints require an Authorization header. The token is forwarded directly
by the gateway — no additional validation logic is needed in the controller.
Filter activities — POST /accounts/{accountId}/activity/filter
// Request body
{
"startDate": "2024-01-01",
"endDate": "2024-12-31",
"activityType": "transfer-out",
"minAmount": 100.00,
"maxAmount": 10000.00
}
// 200 OK — array of ActivityOutDTO
[
{
"id": 88,
"accountId": 5,
"type": "transfer-out",
"amount": 2500.00,
"date": "2024-06-15",
"cvu": "1234567890123456789012"
}
]
Download receipt — GET /accounts/{accountId}/activity/{activityId}/receipt
Returns a binary PDF file:
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename=comprobante_operacion.pdf
Activity Types
Every financial operation is recorded with one of the following type codes:
| Type | Triggered by |
|---|
deposit | Funds loaded from a linked card via /transferences/cards |
transfer-out | Money sent to another account via /transferences/money |
transfer-in | Money received from another account |
Account Entity
The Accounts table in account_service_db stores balance and identifier information.
| Field | Type | Constraints | Description |
|---|
id | Long | PK, auto-increment | Internal account ID |
userId | Long | — | References the user in User Service |
email | String | UNIQUE | Owner’s email, used for authorization checks |
alias | String | — | Three-word dot-separated alias |
cvu | String | — | 22-digit Argentine CVU |
balance | BigDecimal | — | Current wallet balance |
transactions | List<Transaction> | @Transient | Not persisted; populated on demand |
Internal Service Token
Account creation called from the User Service during user registration bypasses the normal JWT flow and instead uses a shared static token:
// AccountsController.createAccount() — internal auth check
if (authHeader != null && authHeader.equals("Bearer " + internalToken)) {
// trusted internal call — skip JWT validation
AccountResponse response = accountsService.createAccount(request);
return ResponseEntity.ok(response);
}
# accounts-service/src/main/resources/application.yml
internal:
token: super-secret-internal-token-123
The internal.token value must match the internal.token configured in the User Service.
Both services read this from their respective configuration files.
Configuration Reference
Properties are read from accounts-service/src/main/resources/application.yml.
| Property | Value | Description |
|---|
server.port | 8084 | HTTP port |
jwt.secret | mySuperUltraSecretKeyFor… | Shared HS256 signing key |
internal.token | super-secret-internal-token-123 | Token for service-to-service account creation |
spring.datasource.url | jdbc:mysql://localhost:3306/account_service_db | MySQL connection |
eureka.client.service-url.defaultZone | http://localhost:8761/eureka | Eureka registry address |
# accounts-service/src/main/resources/application.yml (key excerpt)
server:
port: 8084
jwt:
secret: mySuperUltraSecretKeyForJWTGeneration123456!
internal:
token: super-secret-internal-token-123
spring:
datasource:
url: jdbc:mysql://localhost:3306/account_service_db