nordigen_integration 1.0.1 nordigen_integration: ^1.0.1 copied to clipboard
Development of a Flutter Package for Nordigen Integration, with relevant Data Models.
nordigen_integration #
Development of a Flutter Package for Nordigen Integration with relevant Data Models, proper Encapsulation with the exposing of parameters, and succinct documentation for each relevant element.
For more information about the API view Nordigen's Account Information API documentation.
Find Package on Official Dart Pub:
Usage Steps #
-
Go through the Nordigen's Account Information API documentation.
-
Register and get the API Access Token from https://ob.nordigen.com.
-
Initialise the
NordigenAccountInfoAPI
Class with the token recieved from Step 2. -
Call any of the
NordigenAccountInfoAPI
Class methods to directly interact with Nordigen Server's endpoints while having the internal requests and relevant headers abstracted, based on your need. -
Utilize any of the available Data Classes to modularly and sufficiently store and process the information during any of the API usage steps. The Data Classes have functionality to be constructed
fromMap()
and to be easily converted backtoMap()
as well as to be serialized, at any point.
Available Methods #
-
NordigenAccountInfoAPI({@required String accessToken})
(Class constuctor)Call it with
accessToken
parameter which is the access token recieved from https://ob.nordigen.com/, to access API features.Analogous to Step 1 of Account Information API documentation.
-
getBanksForCountry({@required String countryCode})
Gets the ASPSPs (Banks) in the Country represented by the given two-letter
countryCode
(ISO 3166).Analogous to Step 2 of Account Information API documentation.
-
createEndUserAgreement({@required String endUserID, String aspspID, ASPSP aspsp, int maxHistoricalDays = 90})
Creates an End User Agreement for the given
endUserID
,aspspID
(oraspsp
) and for the givenmaxHistoricalDays
(default 90 days) and returns the resultingEndUserAgreementModel
.Both
aspspID
andaspsp
can not be NULL.If both are NOT NULL, ID ofaspsp
will be prefereed.Analogous to Step 3 of Account Information API documentation.
-
createRequisition({ @required String endUserID, @required String redirect, @required String reference, List<String> agreements = const <String>[]})
Create a Requisition for the given
endUserID
and returns the resultingRequisitionModel
.reference
is additional layer of unique ID. Should match Step 3 if done.redirect
is the link where the end user will be redirected after finishing authentication in ASPSP.agreements
is as an array of ID(s) from Step 3 or empty array if that step was skipped.Analogous to Step 4.1 of Account Information API documentation.
-
fetchRedirectLinkForRequisition({String aspspID, String requisitionID, ASPSP aspsp, RequisitionModel requisition})
Provides a redirect link to the Requisition passed in for the given ASPSP.
Both
aspspID
andaspsp
can not be NULL. If both are NOT NULL, ID ofaspsp
will be prefereed.Both
requisitionID
andrequisition
can not be NULL. If both are NOT NULL, ID ofrequisition
will be prefereed.Analogous to Step 4.2 of Account Information API documentation.
-
getRequisition({@required String requisitionID})
Gets the Requisition identified by
requisitionID
. -
getEndUserAccountIDs({@required String requisitionID})
Gets the Account IDs of the User for the Requisition identified by
requisitionID
.Analogous to Step 5 of Account Information API documentation.
-
getAccountDetails({@required String accountID})
Gets the Details of the Bank Account identified by
accountID
.Analogous to Step 6 of Account Information API documentation for Account Details.
-
getAccountTransactions({@required String accountID})
Gets the Transactions of the Bank Account identified by
accountID
.Analogous to Step 6 of Account Information API documentation for Account Transactions.
-
getAccountBalances({@required String accountID})
Gets the Balances of the Bank Account identified by
accountID
.Analogous to Step 6 of Account Information API documentation for Account Balances.
Available Data Classes #
-
ASPSP({@required this.id, this.name = '',this.bic = '', this.countries = const <String>[]})
ASPSP (Bank) Data Model for Nordigen. Contains the
id
of the ASPSP, itsname
,bic
and thecountries
associated with the ASPSP. -
EndUserAgreementModel({@required this.id, this.created, this.accepted, this.maxHistoricalDays, this.accessValidForDays, @required this.endUserID, @required this.aspspID})
:End-user Agreement Data Model for Nordigen. Contains the
id
of the Agreement, itscreated
time string,accepted
, the number ofmaxHistoricalDays
andaccessValidForDays
, and theendUserID
andaspspID
relevant to the Agreement. -
RequisitionModel({@required this.id, @required this.redirectURL, @required this.reference, this.status = '', this.agreements = const <String>[], this.accounts = const <String>[], @required this.endUserID})
:Requisition Data Model for Nordigen. Contains the
id
of the Requisition, itsstatus
, end-useragreements
, theredirectURL
to which it should redirect,reference
ID if any,accounts
associated, and the associatedendUserID
. -
BankAccountDetails({@required this.id, @required this.created, this.lastAccessed = '', @required this.iban, @required this.aspspIdentifier, this.status = ''})
:Bank Account Data Model. Contains the
id
of the Bank Account, itscreated
andlastAccessed
date and time,iban
,status
and theaspspIdentifier
identifiying its ASPSP. -
TransactionData({@required this.id, this.debtorName, this.debtorAccount, this.bankTransactionCode, this.bookingDate, this.valueDate, this.transactionAmount, this.remittanceInformationUnstructured = ''})
:Transaction Data Model for Nordigen. Contains the
id
of the Transaction, itsdebtorName
andbankTransactionCode
,bookingDate
andvalueDate
asString
,transactionAmount
asTransactionAmountData
and itsremittanceInformationUnstructured
.TransactionAmountData({@required this.amount, @required this.currency})
is a simple Class that holds the transactionamount
and thecurrency
type
Example Usage #
import 'package:nordigen_integration/nordigen_integration.dart';
void main() async {
/// Step 1
final NordigenAccountInfoAPI apiInterface = NordigenAccountInfoAPI(
accessToken: 'YOUR_TOKEN',
);
/// Step 2 and then selecting the first ASPSP
final ASPSP firstBank =
(await apiInterface.getBanksForCountry(countryCode: 'gb')).first;
/// Step 4.1
final RequisitionModel requisition = await apiInterface.createRequisition(
endUserID: 'exampleEndUser',
redirect: 'http://www.yourwebpage.com/',
reference: 'exampleReference420',
);
/// Step 4.2
final String redirectLink =
await apiInterface.fetchRedirectLinkForRequisition(
requisition: requisition,
aspsp: firstBank,
);
/// Open and Validate [redirectLink] and proceed with other functionality.
print(redirectLink);
}
Dependencies #
-
http is used for making API calls to the Nordigen Server Endpoints with proper response and error handling.
-
meta is used for supporting the
@required
tags to signify required named parameters across the code.
Getting Started
This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.