Skip to content

Commit

Permalink
Merge pull request #12 from tolik505/main
Browse files Browse the repository at this point in the history
Parse bban property in account details
  • Loading branch information
Dhi13man authored Sep 9, 2022
2 parents de4815f + 6dd7a9b commit 3000687
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/data_models/nordigen_account_models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class AccountDetails {
const AccountDetails({
this.id,
this.iban,
this.bban,
this.msisdn,
required this.currency,
this.ownerName,
Expand All @@ -33,6 +34,7 @@ class AccountDetails {
return AccountDetails(
id: fetchedMap['resourceId'] as String?,
iban: fetchedMap['iban'] as String?,
bban: fetchedMap['bban'] as String?,
msisdn: fetchedMap['msisdn'] as String?,
currency: fetchedMap['currency'] as String,
ownerName: fetchedMap['ownerName'] as String?,
Expand Down Expand Up @@ -61,6 +63,7 @@ class AccountDetails {
Map<String, dynamic> toMap() => <String, dynamic>{
'resourceId': id,
'iban': iban,
'bban': bban,
'msisdn': msisdn,
'currency': currency,
'ownerName': ownerName,
Expand All @@ -85,6 +88,9 @@ class AccountDetails {
/// This data element is used for payment accounts which have no IBAN.
final String? iban;

// This data element is used for payment accounts which have no IBAN
final String? bban;

/// An alias to a payment account via a registered mobile phone number.
final String? msisdn;

Expand Down
30 changes: 30 additions & 0 deletions test/unit_tests/nordigen_account_models_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,36 @@ Future<void> main() async {
group(
'Nordigen Account Models Unit Tests',
() => <void>{
test('Parse Account Details', () {
// Arrange - Sample Data
const Map<String, dynamic> sampleMap = <String, dynamic>{
'resourceId': '0df01281-2408-5dbe-92f2-96b2c1cc08e1',
'iban': 'DE26100110012622221111',
'bban': '333322221111',
'currency': 'EUR',
'name': 'Main Account',
'product': 'Main Product',
'cashAccountType': 'CACC',
'status': 'enabled',
'bic': 'NTSBDEB1XXX',
'usage': 'PRIV'
};

// Act - Parse Data
final AccountDetails result = AccountDetails.fromMap(sampleMap);

// Assert - Check Data
expect(result.id, '0df01281-2408-5dbe-92f2-96b2c1cc08e1');
expect(result.iban, 'DE26100110012622221111');
expect(result.bban, '333322221111');
expect(result.currency, 'EUR');
expect(result.name, 'Main Account');
expect(result.product, 'Main Product');
expect(result.cashAccountType, 'CACC');
expect(result.status, 'enabled');
expect(result.bic, 'NTSBDEB1XXX');
expect(result.usage, 'PRIV');
}),
test('Parse sample Account Model Transaction Data', () {
// Arrange - Sample Data
const Map<String, dynamic> sampleTransactionMap = <String, dynamic>{
Expand Down

0 comments on commit 3000687

Please sign in to comment.