-
Notifications
You must be signed in to change notification settings - Fork 0
/
rest-endpoints.txt
74 lines (67 loc) · 2.64 KB
/
rest-endpoints.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Sure, here are the REST API contracts for each method in the UserController class:
getUserByCpf method
HTTP Method: GET
Endpoint: /user/{cpf}
Path Parameter:
cpf - long - CPF of the user to retrieve
Response:
Success - 200 OK - User object representing the user with the specified CPF
Failure - 404 Not Found - If user with the specified CPF does not exist in the database
getUserByEmail method
HTTP Method: GET
Endpoint: /user/byEmail
Request Parameter:
email - String - Email of the user to retrieve
Response:
Success - 200 OK - User object representing the user with the specified email
Failure - 404 Not Found - If user with the specified email does not exist in the database
getUserWalletByCpf method
HTTP Method: GET
Endpoint: /userWallet/{cpf}
Path Parameter:
cpf - long - CPF of the user whose wallet to retrieve
Response:
Success - 200 OK - Wallet object representing the wallet of the user with the specified CPF
Failure - 404 Not Found - If user with the specified CPF does not exist in the database
adjustAmountByUserCpf method
HTTP Method: POST
Endpoint: /adjustAmount/{cpf}/{amount}
Path Parameters:
cpf - long - CPF of the user whose wallet to adjust
amount - double - Amount to adjust the wallet balance by
Response:
Success - 200 OK - Wallet object representing the updated wallet of the user with the specified CPF
Failure - 404 Not Found - If user with the specified CPF does not exist in the database
Failure - 400 Bad Request - If the adjustment causes the wallet balance to become negative
transactAmount method
HTTP Method: POST
Endpoint: /transaction
Request Body:
Transaction - JSON object - Contains payer, payee, and amount fields
payer - long - CPF of the user who will pay
payee - long - CPF of the user who will receive payment
amount - double - Amount to transfer between the two users' wallets
Response:
Success - 200 OK - String "transaction success!"
Failure - 404 Not Found - If either the payer or payee with the specified CPF does not exist in the database
Failure - 400 Bad Request - If the payer does not have sufficient balance in their wallet for the transaction
createUser method
HTTP Method: POST
Endpoint: /user
Request Body:
User - JSON object - Contains fields for user details
fname - String - First name of the user
lname - String - Last name of the user
email - String - Email of the user
cpf - long - CPF of the user
Response:
Success - 200 OK - User object representing the newly created user
createLogin method
HTTP Method: POST
Endpoint: /login
Request Body:
Login - JSON object - Contains fields for login credentials
username - String - Username for the login
password - String - Password for the login
Response:
Success - 200 OK - Login object