Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Postman collection to test every single endpoint in the BankAccountAccess module #50

Open
Tracked by #36
francis-pouatcha opened this issue Sep 18, 2024 · 0 comments

Comments

@francis-pouatcha
Copy link
Contributor

francis-pouatcha commented Sep 18, 2024

Creating a Postman Collection for Testing Endpoints in the BankAccountAccess Module

To thoroughly test the endpoints in the BankAccountAccess module, we'll create a structured Postman collection. This collection will include tests for creating, modifying, viewing, and deleting BankAccountAccess objects, as well as testing various roles such as HolderAccess, SeniorManagerAccess, ManagerAccess, AgentAccess, AuditorAccess, and PoAAccess.

Here's a detailed approach to creating the Postman collection for each of these operations:

1. Base URL and Environment Setup

  • First, define your environment variables in Postman:
    • base_url: The base URL for your API, e.g., http://localhost:8080/api/
    • token: An authorization token for secure endpoints if necessary.

The base structure for all requests would be {{base_url}}/bank-account-access.

2. Create BankAccountAccess

  • Endpoint: POST /bank-account-access
  • Description: This endpoint is used to create a BankAccountAccess entry.
  • Request Body:
    {
      "accountId": "12345",
      "entityId": "67890",
      "scope": ["read_balance", "manage_access", "execute_payment"],
      "weight": 1.0,
      "conditions": {
        "monetary_limit": 10000,
        "time_constraint": "2024-12-31",
        "location_constraints": ["US", "EU"]
      },
      "status": "active",
      "policies": ["standard_policy"]
    }
  • Test Scenarios:
    • Successfully create a new BankAccountAccess entry.
    • Handle validation errors (e.g., missing accountId or entityId).

3. Get All BankAccountAccess Records

  • Endpoint: GET /bank-account-access
  • Description: This endpoint retrieves a list of all BankAccountAccess entries.
  • Test Scenarios:
    • Retrieve the list of all bank account access records.
    • Handle empty lists if no access records exist.

4. Get Specific BankAccountAccess by ID

  • Endpoint: GET /bank-account-access/{id}
  • Description: Retrieves a specific BankAccountAccess entry by its ID.
  • Path Variable: {id} is the unique ID of the BankAccountAccess entry.
  • Test Scenarios:
    • Successfully retrieve a specific BankAccountAccess entry.
    • Handle cases where the BankAccountAccess entry does not exist (404 error).

5. Update BankAccountAccess

  • Endpoint: PUT /bank-account-access/{id}
  • Description: Updates an existing BankAccountAccess entry.
  • Path Variable: {id} is the unique ID of the BankAccountAccess entry to update.
  • Request Body:
    {
      "scope": ["read_balance", "execute_payment"],
      "weight": 0.5,
      "status": "restricted"
    }
  • Test Scenarios:
    • Successfully update an existing BankAccountAccess entry.
    • Handle validation errors for invalid or incomplete updates.

6. Delete BankAccountAccess

  • Endpoint: DELETE /bank-account-access/{id}
  • Description: Deletes a BankAccountAccess entry by its ID.
  • Test Scenarios:
    • Successfully delete an existing BankAccountAccess entry.
    • Handle attempts to delete non-existing entries (404 error).

7. Test Scenarios for Access Roles

7.1 HolderAccess

  • Endpoint: POST /bank-account-access/holder-access
  • Description: This endpoint automatically creates HolderAccess when a new account is created.
  • Test Scenarios:
    • Create an account and ensure that HolderAccess is automatically generated.
    • Suspend HolderAccess when transferring account ownership.

7.2 SeniorManagerAccess

  • Endpoint: POST /bank-account-access/senior-manager-access
  • Description: Creates SeniorManagerAccess for managing ManagerAccess roles.
  • Test Scenarios:
    • Successfully create SeniorManagerAccess.
    • Test updating or suspending SeniorManagerAccess.

7.3 ManagerAccess

  • Endpoint: POST /bank-account-access/manager-access
  • Description: Creates and manages ManagerAccess for the account.
  • Test Scenarios:
    • Successfully create and modify ManagerAccess.
    • Limit the scope of ManagerAccess to prevent unauthorized actions.

7.4 AgentAccess

  • Endpoint: POST /bank-account-access/agent-access
  • Description: Grants AgentAccess, allowing the agent to impersonate the holder in specific processes.
  • Test Scenarios:
    • Test the creation of AgentAccess and ensure it does not grant permission to manage access.

7.5 AuditorAccess

  • Endpoint: POST /bank-account-access/auditor-access
  • Description: Grants read-only access to auditors for reviewing account data.
  • Test Scenarios:
    • Test that auditors can view account data without modifying it.
    • Validate that unauthorized users cannot access the same data.

7.6 PoAAccess

  • Endpoint: POST /bank-account-access/poa-access
  • Description: Grants Power of Attorney access, allowing the user to act on behalf of the account holder.
  • Test Scenarios:
    • Create and test PoAAccess with different scopes.
    • Ensure revocation of PoAAccess is handled properly.

8. Error Handling and Edge Cases

  • Include tests for:
    • Invalid data (e.g., missing fields or incorrect formats).
    • Unauthorized access (e.g., attempting to modify access without proper permissions).
    • Expired or suspended access statuses.

9. Testing Open Banking Use Cases (Optional)

  • Since PoAAccess and ThirdPartyAccess can implement open banking concepts, you can include additional test cases for:
    • Account Information Consent (read-only access to account information).
    • Payment Initiation Consent (initiating payments on behalf of the account holder).
    • Confirmation of Funds Consent (verifying available funds).

10. Postman Collection Structure

Organize the Postman collection into folders for easy navigation:

  • Authentication: If your API requires authentication, have a folder for login and token generation.
  • BankAccountAccess:
    • POST Create BankAccountAccess.
    • GET All BankAccountAccess entries.
    • GET BankAccountAccess by ID.
    • PUT Update BankAccountAccess.
    • DELETE Delete BankAccountAccess.
  • Access Roles:
    • HolderAccess.
    • SeniorManagerAccess.
    • ManagerAccess.
    • AgentAccess.
    • AuditorAccess.
    • PoAAccess.

11. Environment Variables and Pre-Scripts

  • Use Postman environment variables (e.g., {{token}}, {{base_url}}) to make the requests reusable across different environments (development, staging, production).
  • Include pre-scripts to handle token refresh or any required setup steps before making the API requests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant