ADORSYS-GIS / ADORSYS-GIS/webank

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

Ouverte
#50 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Aucune donnée de langage
Étoiles
6
Forks
3
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### 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**:
```json
{
"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**:
```json
{
"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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.