Description for GET /api/scheduledTransfer
GET /api/scheduledTransfer
Objective:
To verify the correct functionality of the GET /api/scheduledTransfer
API method for retrieving a list of scheduled transfers for a user.
API Endpoint:
GET /api/scheduledTransfer
Method:
GET
Description:
This API method retrieves a list of all scheduled transfers associated with the authenticated user. The response includes details of each scheduled transfer, such as the transfer amount, date, and accounts involved.
Request Parameters:
-
Query Parameters:
page
(integer, optional): The page number for pagination (default is 1).limit
(integer, optional): The number of transfers to return per page (default is 10, maximum is 100).
-
Headers:
Authorization
(string): Bearer token or other authentication token to validate the request.
Request Example:
GET /api/scheduledTransfer
Authorization: Bearer {token}
Expected Responses:
```
-
Client Error (HTTP 401 Unauthorized):
- Description: The request is missing or has an invalid authorization token.
- Response Body:
{ "status": "error", "message": "Authorization required or invalid token." }
-
Client Error (HTTP 400 Bad Request):
- Description: The request has invalid query parameters (e.g., non-integer
page
orlimit
). - Response Body:
{ "status": "error", "message": "Invalid query parameters." }
- Description: The request has invalid query parameters (e.g., non-integer
-
Server Error (HTTP 500 Internal Server Error):
- Description: An unexpected error occurred on the server while processing the request.
- Response Body:
{ "status": "error", "message": "An internal error occurred. Please try again later." }
Test Cases:
-
Valid Request:
- Description: Test retrieval of scheduled transfers with valid
page
andlimit
parameters and a valid authorization token. - Expected Result: Receives a 200 OK status with a list of scheduled transfers and pagination details.
- Description: Test retrieval of scheduled transfers with valid
-
Missing Authorization Token:
- Description: Test request without an authorization token.
- Expected Result: Receives a 401 Unauthorized status with an error message about missing or invalid authorization.
-
Invalid Query Parameters:
- Description: Test request with invalid query parameters, such as a non-integer value for
page
orlimit
. - Expected Result: Receives a 400 Bad Request status with an error message about invalid parameters.
- Description: Test request with invalid query parameters, such as a non-integer value for
-
Pagination Limits:
- Description: Test request with
limit
exceeding the maximum allowed value (e.g.,limit=150
). - Expected Result: Receives a 400 Bad Request status with an error message about exceeding the maximum limit.
- Description: Test request with
-
Empty List:
- Description: Test retrieval when no scheduled transfers exist for the user.
- Expected Result: Receives a 200 OK status with an empty list of transfers and pagination details indicating no results.
-
Server Error Simulation:
- Description: Simulate a server-side issue to test handling of internal errors.
- Expected Result: Receives a 500 Internal Server Error status with a generic error message.
Notes:
- Ensure the authorization token has the correct privileges to access the scheduled transfers.
- Validate pagination behavior to ensure correct handling of
page
andlimit
parameters. - Test edge cases for parameter values and verify that the system handles them gracefully.
This test description provides a thorough approach to verifying the functionality and reliability of the GET /api/scheduledTransfer
endpoint.