fetch method

Future<Response<RazorpayInvoice>> fetch({
  1. required String invoiceId,
  2. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayInvoice>?
    )?,
})

Fetches invoice entity with given id

@param invoiceId - The unique identifier of the invoice

Implementation

Future<Response<RazorpayInvoice>> fetch({
  required String invoiceId,
  void Function(RazorpayApiException?, Response<RazorpayInvoice>?)? callback,
}) async {
  if (invoiceId.isEmpty) {
    throw ArgumentError(MISSING_ID_ERROR);
  }
  final url = '$BASE_URL/$invoiceId';
  return api.get<RazorpayInvoice>(
    {'url': url},
    fromJsonFactory: RazorpayInvoice.fromJson,
    callback: callback,
  );
}