getTransactions method
Future<Map>
getTransactions(
- String token,
- String? billingCurrencyCode,
- String? cardId,
- String? fromCreatedAt,
- String? pageNumber,
- String? pageSize,
- String? retrievalRef,
- String? toCreatedAt,
- String? transactionType,
override
Implementation
@override
Future<Map> getTransactions(
String token,
String? billingCurrencyCode,
String? cardId,
String? fromCreatedAt,
String? pageNumber,
String? pageSize,
String? retrievalRef,
String? toCreatedAt,
String? transactionType) async {
final String baseUrl = await getBaseUrl;
var filters = [];
var prefixes = [];
if (billingCurrencyCode != null) {
filters.add(billingCurrencyCode);
prefixes.add("billing_currency=");
}
if (cardId != null) {
filters.add(cardId);
prefixes.add("card_id=");
}
if (fromCreatedAt != null) {
filters.add(fromCreatedAt);
prefixes.add("from_created_at=");
}
if (pageNumber != null) {
filters.add(pageNumber);
prefixes.add("page_num=");
}
if (pageSize != null) {
filters.add(pageSize);
prefixes.add("page_size=");
}
if (retrievalRef != null) {
filters.add(retrievalRef);
prefixes.add("retrieval_ref=");
}
if (toCreatedAt != null) {
filters.add(toCreatedAt);
prefixes.add("to_created_at=");
}
if (transactionType != null) {
filters.add(transactionType);
prefixes.add("transaction_type=");
}
String params = addFilter(filters, prefixes);
var url = Uri.parse("$baseUrl/api/v1/issuing/transactions$params");
var response = await http.get(
url,
headers: {"Authorization": "Bearer $token"},
);
var data = jsonDecode(response.body);
return data;
}