Skip to content

Commit

Permalink
Update api base url (#13)
Browse files Browse the repository at this point in the history
* Update api url

* Format code

* Upgrade dependencies
  • Loading branch information
tolik505 authored Mar 30, 2024
1 parent a95d572 commit f0f198b
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 108 deletions.
9 changes: 5 additions & 4 deletions lib/extensions/accounts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ extension NordigenAccountsEndpoints on NordigenAccountInfoAPI {
assert(accountID.isNotEmpty);
// Make GET request and fetch output.
final dynamic fetchedData = await _nordigenGetter(
endpointUrl: 'https://ob.nordigen.com/api/v2/accounts/$accountID/',
endpointUrl:
'https://bankaccountdata.gocardless.com/api/v2/accounts/$accountID/',
);
// Form the received dynamic Map into AccountMetaData for convenience.
return AccountMetaData.fromMap(fetchedData);
Expand All @@ -41,7 +42,7 @@ extension NordigenAccountsEndpoints on NordigenAccountInfoAPI {
// Make GET request and fetch output.
final dynamic fetchedData = await _nordigenGetter(
endpointUrl:
'https://ob.nordigen.com/api/v2/accounts/$accountID/details/',
'https://bankaccountdata.gocardless.com/api/v2/accounts/$accountID/details/',
);
assert(fetchedData['account'] != null);
// Form the recieved dynamic Map into BankAccountDetails for convenience.
Expand All @@ -61,7 +62,7 @@ extension NordigenAccountsEndpoints on NordigenAccountInfoAPI {
// Make GET request and fetch output.
final dynamic fetchedData = await _nordigenGetter(
endpointUrl:
'https://ob.nordigen.com/api/v2/accounts/$accountID/transactions/',
'https://bankaccountdata.gocardless.com/api/v2/accounts/$accountID/transactions/',
);
// No Transactions retrieved case.
if (fetchedData['transactions'] == null) {
Expand Down Expand Up @@ -97,7 +98,7 @@ extension NordigenAccountsEndpoints on NordigenAccountInfoAPI {
// Make GET request and fetch output.
final dynamic fetched = await _nordigenGetter(
endpointUrl:
'https://ob.nordigen.com/api/v2/accounts/$accountID/balances/',
'https://bankaccountdata.gocardless.com/api/v2/accounts/$accountID/balances/',
);
final List<dynamic> fetchedData = fetched['balances'] ?? <dynamic>[];
// Form the recieved dynamic Map into BankAccountDetails for convenience.
Expand Down
13 changes: 7 additions & 6 deletions lib/extensions/agreements.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ extension NordigenAgreementsEndpoints on NordigenAccountInfoAPI {

// Make POST request and fetch output.
final dynamic fetchedData = await _nordigenPoster(
endpointUrl: 'https://ob.nordigen.com/api/v2/agreements/enduser/',
endpointUrl:
'https://bankaccountdata.gocardless.com/api/v2/agreements/enduser/',
data: <String, dynamic>{
// API accepts days as String
'max_historical_days': maxHistoricalDays.toString(),
Expand Down Expand Up @@ -62,7 +63,7 @@ extension NordigenAgreementsEndpoints on NordigenAccountInfoAPI {
// Make POST request and fetch output.
final dynamic fetchedData = await _nordigenPoster(
endpointUrl:
'https://ob.nordigen.com/api/v2/agreements/enduser/$endUserAgreementID/accept/',
'https://bankaccountdata.gocardless.com/api/v2/agreements/enduser/$endUserAgreementID/accept/',
data: <String, dynamic>{
'user_agent': userAgent,
'ip_address': ipAddress,
Expand All @@ -82,7 +83,7 @@ extension NordigenAgreementsEndpoints on NordigenAccountInfoAPI {
// Make GET request and fetch output.
final dynamic fetchedData = await _nordigenGetter(
endpointUrl:
'https://ob.nordigen.com/api/v2/agreements/enduser/$endUserAgreementID/',
'https://bankaccountdata.gocardless.com/api/v2/agreements/enduser/$endUserAgreementID/',
);
// Form the recieved dynamic Map into RequisitionModel for convenience.
return EndUserAgreementModel.fromMap(fetchedData);
Expand All @@ -97,7 +98,7 @@ extension NordigenAgreementsEndpoints on NordigenAccountInfoAPI {
// Make GET request and fetch output.
final dynamic fetchedData = await _nordigenGetter(
endpointUrl:
'https://ob.nordigen.com/api/v2/agreements/enduser/$endUserAgreementID/text/',
'https://bankaccountdata.gocardless.com/api/v2/agreements/enduser/$endUserAgreementID/text/',
);
return fetchedData;
}
Expand All @@ -113,7 +114,7 @@ extension NordigenAgreementsEndpoints on NordigenAccountInfoAPI {
// Make GET request and fetch output.
final Map<String, dynamic> fetchedData = await _nordigenGetter(
endpointUrl:
'https://ob.nordigen.com/api/v2/agreements/enduser/?limit=$limit&offset=$offset',
'https://bankaccountdata.gocardless.com/api/v2/agreements/enduser/?limit=$limit&offset=$offset',
);
final List<dynamic> fetchedEndUserAgreements = fetchedData['results'];
// Form the recieved dynamic Map into EndUserAgreementModel for convenience.
Expand All @@ -133,6 +134,6 @@ extension NordigenAgreementsEndpoints on NordigenAccountInfoAPI {
}) async =>
await _nordigenDeleter(
endpointUrl:
'https://ob.nordigen.com/api/v2/agreements/enduser/$endUserAgreementID/',
'https://bankaccountdata.gocardless.com/api/v2/agreements/enduser/$endUserAgreementID/',
);
}
4 changes: 2 additions & 2 deletions lib/extensions/institutions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension NordigenInstitutionsEndpoints on NordigenAccountInfoAPI {
// Make GET request and fetch output.
final List<dynamic> fetchedData = await _nordigenGetter(
endpointUrl:
'https://ob.nordigen.com/api/v2/institutions/?country=$countryCode',
'https://bankaccountdata.gocardless.com/api/v2/institutions/?country=$countryCode',
) ??
<dynamic>[];
// Map the recieved List<dynamic> into List<Institution> Data Format.
Expand All @@ -29,7 +29,7 @@ extension NordigenInstitutionsEndpoints on NordigenAccountInfoAPI {
// Make GET request and fetch output.
final dynamic fetchedData = await _nordigenGetter(
endpointUrl:
'https://ob.nordigen.com/api/v2/institutions/$institutionID/',
'https://bankaccountdata.gocardless.com/api/v2/institutions/$institutionID/',
);
// Form the recieved dynamic Map into RequisitionModel for convenience.
return Institution.fromMap(fetchedData);
Expand Down
9 changes: 5 additions & 4 deletions lib/extensions/requisitions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ extension NordigenRequisitionsEndpoints on NordigenAccountInfoAPI {
}) async {
// Make POST request and fetch output.
final dynamic fetchedData = await _nordigenPoster(
endpointUrl: 'https://ob.nordigen.com/api/v2/requisitions/',
endpointUrl:
'https://bankaccountdata.gocardless.com/api/v2/requisitions/',
data: <String, dynamic>{
'redirect': redirect,
'institution_id': institutionID,
Expand All @@ -58,7 +59,7 @@ extension NordigenRequisitionsEndpoints on NordigenAccountInfoAPI {
// Make GET request and fetch output.
final Map<String, dynamic> fetchedData = await _nordigenGetter(
endpointUrl:
'https://ob.nordigen.com/api/v2/requisitions/?limit=$limit&offset=$offset',
'https://bankaccountdata.gocardless.com/api/v2/requisitions/?limit=$limit&offset=$offset',
);
final List<dynamic> fetchedRequisitions = fetchedData['results'];
// Form the recieved dynamic Map into RequisitionModel for convenience.
Expand All @@ -78,7 +79,7 @@ extension NordigenRequisitionsEndpoints on NordigenAccountInfoAPI {
// Make GET request and fetch output.
final dynamic fetchedData = await _nordigenGetter(
endpointUrl:
'https://ob.nordigen.com/api/v2/requisitions/$requisitionID/',
'https://bankaccountdata.gocardless.com/api/v2/requisitions/$requisitionID/',
);
// Form the recieved dynamic Map into RequisitionModel for convenience.
return RequisitionModel.fromMap(fetchedData);
Expand All @@ -92,6 +93,6 @@ extension NordigenRequisitionsEndpoints on NordigenAccountInfoAPI {
}) async =>
await _nordigenDeleter(
endpointUrl:
'https://ob.nordigen.com/api/v2/requisitions/$requisitionID/',
'https://bankaccountdata.gocardless.com/api/v2/requisitions/$requisitionID/',
);
}
4 changes: 2 additions & 2 deletions lib/extensions/token.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extension NordigenTokenEndpoints on NordigenAccountInfoAPI {
};
// Make POST request and fetch output.
final http.Response response = await http.post(
Uri.parse('https://ob.nordigen.com/api/v2/token/new/'),
Uri.parse('https://bankaccountdata.gocardless.com/api/v2/token/new/'),
headers: <String, String>{
'Content-Type': 'application/json',
'accept': 'application/json',
Expand Down Expand Up @@ -55,7 +55,7 @@ extension NordigenTokenEndpoints on NordigenAccountInfoAPI {
}) async {
// Make POST request and fetch output.
final http.Response response = await http.post(
Uri.parse('https://ob.nordigen.com/api/v2/token/refresh/'),
Uri.parse('https://bankaccountdata.gocardless.com/api/v2/token/refresh/'),
headers: _headers,
body: json.encode(<String, String>{'refresh': refresh}),
);
Expand Down
Loading

0 comments on commit f0f198b

Please sign in to comment.