fetchAllPayments method
Future<Response<RazorpayQrCodePaymentsResponse> >
fetchAllPayments({
- required String qrCodeId,
- RazorpayPaginationOptions? params,
- void callback(
- RazorpayApiException?,
- Response<
RazorpayQrCodePaymentsResponse> ?
Fetch Payments for a QR Code
@param qrCodeId - The unique identifier of the QR Code. @param params - Check doc for required params
Implementation
Future<Response<RazorpayQrCodePaymentsResponse>> fetchAllPayments({
required String qrCodeId,
RazorpayPaginationOptions? params,
void Function(
RazorpayApiException?,
Response<RazorpayQrCodePaymentsResponse>?,
)? callback,
}) async {
if (qrCodeId.isEmpty) {
throw ArgumentError('qrCodeId is mandatory');
}
final url = '$BASE_URL/$qrCodeId/payments';
final from = params?.from;
final to = params?.to;
final count = params?.count ?? 10;
final skip = params?.skip ?? 0;
// No need to normalizeDate
final queryParams = {
'from': from,
'to': to,
'count': count,
'skip': skip,
...?params?.toJson(),
};
queryParams.removeWhere((key, value) => value == null);
return api.get<RazorpayQrCodePaymentsResponse>(
{
'url': url,
'data': queryParams,
},
fromJsonFactory: RazorpayQrCodePaymentsResponse.fromJson,
callback: callback,
);
}