Dhi13man / nordigen_integration

Development of a Dart/Flutter Package for Nordigen EU PSD2 AISP Banking API Integration with relevant Data Models, and proper encapsulation.
https://pub.dev/packages/nordigen_integration
MIT License
12 stars 8 forks source link

MAJOR: Encapsulation of Categorisation and Insights API #5

Open Dhi13man opened 3 years ago

Dhi13man commented 3 years ago

Nordigen's Account information API has already been encapsulated in depth over the contributions so far. However, now it's time to get started with the procedure of encapsulating the Categorisation and Insights APIs too.

Documentation for the API available here: https://nordigen.com/en/categorisation_and_insights_documentation/api_documentation/endpoints/parameters-and-responses/

Feel free to request division of this issue into sub-issues if that helps the development flow become more efficient. :)

antoineraulin commented 2 years ago

Hi! I'm starting to integrate the premium endpoints (which include categorisation and insights) into the library.

At first sight at least some of these premium endpoints (notably the one allowing to retrieve the list of categories) use a Bearer token obtained differently from the one for the classic endpoints. Indeed, to obtain it, you have to use an oauth2 authentication which requires a client_id and a client_secret obtained from the premium dashboard. It might therefore be interesting to separate the logic of the premium endpoints from the classic ones.

These premium endpoints are free up to 100 end-users/month

Dhi13man commented 2 years ago

Great, @antoineraulin. Two things:

  1. Firstly, full disclosure, I don't have the access to test the endpoints in Categories and Insights API or too much info about it, which is why this issue has been left open for so long.

  2. I don't think the Account Data API and the Categorisation and Insights API share much common functionality. So we can encapsulate Categorisation and Insights API into a seperate class with its own authentication and functionality extensions.

    That way people will be able to use NordigenAccountInfoAPI class methods to use Account Info API, and say NordigenCatInsAPI class methods to use categorization and Insights API. They can also have different methods of authentication like you said (NordigenAccountInfoAPI uses secrets to authenticate and initialize, while NordigenCatInsAPI can use oauth).

antoineraulin commented 2 years ago

Great,

The premium products also allow you to enrich the account information:

This data enriches the data already provided by the classic endpoints, except that to access it you need to use a premium endpoint to have the classic + premium data in a single request as specified in the documentation:

Once products are enabled when using premium endpoints, the respective account information layer will be returned together with the premium layer. There is no need to separately use accounts endpoints in case premium endpoints are used.

In this case the NordigenCatInsAPI class is no longer dedicated to categorisation and insights but to all premium endpoints. It might be better to name it accordingly, right?

antoineraulin commented 2 years ago

Well, actually I'm wrong about the premium account information endpoints, these actually use the same token as the regular endpoints. Only the ones directly quoted on the https://nordigen.com/en/categorisation_and_insights_documentation/api_documentation/endpoints/parameters-and-responses/ page use the oauth2 system.

So we can keep NordigenCatInsAPI as the class name and implement the premium account information endpoints in NordigenAccountInfoAPI. This also allows me to extend the data model classes since the premium endpoint responses are just an extension of the classic data.

Dhi13man commented 2 years ago

Works perfectly then. Just gotta extend Accounts API data models and implement the categorization and insights API. Should I break them into separate issues?

antoineraulin commented 2 years ago

If you can make two separate issues: one for the premium endpoints of account information (transactions, etc) and another for categorisation and insights that would be great.

Dhi13man commented 2 years ago

Cool. Will do. This will remain the issue for Cat and Ins. Another issue has been created for premium endpoints: https://github.com/Dhi13man/nordigen_integration/issues/7

Dhi13man commented 2 years ago

This issue was not picked up and so is open again. Would love for anyone else to contribute. :)