The purpose if this repository is to serve as a starting point from which one can explore, and test the DnB API. This repository is based upon the Sandbox API.
Note: this library may be subtly broken or buggy. The code is released under the MIT License – please take the following message to heart:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The code in this repository only contain code that works with the AISP section of the DNB API. Please see the TODO list at the bottom of the README if to see what features the team is working on implementing.
First, you should sign up at the DNB Developer portal, and read the Documentation there. There is only one requirement to get this code up and running. And it is to create, and download a certificate from here.
- Make sure that you have Python 3.7 or higher installed on your computer.
- Make sure that you have pip installed.
- Install the library by using the following command:
pip install git+https://github.com/Njord-Technologies/get_started_with_psd2
- Test that the installation of the library was successful by running the command
python -m from DNB_psd2 import AISP
If there are no error messages you're good to go! (Knock on wood)
The DNB sandbox API can be divded in three parts. These are:
- AISP - Account Information Service Provider. With this role you can list accounts, get balances and account details.
- PISP - Payment Initiation Service Provider. With this role you can initiate payments.
- PIISP - Payment Instrument Issuing Service Provider. With this role you can check if a card/account has sufficient funds for a transaction
In it's current stage, this code only supports a limited set of the API. Work is being done at broadening the capability of the code.
The AISP endpoints can be reached using AISP
from DNB_psd2 import AISP
AISP_client = AISP(PSU_ID = "Insert SSN or TB here", pem_path = "Path to the *.pem file",
key_path = "Path to the *.key file")
The AISP()
class collects the consent for the user.
The following SSN's(Sosial Security Number) and ID for Corporate users are accesible in the Sandbox API:
SSN/TB-ident | No. of accounts | No. of credit card accounts | Available context |
---|---|---|---|
31125453913 | 4 | 4 | Retail |
31125451740 | 2 | 6 | Retail |
31125459199 | 1 | 2 | Retail |
31125458990 | 3 | 2 | Retail |
31125461037 | 2 | 4 | Retail |
31125461118 | 1 | 2 | Retail |
31125452887 | 2 | 4 | Retail |
31125450361 | 3 | 2 | Retail |
31125458052 | 2 | 2 | Retail |
31125470982 | 2 | 2 | Retail |
TB76688 | 4 | - | Corporate |
# Get the accounts accosiated with the SSN/TB
AISP.accounts()
#Get information about a certain account.
AISP.get_account_info(bban = "Insert Account nr(bban) here")
#Get balance for a certain account.
AISP.get_account_balance(bban = "Insert Account nr(bban) here")
#Get the bank transactions for the spesified account
AISP.get_bank_transactions(bban = "Insert Account nr(bban) here")
#Get information about the card accounts tied to a spesific user
AISP.get_card()
#Get a list over the transactions for the spesified card account
AISP.get_card_transactions(bban = "Insert Account nr(bban) here")