fetchRefund method

Future<Response<RazorpayRefund>> fetchRefund({
  1. required String paymentId,
  2. required String refundId,
  3. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayRefund>?
    )?,
})

Fetch a specific refund for a payment

@param paymentId - The unique identifier of the payment. @param refundId - The unique identifier of the refund.

Implementation

Future<Response<RazorpayRefund>> fetchRefund({
  required String paymentId,
  required String refundId,
  void Function(RazorpayApiException?, Response<RazorpayRefund>?)? callback,
}) async {
  if (paymentId.isEmpty) {
    throw ArgumentError('paymentId is mandatory');
  }
  if (refundId.isEmpty) {
    throw ArgumentError('refundId is mandatory');
  }
  return api.get<RazorpayRefund>(
    {'url': '$BASE_URL/$paymentId/refunds/$refundId'},
    fromJsonFactory: RazorpayRefund.fromJson,
    callback: callback,
  );
}