OpenBankProject / OBP-API

An open source RESTful API platform for banks that supports Open Banking, XS2A and PSD2 through access to accounts, transactions, counterparties, payments, entitlements and metadata - plus a host of internal banking and management APIs.
https://www.openbankproject.com/
1.55k stars 430 forks source link

Provide endpoints showing which customers have access to which accounts. #601

Open simonredfern opened 7 years ago

simonredfern commented 7 years ago

Add new endpoints that list the customers linked to the view of an account.

List all customers for the (implicit) "owner" view. obp/v2.2.0/my/banks/BANK_ID/accounts/ACCOUNT_ID/customer-views

List all customers for a certain view obp/v2.2.0/banks/BANK_ID/accounts/ACCOUNT_ID/views/VIEW_ID/customer_views

List all Customers + Views they have access to: obp/v2.2.0/banks/BANK_ID/accounts/ACCOUNT_ID/customer-views

Probably makes sense to have a customer-views resource like so:

customer-views:

[{
    "user": {
        "user_id": "5995d6a2-01b3-423c-a173-5481df49bdaf",
        "email": "robert.x.0.gh@example.com",
        "provider_id": "robert.x.0.gh",
        "provider": "OBP",
        "username": "robert.x.0.gh"
    },
    "customer": {
        "customer_id": "yauiuy67876f",
        "customer_number": "12345",
        "legal_name": "Robert Manchester"
    },
    "view": {
        "view_id": "owner",
        "short_name": "Accountant",
        "description": "For the accountants",
        "is_public": false
    }
}]

Get the customers like this:

Account -> View (e.g. owner) -> User -> User Customer Links -> Customer

simonredfern commented 7 years ago

WIP . See V2.2.0 getCustomerViewsForAccount