Examples
Here are some examples demonstrating how to interact with the Fintech Platform.
🖥️ CLI Interaction
- Start the CLI:
- Login (when prompted):
- Create an account:
- Deposit funds:
> deposit xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 100.50
Deposited 100.50 to account xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. New balance: 100.50
- Check balance:
> balance xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Account xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx balance: 100.50
🌐 API Interaction (using curl
)
- Register a new user:
curl -X POST http://localhost:3000/user \
-H "Content-Type: application/json" \
-d '{"username":"apiuser","email":"api@example.com","password":"apipassword"}'
- Login to get a JWT token:
curl -X POST http://localhost:3000/login \
-H "Content-Type: application/json" \
-d '{"identity":"apiuser","password":"apipassword"}'
# Copy the token from the response for subsequent requests
- Create an account (using the JWT token):
- Deposit funds into the account:
curl -X POST http://localhost:3000/account/YOUR_ACCOUNT_ID/deposit \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{"amount": 500.75}'
# Note: This creates a pending transaction. The account balance will only update after the payment provider (or mock) calls the webhook endpoint to confirm payment completion.
- Get account balance: