Delete scheduled transfer

Description for DELETE /api/scheduledTransfer

Objective:

To verify the correct functionality of the DELETE /api/scheduledTransfer API method in removing a scheduled transfer from the banking system.

API Endpoint:

DELETE /api/scheduledTransfer

Method:

DELETE

Description:

This API method deletes a previously scheduled transfer from the user's account. It requires a valid scheduled transfer ID to identify the transfer to be removed.

Request Parameters:

  • Path Parameter:

    • transferId (string): The unique identifier of the scheduled transfer to be deleted. This should be provided as part of the URL.
  • Headers:

    • Authorization (string): Bearer token or other authentication token to validate the request.

Request Example:

DELETE /api/scheduledTransfer/{transferId}
Authorization: Bearer {token}

Expected Responses:

  • Success (HTTP 200 OK):

    • Description: The scheduled transfer has been successfully deleted.
    • Response Body:
      {
        "status": "success",
        "message": "Scheduled transfer deleted successfully."
      }
      
  • Client Error (HTTP 400 Bad Request):

    • Description: The request is malformed or missing required parameters.
    • Response Body:
      {
        "status": "error",
        "message": "Invalid transfer ID or missing authorization token."
      }
      
  • Client Error (HTTP 404 Not Found):

    • Description: The transfer ID does not match any existing scheduled transfers.
    • Response Body:
      {
        "status": "error",
        "message": "Scheduled transfer not found."
      }
      
  • Client Error (HTTP 403 Forbidden):

    • Description: The user does not have permission to delete the scheduled transfer.
    • Response Body:
      {
        "status": "error",
        "message": "Unauthorized to delete this transfer."
      }
      
  • 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:

  1. Valid Request:

    • Description: Test deletion of a scheduled transfer with a valid transferId and proper authorization.
    • Expected Result: Transfer is successfully deleted and receives a 200 OK status with a success message.
  2. Invalid Transfer ID:

    • Description: Test deletion with an invalid or non-existent transferId.
    • Expected Result: Receives a 404 Not Found status with an error message indicating the transfer does not exist.
  3. Missing Authorization Token:

    • Description: Test deletion without providing an authorization token.
    • Expected Result: Receives a 400 Bad Request or 403 Forbidden status with an error message about missing or invalid authorization.
  4. Permission Denied:

    • Description: Test deletion with a valid transferId but without sufficient permissions.
    • Expected Result: Receives a 403 Forbidden status with an error message about unauthorized access.
  5. Server Error Simulation:

    • Description: Test handling of server errors by simulating a server-side issue.
    • Expected Result: Receives a 500 Internal Server Error status with a generic error message.

Notes:

  • Ensure that the transferId used in tests is valid and corresponds to a real scheduled transfer in the test environment.
  • The authorization mechanism and permissions should be properly configured to reflect real-world scenarios.
  • Error handling should be thoroughly checked to ensure that the API gracefully handles all edge cases and unexpected conditions.

This test description covers the main aspects of verifying the functionality and robustness of the DELETE /api/scheduledTransfer endpoint.

Language
Credentials
Bearer
JWT
Click Try It! to start a request and see the response here!