getPaymentConsents method
Future<Map>
getPaymentConsents(
- String token,
- String? customerId,
- String? fromCreatedAt,
- String? merchantTriggerReason,
- String? nextTriggerBy,
- String? pageNumber,
- String? pageSize,
- String? status,
- String? toCreatedAt,
override
Implementation
@override
Future<Map> getPaymentConsents(
String token,
String? customerId,
String? fromCreatedAt,
String? merchantTriggerReason,
String? nextTriggerBy,
String? pageNumber,
String? pageSize,
String? status,
String? toCreatedAt) async {
final baseUrl = await getBaseUrl;
var filters = [];
var prefixes = [];
if (customerId != null) {
filters.add(customerId);
prefixes.add("customer_id=");
}
if (fromCreatedAt != null) {
filters.add(fromCreatedAt);
prefixes.add("from_created_at=");
}
if (merchantTriggerReason != null) {
filters.add(merchantTriggerReason);
prefixes.add("merchant_trigger_reason=");
}
if (nextTriggerBy != null) {
filters.add(nextTriggerBy);
prefixes.add("next_trigger_by=");
}
if (pageNumber != null) {
filters.add(pageNumber);
prefixes.add("page_num=");
}
if (pageSize != null) {
filters.add(pageSize);
prefixes.add("page_size=");
}
if (status != null) {
filters.add(status);
prefixes.add("status=");
}
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_consents$params");
var response = await http.get(
url,
headers: {"Authorization": "Bearer $token"},
);
var data = jsonDecode(response.body);
return data;
}