Create scheduled transfer

Description for POST /api/scheduledTransfer

Objective:

To verify the correct functionality of the POST /api/scheduledTransfer API method for creating a new scheduled transfer in the banking system.

API Endpoint:

POST /api/scheduledTransfer

Method:

POST

Description:

This API method creates a new scheduled transfer based on the details provided in the request. The transfer is set to occur at a specified future date and time.

Expected Responses:

  • Success (HTTP 201 Created):

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

    • Description: The request is malformed or missing required parameters.
    • Response Body:
      {
        "status": "error",
        "message": "Invalid request. Please check the input data."
      }
      
  • 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 403 Forbidden):

    • Description: The user does not have permission to create the scheduled transfer.
    • Response Body:
      {
        "status": "error",
        "message": "User does not have permission to create this transfer."
      }
      
  • Client Error (HTTP 422 Unprocessable Entity):

    • Description: The request contains valid syntax but is semantically incorrect (e.g., insufficient funds).
    • Response Body:
      {
        "status": "error",
        "message": "Unable to process transfer. Please check the provided details."
      }
      
  • 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 creation of a scheduled transfer with all required fields correctly provided.
    • Expected Result: The transfer is successfully created, and a 201 Created status is returned with the new transfer ID.
  2. Missing Required Fields:

    • Description: Test request missing one or more required fields (e.g., amount, sourceAccountId).
    • Expected Result: Receives a 400 Bad Request status with an error message indicating the missing fields.
  3. Invalid Authorization Token:

    • Description: Test creation with an invalid or expired authorization token.
    • Expected Result: Receives a 401 Unauthorized status with an error message about authorization.
  4. Insufficient Funds:

    • Description: Test creation with a transfer amount greater than the available balance in the source account.
    • Expected Result: Receives a 422 Unprocessable Entity status with a message about insufficient funds.
  5. Permission Denied:

    • Description: Test creation with valid details but without sufficient permissions for the source account.
    • Expected Result: Receives a 403 Forbidden status with an error message about permission.
  6. Server Error Simulation:

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

Notes:

  • Ensure the transferDate is set in the future and formatted correctly.
  • Verify that the authorization token has sufficient privileges to perform the transfer.
  • Check edge cases like invalid account IDs and amounts to ensure proper error handling.

This test description outlines the key aspects needed to validate the functionality and reliability of the POST /api/scheduledTransfer endpoint.

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