getPaymentLinks method
Future<Map>
getPaymentLinks(
- String token,
- String? active,
- String? fromCreatedAt,
- String? pageNumber,
- String? pageSize,
- String? reusable,
- String? toCreatedAt,
override
Implementation
@override
Future<Map> getPaymentLinks(
String token,
String? active,
String? fromCreatedAt,
String? pageNumber,
String? pageSize,
String? reusable,
String? toCreatedAt) async {
final baseUrl = await getBaseUrl;
var filters = [];
var prefixes = [];
if (active != null) {
filters.add(active);
prefixes.add("active=");
}
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 (reusable != null) {
filters.add(reusable);
prefixes.add("reusable=");
}
if (toCreatedAt != null) {
filters.add(toCreatedAt);
prefixes.add("to_created_at=");
}
String params = addFilter(filters, prefixes);
var url = Uri.parse("$baseUrl/api/v1/pa/payment_links$params");
var response = await http.get(
url,
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer $token"
},
);
var data = jsonDecode(response.body);
return data;
}